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