Add emu.stepOver() and emu.stepOut() to lua api environment

This commit is contained in:
Zachery Delafosse 2021-11-13 12:21:49 -06:00
parent b4e1054d34
commit 7411f2e878
3 changed files with 24 additions and 0 deletions

View file

@ -87,6 +87,8 @@ int LuaApi::GetLibrary(lua_State *lua)
{ "reset", LuaApi::Reset }, { "reset", LuaApi::Reset },
{ "stop", LuaApi::Stop }, { "stop", LuaApi::Stop },
{ "breakExecution", LuaApi::Break }, { "breakExecution", LuaApi::Break },
{ "stepOver", LuaApi::StepOver },
{ "stepOut", LuaApi::StepOut },
{ "resume", LuaApi::Resume }, { "resume", LuaApi::Resume },
{ "execute", LuaApi::Execute }, { "execute", LuaApi::Execute },
{ "rewind", LuaApi::Rewind }, { "rewind", LuaApi::Rewind },
@ -585,6 +587,24 @@ int LuaApi::Execute(lua_State *lua)
return l.ReturnCount(); return l.ReturnCount();
} }
int LuaApi::StepOut(lua_State* lua)
{
LuaCallHelper l(lua);
checkparams();
checkinitdone();
_debugger->StepOut();
return l.ReturnCount();
}
int LuaApi::StepOver(lua_State* lua)
{
LuaCallHelper l(lua);
checkparams();
checkinitdone();
_debugger->StepOver();
return l.ReturnCount();
}
int LuaApi::Rewind(lua_State *lua) int LuaApi::Rewind(lua_State *lua)
{ {
LuaCallHelper l(lua); LuaCallHelper l(lua);

View file

@ -49,6 +49,8 @@ public:
static int Break(lua_State *lua); static int Break(lua_State *lua);
static int Resume(lua_State *lua); static int Resume(lua_State *lua);
static int Execute(lua_State *lua); static int Execute(lua_State *lua);
static int StepOut(lua_State* lua);
static int StepOver(lua_State* lua);
static int Rewind(lua_State *lua); static int Rewind(lua_State *lua);
static int TakeScreenshot(lua_State *lua); static int TakeScreenshot(lua_State *lua);

View file

@ -535,6 +535,8 @@ namespace Mesen.GUI.Debugger
new List<string> {"func","emu.breakExecution","emu.breakExecution()","","","Breaks the execution of the game and displays the debugger window."}, new List<string> {"func","emu.breakExecution","emu.breakExecution()","","","Breaks the execution of the game and displays the debugger window."},
new List<string> {"func","emu.stop","emu.stop()","","","Stops execution of the game."}, new List<string> {"func","emu.stop","emu.stop()","","","Stops execution of the game."},
new List<string> {"func","emu.execute","emu.execute(count, type)","count - *Integer* The number of cycles or instructions to run before breaking\ntype - *Enum* See executeCountType","","Runs the emulator for the specified number of cycles/instructions and then breaks the execution."}, new List<string> {"func","emu.execute","emu.execute(count, type)","count - *Integer* The number of cycles or instructions to run before breaking\ntype - *Enum* See executeCountType","","Runs the emulator for the specified number of cycles/instructions and then breaks the execution."},
new List<string> {"func","emu.stepOver", "emu.stepOver()", "","","Step over the next instruction."},
new List<string> {"func","emu.stepOut", "emu.stepOver()", "","","Step out of the subroutine."},
new List<string> {"func","emu.reset","emu.reset()","","","Resets the current game."}, new List<string> {"func","emu.reset","emu.reset()","","","Resets the current game."},
new List<string> {"func","emu.resume","emu.resume()","","","Resumes execution after breaking."}, new List<string> {"func","emu.resume","emu.resume()","","","Resumes execution after breaking."},
new List<string> {"func","emu.rewind","emu.rewind(seconds)","seconds - *Integer* The number of seconds to rewind","","Instantly rewinds the emulation by the number of seconds specified.\n Note: this can only be called from within a 'StartFrame' event callback."}, new List<string> {"func","emu.rewind","emu.rewind(seconds)","seconds - *Integer* The number of seconds to rewind","","Instantly rewinds the emulation by the number of seconds specified.\n Note: this can only be called from within a 'StartFrame' event callback."},