diff --git a/Core/Debugger.cpp b/Core/Debugger.cpp index 3114411e..9af58c56 100644 --- a/Core/Debugger.cpp +++ b/Core/Debugger.cpp @@ -1003,8 +1003,16 @@ bool Debugger::SleepUntilResume(BreakSource source, uint32_t breakpointId, Break _executionStopped = true; _pausedForDebugHelper = breakRequested; + int whilePausedRunCounter = 0; while((((stepCount == 0 || _breakRequested) && _suspendCount == 0) || _preventResume > 0) && !_stopFlag) { std::this_thread::sleep_for(std::chrono::duration(10)); + if (preventResume == 0) { + whilePausedRunCounter++; + if (whilePausedRunCounter > 10) { + ProcessEvent(EventType::WhilePaused); + whilePausedRunCounter = 0; + } + } if(stepCount == 0) { _console->ResetRunTimers(); } diff --git a/Core/DebuggerTypes.h b/Core/DebuggerTypes.h index 0669785b..b9f7b2ea 100644 --- a/Core/DebuggerTypes.h +++ b/Core/DebuggerTypes.h @@ -203,6 +203,7 @@ enum class EventType SpriteZeroHit = 9, ScriptEnded = 10, BusConflict = 11, + WhilePaused = 12, EventTypeSize }; diff --git a/Core/LuaApi.cpp b/Core/LuaApi.cpp index 54816aa4..8c590199 100644 --- a/Core/LuaApi.cpp +++ b/Core/LuaApi.cpp @@ -168,6 +168,7 @@ int LuaApi::GetLibrary(lua_State *lua) lua_pushintvalue(stateSaved, EventType::StateSaved); lua_pushintvalue(inputPolled, EventType::InputPolled); lua_pushintvalue(scriptEnded, EventType::ScriptEnded); + lua_pushintvalue(whilePaused, EventType::WhilePaused); lua_settable(lua, -3); lua_pushliteral(lua, "executeCountType"); diff --git a/GUI.NET/Debugger/frmScript.cs b/GUI.NET/Debugger/frmScript.cs index 3b7614a2..ee5fd973 100644 --- a/GUI.NET/Debugger/frmScript.cs +++ b/GUI.NET/Debugger/frmScript.cs @@ -578,6 +578,7 @@ namespace Mesen.GUI.Debugger new List {"enum","emu.eventType.inputPolled","Triggered when the emulation core polls the state of the input devices for the next frame","","",""}, new List {"enum","emu.eventType.spriteZeroHit","Triggered when the PPU sets the sprite zero hit flag","","",""}, new List {"enum","emu.eventType.scriptEnded","Triggered when the current Lua script ends (script window closed, execution stopped, etc.)","","",""}, + new List {"enum","emu.eventType.whilePaused","Triggered repeatedly while execution is paused","","",""}, new List {"enum","emu.executeCountType","emu.executeCountType.[value]","","","Values:\ncpuCycles = 0,\nppuCycles = 1,\ncpuInstructions = 2\n\nUsed by execute calls." }, new List {"enum","emu.executeCountType.cpuCycles","Count the number of CPU cycles","","",""}, new List {"enum","emu.executeCountType.ppuCycles","Count the number of PPU cycles","","",""},