Write make_game.py's reset state at once when the game files changed.

A new input reset the steps in memory only; the next save came after the first step finished, while the exefs step
rewrites <out>/exefs in place. A run stopped there left the old state.json saying the old game's steps were done,
and --rebuild then trusted the half-replaced files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-08 09:25:25 -05:00
parent 35ff999958
commit 215c423d84

View File

@@ -1103,7 +1103,8 @@ def main():
except ImportError:
fail(f'the Python package {mod} is missing: pip install numpy lz4 zstandard zbic')
cache.mkdir(parents=True, exist_ok=True)
if state.get('version') != STATE_VERSION or state.get('input') != src.identity:
reset = state.get('version') != STATE_VERSION or state.get('input') != src.identity
if reset:
state = {'version': STATE_VERSION, 'input': src.identity, 'steps': {}}
state['kit'] = kit_version()
keep_awake()
@@ -1122,6 +1123,11 @@ def main():
tmp.write_text(json.dumps(state, indent=1), encoding='utf-8')
os.replace(tmp, state_path)
if reset:
# on disk at once: the exefs step rewrites <out>/exefs in place, and a run cut short there would leave the
# old state.json saying the old game's steps are done, which --rebuild trusts
save()
def run(name):
t = time.time()
runs[name]()