feat(gameui): add Game Script table

This commit is contained in:
VDm 2025-08-03 02:02:19 +04:00
parent 6c5c560dc7
commit 679ed1101f
5 changed files with 1593 additions and 2 deletions

File diff suppressed because it is too large Load Diff

View File

@ -6,9 +6,11 @@
struct lua_State;
#define NUM_SCRIPT_FUNCTIONS_GAME 310
#define NUM_SCRIPT_FUNCTIONS_CAMERA 22
namespace GameScript {
extern FrameScript_Method s_ScriptFunctions_Game[NUM_SCRIPT_FUNCTIONS_GAME];
extern FrameScript_Method s_ScriptFunctions_Camera[NUM_SCRIPT_FUNCTIONS_CAMERA];
}

View File

@ -156,7 +156,12 @@ void FrameScript_CreateEvents(const char* names[], uint32_t count) {
}
void FrameScript_Destroy() {
// TODO
lua_close(FrameScript::s_context);
FrameScript::s_context = nullptr;
luaM_freePool(FrameScript::s_mempool);
FrameScript::s_mempool = nullptr;
FrameScript::s_scriptEventsHash.Clear();
FrameScript::s_scriptEvents.Clear();
}
void FrameScript_Execute(const char* source, const char* filename, const char* a3) {

View File

@ -30,6 +30,25 @@ void* luaM_initPool() {
return pools;
}
void luaM_freePool(void* ptr) {
if (!ptr) {
return;
}
MemPool** pools = reinterpret_cast<MemPool**>(ptr);
for (uint32_t i = 0; i < 9; ++i) {
MemPool* pool = pools[i];
if (pool) {
// Is the sub_8556E0(pool) a desturctor?
pool->~MemPool();
SMemFree(pool, __FILE__, __LINE__, 0);
}
}
SMemFree(pools, __FILE__, __LINE__, 0);
}
void* luaM_reallocPool(void* ud, void* ptr, size_t osize, size_t nsize) {
void* result; // eax
signed int v5; // esi

View File

@ -4,6 +4,7 @@
#include <cstdlib>
void* luaM_initPool();
void luaM_freePool(void* ptr);
void* luaM_reallocPool(void* ud, void* ptr, size_t osize, size_t nsize);
#endif