Save-state: Do not reset on minor state load errors (PR #623)

This commit is contained in:
Raphaël Zumer 2019-02-23 04:17:29 -05:00 committed by TomCh
parent 8589ad2510
commit 11137cbc44

View File

@ -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;
}
//