mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 15:09:58 -04:00
Keep the game installed when an update stops in the compile.
An update whose lift ran again drops the compile step's record before the compile runs, so a compile that then stopped left state.json without it, build.built_version said '' and the launcher's next start showed the first-run screen and asked for the dump. build.installed now also counts a folder that holds the exe of the build before and game files a rebuild can start from: the window opens on home, where Rebuild the Game reads "Not Finished" and Play says which build it starts, and an update's rebuild and the command line's go on with the game. Begin Installation into a folder whose game files are already unpacked builds on from them instead of reading the dump again. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -151,3 +151,24 @@ def built_version(game_dir):
|
||||
def can_rebuild(game_dir):
|
||||
st = build_state(game_dir)
|
||||
return st.get('version') == 2 and all(s in st.get('steps', {}) for s in ('exefs', 'romfs'))
|
||||
|
||||
|
||||
def unpacked(game_dir):
|
||||
"""True when the game files a rebuild reads are in the game folder (make_game.py BuiltSource names the same
|
||||
ones): the unpacked ExeFS, the RomFS image and its index."""
|
||||
gd = str(game_dir)
|
||||
return all(os.path.isfile(os.path.join(gd, *parts)) for parts in
|
||||
(('exefs', 'main'), ('romfs', 'romfs.bin'), ('romfs', 'index.json')))
|
||||
|
||||
|
||||
def installed(game_dir):
|
||||
"""True when the game folder holds a game the player can start: a finished build, or the exe of the last
|
||||
finished build beside a build that stopped later. make_game.py drops a step's record when a step before it
|
||||
runs again, so an update that lifted again and then stopped in the compile (an error, Cancel, a power cut)
|
||||
leaves state.json without `compile` and built_version says '': the old exe is still there and playable, and
|
||||
a rebuild continues from the unpacked game files without the dump (can_rebuild)."""
|
||||
if not game_dir:
|
||||
return False
|
||||
if built_version(game_dir):
|
||||
return True
|
||||
return os.path.isfile(os.path.join(str(game_dir), 'ocarina.exe')) and can_rebuild(game_dir)
|
||||
|
||||
Reference in New Issue
Block a user