From 11137cbc44752e30d1590a171d25f0b848f0b7d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Zumer?= Date: Sat, 23 Feb 2019 04:17:29 -0500 Subject: [PATCH] Save-state: Do not reset on minor state load errors (PR #623) --- source/SaveState.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/source/SaveState.cpp b/source/SaveState.cpp index 1bc1b4c3..7fed83db 100644 --- a/source/SaveState.cpp +++ b/source/SaveState.cpp @@ -358,13 +358,28 @@ static void Snapshot_LoadState_v2(void) { try { + std::string err_msg = ""; int res = yamlHelper.InitParser( g_strSaveStatePathname.c_str() ); if (!res) - throw std::string("Failed to initialize parser or open file"); // TODO: disambiguate + { + err_msg = "Failed to initialize parser or open file"; + } + else + { + UINT version = ParseFileHdr(); + if (version != SS_FILE_VER) + err_msg = "Version mismatch"; + } - UINT version = ParseFileHdr(); - if (version != SS_FILE_VER) - throw std::string("Version mismatch"); + if (err_msg != "") + { + MessageBox(g_hFrameWindow, + err_msg.c_str(), + TEXT("Load State"), + MB_ICONEXCLAMATION | MB_SETFOREGROUND); + + return; + } //