More refactoring

This commit is contained in:
Henrik Rydgård committed 2026-06-15 01:16:05 +02:00
1 parent 2cafa268b2
commit a9af37e684
3 files changed
+5 -8

No files matched your search

+2 -3
View File
@@ -46,7 +46,7 @@ static std::vector<PluginInfo> prxPlugins;
struct LuaPlugin {
std::string filename;
std::unique_ptr<sol::state> context;
std::unique_ptr<LuaContext> context;
};
static std::vector<LuaPlugin> 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<std::mutex> guard(g_inputMutex);
+2 -3
View File
@@ -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() {
+1 -2
View File
@@ -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<sol::state> lua_;
};