From 459aefb48b8e7ce218d26705d13d8d1fc5ca95e1 Mon Sep 17 00:00:00 2001 From: Ren Date: Mon, 27 Jul 2026 16:13:24 +0200 Subject: [PATCH] Savedata dialog: serialize ioThreadStatus (bump section to v3) The s > 2 branch in PSPSaveDialog::DoState has been dead code since it was written - the section version was never raised past 2, so ioThreadStatus was reset to SAVEIO_NONE on every savestate load. Loading a state that was saved while a savedata operation was in flight then repeated the operation (or left the dialog waiting on a completion that had already happened), instead of resuming from the recorded status. Restoring the value is safe: DoState joins the IO thread before serializing, so the stored status is only ever SAVEIO_NONE or SAVEIO_DONE, and the operation's effects are already part of the serialized emulated RAM. Old (v2) states still load through the reset path. --- Core/Dialog/PSPSaveDialog.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Core/Dialog/PSPSaveDialog.cpp b/Core/Dialog/PSPSaveDialog.cpp index 07ed87172b..0e59fb80a9 100755 --- a/Core/Dialog/PSPSaveDialog.cpp +++ b/Core/Dialog/PSPSaveDialog.cpp @@ -1293,7 +1293,13 @@ void PSPSaveDialog::DoState(PointerWrap &p) { } PSPDialog::DoState(p); - auto s = p.Section("PSPSaveDialog", 1, 2); + // Version 3 activates the s > 2 branch below, so ioThreadStatus survives + // a savestate. Safe to restore: the IO thread was joined above, so the + // value is only ever SAVEIO_NONE or SAVEIO_DONE, and the operation's + // effects are already part of the serialized state. Without this, loading + // a state taken while a savedata operation was in flight would restart + // the operation instead of resuming from its recorded status. + auto s = p.Section("PSPSaveDialog", 1, 3); if (!s) { return; }