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:
chrg6
2026-11-10 15:11:06 -05:00
parent 7b35fe7504
commit 88495c296c
6 changed files with 175 additions and 6 deletions

View File

@@ -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)

View File

@@ -98,7 +98,7 @@ def main(argv=None):
if a.cmd == 'continue-update':
gd = s.get('game_dir')
return follow(jobs.ContinueUpdateJob(ctx, gd if gd and build.built_version(gd) else '', a.old,
return follow(jobs.ContinueUpdateJob(ctx, gd if build.installed(gd) else '', a.old,
s.get('dump')))
if a.cmd == 'tools':

View File

@@ -301,9 +301,18 @@ class InstallJob(Job):
'scan', 'ready'])
self.dump, self.game_dir = str(dump), str(game_dir)
def args(self):
"""make_game.py's arguments. A game folder whose game files an earlier run already unpacked and checked
(build.can_rebuild, build.unpacked) is built on from those, for this processor's level as a first build is:
the dump is not read again, so an install that stopped after the RomFS image goes on although the dump
was moved or deleted since, and the 26 GB image is not packed a second time."""
if build.can_rebuild(self.game_dir) and build.unpacked(self.game_dir):
return build.rebuild_args(self.ctx.layout, self.game_dir, retune=True)
return build.install_args(self.ctx.layout, self.dump, self.game_dir)
def run(self):
self.ensure_tools('tools')
self.make_game(build.install_args(self.ctx.layout, self.dump, self.game_dir),
self.make_game(self.args(),
{s: s for s in ('check', 'exefs', 'romfs', 'lift', 'compile', 'shaders', 'prompts', 'scan')})
for sid in ('shaders', 'prompts', 'scan'):
if self.step(sid) and self.step(sid).state == PENDING:

View File

@@ -653,9 +653,11 @@ class App:
elif a.continue_update is not None and not a.rolled_back:
# after a rollback the stub passes the failed version's --continue-update on to this one: the game was
# never rebuilt for the new version, so there is nothing to finish, and home tells why the version is back
self.run_job(jobs.ContinueUpdateJob(self.ctx, gd if gd and build.built_version(gd) else '',
self.run_job(jobs.ContinueUpdateJob(self.ctx, gd if build.installed(gd) else '',
a.continue_update, self.settings.get('dump')), 'home')
elif gd and build.built_version(gd):
elif build.installed(gd):
# also a game whose last update stopped in the compile (build.installed): home, where Play starts the
# build from before the update and Rebuild the Game finishes it, not the first-run screen and its dump
self.show('home')
self.after_update_notice()
if self.install_staged('a staged update waited for the launcher to start'):
@@ -870,11 +872,17 @@ class App:
upd = Row('value', 'Updates', f'Version {mine}', 'normal', big=True, icon='refresh',
on=lambda: self.check_now(force=True),
desc=(f'You have NX2navi {mine}. Select this row to look for a new version.',))
rebuild_value = f'Built with {versions.display(built)}' if built else 'Not built'
# an update that stopped in the compile left no finished build on record, but the exe of the build before it
unfinished = not built and build.installed(gd)
rebuild_value = (f'Built with {versions.display(built)}' if built else
'Not Finished' if unfinished else 'Not built')
rebuild_style = 'normal' if versions.display(built) == mine else 'salmon'
play_desc = ('Start Ocarina of Time. The launcher steps aside while you play and comes back when you quit.',)
if built and versions.display(built) != mine:
play_desc += (f'The game was built with {versions.display(built)}. Rebuild the Game brings it to {mine}.',)
elif unfinished:
play_desc += (f'The last rebuild of the game did not finish, so Play starts the build from before it. '
f'Rebuild the Game finishes it and brings the game to {mine}; your dump is not needed.',)
if staged and self.settings.get('auto_install'):
play_desc += (f'NX2navi {staged["version"]} is downloaded and installs after you quit the game.',)
if self.message: