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; EventList Events = m_Events;
m_Events.clear(); m_Events.clear();
bool bPause = false, bLoadedSave = false; bool bPause = false, bLoadedSave = false;
for (EventList::const_iterator iter = Events.begin(); !bLoadedSave && iter != Events.end(); iter++ ) for (EventList::const_iterator iter = Events.begin(); !bLoadedSave && iter != Events.end(); iter++ )
{ {
switch (*iter) switch (*iter)

View File

@ -149,9 +149,9 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
openfilename.Flags = OFN_HIDEREADONLY; openfilename.Flags = OFN_HIDEREADONLY;
_BaseSystem->ExternalEvent(SysEvent_PauseCPU_SaveGame); _BaseSystem->ExternalEvent(SysEvent_PauseCPU_SaveGame);
if (GetSaveFileName (&openfilename)) if (GetSaveFileName (&openfilename))
{ {
_splitpath( SaveFile, drive, dir, fname, ext ); _splitpath( SaveFile, drive, dir, fname, ext );
if (_stricmp(ext, ".pj") == 0 || _stricmp(ext, ".zip") == 0) 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]; char SaveDir[MAX_PATH];
_makepath( SaveDir, drive, dir, NULL, NULL ); _makepath( SaveDir, drive, dir, NULL, NULL );
_Settings->SaveString(Directory_LastSave,SaveDir); _Settings->SaveString(Directory_LastSave,SaveDir);
_System->SaveState();
_BaseSystem->ExternalEvent(SysEvent_SaveMachineState);
} }
_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_SaveGame); _BaseSystem->ExternalEvent(SysEvent_ResumeCPU_SaveGame);
} }
break; break;
@ -194,16 +192,13 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men
openfilename.Flags = OFN_HIDEREADONLY; openfilename.Flags = OFN_HIDEREADONLY;
_BaseSystem->ExternalEvent(SysEvent_PauseCPU_LoadGame); _BaseSystem->ExternalEvent(SysEvent_PauseCPU_LoadGame);
if (GetOpenFileName (&openfilename)) { if (GetOpenFileName (&openfilename)) {
_Settings->SaveString(GameRunning_InstantSaveFile,SaveFile); _Settings->SaveString(GameRunning_InstantSaveFile,SaveFile);
char SaveDir[MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR], fname[_MAX_FNAME],ext[_MAX_EXT]; char SaveDir[MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR], fname[_MAX_FNAME],ext[_MAX_EXT];
_splitpath( SaveFile, drive, dir, fname, ext ); _splitpath( SaveFile, drive, dir, fname, ext );
_makepath( SaveDir, drive, dir, NULL, NULL ); _makepath( SaveDir, drive, dir, NULL, NULL );
_Settings->SaveString(Directory_LastSave,SaveDir); _Settings->SaveString(Directory_LastSave,SaveDir);
_System->LoadState();
_BaseSystem->ExternalEvent(SysEvent_LoadMachineState);
} }
_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_LoadGame); _BaseSystem->ExternalEvent(SysEvent_ResumeCPU_LoadGame);
} }