mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-06-01 14:41:33 +00:00
Save-state: Improved PR #623: always throw, but don't restart unless VM state has changed
This commit is contained in:
parent
f998c7ddb2
commit
1f1bcfd374
|
@ -356,33 +356,20 @@ static void ParseUnit(void)
|
|||
|
||||
static void Snapshot_LoadState_v2(void)
|
||||
{
|
||||
bool restart = false; // Only need to restart if any VM state has change
|
||||
|
||||
try
|
||||
{
|
||||
std::string err_msg = "";
|
||||
int res = yamlHelper.InitParser( g_strSaveStatePathname.c_str() );
|
||||
if (!res)
|
||||
{
|
||||
err_msg = "Failed to initialize parser or open file";
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT version = ParseFileHdr();
|
||||
if (version != SS_FILE_VER)
|
||||
err_msg = "Version mismatch";
|
||||
}
|
||||
if (!yamlHelper.InitParser( g_strSaveStatePathname.c_str() ))
|
||||
throw std::string("Failed to initialize parser or open file");
|
||||
|
||||
if (err_msg != "")
|
||||
{
|
||||
MessageBox(g_hFrameWindow,
|
||||
err_msg.c_str(),
|
||||
TEXT("Load State"),
|
||||
MB_ICONEXCLAMATION | MB_SETFOREGROUND);
|
||||
|
||||
return;
|
||||
}
|
||||
if (ParseFileHdr() != SS_FILE_VER)
|
||||
throw std::string("Version mismatch");
|
||||
|
||||
//
|
||||
|
||||
restart = true;
|
||||
|
||||
CConfigNeedingRestart ConfigOld;
|
||||
//ConfigOld.m_Slot[0] = CT_LanguageCard; // fixme: II/II+=LC, //e=empty
|
||||
ConfigOld.m_Slot[1] = CT_GenericPrinter; // fixme
|
||||
|
@ -446,7 +433,8 @@ static void Snapshot_LoadState_v2(void)
|
|||
TEXT("Load State"),
|
||||
MB_ICONEXCLAMATION | MB_SETFOREGROUND);
|
||||
|
||||
PostMessage(g_hFrameWindow, WM_USER_RESTART, 0, 0); // Power-cycle VM (undoing all the new state just loaded)
|
||||
if (restart)
|
||||
PostMessage(g_hFrameWindow, WM_USER_RESTART, 0, 0); // Power-cycle VM (undoing all the new state just loaded)
|
||||
}
|
||||
|
||||
yamlHelper.FinaliseParser();
|
||||
|
|
Loading…
Reference in New Issue
Block a user