Fix up the Load and Save as options by using direct calls to the LoadState and SaveState function, pausing the cpu stops the event queue from being processed from the looks of it so we get stuck on trying to load and save a state. Zilmar you might want to tell me if I'm wrong here XD

This commit is contained in:
Emmet Young 2012-10-04 00:22:13 +10:00
parent ac0108a9b8
commit cf761b3f70
2 changed files with 5 additions and 11 deletions

View File

@ -37,7 +37,6 @@ void CSystemEvents::ExecuteEvents ( void )
EventList Events = m_Events;
m_Events.clear();
bool bPause = false, bLoadedSave = false;
for (EventList::const_iterator iter = Events.begin(); !bLoadedSave && iter != Events.end(); iter++ )
{
switch (*iter)

View File

@ -148,10 +148,10 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
openfilename.nMaxFile = MAX_PATH;
openfilename.Flags = OFN_HIDEREADONLY;
_BaseSystem->ExternalEvent(SysEvent_PauseCPU_SaveGame);
_BaseSystem->ExternalEvent(SysEvent_PauseCPU_SaveGame);
if (GetSaveFileName (&openfilename))
{
_splitpath( SaveFile, drive, dir, fname, ext );
if (_stricmp(ext, ".pj") == 0 || _stricmp(ext, ".zip") == 0)
{
@ -167,10 +167,8 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
char SaveDir[MAX_PATH];
_makepath( SaveDir, drive, dir, NULL, NULL );
_Settings->SaveString(Directory_LastSave,SaveDir);
_BaseSystem->ExternalEvent(SysEvent_SaveMachineState);
_System->SaveState();
}
_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_SaveGame);
}
break;
@ -193,17 +191,14 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
openfilename.nMaxFile = MAX_PATH;
openfilename.Flags = OFN_HIDEREADONLY;
_BaseSystem->ExternalEvent(SysEvent_PauseCPU_LoadGame);
_BaseSystem->ExternalEvent(SysEvent_PauseCPU_LoadGame);
if (GetOpenFileName (&openfilename)) {
_Settings->SaveString(GameRunning_InstantSaveFile,SaveFile);
char SaveDir[MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR], fname[_MAX_FNAME],ext[_MAX_EXT];
_splitpath( SaveFile, drive, dir, fname, ext );
_makepath( SaveDir, drive, dir, NULL, NULL );
_Settings->SaveString(Directory_LastSave,SaveDir);
_BaseSystem->ExternalEvent(SysEvent_LoadMachineState);
_System->LoadState();
}
_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_LoadGame);
}