Repository navigation
Save states: none in a run with no game (a disc_required game's input self-test without its disc) - #115
Merged
Conversation
… self-test without its disc) Since v0.3.7 every window run arms save states. A disc_required game's --input-test without its disc never starts game_main: its vsyncs run on main's stack, so the first capture point stopped the run with "state: the vsync is not on the game stack or a fiber's" (status 1), and dcb_decomp's disc-free input self-test failed. No game means nothing to hold: main no longer arms states then, and says why (port_savestate_no_game). The input self-test skips the quick slot's round trip with "no game in this run" and goes on to the menu's; the hotkeys and the debug channel give the same reason; --save-state and --load-state without the game are refused (status 64). tests/hello_test.py --menu now also builds hello as a disc_required game (examples/hello -DHELLO_DISC_REQUIRED=ON, a made-up disc no image matches): without a disc it must refuse to start, and its input self-test must pass without the game. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
Since v0.3.7 every window run arms save states (
runtime/main.c, the|| windowbeforeport_savestate_arm). A game with game.jsondisc_required(#64) started with--input-testand no disc never startsgame_main: its vsyncs runport_wait()from main's stack. At vsync 1,port_savestate_captured()found the frame on neither the game stack nor a fiber's and stopped the run:state: the vsync is not on the game stack or a fiber's, status 1. dw2003recomp has nodisc_required, so only dcb_decomp's disc-free input self-test (scripts/port_build.sh --sdl, found while bumping its pin to v0.3.18) hit it.The fix
No game means nothing for a state to hold, so main no longer arms states in that run (rather than arming them and skipping each capture: the game stack would be set up for a game that never runs).
port_savestate_no_game()records why states are off and logsstate: off in this run (no game: nothing to hold);port_savestate_off()returns that reason (NULL when armed).the quick slot: skipped (no game in this run)and goes on to the menu's; the hotkeys and the debug channel's save/load give the same reason.--save-state/--load-statewith--input-testand no disc on adisc_requiredgame are refused (status 64) instead of being silently ignored.docs/RUNTIME.md"Save states" (when states are on),docs/GAME_CONTRACT.md(disc_required),CLAUDE.md's command line;CHANGELOG.mdv0.3.19 (unreleased).The test
tests/hello_test.py --menu(CI's launcher job) now also builds hello as adisc_requiredgame:examples/hellowith-DHELLO_DISC_REQUIRED=ONwrites a copy of its game.json withdisc_required: trueand a made-up disc no image matches (no Steam artwork), intobuild/hello-menu-nodisc, with the window and the menu. Without a disc it must refuse to start (status 64); its--input-testoffscreen must pass without the game: status 0, the quick slot skipped forno game in this run, the menu's round trip passed. Before the fix this run ended with the fatal above (reproduced).Gates
python3 -m py_compile tools/*.py tools/mcp/*.py tools/replay/*.py tests/*.pypython3 tests/hello_test.py: passpython3 tests/tasks_test.pyand--sanitize: pass (states on fibers, resumed)python3 tests/hello_test.py --menu --gpu: pass, the new no-game checks included; hello with a game still runs both quick slot round trips (running and paused: passed)DW3_JOBS=4 scripts/test.sh: the census, the probe, layers 1, 2 and 3, and the port layer's run.py and settings.py pass;tests/port/render_gpu.pyfails 3 checks (the present into window sizes at vsyncs 900, 1300 and 1800), the same pixel counts at dw2003recomp's own pin v0.3.18 and at this branch's base 8e9153a, so not from this change (this machine: NVIDIA RTX 4070 Ti SUPER). The steps test.sh did not reach after it, run one by one against this branch: render_filters, textures, gpu_hw_replay, hz60, battle, vram, subpixel_jitter, debug, savestate, crash, field and mods all pass.-DPSXSTACK_DIRat this branch),scripts/port_build.sh --sdlin a build directory of its own: no disc refused (64); the input self-test without the disc exits 0 (the quick slot: skipped (no game in this run), the menu passed), where v0.3.18 ended with status 1. Its window boot with the disc (600 frames offscreen) exits 0 and loads OPENSEG.🤖 Generated with Claude Code