From 52b0a13f944e146c05bec5b44ab3c8d7513cf8cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 3 Nov 2026 08:11:46 +0100 Subject: [PATCH] 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 --- headless/Headless.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/headless/Headless.cpp b/headless/Headless.cpp index 7847602ca9..e7ea089fc3 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -566,6 +566,14 @@ static bool RunAutoTest(GraphicsContext *graphicsContext, CoreParameter &corePar double statsStart = -1.0; int statsLastFlips = 0; std::vector> 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