mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-07 14:45:41 +12:00
Merge pull request #415 from wheremyfoodat/wheremyfoodat-patch-3
Bind more Lua functions
This commit is contained in:
commit
de980f997b
1 changed files with 23 additions and 1 deletions
24
src/lua.cpp
24
src/lua.cpp
|
@ -144,6 +144,21 @@ static int getAppIDThunk(lua_State* L) {
|
||||||
return 3;
|
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
|
// clang-format off
|
||||||
static constexpr luaL_Reg functions[] = {
|
static constexpr luaL_Reg functions[] = {
|
||||||
{ "__read8", read8Thunk },
|
{ "__read8", read8Thunk },
|
||||||
|
@ -155,6 +170,9 @@ static constexpr luaL_Reg functions[] = {
|
||||||
{ "__write32", write32Thunk },
|
{ "__write32", write32Thunk },
|
||||||
{ "__write64", write64Thunk },
|
{ "__write64", write64Thunk },
|
||||||
{ "__getAppID", getAppIDThunk },
|
{ "__getAppID", getAppIDThunk },
|
||||||
|
{ "__pause", pauseThunk},
|
||||||
|
{ "__resume", resumeThunk},
|
||||||
|
{ "__reset", resetThunk},
|
||||||
{ nullptr, nullptr },
|
{ nullptr, nullptr },
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
@ -179,6 +197,10 @@ void LuaManager::initializeThunks() {
|
||||||
return result, id
|
return result, id
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
pause = function() GLOBALS.__pause() end,
|
||||||
|
resume = function() GLOBALS.__resume() end,
|
||||||
|
reset = function() GLOBALS.__reset() end,
|
||||||
|
|
||||||
Frame = __Frame,
|
Frame = __Frame,
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
@ -203,4 +225,4 @@ void LuaManager::initializeThunks() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue