diff --git a/src/core/cpu_core.cpp b/src/core/cpu_core.cpp index 4c10ad610..ef3d31b10 100644 --- a/src/core/cpu_core.cpp +++ b/src/core/cpu_core.cpp @@ -1770,7 +1770,8 @@ void UpdateDebugDispatcherFlag() Log_DevPrintf("%s debug dispatcher", use_debug_dispatcher ? "Now using" : "No longer using"); g_state.use_debug_dispatcher = use_debug_dispatcher; - ExitExecution(); + if (System::IsExecuting()) + ExitExecution(); } void ExitExecution() diff --git a/src/core/system.cpp b/src/core/system.cpp index cb271e9fd..0842bc357 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -337,6 +337,12 @@ bool System::IsValid() return s_state == State::Running || s_state == State::Paused; } +bool System::IsExecuting() +{ + DebugAssert(IsValid()); + return s_system_executing; +} + bool System::IsStartupCancelled() { return s_startup_cancelled.load(); diff --git a/src/core/system.h b/src/core/system.h index 37f84ad29..5686797df 100644 --- a/src/core/system.h +++ b/src/core/system.h @@ -139,6 +139,7 @@ bool IsExecutionInterrupted(); bool IsPaused(); bool IsShutdown(); bool IsValid(); +bool IsExecuting(); bool IsStartupCancelled(); void CancelPendingStartup();