mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 03:02:30 +00:00
feat(gameui): add Game Script table
This commit is contained in:
parent
6c5c560dc7
commit
679ed1101f
5 changed files with 1593 additions and 2 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -6,9 +6,11 @@
|
||||||
|
|
||||||
struct lua_State;
|
struct lua_State;
|
||||||
|
|
||||||
|
#define NUM_SCRIPT_FUNCTIONS_GAME 310
|
||||||
#define NUM_SCRIPT_FUNCTIONS_CAMERA 22
|
#define NUM_SCRIPT_FUNCTIONS_CAMERA 22
|
||||||
|
|
||||||
namespace GameScript {
|
namespace GameScript {
|
||||||
|
extern FrameScript_Method s_ScriptFunctions_Game[NUM_SCRIPT_FUNCTIONS_GAME];
|
||||||
extern FrameScript_Method s_ScriptFunctions_Camera[NUM_SCRIPT_FUNCTIONS_CAMERA];
|
extern FrameScript_Method s_ScriptFunctions_Camera[NUM_SCRIPT_FUNCTIONS_CAMERA];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,12 @@ void FrameScript_CreateEvents(const char* names[], uint32_t count) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameScript_Destroy() {
|
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) {
|
void FrameScript_Execute(const char* source, const char* filename, const char* a3) {
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,25 @@ void* luaM_initPool() {
|
||||||
return pools;
|
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* luaM_reallocPool(void* ud, void* ptr, size_t osize, size_t nsize) {
|
||||||
void* result; // eax
|
void* result; // eax
|
||||||
signed int v5; // esi
|
signed int v5; // esi
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
void* luaM_initPool();
|
void* luaM_initPool();
|
||||||
|
void luaM_freePool(void* ptr);
|
||||||
void* luaM_reallocPool(void* ud, void* ptr, size_t osize, size_t nsize);
|
void* luaM_reallocPool(void* ud, void* ptr, size_t osize, size_t nsize);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue