From ad4191eb977de65fa6702686bca887bcb6b7f724 Mon Sep 17 00:00:00 2001 From: ineed bots Date: Wed, 30 Aug 2023 14:06:03 -0600 Subject: [PATCH] this is how it will be done --- src/game/clientscript_public.hpp | 43 ++++++++++++++++++++++++++++++++ src/game/game.hpp | 3 +++ src/game/symbols.hpp | 3 --- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/src/game/clientscript_public.hpp b/src/game/clientscript_public.hpp index 802b4f2..25cdbe3 100644 --- a/src/game/clientscript_public.hpp +++ b/src/game/clientscript_public.hpp @@ -16,6 +16,8 @@ namespace game struct gclient_s; struct game_hudelem_s; +#pragma region "enums" + enum classNum_e { CLASS_NUM_ENTITY = 0x0, @@ -326,6 +328,10 @@ namespace game VAR_ENDON_LIST = 0x18, }; +#pragma endregion + +#pragma region "structs" + struct VariableStackBuffer { const char * pos; //OFS: 0x0 SIZE: 0x4 @@ -2128,6 +2134,43 @@ namespace game ASSERT_STRUCT_OFFSET(node_field_t, type, 0x8); ASSERT_STRUCT_OFFSET(node_field_t, getter, 0xC); +#pragma endregion + +#pragma region "data" +#pragma endregion + +#pragma region "cscr_main" + + WEAK symbol Scr_LoadScriptInternal{ 0x0, 0x689980 }; + WEAK symbolScr_EndLoadScripts{ 0x0, 0x689C80 }; + WEAK symbol Scr_PrecacheAnimTrees{0x0, 0x689D60}; + WEAK symbolScr_EndLoadAnimTrees{ 0x0, 0x689DC0 }; + + inline void* Scr_IsIdentifier_ADDR() { return CALL_ADDR(0x0, 0x689470); } + bool Scr_IsIdentifier(char* token, void* call_addr = Scr_IsIdentifier_ADDR()); + inline void* Scr_GetFunctionHandle_ADDR() { return CALL_ADDR(0x0, 0x6894B0); } + unsigned int Scr_GetFunctionHandle(const char* file, scriptInstance_t inst, const char* handle, void* call_addr = Scr_GetFunctionHandle_ADDR()); + inline void* SL_TransferToCanonicalString_ADDR() { return CALL_ADDR(0x0, 0x6895A0); } + unsigned int SL_TransferToCanonicalString(scriptInstance_t inst, unsigned int stringValue, void* call_addr = SL_TransferToCanonicalString_ADDR()); + inline void* SL_GetCanonicalString_ADDR() { return CALL_ADDR(0x0, 0x6895F0); } + unsigned int SL_GetCanonicalString(const char* token, scriptInstance_t inst, void* call_addr = SL_GetCanonicalString_ADDR()); + inline void* Scr_BeginLoadScripts_ADDR() { return CALL_ADDR(0x0, 0x689660); } + void Scr_BeginLoadScripts(scriptInstance_t inst, int user, void* call_addr = Scr_BeginLoadScripts_ADDR()); + inline void* Scr_BeginLoadAnimTrees_ADDR() { return CALL_ADDR(0x0, 0x689880); } + void Scr_BeginLoadAnimTrees(scriptInstance_t inst, int user, void* call_addr = Scr_BeginLoadAnimTrees_ADDR()); + inline void* Scr_ScanFile_ADDR() { return CALL_ADDR(0x0, 0x689900); } + int Scr_ScanFile(int max_size, char* buf, void* call_addr = Scr_ScanFile_ADDR()); + inline void* Scr_LoadScript_ADDR() { return CALL_ADDR(0x0, 0x689C60); } + unsigned int Scr_LoadScript(const char* file, scriptInstance_t inst, void* call_addr = Scr_LoadScript_ADDR()); + inline void* Scr_FreeScripts_ADDR() { return CALL_ADDR(0x0, 0x689E50); } + void Scr_FreeScripts(scriptInstance_t a1, void* call_addr = Scr_FreeScripts_ADDR()); + + int Scr_IsInOpcodeMemory(scriptInstance_t inst, const char* pos); + void SL_BeginLoadScripts(scriptInstance_t inst); + void Scr_SetLoadedImpureScript(bool loadedImpureScript); + +#pragma endregion + #ifdef __cplusplus } #endif diff --git a/src/game/game.hpp b/src/game/game.hpp index 892a348..66d934a 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -1,5 +1,8 @@ #pragma once +#define WEAK __declspec(selectany) +#define NAKED __declspec(naked) + #define SELECT(mp, sp) (game::environment::t4mp() ? mp : sp) #define ASSIGN(type, mp, sp) reinterpret_cast(SELECT(mp, sp)) #define CALL_ADDR(mp, sp) ASSIGN(void*, mp, sp) diff --git a/src/game/symbols.hpp b/src/game/symbols.hpp index 107e77c..b7164b8 100644 --- a/src/game/symbols.hpp +++ b/src/game/symbols.hpp @@ -1,8 +1,5 @@ #pragma once -#define WEAK __declspec(selectany) -#define NAKED __declspec(naked) - namespace game { // Functions