chore(ui): clean up SystemRegisterFunctions
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run

This commit is contained in:
fallenoak 2026-01-26 12:24:17 -06:00
parent caf628145d
commit cbbf491620
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
6 changed files with 19 additions and 18 deletions

View File

@ -27,6 +27,7 @@
#include "ui/Interface.hpp" #include "ui/Interface.hpp"
#include "ui/Key.hpp" #include "ui/Key.hpp"
#include "ui/ScriptFunctions.hpp" #include "ui/ScriptFunctions.hpp"
#include "ui/ScriptFunctionsSystem.hpp"
#include "ui/game/CGVideoOptions.hpp" #include "ui/game/CGVideoOptions.hpp"
#include "ui/simple/CSimpleModelFFX.hpp" #include "ui/simple/CSimpleModelFFX.hpp"
#include "ui/simple/CSimpleTop.hpp" #include "ui/simple/CSimpleTop.hpp"

View File

@ -54,12 +54,3 @@ void RegisterSimpleFrameScriptMethods() {
// CSimpleColorSelect::CreateScriptMetaTable(); // CSimpleColorSelect::CreateScriptMetaTable();
// CSimpleMovieFrame::CreateScriptMetaTable(); // CSimpleMovieFrame::CreateScriptMetaTable();
} }
void SystemRegisterFunctions() {
for (int32_t i = 0; i < NUM_SCRIPT_FUNCTIONS_SYSTEM; ++i) {
FrameScript_RegisterFunction(
FrameScript::s_ScriptFunctions_System[i].name,
FrameScript::s_ScriptFunctions_System[i].method
);
}
}

View File

@ -7,15 +7,11 @@
struct lua_State; struct lua_State;
#define NUM_SCRIPT_FUNCTIONS_SIMPLE_FRAME 7 #define NUM_SCRIPT_FUNCTIONS_SIMPLE_FRAME 7
#define NUM_SCRIPT_FUNCTIONS_SYSTEM 7
namespace FrameScript { namespace FrameScript {
extern FrameScript_Method s_ScriptFunctions_SimpleFrame[NUM_SCRIPT_FUNCTIONS_SIMPLE_FRAME]; extern FrameScript_Method s_ScriptFunctions_SimpleFrame[NUM_SCRIPT_FUNCTIONS_SIMPLE_FRAME];
extern FrameScript_Method s_ScriptFunctions_System[NUM_SCRIPT_FUNCTIONS_SYSTEM];
} }
void RegisterSimpleFrameScriptMethods(); void RegisterSimpleFrameScriptMethods();
void SystemRegisterFunctions();
#endif #endif

View File

@ -1,4 +1,4 @@
#include "ui/ScriptFunctions.hpp" #include "ui/FrameScript.hpp"
#include "ui/ScriptFunctionsShared.hpp" #include "ui/ScriptFunctionsShared.hpp"
#include "ui/Types.hpp" #include "ui/Types.hpp"
#include "util/Lua.hpp" #include "util/Lua.hpp"
@ -22,10 +22,12 @@ int32_t Script_ConsoleExec(lua_State* L) {
} }
int32_t Script_AccessDenied(lua_State* L) { int32_t Script_AccessDenied(lua_State* L) {
return luaL_error(L, "Access Denied"); luaL_error(L, "Access Denied");
return 0;
} }
FrameScript_Method FrameScript::s_ScriptFunctions_System[NUM_SCRIPT_FUNCTIONS_SYSTEM] = { static FrameScript_Method s_SystemFunctions[] = {
{ "GetTime", &Script_GetTime }, { "GetTime", &Script_GetTime },
{ "GetGameTime", &Script_GetGameTime }, { "GetGameTime", &Script_GetGameTime },
{ "ConsoleExec", &Script_ConsoleExec }, { "ConsoleExec", &Script_ConsoleExec },
@ -34,3 +36,9 @@ FrameScript_Method FrameScript::s_ScriptFunctions_System[NUM_SCRIPT_FUNCTIONS_SY
{ "AppendToFile", &Script_AccessDenied }, { "AppendToFile", &Script_AccessDenied },
{ "GetAccountExpansionLevel", &Script_GetAccountExpansionLevel } { "GetAccountExpansionLevel", &Script_GetAccountExpansionLevel }
}; };
void SystemRegisterFunctions() {
for (auto& func : s_SystemFunctions) {
FrameScript_RegisterFunction(func.name, func.method);
}
}

View File

@ -0,0 +1,6 @@
#ifndef UI_SCRIPT_FUNCTIONS_SYSTEM_HPP
#define UI_SCRIPT_FUNCTIONS_SYSTEM_HPP
void SystemRegisterFunctions();
#endif

View File

@ -1,7 +1,6 @@
#include "ui/game/ScriptEvents.hpp" #include "ui/game/ScriptEvents.hpp"
#include "ui/FrameScript.hpp" #include "ui/FrameScript.hpp"
#include "ui/ScriptFunctions.hpp" #include "ui/ScriptFunctionsSystem.hpp"
#include "ui/ScriptFunctionsShared.hpp"
#include "util/Unimplemented.hpp" #include "util/Unimplemented.hpp"
int32_t Script_UnitExists(lua_State* L) { int32_t Script_UnitExists(lua_State* L) {