diff --git a/Core/HLE/Plugins.cpp b/Core/HLE/Plugins.cpp index 435538dcd4..b4e55bf51c 100644 --- a/Core/HLE/Plugins.cpp +++ b/Core/HLE/Plugins.cpp @@ -46,7 +46,7 @@ static std::vector prxPlugins; struct LuaPlugin { std::string filename; - std::unique_ptr context; + std::unique_ptr context; }; static std::vector luaPlugins; @@ -236,8 +236,7 @@ bool Load(PSPModule *pluginWaitingModule, SceUID threadID) { WARN_LOG(Log::System, "Plugins are disabled, ignoring enabled Lua plugin %s", luaPlugin.filename.c_str()); continue; } - luaPlugin.context.reset(new sol::state()); - InitializeLuaContextForPPSSPP(*luaPlugin.context); + luaPlugin.context.reset(new LuaContext()); } std::lock_guard guard(g_inputMutex); diff --git a/Core/LuaContext.cpp b/Core/LuaContext.cpp index 2db6f65816..a7d301a6e2 100644 --- a/Core/LuaContext.cpp +++ b/Core/LuaContext.cpp @@ -254,7 +254,7 @@ void lua_memset(int dest, int byte, int size) { Memory::MemsetUnchecked(dest, byte, size); } -void InitializeLuaContextForPPSSPP(sol::state &lua) { +void LuaContext::SetupContext(sol::state &lua) { // Add stuff we want to add. lua.open_libraries(sol::lib::base); lua.open_libraries(sol::lib::table); @@ -346,7 +346,6 @@ void InitializeLuaContextForPPSSPP(sol::state &lua) { // Missing functions after studying Thirteen's plugins // sceIoDevctl("kemulator:", EMULATOR_DEVCTL__TOGGLE_FASTFORWARD, (void*)1, 0, NULL, 0); // Easy-to-use scan functions for hex patterns - // // Functionality required to replace cwcheats // https://datacrystal.tcrf.net/wiki/CwCheat @@ -422,7 +421,7 @@ void LuaContext::Init() { _dbg_assert_(lua_ == nullptr); lua_.reset(new sol::state()); - InitializeLuaContextForPPSSPP(*lua_); + SetupContext(*lua_); } void LuaContext::Shutdown() { diff --git a/Core/LuaContext.h b/Core/LuaContext.h index d54d394eeb..14be0d9b16 100644 --- a/Core/LuaContext.h +++ b/Core/LuaContext.h @@ -27,8 +27,6 @@ struct LuaLogLine { double fnumber; }; -void InitializeLuaContextForPPSSPP(sol::state &lua); - class LuaContext { public: virtual ~LuaContext() = default; @@ -39,6 +37,7 @@ public: virtual void Print(LogLineType type, std::string_view text); protected: + void SetupContext(sol::state &lua); std::unique_ptr lua_; };