From 18c29ca57cc42e49a84d4324e03fb6af4c36256d Mon Sep 17 00:00:00 2001 From: Morilli <35152647+Morilli@users.noreply.github.com> Date: Wed, 4 Jun 2025 22:23:39 +0200 Subject: [PATCH] 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. --- src/BizHawk.Client.EmuHawk/MainForm.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index dac4b6956b..6266e47901 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -4102,18 +4102,19 @@ namespace BizHawk.Client.EmuHawk } else if (Emulator.HasSaveRam()) { - if (!FlushSaveRAM()) + while (true) { - var msgRes = ShowMessageBox2( - owner: null, - "Failed flushing the game's Save RAM to your disk.\nClose without flushing Save RAM?", - "Directory IO Error", + if (FlushSaveRAM()) break; + + var result = ShowMessageBox3( + 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); - if (!msgRes) - { - return; - } + if (result is false) break; + if (result is null) return; } }