Lua: add emu.pause() and emu.unpause()

I am not sure if calling the function from the inside of a frame can be a problem.
This commit is contained in:
gocha 2012-08-15 22:47:10 +09:00
parent 128cd6b3d9
commit f1363914a9
1 changed files with 8 additions and 8 deletions

View File

@ -1673,19 +1673,19 @@ DEFINE_LUA_FUNCTION(emu_frameadvance, "")
break;
}
return 0;
}
}*/
DEFINE_LUA_FUNCTION(emu_pause, "")
{
LuaContextInfo& info = GetCurrentInfo();
Paused = 1;
while(!Step_Gens_MainLoop(true, false) && !info.panic);
Settings.Paused = TRUE;
//while(!Step_Gens_MainLoop(true, false) && !info.panic);
// allow the user to not have to manually unpause
// after restarting a script that used emu.pause()
if(info.panic)
Paused = 0;
Settings.Paused = FALSE;
return 0;
}
@ -1694,11 +1694,11 @@ DEFINE_LUA_FUNCTION(emu_unpause, "")
{
LuaContextInfo& info = GetCurrentInfo();
Paused = 0;
Settings.Paused = FALSE;
return 0;
}
DEFINE_LUA_FUNCTION(emu_redraw, "")
/*DEFINE_LUA_FUNCTION(emu_redraw, "")
{
Show_Genesis_Screen();
worry(L,250);
@ -4014,8 +4014,8 @@ static const struct luaL_reg emulib [] =
// {"frameadvance", emu_frameadvance},
// {"speedmode", emu_speedmode},
// {"wait", emu_wait},
// {"pause", emu_pause},
// {"unpause", emu_unpause},
{"pause", emu_pause},
{"unpause", emu_unpause},
// {"emulateframe", emu_emulateframe},
//{"emulateframefastnoskipping", emu_emulateframefastnoskipping}, // removed from library because probably nobody would notice the difference from emu_emulateframe
// {"emulateframefast", emu_emulateframefast},