[Project64] when changing BP's, on the pause make sure the emulator is paused

This commit is contained in:
zilmar 2018-04-15 05:31:19 +10:00
parent d2e67dc1d9
commit 83b280f761
4 changed files with 20 additions and 15 deletions

View File

@ -190,15 +190,13 @@ void CSystemEvents::ExecuteEvents()
case SysEvent_PauseCPU_FromMenu:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_FromMenu);
bPause = true;
}
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_FromMenu);
break;
case SysEvent_PauseCPU_AppLostFocus:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_AppLostFocus);
bPause = true;
}
@ -206,7 +204,6 @@ void CSystemEvents::ExecuteEvents()
case SysEvent_PauseCPU_AppLostActive:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_AppLostActive);
bPause = true;
}
@ -214,7 +211,6 @@ void CSystemEvents::ExecuteEvents()
case SysEvent_PauseCPU_SaveGame:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_SaveGame);
bPause = true;
}
@ -222,7 +218,6 @@ void CSystemEvents::ExecuteEvents()
case SysEvent_PauseCPU_LoadGame:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_LoadGame);
bPause = true;
}
@ -230,7 +225,6 @@ void CSystemEvents::ExecuteEvents()
case SysEvent_PauseCPU_DumpMemory:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_DumpMemory);
bPause = true;
}
@ -238,7 +232,6 @@ void CSystemEvents::ExecuteEvents()
case SysEvent_PauseCPU_SearchMemory:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_SearchMemory);
bPause = true;
}
@ -246,7 +239,6 @@ void CSystemEvents::ExecuteEvents()
case SysEvent_PauseCPU_Settings:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_Settings);
bPause = true;
}
@ -254,7 +246,6 @@ void CSystemEvents::ExecuteEvents()
case SysEvent_PauseCPU_Cheats:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_Cheats);
bPause = true;
}
@ -262,7 +253,6 @@ void CSystemEvents::ExecuteEvents()
case SysEvent_PauseCPU_ChangingBPs:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
g_Settings->SaveDword(GameRunning_CPU_PausedType, PauseType_ChangingBPs);
bPause = true;
}

View File

@ -213,10 +213,24 @@ void CN64System::ExternalEvent(SystemEvent action)
case SysEvent_PauseCPU_SearchMemory:
case SysEvent_PauseCPU_Settings:
case SysEvent_PauseCPU_Cheats:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
{
QueueEvent(action);
}
break;
case SysEvent_PauseCPU_ChangingBPs:
if (!WaitingForStep() && !g_Settings->LoadBool(GameRunning_CPU_Paused))
{
QueueEvent(action);
for (int i = 0; i < 100; i++)
{
bool paused = g_Settings->LoadBool(GameRunning_CPU_Paused);
pjutil::Sleep(1);
if (paused)
{
break;
}
}
}
break;
case SysEvent_ResumeCPU_FromMenu:
@ -610,17 +624,17 @@ void CN64System::Pause()
{
return;
}
uint32_t PauseType = g_Settings->LoadDword(GameRunning_CPU_PausedType);
PauseType pause_type = (PauseType)g_Settings->LoadDword(GameRunning_CPU_PausedType);
m_hPauseEvent.Reset();
g_Settings->SaveBool(GameRunning_CPU_Paused, true);
if (PauseType == PauseType_FromMenu)
if (pause_type == PauseType_FromMenu)
{
g_Notify->DisplayMessage(5, MSG_CPU_PAUSED);
}
m_hPauseEvent.IsTriggered(SyncEvent::INFINITE_TIMEOUT);
m_hPauseEvent.Reset();
g_Settings->SaveBool(GameRunning_CPU_Paused, (uint32_t)false);
if (PauseType == PauseType_FromMenu)
if (pause_type == PauseType_FromMenu)
{
g_Notify->DisplayMessage(5, MSG_CPU_RESUMED);
}

View File

@ -25,6 +25,7 @@
enum PauseType
{
PauseType_None,
PauseType_FromMenu,
PauseType_AppLostActive,
PauseType_AppLostFocus,

View File

@ -297,7 +297,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(GameRunning_LoadingInProgress, new CSettingTypeTempBool(false));
AddHandler(GameRunning_CPU_Running, new CSettingTypeTempBool(false));
AddHandler(GameRunning_CPU_Paused, new CSettingTypeTempBool(false));
AddHandler(GameRunning_CPU_PausedType, new CSettingTypeTempNumber(Default_None));
AddHandler(GameRunning_CPU_PausedType, new CSettingTypeTempNumber(PauseType_None));
AddHandler(GameRunning_InstantSaveFile, new CSettingTypeTempString(""));
AddHandler(GameRunning_LimitFPS, new CSettingTypeTempBool(true, "Limit FPS"));
AddHandler(GameRunning_ScreenHertz, new CSettingTypeTempNumber(60));