From 8d62ae04dd7686fb0a90d4e2d49768ecd9c34d3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 28 Sep 2026 09:25:52 -0600 Subject: [PATCH] Savestate: Make verify compare memory without emuhacks, and not count The write pass stores memory with the JIT's emuhacks cleared, but the verify pass compared against memory that still had them, so it would report a mismatch under a JIT. Only EMULATOR_DEVCTL__VERIFY_STATE runs it, and nothing currently does. It also counted as a save in the generation. Co-Authored-By: Claude Opus 5.5 (1M context) --- Core/SaveState.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Core/SaveState.cpp b/Core/SaveState.cpp index d21ec64833..d93e777fa1 100644 --- a/Core/SaveState.cpp +++ b/Core/SaveState.cpp @@ -176,7 +176,7 @@ int g_screenshotFailures; // Memory is a bit tricky when jit is enabled, since there's emuhacks in it. // These must be saved before copying out memory and restored after. auto savedReplacements = SaveAndClearReplacements(); - if (MIPSComp::jit && p.mode == p.MODE_WRITE) { + if (MIPSComp::jit && (p.mode == p.MODE_WRITE || p.mode == p.MODE_VERIFY)) { if (MIPSComp::jit) { std::vector savedBlocks; savedBlocks = MIPSComp::jit->SaveAndClearEmuHackOps(); @@ -968,7 +968,10 @@ int g_screenshotFailures; case OperationType::Verify: { + // Its write pass counts as a save, which it isn't. + const int generation = saveStateGeneration; int tempResult = CChunkFileReader::Verify(state) == CChunkFileReader::ERROR_NONE; + saveStateGeneration = generation; callbackResult = tempResult ? Status::SUCCESS : Status::FAILURE; if (tempResult) { INFO_LOG(Log::SaveState, "Verified save state system");