lua: add debuggerloopstep

This commit is contained in:
zeromus 2017-05-15 17:21:58 +00:00
parent 6021ba627d
commit fca1c78925
2 changed files with 30 additions and 13 deletions

View File

@ -903,6 +903,26 @@ void _updateWindow()
//UpdateTasEditor(); //AnS: moved to FCEUD_Update
}
void win_debuggerLoopStep()
{
FCEUD_UpdateInput();
_updateWindow();
//question:
//should this go here, or in the loop?
// HACK: break when Frame Advance is pressed
extern bool frameAdvanceRequested;
extern int frameAdvance_Delay_count, frameAdvance_Delay;
if (frameAdvanceRequested)
{
if (frameAdvance_Delay_count == 0 || frameAdvance_Delay_count >= frameAdvance_Delay)
FCEUI_SetEmulationPaused(EMULATIONPAUSED_FA);
if (frameAdvance_Delay_count < frameAdvance_Delay)
frameAdvance_Delay_count++;
}
}
void win_debuggerLoop()
{
//delay until something causes us to unpause.
@ -910,20 +930,8 @@ void win_debuggerLoop()
while(FCEUI_EmulationPaused() && !FCEUI_EmulationFrameStepped())
{
Sleep(50);
FCEUD_UpdateInput();
_updateWindow();
// HACK: break when Frame Advance is pressed
extern bool frameAdvanceRequested;
extern int frameAdvance_Delay_count, frameAdvance_Delay;
if (frameAdvanceRequested)
{
if (frameAdvance_Delay_count == 0 || frameAdvance_Delay_count >= frameAdvance_Delay)
FCEUI_SetEmulationPaused(EMULATIONPAUSED_FA);
if (frameAdvance_Delay_count < frameAdvance_Delay)
frameAdvance_Delay_count++;
}
win_debuggerLoopStep();
}
int zzz=9;
}
// Update the game and gamewindow with a new frame

View File

@ -407,6 +407,14 @@ static int emu_debuggerloop(lua_State *L) {
return 0;
}
static int emu_debuggerloopstep(lua_State *L) {
#ifdef WIN32
extern void win_debuggerLoopStep();
win_debuggerLoopStep();
#endif
return 0;
}
// emu.softreset()
//
// Executes a power cycle
@ -5547,6 +5555,7 @@ static const struct luaL_reg emulib [] = {
{"poweron", emu_poweron},
{"debuggerloop", emu_debuggerloop},
{"debuggerloopstep", emu_debuggerloopstep},
{"softreset", emu_softreset},
{"speedmode", emu_speedmode},
{"frameadvance", emu_frameadvance},