diff --git a/src/lua.cpp b/src/lua.cpp index f7b0a8a1..ab1896e5 100644 --- a/src/lua.cpp +++ b/src/lua.cpp @@ -144,6 +144,21 @@ static int getAppIDThunk(lua_State* L) { return 3; } +static int pauseThunk(lua_State* L) { + LuaManager::g_emulator->pause(); + return 0; +} + +static int resumeThunk(lua_State* L) { + LuaManager::g_emulator->resume(); + return 0; +} + +static int resetThunk(lua_State* L) { + LuaManager::g_emulator->reset(Emulator::ReloadOption::Reload); + return 0; +} + // clang-format off static constexpr luaL_Reg functions[] = { { "__read8", read8Thunk }, @@ -155,6 +170,9 @@ static constexpr luaL_Reg functions[] = { { "__write32", write32Thunk }, { "__write64", write64Thunk }, { "__getAppID", getAppIDThunk }, + { "__pause", pauseThunk}, + { "__resume", resumeThunk}, + { "__reset", resetThunk}, { nullptr, nullptr }, }; // clang-format on @@ -179,6 +197,10 @@ void LuaManager::initializeThunks() { return result, id end, + pause = function() GLOBALS.__pause() end, + resume = function() GLOBALS.__resume() end, + reset = function() GLOBALS.__reset() end, + Frame = __Frame, } )"; @@ -203,4 +225,4 @@ void LuaManager::initializeThunks() { } } -#endif \ No newline at end of file +#endif