Headless: Hold the game until a --state has been applied

The state is read and decompressed on a worker while the game keeps booting. On a slow host that
got far enough to reach different code, and with MX vs. ATV Untamed without a firmware, its boot
crash, before the state landed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-11-03 08:15:18 +01:00
1 parent a3309cdc2d
commit 52b0a13f94
1 file changed
+8
+8
View File
@@ -566,6 +566,14 @@ static bool RunAutoTest(GraphicsContext *graphicsContext, CoreParameter &corePar
double statsStart = -1.0;
int statsLastFlips = 0;
std::vector<std::pair<double, Path>> screenshotsAt = opt.screenshotsAt;
// Hold the game until a --state has been applied. Otherwise it keeps booting while the state is
// read, which on a slow host can reach a different point (even a crash) before the state lands.
while (g_stateLoadPending && time_now_d() < wallDeadline) {
SaveState::Process();
if (g_stateLoadPending) {
sleep_ms(1, "state-load");
}
}
coreState = coreParameter.startBreak ? CORE_STEPPING_CPU : CORE_RUNNING_CPU;
// The XMB starting a game, or a game going back to it: boot that, the way the app does, and keep