refactor saveram saving error handling in CloseGame

The previous code did nothing when a new rom was loaded or the emulator was closed. Now the user at least gets the chance to try again, however much that will help.
This commit is contained in:
Morilli 2025-06-04 22:23:39 +02:00
parent 1b7e858977
commit 18c29ca57c
1 changed files with 10 additions and 9 deletions

View File

@ -4102,18 +4102,19 @@ namespace BizHawk.Client.EmuHawk
} }
else if (Emulator.HasSaveRam()) else if (Emulator.HasSaveRam())
{ {
if (!FlushSaveRAM()) while (true)
{ {
var msgRes = ShowMessageBox2( if (FlushSaveRAM()) break;
owner: null,
"Failed flushing the game's Save RAM to your disk.\nClose without flushing Save RAM?", var result = ShowMessageBox3(
"Directory IO Error", owner: this,
"Failed flushing the game's Save RAM to your disk.\n" +
"Do you want to try again?",
"IOError while writing SaveRAM",
EMsgBoxIcon.Error); EMsgBoxIcon.Error);
if (!msgRes) if (result is false) break;
{ if (result is null) return;
return;
}
} }
} }