added more detours

This commit is contained in:
ineed bots 2023-08-31 13:10:44 -06:00
parent 27c3bf2d32
commit 00dcc0e424
10 changed files with 6044 additions and 8 deletions

View File

@ -1,2 +0,0 @@
#include <stdinc.hpp>
#include "clientscript_public.hpp"

View File

@ -3,7 +3,7 @@
#include "utils/hook.hpp" #include "utils/hook.hpp"
#include "codsrc/clientscript/cscr_main.hpp" #include "codsrc/clientscript/cscr_main.hpp"
//#define RE_CSCR_MAIN_USE_WRAPPERS #define RE_CSCR_MAIN_USE_WRAPPERS
namespace re_cscr_main namespace re_cscr_main
@ -275,13 +275,13 @@ namespace re_cscr_main
void post_unpack() override void post_unpack() override
{ {
Scr_IsIdentifier_hook.create(game::Scr_IsIdentifier_ADDR(), Scr_IsIdentifier_stub); Scr_IsIdentifier_hook.create(game::Scr_IsIdentifier_ADDR(), Scr_IsIdentifier_stub);
//Scr_GetFunctionHandle_hook.create(game::Scr_GetFunctionHandle_ADDR(), Scr_GetFunctionHandle_stub); Scr_GetFunctionHandle_hook.create(game::Scr_GetFunctionHandle_ADDR(), Scr_GetFunctionHandle_stub);
SL_TransferToCanonicalString_hook.create(game::SL_TransferToCanonicalString_ADDR(), SL_TransferToCanonicalString_stub); SL_TransferToCanonicalString_hook.create(game::SL_TransferToCanonicalString_ADDR(), SL_TransferToCanonicalString_stub);
SL_GetCanonicalString_hook.create(game::SL_GetCanonicalString_ADDR(), SL_GetCanonicalString_stub); SL_GetCanonicalString_hook.create(game::SL_GetCanonicalString_ADDR(), SL_GetCanonicalString_stub);
//Scr_BeginLoadScripts_hook.create(game::Scr_BeginLoadScripts_ADDR(), Scr_BeginLoadScripts_stub); Scr_BeginLoadScripts_hook.create(game::Scr_BeginLoadScripts_ADDR(), Scr_BeginLoadScripts_stub);
Scr_BeginLoadAnimTrees_hook.create(game::Scr_BeginLoadAnimTrees_ADDR(), Scr_BeginLoadAnimTrees_stub); Scr_BeginLoadAnimTrees_hook.create(game::Scr_BeginLoadAnimTrees_ADDR(), Scr_BeginLoadAnimTrees_stub);
Scr_ScanFile_hook.create(game::Scr_ScanFile_ADDR(), Scr_ScanFile_stub); Scr_ScanFile_hook.create(game::Scr_ScanFile_ADDR(), Scr_ScanFile_stub);
//Scr_LoadScriptInternal_hook.create(game::Scr_LoadScriptInternal.get(), Scr_LoadScriptInternal_stub); Scr_LoadScriptInternal_hook.create(game::Scr_LoadScriptInternal.get(), Scr_LoadScriptInternal_stub);
Scr_LoadScript_hook.create(game::Scr_LoadScript_ADDR(), Scr_LoadScript_stub); Scr_LoadScript_hook.create(game::Scr_LoadScript_ADDR(), Scr_LoadScript_stub);
Scr_EndLoadScripts_hook.create(game::Scr_EndLoadScripts.get(), Scr_EndLoadScripts_stub); Scr_EndLoadScripts_hook.create(game::Scr_EndLoadScripts.get(), Scr_EndLoadScripts_stub);
Scr_PrecacheAnimTrees_hook.create(game::Scr_PrecacheAnimTrees.get(), Scr_PrecacheAnimTrees_stub); Scr_PrecacheAnimTrees_hook.create(game::Scr_PrecacheAnimTrees.get(), Scr_PrecacheAnimTrees_stub);

View File

@ -0,0 +1,308 @@
#include <stdinc.hpp>
#include "loader/component_loader.hpp"
#include "utils/hook.hpp"
//#include "codsrc/clientscript/cscr_memorytree.hpp"
#define RE_CSCR_MEMORYTREE_USE_WRAPPERS
namespace re_cscr_memorytree
{
utils::hook::detour MT_GetSubTreeSize_hook;
utils::hook::detour MT_DumpTree_hook;
utils::hook::detour MT_InitBits_hook;
utils::hook::detour MT_GetScore_hook;
utils::hook::detour MT_AddMemoryNode_hook;
utils::hook::detour MT_RemoveMemoryNode_hook;
utils::hook::detour MT_RemoveHeadMemoryNode_hook;
utils::hook::detour MT_Init_hook;
utils::hook::detour MT_Error_hook;
utils::hook::detour MT_GetSize_hook;
utils::hook::detour MT_AllocIndex_hook;
utils::hook::detour MT_FreeIndex_hook;
utils::hook::detour MT_Alloc_hook;
utils::hook::detour MT_Free_hook;
void* MT_GetSubTreeSize_original;
void* MT_DumpTree_original;
void* MT_InitBits_original;
void* MT_GetScore_original;
void* MT_AddMemoryNode_original;
void* MT_RemoveMemoryNode_original;
void* MT_RemoveHeadMemoryNode_original;
void* MT_Init_original;
void* MT_Error_original;
void* MT_GetSize_original;
void* MT_AllocIndex_original;
void* MT_FreeIndex_original;
void* MT_Alloc_original;
void* MT_Free_original;
namespace
{
int MT_GetSubTreeSize_stub(game::scriptInstance_t inst, int nodeNum, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_MEMORYTREE_USE_WRAPPERS
return MT_GetSubTreeSize_hook.invoke<int>(inst, nodeNum);
#else
return codsrc::MT_GetSubTreeSize(inst, nodeNum);
#endif
}
void MT_DumpTree_stub(game::scriptInstance_t a1, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_MEMORYTREE_USE_WRAPPERS
MT_DumpTree_hook.invoke<void>(a1);
#else
codsrc::MT_DumpTree(a1);
#endif
}
void MT_InitBits_call(game::scriptInstance_t a1, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_MEMORYTREE_USE_WRAPPERS
game::MT_InitBits(a1, MT_InitBits_original);
#else
codsrc::MT_InitBits(a1);
#endif
}
// void __usercall MT_InitBits(scriptInstance_t a1@<ecx>)
NAKED void MT_InitBits_stub()
{
_asm
{
push ecx;
call MT_InitBits_call;
add esp, 0x4;
ret;
}
}
int MT_GetScore_call(game::scriptInstance_t a1, [[maybe_unused]] void* caller_addr, int num)
{
#ifdef RE_CSCR_MEMORYTREE_USE_WRAPPERS
return game::MT_GetScore(a1, num, MT_GetScore_original);
#else
return codsrc::MT_GetScore(a1, num);
#endif
}
// int __usercall MT_GetScore@<eax>(scriptInstance_t a1@<edx>, int num)
NAKED int MT_GetScore_stub()
{
_asm
{
push edx;
call MT_GetScore_call;
add esp, 0x4;
ret;
}
}
void MT_AddMemoryNode_stub(game::scriptInstance_t inst, int newNode, int size, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_MEMORYTREE_USE_WRAPPERS
MT_AddMemoryNode_hook.invoke<void>(inst, newNode, size);
#else
codsrc::MT_AddMemoryNode(inst, newNode, size);
#endif
}
char MT_RemoveMemoryNode_stub(game::scriptInstance_t inst, int oldNode, int size, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_MEMORYTREE_USE_WRAPPERS
return MT_RemoveMemoryNode_hook.invoke<char>(inst, oldNode, size);
#else
return codsrc::MT_RemoveMemoryNode(inst, oldNode, size);
#endif
}
void MT_RemoveHeadMemoryNode_stub(game::scriptInstance_t inst, int size, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_MEMORYTREE_USE_WRAPPERS
MT_RemoveHeadMemoryNode_hook.invoke<void>(inst, size);
#else
codsrc::MT_RemoveHeadMemoryNode(inst, size);
#endif
}
void MT_Init_call(game::scriptInstance_t a1, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_MEMORYTREE_USE_WRAPPERS
game::MT_Init(a1, MT_Init_original);
#else
codsrc::MT_Init(a1);
#endif
}
// void __usercall MT_Init(scriptInstance_t a1@<edi>)
NAKED void MT_Init_stub()
{
_asm
{
push edi;
call MT_Init_call;
add esp, 0x4;
ret;
}
}
void MT_Error_call(game::scriptInstance_t a1, [[maybe_unused]] void* caller_addr, const char* funcName, int numBytes)
{
#ifdef RE_CSCR_MEMORYTREE_USE_WRAPPERS
game::MT_Error(a1, funcName, numBytes, MT_Error_original);
#else
codsrc::MT_Error(a1, funcName, numBytes);
#endif
}
// void __usercall MT_Error(scriptInstance_t a1@<eax>, const char *funcName, int numBytes)
NAKED void MT_Error_stub()
{
_asm
{
push eax;
call MT_Error_call;
add esp, 0x4;
ret;
}
}
int MT_GetSize_call(int numBytes, game::scriptInstance_t inst, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_MEMORYTREE_USE_WRAPPERS
return game::MT_GetSize(numBytes, inst, MT_GetSize_original);
#else
return codsrc::MT_GetSize(numBytes, inst);
#endif
}
// int __usercall MT_GetSize@<eax>(int numBytes@<eax>, scriptInstance_t inst@<ecx>)
NAKED int MT_GetSize_stub()
{
_asm
{
push ecx;
push eax;
call MT_GetSize_call;
add esp, 0x8;
ret;
}
}
unsigned __int16 MT_AllocIndex_call(game::scriptInstance_t inst, [[maybe_unused]] void* caller_addr, int size_)
{
#ifdef RE_CSCR_MEMORYTREE_USE_WRAPPERS
return game::MT_AllocIndex(inst, size_, MT_AllocIndex_original);
#else
return codsrc::MT_AllocIndex(inst, size_);
#endif
}
// unsigned __int16 __usercall MT_AllocIndex@<ax>(scriptInstance_t inst@<edi>, int size)
NAKED unsigned __int16 MT_AllocIndex_stub()
{
_asm
{
push edi;
call MT_AllocIndex_call;
add esp, 0x4;
ret;
}
}
void MT_FreeIndex_call(int numBytes, [[maybe_unused]] void* caller_addr, game::scriptInstance_t a1, int nodeNum)
{
#ifdef RE_CSCR_MEMORYTREE_USE_WRAPPERS
game::MT_FreeIndex(numBytes, a1, nodeNum, MT_FreeIndex_original);
#else
codsrc::MT_FreeIndex(numBytes, a1, nodeNum);
#endif
}
// void __usercall MT_FreeIndex(int numBytes@<eax>, scriptInstance_t a1, int nodeNum)
NAKED void MT_FreeIndex_stub()
{
_asm
{
push eax;
call MT_FreeIndex_call;
add esp, 0x4;
ret;
}
}
char* MT_Alloc_call(int numBytes, game::scriptInstance_t inst, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_MEMORYTREE_USE_WRAPPERS
return game::MT_Alloc(numBytes, inst, MT_Alloc_original);
#else
return codsrc::MT_Alloc(numBytes, inst);
#endif
}
// char *__usercall MT_Alloc@<eax>(int numBytes@<eax>, scriptInstance_t a2@<ecx>)
NAKED char * MT_Alloc_stub()
{
_asm
{
push ecx;
push eax;
call MT_Alloc_call;
add esp, 0x8;
ret;
}
}
void MT_Free_stub(void* p, int numBytes, game::scriptInstance_t inst, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_MEMORYTREE_USE_WRAPPERS
MT_Free_hook.invoke<void>(p, numBytes, inst);
#else
codsrc::MT_Free(p, numBytes, inst);
#endif
}
}
class component final : public component_interface
{
public:
void post_unpack() override
{
MT_GetSubTreeSize_hook.create(game::MT_GetSubTreeSize.get(), MT_GetSubTreeSize_stub);
MT_DumpTree_hook.create(game::MT_DumpTree.get(), MT_DumpTree_stub);
MT_InitBits_hook.create(game::MT_InitBits_ADDR(), MT_InitBits_stub);
MT_GetScore_hook.create(game::MT_GetScore_ADDR(), MT_GetScore_stub);
MT_AddMemoryNode_hook.create(game::MT_AddMemoryNode.get(), MT_AddMemoryNode_stub);
MT_RemoveMemoryNode_hook.create(game::MT_RemoveMemoryNode.get(), MT_RemoveMemoryNode_stub);
MT_RemoveHeadMemoryNode_hook.create(game::MT_RemoveHeadMemoryNode.get(), MT_RemoveHeadMemoryNode_stub);
MT_Init_hook.create(game::MT_Init_ADDR(), MT_Init_stub);
MT_Error_hook.create(game::MT_Error_ADDR(), MT_Error_stub);
MT_GetSize_hook.create(game::MT_GetSize_ADDR(), MT_GetSize_stub);
MT_AllocIndex_hook.create(game::MT_AllocIndex_ADDR(), MT_AllocIndex_stub);
MT_FreeIndex_hook.create(game::MT_FreeIndex_ADDR(), MT_FreeIndex_stub);
MT_Alloc_hook.create(game::MT_Alloc_ADDR(), MT_Alloc_stub);
MT_Free_hook.create(game::MT_Free.get(), MT_Free_stub);
//Original hook function addresses
MT_GetSubTreeSize_original = MT_GetSubTreeSize_hook.get_original();
MT_DumpTree_original = MT_DumpTree_hook.get_original();
MT_InitBits_original = MT_InitBits_hook.get_original();
MT_GetScore_original = MT_GetScore_hook.get_original();
MT_AddMemoryNode_original = MT_AddMemoryNode_hook.get_original();
MT_RemoveMemoryNode_original = MT_RemoveMemoryNode_hook.get_original();
MT_RemoveHeadMemoryNode_original = MT_RemoveHeadMemoryNode_hook.get_original();
MT_Init_original = MT_Init_hook.get_original();
MT_Error_original = MT_Error_hook.get_original();
MT_GetSize_original = MT_GetSize_hook.get_original();
MT_AllocIndex_original = MT_AllocIndex_hook.get_original();
MT_FreeIndex_original = MT_FreeIndex_hook.get_original();
MT_Alloc_original = MT_Alloc_hook.get_original();
MT_Free_original = MT_Free_hook.get_original();
}
private:
};
}
REGISTER_COMPONENT(re_cscr_memorytree::component)

View File

@ -0,0 +1,590 @@
#include <stdinc.hpp>
#include "loader/component_loader.hpp"
#include "utils/hook.hpp"
//#include "codsrc/clientscript/cscr_parser.hpp"
#define RE_CSCR_PARSER_USE_WRAPPERS
namespace re_cscr_parser
{
utils::hook::detour Scr_InitOpcodeLookup_hook;
utils::hook::detour Scr_ShutdownOpcodeLookup_hook;
utils::hook::detour AddOpcodePos_hook;
utils::hook::detour RemoveOpcodePos_hook;
utils::hook::detour AddThreadStartOpcodePos_hook;
utils::hook::detour Scr_GetSourceBuffer_hook;
utils::hook::detour Scr_GetLineNumInternal_hook;
utils::hook::detour Scr_GetNewSourceBuffer_hook;
utils::hook::detour Scr_AddSourceBufferInternal_hook;
utils::hook::detour Scr_ReadFile_FastFile_hook;
utils::hook::detour Scr_ReadFile_LoadObj_hook;
utils::hook::detour Scr_ReadFile_hook;
utils::hook::detour Scr_AddSourceBuffer_hook;
utils::hook::detour Scr_CopyFormattedLine_hook;
utils::hook::detour Scr_GetLineInfo_hook;
utils::hook::detour Scr_PrintSourcePos_hook;
utils::hook::detour Scr_GetPrevSourcePosOpcodeLookup_hook;
utils::hook::detour Scr_GetTextSourcePos_hook;
utils::hook::detour Scr_PrintPrevCodePos_hook;
utils::hook::detour CompileError_hook;
utils::hook::detour CompileError2_hook;
utils::hook::detour RuntimeErrorInternal_hook;
utils::hook::detour RuntimeError_hook;
void* Scr_InitOpcodeLookup_original;
void* Scr_ShutdownOpcodeLookup_original;
void* AddOpcodePos_original;
void* RemoveOpcodePos_original;
void* AddThreadStartOpcodePos_original;
void* Scr_GetSourceBuffer_original;
void* Scr_GetLineNumInternal_original;
void* Scr_GetNewSourceBuffer_original;
void* Scr_AddSourceBufferInternal_original;
void* Scr_ReadFile_FastFile_original;
void* Scr_ReadFile_LoadObj_original;
void* Scr_ReadFile_original;
void* Scr_AddSourceBuffer_original;
void* Scr_CopyFormattedLine_original;
void* Scr_GetLineInfo_original;
void* Scr_PrintSourcePos_original;
void* Scr_GetPrevSourcePosOpcodeLookup_original;
void* Scr_GetTextSourcePos_original;
void* Scr_PrintPrevCodePos_original;
void* CompileError_original;
void* CompileError2_original;
void* RuntimeErrorInternal_original;
void* RuntimeError_original;
namespace
{
void Scr_InitOpcodeLookup_call(game::scriptInstance_t a1, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
game::Scr_InitOpcodeLookup(a1, Scr_InitOpcodeLookup_original);
#else
codsrc::Scr_InitOpcodeLookup(a1);
#endif
}
// void __usercall Scr_InitOpcodeLookup(game::scriptInstance_t a1@<eax>)
NAKED void Scr_InitOpcodeLookup_stub()
{
_asm
{
push eax;
call Scr_InitOpcodeLookup_call;
add esp, 0x4;
ret;
}
}
void Scr_ShutdownOpcodeLookup_call(game::scriptInstance_t a1, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
game::Scr_ShutdownOpcodeLookup(a1, Scr_ShutdownOpcodeLookup_original);
#else
codsrc::Scr_ShutdownOpcodeLookup(a1);
#endif
}
// void __usercall Scr_ShutdownOpcodeLookup(game::scriptInstance_t a1@<ecx>)
NAKED void Scr_ShutdownOpcodeLookup_stub()
{
_asm
{
push ecx;
call Scr_ShutdownOpcodeLookup_call;
add esp, 0x4;
ret;
}
}
void AddOpcodePos_call(game::scriptInstance_t a1, [[maybe_unused]] void* caller_addr, unsigned int sourcePos, int type_)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
game::AddOpcodePos(a1, sourcePos, type_, AddOpcodePos_original);
#else
codsrc::AddOpcodePos(a1, sourcePos, type_);
#endif
}
// void __usercall AddOpcodePos(game::scriptInstance_t a1@<eax>, unsigned int sourcePos, int type)
NAKED void AddOpcodePos_stub()
{
_asm
{
push eax;
call AddOpcodePos_call;
add esp, 0x4;
ret;
}
}
void RemoveOpcodePos_call(game::scriptInstance_t result, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
game::RemoveOpcodePos(result, RemoveOpcodePos_original);
#else
codsrc::RemoveOpcodePos(result);
#endif
}
// void __usercall RemoveOpcodePos(game::scriptInstance_t result@<eax>)
NAKED void RemoveOpcodePos_stub()
{
_asm
{
push eax;
call RemoveOpcodePos_call;
add esp, 0x4;
ret;
}
}
void AddThreadStartOpcodePos_call(game::scriptInstance_t result, [[maybe_unused]] void* caller_addr, unsigned int sourcePos)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
game::AddThreadStartOpcodePos(result, sourcePos, AddThreadStartOpcodePos_original);
#else
codsrc::AddThreadStartOpcodePos(result, sourcePos);
#endif
}
// void __usercall AddThreadStartOpcodePos(game::scriptInstance_t result@<eax>, unsigned int sourcePos)
NAKED void AddThreadStartOpcodePos_stub()
{
_asm
{
push eax;
call AddThreadStartOpcodePos_call;
add esp, 0x4;
ret;
}
}
unsigned int Scr_GetSourceBuffer_call(game::scriptInstance_t a1, const char * codePos, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
return game::Scr_GetSourceBuffer(a1, codePos, Scr_GetSourceBuffer_original);
#else
return codsrc::Scr_GetSourceBuffer(a1, codePos);
#endif
}
// unsigned int __usercall Scr_GetSourceBuffer@<eax>(game::scriptInstance_t inst@<eax>, const char *codePos@<esi>)
NAKED unsigned int Scr_GetSourceBuffer_stub()
{
_asm
{
push esi;
push eax;
call Scr_GetSourceBuffer_call;
add esp, 0x8;
ret;
}
}
unsigned int Scr_GetLineNumInternal_call(const char ** startLine, const char * buf, [[maybe_unused]] void* caller_addr, const char * sourcePos, int * col)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
return game::Scr_GetLineNumInternal(startLine, buf, sourcePos, col, Scr_GetLineNumInternal_original);
#else
return codsrc::Scr_GetLineNumInternal(startLine, buf, sourcePos, col);
#endif
}
// unsigned int __usercall Scr_GetLineNumInternal@<eax>(const char **startLine@<edx>, const char *buf@<ecx>, const char *sourcePos, int *col)
NAKED unsigned int Scr_GetLineNumInternal_stub()
{
_asm
{
push ecx;
push edx;
call Scr_GetLineNumInternal_call;
add esp, 0x8;
ret;
}
}
game::SourceBufferInfo * Scr_GetNewSourceBuffer_call(game::scriptInstance_t a1, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
return game::Scr_GetNewSourceBuffer(a1, Scr_GetNewSourceBuffer_original);
#else
return codsrc::Scr_GetNewSourceBuffer(a1);
#endif
}
// SourceBufferInfo *__usercall Scr_GetNewSourceBuffer@<eax>(game::scriptInstance_t a1@<eax>)
NAKED game::SourceBufferInfo * Scr_GetNewSourceBuffer_stub()
{
_asm
{
push eax;
call Scr_GetNewSourceBuffer_call;
add esp, 0x4;
ret;
}
}
void Scr_AddSourceBufferInternal_call(const char * filename, [[maybe_unused]] void* caller_addr, game::scriptInstance_t inst, const char * codepos, char * buffer, int len, int archive)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
game::Scr_AddSourceBufferInternal(filename, inst, codepos, buffer, len, archive, Scr_AddSourceBufferInternal_original);
#else
codsrc::Scr_AddSourceBufferInternal(filename, inst, codepos, buffer, len, archive);
#endif
}
// void __usercall Scr_AddSourceBufferInternal(const char *filename@<eax>, game::scriptInstance_t inst, const char *codepos, char *buffer, int len, int archive)
NAKED void Scr_AddSourceBufferInternal_stub()
{
_asm
{
push eax;
call Scr_AddSourceBufferInternal_call;
add esp, 0x4;
ret;
}
}
char * Scr_ReadFile_FastFile_stub(game::scriptInstance_t inst, int unused, char * filename, const char * codepos, int archive)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
return Scr_ReadFile_FastFile_hook.invoke<char *>(inst, unused, filename, codepos, archive);
#else
return codsrc::Scr_ReadFile_FastFile(inst, unused, filename, codepos, archive);
#endif
}
char * Scr_ReadFile_LoadObj_stub(game::scriptInstance_t inst, int unused_arg1, const char * filename, const char * codepos, int archive)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
return Scr_ReadFile_LoadObj_hook.invoke<char *>(inst, unused_arg1, filename, codepos, archive);
#else
return codsrc::Scr_ReadFile_LoadObj(inst, unused_arg1, filename, codepos, archive);
#endif
}
char * Scr_ReadFile_call(const char * codepos, char * filename, [[maybe_unused]] void* caller_addr, game::scriptInstance_t inst, int unused)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
return game::Scr_ReadFile(codepos, filename, inst, unused, Scr_ReadFile_original);
#else
return codsrc::Scr_ReadFile(codepos, filename, inst, unused);
#endif
}
// char *__usercall Scr_ReadFile@<eax>(const char *codepos@<edi>, char *filename@<esi>, game::scriptInstance_t inst, int unused)
NAKED char * Scr_ReadFile_stub()
{
_asm
{
push esi;
push edi;
call Scr_ReadFile_call;
add esp, 0x8;
ret;
}
}
char * Scr_AddSourceBuffer_call(game::scriptInstance_t inst, [[maybe_unused]] void* caller_addr, int unused_arg1, char * filename, const char * codepos)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
return game::Scr_AddSourceBuffer(inst, unused_arg1, filename, codepos, Scr_AddSourceBuffer_original);
#else
return codsrc::Scr_AddSourceBuffer(inst, unused_arg1, filename, codepos);
#endif
}
// char *__usercall Scr_AddSourceBuffer@<eax>(game::scriptInstance_t inst@<eax>, int unused_arg1, char *filename, const char *codepos)
NAKED char * Scr_AddSourceBuffer_stub()
{
_asm
{
push eax;
call Scr_AddSourceBuffer_call;
add esp, 0x4;
ret;
}
}
void Scr_CopyFormattedLine_call(const char * rawLine, [[maybe_unused]] void* caller_addr, char * line)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
game::Scr_CopyFormattedLine(rawLine, line, Scr_CopyFormattedLine_original);
#else
codsrc::Scr_CopyFormattedLine(rawLine, line);
#endif
}
// void __usercall Scr_CopyFormattedLine(const char *rawLine@<eax>, char *line)
NAKED void Scr_CopyFormattedLine_stub()
{
_asm
{
push eax;
call Scr_CopyFormattedLine_call;
add esp, 0x4;
ret;
}
}
unsigned int Scr_GetLineInfo_call(int * col, const char * buf, [[maybe_unused]] void* caller_addr, unsigned int sourcePos, char * line)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
return game::Scr_GetLineInfo(col, buf, sourcePos, line, Scr_GetLineInfo_original);
#else
return codsrc::Scr_GetLineInfo(col, buf, sourcePos, line);
#endif
}
// unsigned int __usercall Scr_GetLineInfo@<eax>(int *col@<edx>, _BYTE *buf@<ecx>, unsigned int sourcePos, char *line)
NAKED unsigned int Scr_GetLineInfo_stub()
{
_asm
{
push ecx;
push edx;
call Scr_GetLineInfo_call;
add esp, 0x8;
ret;
}
}
void Scr_PrintSourcePos_call(unsigned int sourcePos, const char * buf, game::con_channel_e channel, [[maybe_unused]] void* caller_addr, game::scriptInstance_t a4, const char * file)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
game::Scr_PrintSourcePos(sourcePos, buf, channel, a4, file, Scr_PrintSourcePos_original);
#else
codsrc::Scr_PrintSourcePos(sourcePos, buf, channel, a4, file);
#endif
}
// void __usercall Scr_PrintSourcePos(unsigned int sourcePos@<edx>, const char *buf@<ecx>, con_channel_e channel@<esi>, game::scriptInstance_t a4, const char *file)
NAKED void Scr_PrintSourcePos_stub()
{
_asm
{
push esi;
push ecx;
push edx;
call Scr_PrintSourcePos_call;
add esp, 0xC;
ret;
}
}
game::OpcodeLookup * Scr_GetPrevSourcePosOpcodeLookup_call(game::scriptInstance_t a1, const char * codePos, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
return game::Scr_GetPrevSourcePosOpcodeLookup(a1, codePos, Scr_GetPrevSourcePosOpcodeLookup_original);
#else
return codsrc::Scr_GetPrevSourcePosOpcodeLookup(a1, codePos);
#endif
}
// OpcodeLookup *__usercall Scr_GetPrevSourcePosOpcodeLookup@<eax>(game::scriptInstance_t a1@<eax>, const char *codePos@<edi>)
NAKED game::OpcodeLookup * Scr_GetPrevSourcePosOpcodeLookup_stub()
{
_asm
{
push edi;
push eax;
call Scr_GetPrevSourcePosOpcodeLookup_call;
add esp, 0x8;
ret;
}
}
void Scr_GetTextSourcePos_call(char * line, const char * codePos, [[maybe_unused]] void* caller_addr, game::scriptInstance_t a3)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
game::Scr_GetTextSourcePos(line, codePos, a3, Scr_GetTextSourcePos_original);
#else
codsrc::Scr_GetTextSourcePos(line, codePos, a3);
#endif
}
// void __usercall Scr_GetTextSourcePos(char *line@<edx>, const char *codePos@<ecx>, game::scriptInstance_t a3)
NAKED void Scr_GetTextSourcePos_stub()
{
_asm
{
push ecx;
push edx;
call Scr_GetTextSourcePos_call;
add esp, 0x8;
ret;
}
}
void Scr_PrintPrevCodePos_call(const char * codepos, [[maybe_unused]] void* caller_addr, game::scriptInstance_t scriptInstance, game::con_channel_e channel, unsigned int index)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
game::Scr_PrintPrevCodePos(codepos, scriptInstance, channel, index, Scr_PrintPrevCodePos_original);
#else
codsrc::Scr_PrintPrevCodePos(codepos, scriptInstance, channel, index);
#endif
}
// void __usercall Scr_PrintPrevCodePos(const char *codepos@<eax>, game::scriptInstance_t scriptInstance, con_channel_e channel, unsigned int index)
NAKED void Scr_PrintPrevCodePos_stub()
{
_asm
{
push eax;
call Scr_PrintPrevCodePos_call;
add esp, 0x4;
ret;
}
}
void CompileError_stub(game::scriptInstance_t a1, unsigned int codePos, const char * msg, ...)
{
char Buffer[1024];
va_list ArgList;
va_start(ArgList, msg);
_vsnprintf(Buffer, 0x400u, msg, ArgList);
va_end(ArgList);
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
CompileError_hook.invoke<void>(a1, codePos, "%s", Buffer);
#else
codsrc::CompileError(a1, codePos, "%s", Buffer);
#endif
}
void CompileError2_call(const char * codePos, game::scriptInstance_t a2, [[maybe_unused]] void* caller_addr, const char * msg, ...)
{
char Buffer[1024];
va_list ArgList;
va_start(ArgList, msg);
_vsnprintf(Buffer, 0x400u, msg, ArgList);
va_end(ArgList);
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
game::CompileError2(codePos, a2, CompileError2_original, "%s", Buffer);
#else
codsrc::CompileError2(codePos, a2, "%s", Buffer);
#endif
}
// void __usercall CompileError2(const char *codePos@<edi>, game::scriptInstance_t a2@<esi>, char *msg, ...)
NAKED void CompileError2_stub()
{
_asm
{
push esi;
push edi;
call CompileError2_call;
add esp, 0x8;
ret;
}
}
void RuntimeErrorInternal_call(const char * msg, game::scriptInstance_t inst, [[maybe_unused]] void* caller_addr, game::con_channel_e channel, const char * codepos, int index)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
game::RuntimeErrorInternal(msg, inst, channel, codepos, index, RuntimeErrorInternal_original);
#else
codsrc::RuntimeErrorInternal(msg, inst, channel, codepos, index);
#endif
}
// void __usercall RuntimeErrorInternal(const char *msg@<eax>, game::scriptInstance_t inst@<edi>, con_channel_e channel, const char *codepos, int index)
NAKED void RuntimeErrorInternal_stub()
{
_asm
{
push edi;
push eax;
call RuntimeErrorInternal_call;
add esp, 0x8;
ret;
}
}
void RuntimeError_call(game::scriptInstance_t inst, [[maybe_unused]] void* caller_addr, const char * pos, int error_index, const char * err, const char * err2)
{
#ifdef RE_CSCR_PARSER_USE_WRAPPERS
game::RuntimeError(inst, pos, error_index, err, err2, RuntimeError_original);
#else
codsrc::RuntimeError(inst, pos, error_index, err, err2);
#endif
}
// void __usercall RuntimeError(game::scriptInstance_t inst@<eax>, const char *pos, int error_index, const char *err, const char *err2)
NAKED void RuntimeError_stub()
{
_asm
{
push eax;
call RuntimeError_call;
add esp, 0x4;
ret;
}
}
}
class component final : public component_interface
{
public:
void post_unpack() override
{
Scr_InitOpcodeLookup_hook.create(game::Scr_InitOpcodeLookup_ADDR(), Scr_InitOpcodeLookup_stub);
Scr_ShutdownOpcodeLookup_hook.create(game::Scr_ShutdownOpcodeLookup_ADDR(), Scr_ShutdownOpcodeLookup_stub);
AddOpcodePos_hook.create(game::AddOpcodePos_ADDR(), AddOpcodePos_stub);
RemoveOpcodePos_hook.create(game::RemoveOpcodePos_ADDR(), RemoveOpcodePos_stub);
AddThreadStartOpcodePos_hook.create(game::AddThreadStartOpcodePos_ADDR(), AddThreadStartOpcodePos_stub);
Scr_GetSourceBuffer_hook.create(game::Scr_GetSourceBuffer_ADDR(), Scr_GetSourceBuffer_stub);
Scr_GetLineNumInternal_hook.create(game::Scr_GetLineNumInternal_ADDR(), Scr_GetLineNumInternal_stub);
Scr_GetNewSourceBuffer_hook.create(game::Scr_GetNewSourceBuffer_ADDR(), Scr_GetNewSourceBuffer_stub);
Scr_AddSourceBufferInternal_hook.create(game::Scr_AddSourceBufferInternal_ADDR(), Scr_AddSourceBufferInternal_stub);
Scr_ReadFile_FastFile_hook.create(game::Scr_ReadFile_FastFile.get(), Scr_ReadFile_FastFile_stub);
Scr_ReadFile_LoadObj_hook.create(game::Scr_ReadFile_LoadObj.get(), Scr_ReadFile_LoadObj_stub);
Scr_ReadFile_hook.create(game::Scr_ReadFile_ADDR(), Scr_ReadFile_stub);
Scr_AddSourceBuffer_hook.create(game::Scr_AddSourceBuffer_ADDR(), Scr_AddSourceBuffer_stub);
Scr_CopyFormattedLine_hook.create(game::Scr_CopyFormattedLine_ADDR(), Scr_CopyFormattedLine_stub);
Scr_GetLineInfo_hook.create(game::Scr_GetLineInfo_ADDR(), Scr_GetLineInfo_stub);
Scr_PrintSourcePos_hook.create(game::Scr_PrintSourcePos_ADDR(), Scr_PrintSourcePos_stub);
Scr_GetPrevSourcePosOpcodeLookup_hook.create(game::Scr_GetPrevSourcePosOpcodeLookup_ADDR(), Scr_GetPrevSourcePosOpcodeLookup_stub);
Scr_GetTextSourcePos_hook.create(game::Scr_GetTextSourcePos_ADDR(), Scr_GetTextSourcePos_stub);
Scr_PrintPrevCodePos_hook.create(game::Scr_PrintPrevCodePos_ADDR(), Scr_PrintPrevCodePos_stub);
CompileError_hook.create(game::CompileError.get(), CompileError_stub);
CompileError2_hook.create(game::CompileError2_ADDR(), CompileError2_stub);
RuntimeErrorInternal_hook.create(game::RuntimeErrorInternal_ADDR(), RuntimeErrorInternal_stub);
RuntimeError_hook.create(game::RuntimeError_ADDR(), RuntimeError_stub);
//Original hook function addresses
Scr_InitOpcodeLookup_original = Scr_InitOpcodeLookup_hook.get_original();
Scr_ShutdownOpcodeLookup_original = Scr_ShutdownOpcodeLookup_hook.get_original();
AddOpcodePos_original = AddOpcodePos_hook.get_original();
RemoveOpcodePos_original = RemoveOpcodePos_hook.get_original();
AddThreadStartOpcodePos_original = AddThreadStartOpcodePos_hook.get_original();
Scr_GetSourceBuffer_original = Scr_GetSourceBuffer_hook.get_original();
Scr_GetLineNumInternal_original = Scr_GetLineNumInternal_hook.get_original();
Scr_GetNewSourceBuffer_original = Scr_GetNewSourceBuffer_hook.get_original();
Scr_AddSourceBufferInternal_original = Scr_AddSourceBufferInternal_hook.get_original();
Scr_ReadFile_FastFile_original = Scr_ReadFile_FastFile_hook.get_original();
Scr_ReadFile_LoadObj_original = Scr_ReadFile_LoadObj_hook.get_original();
Scr_ReadFile_original = Scr_ReadFile_hook.get_original();
Scr_AddSourceBuffer_original = Scr_AddSourceBuffer_hook.get_original();
Scr_CopyFormattedLine_original = Scr_CopyFormattedLine_hook.get_original();
Scr_GetLineInfo_original = Scr_GetLineInfo_hook.get_original();
Scr_PrintSourcePos_original = Scr_PrintSourcePos_hook.get_original();
Scr_GetPrevSourcePosOpcodeLookup_original = Scr_GetPrevSourcePosOpcodeLookup_hook.get_original();
Scr_GetTextSourcePos_original = Scr_GetTextSourcePos_hook.get_original();
Scr_PrintPrevCodePos_original = Scr_PrintPrevCodePos_hook.get_original();
CompileError_original = CompileError_hook.get_original();
CompileError2_original = CompileError2_hook.get_original();
RuntimeErrorInternal_original = RuntimeErrorInternal_hook.get_original();
RuntimeError_original = RuntimeError_hook.get_original();
}
private:
};
}
REGISTER_COMPONENT(re_cscr_parser::component)

View File

@ -0,0 +1,198 @@
#include <stdinc.hpp>
#include "loader/component_loader.hpp"
#include "utils/hook.hpp"
//#include "codsrc/clientscript/cscr_parsetree.hpp"
#define RE_CSCR_PARSETREE_USE_WRAPPERS
namespace re_cscr_parsetree
{
utils::hook::detour Scr_InitAllocNode_hook;
utils::hook::detour node0_hook;
utils::hook::detour node1_hook;
utils::hook::detour node2_hook;
utils::hook::detour node3_hook;
utils::hook::detour node4_hook;
utils::hook::detour node5_hook;
utils::hook::detour node6_hook;
utils::hook::detour node7_hook;
utils::hook::detour node8_hook;
utils::hook::detour linked_list_end_hook;
utils::hook::detour prepend_node_hook;
utils::hook::detour append_node_hook;
void* Scr_InitAllocNode_original;
void* node0_original;
void* node1_original;
void* node2_original;
void* node3_original;
void* node4_original;
void* node5_original;
void* node6_original;
void* node7_original;
void* node8_original;
void* linked_list_end_original;
void* prepend_node_original;
void* append_node_original;
namespace
{
void Scr_InitAllocNode_stub(game::scriptInstance_t inst)
{
#ifdef RE_CSCR_PARSETREE_USE_WRAPPERS
Scr_InitAllocNode_hook.invoke<void>(inst);
#else
codsrc::Scr_InitAllocNode(inst);
#endif
}
game::sval_u node0_stub()
{
#ifdef RE_CSCR_PARSETREE_USE_WRAPPERS
return node0_hook.invoke<game::sval_u>();
#else
return codsrc::node0();
#endif
}
game::sval_u node1_stub(game::scr_enum_t type, game::sval_u val1)
{
#ifdef RE_CSCR_PARSETREE_USE_WRAPPERS
return node1_hook.invoke<game::sval_u>(type, val1);
#else
return codsrc::node1(type, val1);
#endif
}
game::sval_u node2_stub(game::scr_enum_t type, game::sval_u val1, game::sval_u val2)
{
#ifdef RE_CSCR_PARSETREE_USE_WRAPPERS
return node2_hook.invoke<game::sval_u>(type, val1, val2);
#else
return codsrc::node2(type, val1, val2);
#endif
}
game::sval_u node3_stub(game::scr_enum_t type, game::sval_u val1, game::sval_u val2, game::sval_u val3)
{
#ifdef RE_CSCR_PARSETREE_USE_WRAPPERS
return node3_hook.invoke<game::sval_u>(type, val1, val2, val3);
#else
return codsrc::node3(type, val1, val2, val3);
#endif
}
game::sval_u node4_stub(game::scr_enum_t type, game::sval_u val1, game::sval_u val2, game::sval_u val3, game::sval_u val4)
{
#ifdef RE_CSCR_PARSETREE_USE_WRAPPERS
return node4_hook.invoke<game::sval_u>(type, val1, val2, val3, val4);
#else
return codsrc::node4(type, val1, val2, val3, val4);
#endif
}
game::sval_u node5_stub(game::scr_enum_t type, game::sval_u val1, game::sval_u val2, game::sval_u val3, game::sval_u val4, game::sval_u val5)
{
#ifdef RE_CSCR_PARSETREE_USE_WRAPPERS
return node5_hook.invoke<game::sval_u>(type, val1, val2, val3, val4, val5);
#else
return codsrc::node5(type, val1, val2, val3, val4, val5);
#endif
}
game::sval_u node6_stub(game::sval_u val1, game::sval_u val2, game::sval_u val3, game::sval_u val4, game::sval_u val5, game::sval_u val6)
{
#ifdef RE_CSCR_PARSETREE_USE_WRAPPERS
return node6_hook.invoke<game::sval_u>(val1, val2, val3, val4, val5, val6);
#else
return codsrc::node6(val1, val2, val3, val4, val5, val6);
#endif
}
game::sval_u node7_stub(game::sval_u val1, game::sval_u val2, game::sval_u val3, game::sval_u val4, game::sval_u val5, game::sval_u val6, game::sval_u val7)
{
#ifdef RE_CSCR_PARSETREE_USE_WRAPPERS
return node7_hook.invoke<game::sval_u>(val1, val2, val3, val4, val5, val6, val7);
#else
return codsrc::node7(val1, val2, val3, val4, val5, val6, val7);
#endif
}
game::sval_u node8_stub(game::sval_u val1, game::sval_u val2, game::sval_u val3, game::sval_u val4, game::sval_u val5, game::sval_u val6, game::sval_u val7, game::sval_u val8)
{
#ifdef RE_CSCR_PARSETREE_USE_WRAPPERS
return node8_hook.invoke<game::sval_u>(val1, val2, val3, val4, val5, val6, val7, val8);
#else
return codsrc::node8(val1, val2, val3, val4, val5, val6, val7, val8);
#endif
}
game::sval_u linked_list_end_stub(game::sval_u val1)
{
#ifdef RE_CSCR_PARSETREE_USE_WRAPPERS
return linked_list_end_hook.invoke<game::sval_u>(val1);
#else
return codsrc::linked_list_end(val1);
#endif
}
game::sval_u prepend_node_stub(game::sval_u val1, game::sval_u val2)
{
#ifdef RE_CSCR_PARSETREE_USE_WRAPPERS
return prepend_node_hook.invoke<game::sval_u>(val1, val2);
#else
return codsrc::prepend_node(val1, val2);
#endif
}
game::sval_u append_node_stub(game::sval_u val1, game::sval_u val2)
{
#ifdef RE_CSCR_PARSETREE_USE_WRAPPERS
return append_node_hook.invoke<game::sval_u>(val1, val2);
#else
return codsrc::append_node(val1, val2);
#endif
}
}
class component final : public component_interface
{
public:
void post_unpack() override
{
//Scr_InitAllocNode_hook.create(game::Scr_InitAllocNode.get(), Scr_InitAllocNode_stub);
node0_hook.create(game::node0.get(), node0_stub);
node1_hook.create(game::node1.get(), node1_stub);
node2_hook.create(game::node2.get(), node2_stub);
node3_hook.create(game::node3.get(), node3_stub);
node4_hook.create(game::node4.get(), node4_stub);
node5_hook.create(game::node5.get(), node5_stub);
node6_hook.create(game::node6.get(), node6_stub);
node7_hook.create(game::node7.get(), node7_stub);
node8_hook.create(game::node8.get(), node8_stub);
linked_list_end_hook.create(game::linked_list_end.get(), linked_list_end_stub);
prepend_node_hook.create(game::prepend_node.get(), prepend_node_stub);
append_node_hook.create(game::append_node.get(), append_node_stub);
//Original hook function addresses
Scr_InitAllocNode_original = Scr_InitAllocNode_hook.get_original();
node0_original = node0_hook.get_original();
node1_original = node1_hook.get_original();
node2_original = node2_hook.get_original();
node3_original = node3_hook.get_original();
node4_original = node4_hook.get_original();
node5_original = node5_hook.get_original();
node6_original = node6_hook.get_original();
node7_original = node7_hook.get_original();
node8_original = node8_hook.get_original();
linked_list_end_original = linked_list_end_hook.get_original();
prepend_node_original = prepend_node_hook.get_original();
append_node_original = append_node_hook.get_original();
}
private:
};
}
REGISTER_COMPONENT(re_cscr_parsetree::component)

View File

@ -0,0 +1,79 @@
#include <stdinc.hpp>
#include "loader/component_loader.hpp"
#include "utils/hook.hpp"
//#include "codsrc/clientscript/cscr_readwrite.hpp"
#define RE_CSCR_READWRITE_USE_WRAPPERS
namespace re_cscr_readwrite
{
utils::hook::detour FindVariableIndexInternal2_hook;
utils::hook::detour FindLastSibling_hook;
void* FindVariableIndexInternal2_original;
void* FindLastSibling_original;
namespace
{
unsigned int FindVariableIndexInternal2_call(game::scriptInstance_t inst, [[maybe_unused]] void* caller_addr, unsigned int name, unsigned int index)
{
#ifdef RE_CSCR_READWRITE_USE_WRAPPERS
return game::FindVariableIndexInternal2(inst, name, index, FindVariableIndexInternal2_original);
#else
return codsrc::FindVariableIndexInternal2(inst, name, index);
#endif
}
// unsigned int __usercall FindVariableIndexInternal2@<eax>(scriptInstance_t inst@<eax>, unsigned int name, unsigned int index)
NAKED unsigned int FindVariableIndexInternal2_stub()
{
_asm
{
push eax;
call FindVariableIndexInternal2_call;
add esp, 0x4;
ret;
}
}
unsigned int FindLastSibling_call(unsigned int parentId, game::scriptInstance_t inst, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_READWRITE_USE_WRAPPERS
return game::FindLastSibling(parentId, inst, FindLastSibling_original);
#else
return codsrc::FindLastSibling(parentId, inst);
#endif
}
// unsigned int __usercall FindLastSibling@<eax>(unsigned int parentId@<edx>, scriptInstance_t inst@<esi>)
NAKED unsigned int FindLastSibling_stub()
{
_asm
{
push esi;
push edx;
call FindLastSibling_call;
add esp, 0x8;
ret;
}
}
}
class component final : public component_interface
{
public:
void post_unpack() override
{
FindVariableIndexInternal2_hook.create(game::FindVariableIndexInternal2_ADDR(), FindVariableIndexInternal2_stub);
FindLastSibling_hook.create(game::FindLastSibling_ADDR(), FindLastSibling_stub);
//Original hook function addresses
FindVariableIndexInternal2_original = FindVariableIndexInternal2_hook.get_original();
FindLastSibling_original = FindLastSibling_hook.get_original();
}
private:
};
}
REGISTER_COMPONENT(re_cscr_readwrite::component)

View File

@ -0,0 +1,653 @@
#include <stdinc.hpp>
#include "loader/component_loader.hpp"
#include "utils/hook.hpp"
//#include "codsrc/clientscript/cscr_stringlist.hpp"
#define RE_CSCR_STRINGLIST_USE_WRAPPERS
namespace re_cscr_stringlist
{
utils::hook::detour SL_ConvertToString_hook;
utils::hook::detour SL_GetStringLen_hook;
utils::hook::detour GetHashCode_hook;
utils::hook::detour SL_Init_hook;
utils::hook::detour SL_FindStringOfSize_hook;
utils::hook::detour SL_FindString_hook;
utils::hook::detour SL_FindLowercaseString_hook;
utils::hook::detour SL_AddUserInternal_hook;
utils::hook::detour Mark_ScriptStringCustom_hook;
utils::hook::detour SL_GetStringOfSize_hook;
utils::hook::detour SL_GetString__hook;
utils::hook::detour SL_GetString__0_hook;
utils::hook::detour SL_GetLowercaseStringOfLen_hook;
utils::hook::detour SL_GetLowercaseString_hook;
utils::hook::detour SL_ConvertToLowercase_hook;
utils::hook::detour SL_TransferRefToUser_hook;
utils::hook::detour SL_FreeString_hook;
utils::hook::detour SL_RemoveRefToString_hook;
utils::hook::detour Scr_SetString_hook;
utils::hook::detour Scr_SetStringFromCharString_hook;
utils::hook::detour GScr_AllocString_hook;
utils::hook::detour SL_GetStringForFloat_hook;
utils::hook::detour SL_GetStringForInt_hook;
utils::hook::detour SL_GetStringForVector_hook;
utils::hook::detour SL_ShutdownSystem_hook;
utils::hook::detour SL_TransferSystem_hook;
utils::hook::detour SL_CreateCanonicalFilename_hook;
utils::hook::detour Scr_CreateCanonicalFilename_hook;
void* SL_ConvertToString_original;
void* SL_GetStringLen_original;
void* GetHashCode_original;
void* SL_Init_original;
void* SL_FindStringOfSize_original;
void* SL_FindString_original;
void* SL_FindLowercaseString_original;
void* SL_AddUserInternal_original;
void* Mark_ScriptStringCustom_original;
void* SL_GetStringOfSize_original;
void* SL_GetString__original;
void* SL_GetString__0_original;
void* SL_GetLowercaseStringOfLen_original;
void* SL_GetLowercaseString_original;
void* SL_ConvertToLowercase_original;
void* SL_TransferRefToUser_original;
void* SL_FreeString_original;
void* SL_RemoveRefToString_original;
void* Scr_SetString_original;
void* Scr_SetStringFromCharString_original;
void* GScr_AllocString_original;
void* SL_GetStringForFloat_original;
void* SL_GetStringForInt_original;
void* SL_GetStringForVector_original;
void* SL_ShutdownSystem_original;
void* SL_TransferSystem_original;
void* SL_CreateCanonicalFilename_original;
void* Scr_CreateCanonicalFilename_original;
namespace
{
char* SL_ConvertToString_call(unsigned int id, game::scriptInstance_t inst, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
return game::SL_ConvertToString(id, inst, SL_ConvertToString_original);
#else
return codsrc::SL_ConvertToString(id, inst);
#endif
}
// char *__usercall SL_ConvertToString@<eax>(unsigned int id@<eax>, game::scriptInstance_t inst@<ecx>)
NAKED char* SL_ConvertToString_stub()
{
_asm
{
push ecx;
push eax;
call SL_ConvertToString_call;
add esp, 0x8;
ret;
}
}
int SL_GetStringLen_call(unsigned int a1, game::scriptInstance_t a2, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
return game::SL_GetStringLen(a1, a2, SL_GetStringLen_original);
#else
return codsrc::SL_GetStringLen(a1, a2);
#endif
}
// int __usercall SL_GetStringLen@<eax>(unsigned int a1@<eax>, game::scriptInstance_t a2@<ecx>)
NAKED int SL_GetStringLen_stub()
{
_asm
{
push ecx;
push eax;
call SL_GetStringLen_call;
add esp, 0x8;
ret;
}
}
unsigned int GetHashCode_call(unsigned int a1, const char* a2, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
return game::GetHashCode(a1, a2, GetHashCode_original);
#else
return codsrc::GetHashCode(a1, a2);
#endif
}
// unsigned int __usercall GetHashCode@<eax>(unsigned int a1@<eax>, const char *a2@<edx>)
NAKED unsigned int GetHashCode_stub()
{
_asm
{
push edx;
push eax;
call GetHashCode_call;
add esp, 0x8;
ret;
}
}
void SL_Init_call(game::scriptInstance_t a1, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
game::SL_Init(a1, SL_Init_original);
#else
codsrc::SL_Init(a1);
#endif
}
// void __usercall SL_Init(game::scriptInstance_t a1@<eax>)
NAKED void SL_Init_stub()
{
_asm
{
push eax;
call SL_Init_call;
add esp, 0x4;
ret;
}
}
unsigned int SL_FindStringOfSize_call(game::scriptInstance_t inst, [[maybe_unused]] void* caller_addr, const char* str_, unsigned int len)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
return game::SL_FindStringOfSize(inst, str_, len, SL_FindStringOfSize_original);
#else
return codsrc::SL_FindStringOfSize(inst, str_, len);
#endif
}
// unsigned int __usercall SL_FindStringOfSize@<eax>(game::scriptInstance_t inst@<eax>, const char *str, unsigned int len)
NAKED unsigned int SL_FindStringOfSize_stub()
{
_asm
{
push eax;
call SL_FindStringOfSize_call;
add esp, 0x4;
ret;
}
}
unsigned int SL_FindString_call(const char* a1, [[maybe_unused]] void* caller_addr, game::scriptInstance_t a2)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
return game::SL_FindString(a1, a2, SL_FindString_original);
#else
return codsrc::SL_FindString(a1, a2);
#endif
}
// unsigned int __usercall SL_FindString@<eax>(const char *a1@<edx>, game::scriptInstance_t a2)
NAKED unsigned int SL_FindString_stub()
{
_asm
{
push edx;
call SL_FindString_call;
add esp, 0x4;
ret;
}
}
unsigned int SL_FindLowercaseString_stub(const char* str, game::scriptInstance_t inst)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
return SL_FindLowercaseString_hook.invoke<unsigned int>(str, inst);
#else
return codsrc::SL_FindLowercaseString(str, inst);
#endif
}
void SL_AddUserInternal_call(unsigned int user, game::RefString* refStr, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
game::SL_AddUserInternal(user, refStr, SL_AddUserInternal_original);
#else
codsrc::SL_AddUserInternal(user, refStr);
#endif
}
// void __usercall SL_AddUserInternal(unsigned int user@<eax>, RefString *refStr@<edx>)
NAKED void SL_AddUserInternal_stub()
{
_asm
{
push edx;
push eax;
call SL_AddUserInternal_call;
add esp, 0x8;
ret;
}
}
void Mark_ScriptStringCustom_call(unsigned int a1, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
game::Mark_ScriptStringCustom(a1, Mark_ScriptStringCustom_original);
#else
codsrc::Mark_ScriptStringCustom(a1);
#endif
}
// void __usercall Mark_ScriptStringCustom(unsigned __int16 *a1@<eax>)
NAKED void Mark_ScriptStringCustom_stub()
{
_asm
{
push eax;
call Mark_ScriptStringCustom_call;
add esp, 0x4;
ret;
}
}
unsigned int SL_GetStringOfSize_stub(game::scriptInstance_t inst, const char* string, unsigned int user, unsigned int len)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
return SL_GetStringOfSize_hook.invoke<unsigned int>(inst, string, user, len);
#else
return codsrc::SL_GetStringOfSize(inst, string, user, len);
#endif
}
unsigned int SL_GetString__call(const char* a1, [[maybe_unused]] void* caller_addr, game::scriptInstance_t a2, unsigned int user)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
return game::SL_GetString_(a1, a2, user, SL_GetString__original);
#else
return codsrc::SL_GetString_(a1, a2, user);
#endif
}
// unsigned int __usercall SL_GetString_@<eax>(const char *a1@<edx>, game::scriptInstance_t a2, unsigned int user)
NAKED unsigned int SL_GetString__stub()
{
_asm
{
push edx;
call SL_GetString__call;
add esp, 0x4;
ret;
}
}
unsigned int SL_GetString__0_call(const char* a1, [[maybe_unused]] void* caller_addr, unsigned int user, game::scriptInstance_t a3)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
return game::SL_GetString__0(a1, user, a3, SL_GetString__0_original);
#else
return codsrc::SL_GetString__0(a1, user, a3);
#endif
}
// unsigned int __usercall SL_GetString__0@<eax>(const char *a1@<edx>, unsigned int user, game::scriptInstance_t a3)
NAKED unsigned int SL_GetString__0_stub()
{
_asm
{
push edx;
call SL_GetString__0_call;
add esp, 0x4;
ret;
}
}
unsigned int SL_GetLowercaseStringOfLen_stub(game::scriptInstance_t a1, const char* ArgList, unsigned int user, unsigned int len)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
return SL_GetLowercaseStringOfLen_hook.invoke<unsigned int>(a1, ArgList, user, len);
#else
return codsrc::SL_GetLowercaseStringOfLen(a1, ArgList, user, len);
#endif
}
unsigned int SL_GetLowercaseString_call(const char* a2, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
return game::SL_GetLowercaseString(a2, SL_GetLowercaseString_original);
#else
return codsrc::SL_GetLowercaseString(a2);
#endif
}
// unsigned int __usercall SL_GetLowercaseString@<eax>(const char *a2@<edx>)
NAKED unsigned int SL_GetLowercaseString_stub()
{
_asm
{
push edx;
call SL_GetLowercaseString_call;
add esp, 0x4;
ret;
}
}
unsigned int SL_ConvertToLowercase_stub(game::scriptInstance_t inst, unsigned int stringVal, unsigned int user)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
return SL_ConvertToLowercase_hook.invoke<unsigned int>(inst, stringVal, user);
#else
return codsrc::SL_ConvertToLowercase(inst, stringVal, user);
#endif
}
void SL_TransferRefToUser_call(unsigned int stringValue, unsigned int user, [[maybe_unused]] void* caller_addr, game::scriptInstance_t inst)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
game::SL_TransferRefToUser(stringValue, user, inst, SL_TransferRefToUser_original);
#else
codsrc::SL_TransferRefToUser(stringValue, user, inst);
#endif
}
// void __usercall SL_TransferRefToUser(unsigned int stringValue@<eax>, unsigned int user@<ecx>, game::scriptInstance_t inst)
NAKED void SL_TransferRefToUser_stub()
{
_asm
{
push ecx;
push eax;
call SL_TransferRefToUser_call;
add esp, 0x8;
ret;
}
}
void SL_FreeString_stub(game::scriptInstance_t a1, unsigned int a2, game::RefString* a3, unsigned int a4)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
SL_FreeString_hook.invoke<void>(a1, a2, a3, a4);
#else
codsrc::SL_FreeString(a1, a2, a3, a4);
#endif
}
void SL_RemoveRefToString_call(unsigned int stringVal, game::scriptInstance_t inst, [[maybe_unused]] void* caller_addr)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
game::SL_RemoveRefToString(stringVal, inst, SL_RemoveRefToString_original);
#else
codsrc::SL_RemoveRefToString(stringVal, inst);
#endif
}
// void __usercall SL_RemoveRefToString(unsigned int stringVal@<edx>, game::scriptInstance_t inst@<esi>)
NAKED void SL_RemoveRefToString_stub()
{
_asm
{
push esi;
push edx;
call SL_RemoveRefToString_call;
add esp, 0x8;
ret;
}
}
void Scr_SetString_call(game::scriptInstance_t inst, unsigned int from, [[maybe_unused]] void* caller_addr, unsigned __int16* to)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
game::Scr_SetString(inst, from, to, Scr_SetString_original);
#else
codsrc::Scr_SetString(inst, from, to);
#endif
}
// void __usercall Scr_SetString(game::scriptInstance_t inst@<eax>, unsigned int from@<edi>, unsigned __int16 *to)
NAKED void Scr_SetString_stub()
{
_asm
{
push edi;
push eax;
call Scr_SetString_call;
add esp, 0x8;
ret;
}
}
void Scr_SetStringFromCharString_call(const char* a1, [[maybe_unused]] void* caller_addr, unsigned __int16* a2)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
game::Scr_SetStringFromCharString(a1, a2, Scr_SetStringFromCharString_original);
#else
codsrc::Scr_SetStringFromCharString(a1, a2);
#endif
}
// unsigned int __usercall Scr_SetStringFromCharString@<eax>(const char *a1@<edi>, unsigned __int16 *a2)
NAKED void Scr_SetStringFromCharString_stub()
{
_asm
{
push edi;
call Scr_SetStringFromCharString_call;
add esp, 0x4;
ret;
}
}
unsigned int GScr_AllocString_call(const char* a1, [[maybe_unused]] void* caller_addr, game::scriptInstance_t inst)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
return game::GScr_AllocString(a1, inst, GScr_AllocString_original);
#else
return codsrc::GScr_AllocString(a1, inst);
#endif
}
// unsigned int __usercall GScr_AllocString@<eax>(const char *a1@<edx>, game::scriptInstance_t inst)
NAKED unsigned int GScr_AllocString_stub()
{
_asm
{
push edx;
call GScr_AllocString_call;
add esp, 0x4;
ret;
}
}
unsigned int SL_GetStringForFloat_call(float a1, [[maybe_unused]] void* caller_addr, game::scriptInstance_t a2)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
return game::SL_GetStringForFloat(a1, a2, SL_GetStringForFloat_original);
#else
return codsrc::SL_GetStringForFloat(a1, a2);
#endif
}
// unsigned int __usercall SL_GetStringForFloat@<eax>(float a1@<xmm0>, game::scriptInstance_t a2)
NAKED unsigned int SL_GetStringForFloat_stub()
{
_asm
{
movd eax, xmm0;
push eax;
call SL_GetStringForFloat_call;
add esp, 0x4;
ret;
}
}
unsigned int SL_GetStringForInt_call(int a1, [[maybe_unused]] void* caller_addr, game::scriptInstance_t a2)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
return game::SL_GetStringForInt(a1, a2, SL_GetStringForInt_original);
#else
return codsrc::SL_GetStringForInt(a1, a2);
#endif
}
// unsigned int __usercall SL_GetStringForInt@<eax>(int a1@<eax>, game::scriptInstance_t a2)
NAKED unsigned int SL_GetStringForInt_stub()
{
_asm
{
push eax;
call SL_GetStringForInt_call;
add esp, 0x4;
ret;
}
}
unsigned int SL_GetStringForVector_call(float* a1, [[maybe_unused]] void* caller_addr, game::scriptInstance_t a2)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
return game::SL_GetStringForVector(a1, a2, SL_GetStringForVector_original);
#else
return codsrc::SL_GetStringForVector(a1, a2);
#endif
}
// unsigned int __usercall SL_GetStringForVector@<eax>(float *a1@<eax>, game::scriptInstance_t a2)
NAKED unsigned int SL_GetStringForVector_stub()
{
_asm
{
push eax;
call SL_GetStringForVector_call;
add esp, 0x4;
ret;
}
}
void SL_ShutdownSystem_call(game::scriptInstance_t a1, [[maybe_unused]] void* caller_addr, unsigned int a2)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
game::SL_ShutdownSystem(a1, a2, SL_ShutdownSystem_original);
#else
codsrc::SL_ShutdownSystem(a1, a2);
#endif
}
// void __usercall SL_ShutdownSystem(game::scriptInstance_t a1@<edi>, unsigned int a2)
NAKED void SL_ShutdownSystem_stub()
{
_asm
{
push edi;
call SL_ShutdownSystem_call;
add esp, 0x4;
ret;
}
}
void SL_TransferSystem_stub()
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
SL_TransferSystem_hook.invoke<void>();
#else
codsrc::SL_TransferSystem();
#endif
}
void SL_CreateCanonicalFilename_call(const char* filename, [[maybe_unused]] void* caller_addr, char* newFilename)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
game::SL_CreateCanonicalFilename(filename, newFilename, SL_CreateCanonicalFilename_original);
#else
codsrc::SL_CreateCanonicalFilename(filename, newFilename);
#endif
}
// void __usercall SL_CreateCanonicalFilename(const char *filename@<eax>, char *newFilename)
NAKED void SL_CreateCanonicalFilename_stub()
{
_asm
{
push eax;
call SL_CreateCanonicalFilename_call;
add esp, 0x4;
ret;
}
}
unsigned int Scr_CreateCanonicalFilename_stub(game::scriptInstance_t a1, const char* a2)
{
#ifdef RE_CSCR_STRINGLIST_USE_WRAPPERS
return Scr_CreateCanonicalFilename_hook.invoke<unsigned int>(a1, a2);
#else
return codsrc::Scr_CreateCanonicalFilename(a1, a2);
#endif
}
}
class component final : public component_interface
{
public:
void post_unpack() override
{
SL_ConvertToString_hook.create(game::SL_ConvertToString_ADDR(), SL_ConvertToString_stub);
SL_GetStringLen_hook.create(game::SL_GetStringLen_ADDR(), SL_GetStringLen_stub);
GetHashCode_hook.create(game::GetHashCode_ADDR(), GetHashCode_stub);
SL_Init_hook.create(game::SL_Init_ADDR(), SL_Init_stub);
SL_FindStringOfSize_hook.create(game::SL_FindStringOfSize_ADDR(), SL_FindStringOfSize_stub);
SL_FindString_hook.create(game::SL_FindString_ADDR(), SL_FindString_stub);
SL_FindLowercaseString_hook.create(game::SL_FindLowercaseString.get(), SL_FindLowercaseString_stub);
SL_AddUserInternal_hook.create(game::SL_AddUserInternal_ADDR(), SL_AddUserInternal_stub);
Mark_ScriptStringCustom_hook.create(game::Mark_ScriptStringCustom_ADDR(), Mark_ScriptStringCustom_stub);
SL_GetStringOfSize_hook.create(game::SL_GetStringOfSize.get(), SL_GetStringOfSize_stub);
SL_GetString__hook.create(game::SL_GetString__ADDR(), SL_GetString__stub);
SL_GetString__0_hook.create(game::SL_GetString__0_ADDR(), SL_GetString__0_stub);
SL_GetLowercaseStringOfLen_hook.create(game::SL_GetLowercaseStringOfLen.get(), SL_GetLowercaseStringOfLen_stub);
SL_GetLowercaseString_hook.create(game::SL_GetLowercaseString_ADDR(), SL_GetLowercaseString_stub);
SL_ConvertToLowercase_hook.create(game::SL_ConvertToLowercase.get(), SL_ConvertToLowercase_stub);
SL_TransferRefToUser_hook.create(game::SL_TransferRefToUser_ADDR(), SL_TransferRefToUser_stub);
SL_FreeString_hook.create(game::SL_FreeString.get(), SL_FreeString_stub);
SL_RemoveRefToString_hook.create(game::SL_RemoveRefToString_ADDR(), SL_RemoveRefToString_stub);
Scr_SetString_hook.create(game::Scr_SetString_ADDR(), Scr_SetString_stub);
Scr_SetStringFromCharString_hook.create(game::Scr_SetStringFromCharString_ADDR(), Scr_SetStringFromCharString_stub);
GScr_AllocString_hook.create(game::GScr_AllocString_ADDR(), GScr_AllocString_stub);
SL_GetStringForFloat_hook.create(game::SL_GetStringForFloat_ADDR(), SL_GetStringForFloat_stub);
SL_GetStringForInt_hook.create(game::SL_GetStringForInt_ADDR(), SL_GetStringForInt_stub);
SL_GetStringForVector_hook.create(game::SL_GetStringForVector_ADDR(), SL_GetStringForVector_stub);
SL_ShutdownSystem_hook.create(game::SL_ShutdownSystem_ADDR(), SL_ShutdownSystem_stub);
SL_TransferSystem_hook.create(game::SL_TransferSystem.get(), SL_TransferSystem_stub);
SL_CreateCanonicalFilename_hook.create(game::SL_CreateCanonicalFilename_ADDR(), SL_CreateCanonicalFilename_stub);
Scr_CreateCanonicalFilename_hook.create(game::Scr_CreateCanonicalFilename.get(), Scr_CreateCanonicalFilename_stub);
//Original hook function addresses
SL_ConvertToString_original = SL_ConvertToString_hook.get_original();
SL_GetStringLen_original = SL_GetStringLen_hook.get_original();
GetHashCode_original = GetHashCode_hook.get_original();
SL_Init_original = SL_Init_hook.get_original();
SL_FindStringOfSize_original = SL_FindStringOfSize_hook.get_original();
SL_FindString_original = SL_FindString_hook.get_original();
SL_FindLowercaseString_original = SL_FindLowercaseString_hook.get_original();
SL_AddUserInternal_original = SL_AddUserInternal_hook.get_original();
Mark_ScriptStringCustom_original = Mark_ScriptStringCustom_hook.get_original();
SL_GetStringOfSize_original = SL_GetStringOfSize_hook.get_original();
SL_GetString__original = SL_GetString__hook.get_original();
SL_GetString__0_original = SL_GetString__0_hook.get_original();
SL_GetLowercaseStringOfLen_original = SL_GetLowercaseStringOfLen_hook.get_original();
SL_GetLowercaseString_original = SL_GetLowercaseString_hook.get_original();
SL_ConvertToLowercase_original = SL_ConvertToLowercase_hook.get_original();
SL_TransferRefToUser_original = SL_TransferRefToUser_hook.get_original();
SL_FreeString_original = SL_FreeString_hook.get_original();
SL_RemoveRefToString_original = SL_RemoveRefToString_hook.get_original();
Scr_SetString_original = Scr_SetString_hook.get_original();
Scr_SetStringFromCharString_original = Scr_SetStringFromCharString_hook.get_original();
GScr_AllocString_original = GScr_AllocString_hook.get_original();
SL_GetStringForFloat_original = SL_GetStringForFloat_hook.get_original();
SL_GetStringForInt_original = SL_GetStringForInt_hook.get_original();
SL_GetStringForVector_original = SL_GetStringForVector_hook.get_original();
SL_ShutdownSystem_original = SL_ShutdownSystem_hook.get_original();
SL_TransferSystem_original = SL_TransferSystem_hook.get_original();
SL_CreateCanonicalFilename_original = SL_CreateCanonicalFilename_hook.get_original();
Scr_CreateCanonicalFilename_original = Scr_CreateCanonicalFilename_hook.get_original();
}
private:
};
}
REGISTER_COMPONENT(re_cscr_stringlist::component)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -137,10 +137,9 @@ namespace game
void Scr_RunCurrentThreads(scriptInstance_t inst, void* call_addr = Scr_RunCurrentThreads_ADDR()); void Scr_RunCurrentThreads(scriptInstance_t inst, void* call_addr = Scr_RunCurrentThreads_ADDR());
inline void* Scr_ResetTimeout_ADDR() { return CALL_ADDR(0x0, 0x69AE60); } inline void* Scr_ResetTimeout_ADDR() { return CALL_ADDR(0x0, 0x69AE60); }
void Scr_ResetTimeout(scriptInstance_t inst, void* call_addr = Scr_ResetTimeout_ADDR()); void Scr_ResetTimeout(scriptInstance_t inst, void* call_addr = Scr_ResetTimeout_ADDR());
void SetVariableFieldValue(scriptInstance_t inst, unsigned int id, VariableValue* value); void SetVariableFieldValue(scriptInstance_t inst, unsigned int id, VariableValue* value);
void SetNewVariableValue(scriptInstance_t inst, unsigned int id, VariableValue* value); void SetNewVariableValue(scriptInstance_t inst, unsigned int id, VariableValue* value);
void Scr_ClearErrorMessage(scriptInstance_t inst); void Scr_ClearErrorMessage(scriptInstance_t inst);
void VM_Shutdown(scriptInstance_t inst); void VM_Shutdown(scriptInstance_t inst);
void Scr_ShutdownVariables(scriptInstance_t inst); void Scr_ShutdownVariables(scriptInstance_t inst);