mirror of
https://github.com/JezuzLizard/T4SP-Server-Plugin.git
synced 2025-05-10 06:04:51 +00:00
Added yacc and animtree detours
This commit is contained in:
parent
d57945fece
commit
a21b76b0a3
400
src/component/decomp/clientscript/re_cscr_animtree.cpp
Normal file
400
src/component/decomp/clientscript/re_cscr_animtree.cpp
Normal file
@ -0,0 +1,400 @@
|
|||||||
|
#include <stdinc.hpp>
|
||||||
|
#include "loader/component_loader.hpp"
|
||||||
|
#include "utils/hook.hpp"
|
||||||
|
//#include "codsrc/clientscript/cscr_animtree.hpp"
|
||||||
|
|
||||||
|
#define RE_CSCR_ANIMTREE_USE_WRAPPERS
|
||||||
|
|
||||||
|
namespace re_cscr_animtree
|
||||||
|
{
|
||||||
|
utils::hook::detour AnimTreeCompileError_hook;
|
||||||
|
utils::hook::detour GetAnimTreeParseProperties_hook;
|
||||||
|
utils::hook::detour Scr_EmitAnimationInternal_hook;
|
||||||
|
utils::hook::detour AnimTreeParseInternal_hook;
|
||||||
|
utils::hook::detour Scr_AnimTreeParse_hook;
|
||||||
|
utils::hook::detour Scr_GetAnimTreeSize_hook;
|
||||||
|
utils::hook::detour ConnectScriptToAnim_hook;
|
||||||
|
utils::hook::detour Scr_GetAnimsIndex_hook;
|
||||||
|
utils::hook::detour Scr_CreateAnimationTree_hook;
|
||||||
|
utils::hook::detour Scr_CheckAnimsDefined_hook;
|
||||||
|
utils::hook::detour Scr_PrecacheAnimationTree_hook;
|
||||||
|
utils::hook::detour Scr_UsingTreeInternal_hook;
|
||||||
|
utils::hook::detour Scr_UsingTree_hook;
|
||||||
|
utils::hook::detour Scr_SetAnimTreeConfigstring_hook;
|
||||||
|
utils::hook::detour Scr_LoadAnimTreeInternal_hook;
|
||||||
|
utils::hook::detour Scr_LoadAnimTreeAtIndex_hook;
|
||||||
|
utils::hook::detour Scr_FindAnimTree_hook;
|
||||||
|
utils::hook::detour Scr_FindAnim_hook;
|
||||||
|
|
||||||
|
void* AnimTreeCompileError_original;
|
||||||
|
void* GetAnimTreeParseProperties_original;
|
||||||
|
void* Scr_EmitAnimationInternal_original;
|
||||||
|
void* AnimTreeParseInternal_original;
|
||||||
|
void* Scr_AnimTreeParse_original;
|
||||||
|
void* Scr_GetAnimTreeSize_original;
|
||||||
|
void* ConnectScriptToAnim_original;
|
||||||
|
void* Scr_GetAnimsIndex_original;
|
||||||
|
void* Scr_CreateAnimationTree_original;
|
||||||
|
void* Scr_CheckAnimsDefined_original;
|
||||||
|
void* Scr_PrecacheAnimationTree_original;
|
||||||
|
void* Scr_UsingTreeInternal_original;
|
||||||
|
void* Scr_UsingTree_original;
|
||||||
|
void* Scr_SetAnimTreeConfigstring_original;
|
||||||
|
void* Scr_LoadAnimTreeInternal_original;
|
||||||
|
void* Scr_LoadAnimTreeAtIndex_original;
|
||||||
|
void* Scr_FindAnimTree_original;
|
||||||
|
void* Scr_FindAnim_original;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
void AnimTreeCompileError_stub(game::scriptInstance_t inst, const char * errorMsg)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_ANIMTREE_USE_WRAPPERS
|
||||||
|
return AnimTreeCompileError_hook.invoke<void>(inst, errorMsg);
|
||||||
|
#else
|
||||||
|
return cscr_animtree::AnimTreeCompileError(inst, errorMsg);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int GetAnimTreeParseProperties_stub(game::scriptInstance_t inst)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_ANIMTREE_USE_WRAPPERS
|
||||||
|
return GetAnimTreeParseProperties_hook.invoke<int>(inst);
|
||||||
|
#else
|
||||||
|
return cscr_animtree::GetAnimTreeParseProperties(inst);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scr_EmitAnimationInternal_call(game::scriptInstance_t inst, [[maybe_unused]] void* caller_addr, const char * pos, unsigned int animName, unsigned int names)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_ANIMTREE_USE_WRAPPERS
|
||||||
|
game::Scr_EmitAnimationInternal(inst, pos, animName, names, Scr_EmitAnimationInternal_original);
|
||||||
|
#else
|
||||||
|
cscr_animtree::Scr_EmitAnimationInternal(inst, pos, animName, names);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// void __usercall Scr_EmitAnimationInternal(game::scriptInstance_t inst@<edi>, const char *pos, unsigned int animName, unsigned int names)
|
||||||
|
NAKED void Scr_EmitAnimationInternal_stub()
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
push edi;
|
||||||
|
call Scr_EmitAnimationInternal_call;
|
||||||
|
add esp, 0x4;
|
||||||
|
ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char AnimTreeParseInternal_stub(game::scriptInstance_t inst, int parentId, int names, int bIncludeParent, int bLoop, int bComplete)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_ANIMTREE_USE_WRAPPERS
|
||||||
|
return AnimTreeParseInternal_hook.invoke<char>(inst, parentId, names, bIncludeParent, bLoop, bComplete);
|
||||||
|
#else
|
||||||
|
return cscr_animtree::AnimTreeParseInternal(inst, parentId, names, bIncludeParent, bLoop, bComplete);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scr_AnimTreeParse_call(game::scriptInstance_t inst, const char * pos, [[maybe_unused]] void* caller_addr, unsigned int parentNode, unsigned int names)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_ANIMTREE_USE_WRAPPERS
|
||||||
|
game::Scr_AnimTreeParse(inst, pos, parentNode, names, Scr_AnimTreeParse_original);
|
||||||
|
#else
|
||||||
|
cscr_animtree::Scr_AnimTreeParse(inst, pos, parentNode, names);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// void __usercall Scr_AnimTreeParse(game::scriptInstance_t inst@<eax>, const char *pos@<edi>, unsigned int parentNode, unsigned int names)
|
||||||
|
NAKED void Scr_AnimTreeParse_stub()
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
push edi;
|
||||||
|
push eax;
|
||||||
|
call Scr_AnimTreeParse_call;
|
||||||
|
add esp, 0x8;
|
||||||
|
ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int Scr_GetAnimTreeSize_stub(game::scriptInstance_t inst, unsigned int parentNode)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_ANIMTREE_USE_WRAPPERS
|
||||||
|
return Scr_GetAnimTreeSize_hook.invoke<int>(inst, parentNode);
|
||||||
|
#else
|
||||||
|
return cscr_animtree::Scr_GetAnimTreeSize(inst, parentNode);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConnectScriptToAnim_call(unsigned int name, unsigned int names, [[maybe_unused]] void* caller_addr, game::scriptInstance_t inst, int index, unsigned int filename, int treeIndex)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_ANIMTREE_USE_WRAPPERS
|
||||||
|
game::ConnectScriptToAnim(name, names, inst, index, filename, treeIndex, ConnectScriptToAnim_original);
|
||||||
|
#else
|
||||||
|
cscr_animtree::ConnectScriptToAnim(name, names, inst, index, filename, treeIndex);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// void __usercall ConnectScriptToAnim(unsigned int name@<eax>, unsigned int names@<edi>, game::scriptInstance_t inst, int index, unsigned int filename, int treeIndex)
|
||||||
|
NAKED void ConnectScriptToAnim_stub()
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
push edi;
|
||||||
|
push eax;
|
||||||
|
call ConnectScriptToAnim_call;
|
||||||
|
add esp, 0x8;
|
||||||
|
ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int Scr_GetAnimsIndex_call(game::XAnim_s * anim, [[maybe_unused]] void* caller_addr)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_ANIMTREE_USE_WRAPPERS
|
||||||
|
return game::Scr_GetAnimsIndex(anim, Scr_GetAnimsIndex_original);
|
||||||
|
#else
|
||||||
|
return cscr_animtree::Scr_GetAnimsIndex(anim);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// int __usercall Scr_GetAnimsIndex@<eax>(game::XAnim_s *anim@<ecx>)
|
||||||
|
NAKED int Scr_GetAnimsIndex_stub()
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
push ecx;
|
||||||
|
call Scr_GetAnimsIndex_call;
|
||||||
|
add esp, 0x4;
|
||||||
|
ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int Scr_CreateAnimationTree_stub(game::scriptInstance_t inst, unsigned int parentNode, unsigned int rootData, game::XAnim_s* animtree, unsigned int childIndex, const char* name, unsigned int parentIndex, unsigned int filename, int treeIndex, int flags)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_ANIMTREE_USE_WRAPPERS
|
||||||
|
return Scr_CreateAnimationTree_hook.invoke<int>(inst, parentNode, rootData, animtree, childIndex, name, parentIndex, filename, treeIndex, flags);
|
||||||
|
#else
|
||||||
|
return cscr_animtree::Scr_CreateAnimationTree(inst, parentNode, rootData, animtree, childIndex, name, parentIndex, filename, treeIndex, flags);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scr_CheckAnimsDefined_call(unsigned int names, game::scriptInstance_t a2, [[maybe_unused]] void* caller_addr, unsigned int filename)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_ANIMTREE_USE_WRAPPERS
|
||||||
|
game::Scr_CheckAnimsDefined(names, a2, filename, Scr_CheckAnimsDefined_original);
|
||||||
|
#else
|
||||||
|
cscr_animtree::Scr_CheckAnimsDefined(names, a2, filename);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// void __usercall Scr_CheckAnimsDefined(unsigned int names@<eax>, game::scriptInstance_t a2@<ecx>, unsigned int filename)
|
||||||
|
NAKED void Scr_CheckAnimsDefined_stub()
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
push ecx;
|
||||||
|
push eax;
|
||||||
|
call Scr_CheckAnimsDefined_call;
|
||||||
|
add esp, 0x8;
|
||||||
|
ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scr_PrecacheAnimationTree_stub(game::scriptInstance_t inst, unsigned int parentNode)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_ANIMTREE_USE_WRAPPERS
|
||||||
|
Scr_PrecacheAnimationTree_hook.invoke<void>(inst, parentNode);
|
||||||
|
#else
|
||||||
|
cscr_animtree::Scr_PrecacheAnimationTree(inst, parentNode);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int Scr_UsingTreeInternal_call(const char * filename, int user, [[maybe_unused]] void* caller_addr, game::scriptInstance_t inst, unsigned int * index)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_ANIMTREE_USE_WRAPPERS
|
||||||
|
return game::Scr_UsingTreeInternal(filename, user, inst, index, Scr_UsingTreeInternal_original);
|
||||||
|
#else
|
||||||
|
return cscr_animtree::Scr_UsingTreeInternal(filename, user, inst, index);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// unsigned int __usercall Scr_UsingTreeInternal@<eax>(const char *filename@<eax>, int user@<ecx>, game::scriptInstance_t inst, unsigned int *index)
|
||||||
|
NAKED unsigned int Scr_UsingTreeInternal_stub()
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
push ecx;
|
||||||
|
push eax;
|
||||||
|
call Scr_UsingTreeInternal_call;
|
||||||
|
add esp, 0x8;
|
||||||
|
ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scr_UsingTree_call(game::scriptInstance_t a1, [[maybe_unused]] void* caller_addr, const char * filename, unsigned int sourcePos)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_ANIMTREE_USE_WRAPPERS
|
||||||
|
game::Scr_UsingTree(a1, filename, sourcePos, Scr_UsingTree_original);
|
||||||
|
#else
|
||||||
|
cscr_animtree::Scr_UsingTree(a1, filename, sourcePos);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// void __usercall Scr_UsingTree(game::scriptInstance_t a1@<edi>, const char *filename, unsigned int sourcePos)
|
||||||
|
NAKED void Scr_UsingTree_stub()
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
push edi;
|
||||||
|
call Scr_UsingTree_call;
|
||||||
|
add esp, 0x4;
|
||||||
|
ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scr_SetAnimTreeConfigstring_stub(const char * animtreeName)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_ANIMTREE_USE_WRAPPERS
|
||||||
|
Scr_SetAnimTreeConfigstring_hook.invoke<void>(animtreeName);
|
||||||
|
#else
|
||||||
|
cscr_animtree::Scr_SetAnimTreeConfigstring(animtreeName);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Scr_LoadAnimTreeInternal_call(const char * animtreeName, game::scriptInstance_t inst, [[maybe_unused]] void* caller_addr, unsigned int parentNode, unsigned int names)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_ANIMTREE_USE_WRAPPERS
|
||||||
|
return game::Scr_LoadAnimTreeInternal(animtreeName, inst, parentNode, names, Scr_LoadAnimTreeInternal_original);
|
||||||
|
#else
|
||||||
|
return cscr_animtree::Scr_LoadAnimTreeInternal(animtreeName, inst, parentNode, names);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// bool __usercall Scr_LoadAnimTreeInternal@<al>(const char *animtreeName@<eax>, game::scriptInstance_t inst@<ecx>, unsigned int parentNode, unsigned int names)
|
||||||
|
NAKED bool Scr_LoadAnimTreeInternal_stub()
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
push ecx;
|
||||||
|
push eax;
|
||||||
|
call Scr_LoadAnimTreeInternal_call;
|
||||||
|
add esp, 0x8;
|
||||||
|
ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scr_LoadAnimTreeAtIndex_call(game::scriptInstance_t inst, int user, [[maybe_unused]] void* caller_addr, unsigned int index, void *(__cdecl * Alloc)(int), int modCheckSum)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_ANIMTREE_USE_WRAPPERS
|
||||||
|
return game::Scr_LoadAnimTreeAtIndex(inst, user, index, Alloc, modCheckSum, Scr_LoadAnimTreeAtIndex_original);
|
||||||
|
#else
|
||||||
|
return cscr_animtree::Scr_LoadAnimTreeAtIndex(inst, user, index, Alloc, modCheckSum);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// void __usercall Scr_LoadAnimTreeAtIndex(game::scriptInstance_t inst@<ecx>, int user@<eax>, unsigned int index, void *(__cdecl *Alloc)(int), int modCheckSum)
|
||||||
|
NAKED void Scr_LoadAnimTreeAtIndex_stub()
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
push eax;
|
||||||
|
push ecx;
|
||||||
|
call Scr_LoadAnimTreeAtIndex_call;
|
||||||
|
add esp, 0x8;
|
||||||
|
ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
game::scr_animtree_t Scr_FindAnimTree_call(const char * filename, [[maybe_unused]] void* caller_addr)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_ANIMTREE_USE_WRAPPERS
|
||||||
|
return game::Scr_FindAnimTree(filename, Scr_FindAnimTree_original);
|
||||||
|
#else
|
||||||
|
return cscr_animtree::Scr_FindAnimTree(filename);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// game::XAnim_s *__usercall Scr_FindAnimTree@<eax>(const char *filename@<eax>)
|
||||||
|
NAKED game::XAnim_s * Scr_FindAnimTree_stub()
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
push eax;
|
||||||
|
call Scr_FindAnimTree_call;
|
||||||
|
add esp, 0x4;
|
||||||
|
ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scr_FindAnim_call(const char * animName, [[maybe_unused]] void* caller_addr, game::scr_anim_s a2, int user)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_ANIMTREE_USE_WRAPPERS
|
||||||
|
game::Scr_FindAnim(animName, a2, user, Scr_FindAnim_original);
|
||||||
|
#else
|
||||||
|
cscr_animtree::Scr_FindAnim(animName, a2, user);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// void __usercall Scr_FindAnim(const char *animName@<edx>, game::scr_anim_s a2, int user)
|
||||||
|
NAKED void Scr_FindAnim_stub()
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
push edx;
|
||||||
|
call Scr_FindAnim_call;
|
||||||
|
add esp, 0x4;
|
||||||
|
ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class component final : public component_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void post_unpack() override
|
||||||
|
{
|
||||||
|
AnimTreeCompileError_hook.create(game::AnimTreeCompileError.get(), AnimTreeCompileError_stub);
|
||||||
|
GetAnimTreeParseProperties_hook.create(game::GetAnimTreeParseProperties.get(), GetAnimTreeParseProperties_stub);
|
||||||
|
Scr_EmitAnimationInternal_hook.create(game::Scr_EmitAnimationInternal_ADDR(), Scr_EmitAnimationInternal_stub);
|
||||||
|
AnimTreeParseInternal_hook.create(game::AnimTreeParseInternal.get(), AnimTreeParseInternal_stub);
|
||||||
|
Scr_AnimTreeParse_hook.create(game::Scr_AnimTreeParse_ADDR(), Scr_AnimTreeParse_stub);
|
||||||
|
Scr_GetAnimTreeSize_hook.create(game::Scr_GetAnimTreeSize.get(), Scr_GetAnimTreeSize_stub);
|
||||||
|
ConnectScriptToAnim_hook.create(game::ConnectScriptToAnim_ADDR(), ConnectScriptToAnim_stub);
|
||||||
|
Scr_GetAnimsIndex_hook.create(game::Scr_GetAnimsIndex_ADDR(), Scr_GetAnimsIndex_stub);
|
||||||
|
Scr_CreateAnimationTree_hook.create(game::Scr_CreateAnimationTree.get(), Scr_CreateAnimationTree_stub);
|
||||||
|
Scr_CheckAnimsDefined_hook.create(game::Scr_CheckAnimsDefined_ADDR(), Scr_CheckAnimsDefined_stub);
|
||||||
|
Scr_PrecacheAnimationTree_hook.create(game::Scr_PrecacheAnimationTree.get(), Scr_PrecacheAnimationTree_stub);
|
||||||
|
Scr_UsingTreeInternal_hook.create(game::Scr_UsingTreeInternal_ADDR(), Scr_UsingTreeInternal_stub);
|
||||||
|
Scr_UsingTree_hook.create(game::Scr_UsingTree_ADDR(), Scr_UsingTree_stub);
|
||||||
|
Scr_SetAnimTreeConfigstring_hook.create(game::Scr_SetAnimTreeConfigstring.get(), Scr_SetAnimTreeConfigstring_stub);
|
||||||
|
Scr_LoadAnimTreeInternal_hook.create(game::Scr_LoadAnimTreeInternal_ADDR(), Scr_LoadAnimTreeInternal_stub);
|
||||||
|
Scr_LoadAnimTreeAtIndex_hook.create(game::Scr_LoadAnimTreeAtIndex_ADDR(), Scr_LoadAnimTreeAtIndex_stub);
|
||||||
|
Scr_FindAnimTree_hook.create(game::Scr_FindAnimTree_ADDR(), Scr_FindAnimTree_stub);
|
||||||
|
Scr_FindAnim_hook.create(game::Scr_FindAnim_ADDR(), Scr_FindAnim_stub);
|
||||||
|
|
||||||
|
//Original hook function addresses
|
||||||
|
AnimTreeCompileError_original = AnimTreeCompileError_hook.get_original();
|
||||||
|
GetAnimTreeParseProperties_original = GetAnimTreeParseProperties_hook.get_original();
|
||||||
|
Scr_EmitAnimationInternal_original = Scr_EmitAnimationInternal_hook.get_original();
|
||||||
|
AnimTreeParseInternal_original = AnimTreeParseInternal_hook.get_original();
|
||||||
|
Scr_AnimTreeParse_original = Scr_AnimTreeParse_hook.get_original();
|
||||||
|
Scr_GetAnimTreeSize_original = Scr_GetAnimTreeSize_hook.get_original();
|
||||||
|
ConnectScriptToAnim_original = ConnectScriptToAnim_hook.get_original();
|
||||||
|
Scr_GetAnimsIndex_original = Scr_GetAnimsIndex_hook.get_original();
|
||||||
|
Scr_CreateAnimationTree_original = Scr_CreateAnimationTree_hook.get_original();
|
||||||
|
Scr_CheckAnimsDefined_original = Scr_CheckAnimsDefined_hook.get_original();
|
||||||
|
Scr_PrecacheAnimationTree_original = Scr_PrecacheAnimationTree_hook.get_original();
|
||||||
|
Scr_UsingTreeInternal_original = Scr_UsingTreeInternal_hook.get_original();
|
||||||
|
Scr_UsingTree_original = Scr_UsingTree_hook.get_original();
|
||||||
|
Scr_SetAnimTreeConfigstring_original = Scr_SetAnimTreeConfigstring_hook.get_original();
|
||||||
|
Scr_LoadAnimTreeInternal_original = Scr_LoadAnimTreeInternal_hook.get_original();
|
||||||
|
Scr_LoadAnimTreeAtIndex_original = Scr_LoadAnimTreeAtIndex_hook.get_original();
|
||||||
|
Scr_FindAnimTree_original = Scr_FindAnimTree_hook.get_original();
|
||||||
|
Scr_FindAnim_original = Scr_FindAnim_hook.get_original();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
}
|
||||||
|
REGISTER_COMPONENT(re_cscr_animtree::component)
|
232
src/component/decomp/clientscript/re_cscr_yacc.cpp
Normal file
232
src/component/decomp/clientscript/re_cscr_yacc.cpp
Normal file
@ -0,0 +1,232 @@
|
|||||||
|
#include <stdinc.hpp>
|
||||||
|
#include "loader/component_loader.hpp"
|
||||||
|
#include "utils/hook.hpp"
|
||||||
|
//#include "codsrc/clientscript/cscr_yacc.hpp"
|
||||||
|
|
||||||
|
#define RE_CSCR_YACC_USE_WRAPPERS
|
||||||
|
|
||||||
|
namespace re_cscr_yacc
|
||||||
|
{
|
||||||
|
utils::hook::detour LowerCase_hook;
|
||||||
|
utils::hook::detour yyparse_hook;
|
||||||
|
utils::hook::detour StringValue_hook;
|
||||||
|
utils::hook::detour yylex_hook;
|
||||||
|
utils::hook::detour yy_get_next_buffer_hook;
|
||||||
|
utils::hook::detour yy_get_previous_state_hook;
|
||||||
|
utils::hook::detour yy_try_NUL_trans_hook;
|
||||||
|
utils::hook::detour yyrestart_hook;
|
||||||
|
utils::hook::detour yy_create_buffer_hook;
|
||||||
|
utils::hook::detour yy_flush_buffer_hook;
|
||||||
|
utils::hook::detour ScriptParse_hook;
|
||||||
|
|
||||||
|
void* LowerCase_original;
|
||||||
|
void* yyparse_original;
|
||||||
|
void* StringValue_original;
|
||||||
|
void* yylex_original;
|
||||||
|
void* yy_get_next_buffer_original;
|
||||||
|
void* yy_get_previous_state_original;
|
||||||
|
void* yy_try_NUL_trans_original;
|
||||||
|
void* yyrestart_original;
|
||||||
|
void* yy_create_buffer_original;
|
||||||
|
void* yy_flush_buffer_original;
|
||||||
|
void* ScriptParse_original;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
unsigned int LowerCase_call(unsigned int strVal, [[maybe_unused]] void* caller_addr)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_YACC_USE_WRAPPERS
|
||||||
|
return game::LowerCase(strVal, LowerCase_original);
|
||||||
|
#else
|
||||||
|
return cscr_yacc::LowerCase(strVal);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// unsigned int __usercall LowerCase@<eax>(unsigned int strVal@<ecx>)
|
||||||
|
NAKED unsigned int LowerCase_stub()
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
push ecx;
|
||||||
|
call LowerCase_call;
|
||||||
|
add esp, 0x4;
|
||||||
|
ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int yyparse_stub()
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_YACC_USE_WRAPPERS
|
||||||
|
return yyparse_hook.invoke<int>();
|
||||||
|
#else
|
||||||
|
return cscr_yacc::yyparse();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int StringValue_call(int len, const char * str_, [[maybe_unused]] void* caller_addr)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_YACC_USE_WRAPPERS
|
||||||
|
return game::StringValue(len, str_, StringValue_original);
|
||||||
|
#else
|
||||||
|
return cscr_yacc::StringValue(len, str_);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// int __usercall StringValue@<eax>(int len@<ecx>, const char *str@<edx>)
|
||||||
|
NAKED int StringValue_stub()
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
push edx;
|
||||||
|
push ecx;
|
||||||
|
call StringValue_call;
|
||||||
|
add esp, 0x8;
|
||||||
|
ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int yylex_stub()
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_YACC_USE_WRAPPERS
|
||||||
|
return yylex_hook.invoke<int>();
|
||||||
|
#else
|
||||||
|
return cscr_yacc::yylex();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int yy_get_next_buffer_stub()
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_YACC_USE_WRAPPERS
|
||||||
|
return yy_get_next_buffer_hook.invoke<int>();
|
||||||
|
#else
|
||||||
|
return cscr_yacc::yy_get_next_buffer();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int yy_get_previous_state_stub()
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_YACC_USE_WRAPPERS
|
||||||
|
return yy_get_previous_state_hook.invoke<int>();
|
||||||
|
#else
|
||||||
|
return cscr_yacc::yy_get_previous_state();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int yy_try_NUL_trans_call(int yy_current_state, [[maybe_unused]] void* caller_addr)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_YACC_USE_WRAPPERS
|
||||||
|
return game::yy_try_NUL_trans(yy_current_state, yy_try_NUL_trans_original);
|
||||||
|
#else
|
||||||
|
return cscr_yacc::yy_try_NUL_trans(yy_current_state);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// int __usercall yy_try_NUL_trans@<eax>(int yy_current_state@<eax>)
|
||||||
|
NAKED int yy_try_NUL_trans_stub()
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
push eax;
|
||||||
|
call yy_try_NUL_trans_call;
|
||||||
|
add esp, 0x4;
|
||||||
|
ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void yyrestart_stub()
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_YACC_USE_WRAPPERS
|
||||||
|
yyrestart_hook.invoke<void>();
|
||||||
|
#else
|
||||||
|
cscr_yacc::yyrestart();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
game::yy_buffer_state * yy_create_buffer_stub()
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_YACC_USE_WRAPPERS
|
||||||
|
return yy_create_buffer_hook.invoke<game::yy_buffer_state *>();
|
||||||
|
#else
|
||||||
|
return cscr_yacc::yy_create_buffer();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void yy_flush_buffer_call(game::yy_buffer_state * result, [[maybe_unused]] void* caller_addr)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_YACC_USE_WRAPPERS
|
||||||
|
game::yy_flush_buffer(result, yy_flush_buffer_original);
|
||||||
|
#else
|
||||||
|
cscr_yacc::yy_flush_buffer(result);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// void __usercall yy_flush_buffer(game::yy_buffer_state *result@<eax>)
|
||||||
|
NAKED void yy_flush_buffer_stub()
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
push eax;
|
||||||
|
call yy_flush_buffer_call;
|
||||||
|
add esp, 0x4;
|
||||||
|
ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScriptParse_call(game::scriptInstance_t a1, [[maybe_unused]] void* caller_addr, game::sval_u * parseData)
|
||||||
|
{
|
||||||
|
#ifdef RE_CSCR_YACC_USE_WRAPPERS
|
||||||
|
game::ScriptParse(a1, parseData, ScriptParse_original);
|
||||||
|
#else
|
||||||
|
cscr_yacc::ScriptParse(a1, parseData);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// void __usercall ScriptParse(game::scriptInstance_t a1@<eax>, game::sval_u *parseData)
|
||||||
|
NAKED void ScriptParse_stub()
|
||||||
|
{
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
push eax;
|
||||||
|
call ScriptParse_call;
|
||||||
|
add esp, 0x4;
|
||||||
|
ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class component final : public component_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void post_unpack() override
|
||||||
|
{
|
||||||
|
LowerCase_hook.create(game::LowerCase(), LowerCase_stub);
|
||||||
|
yyparse_hook.create(game::yyparse.get(), yyparse_stub);
|
||||||
|
StringValue_hook.create(game::StringValue(), StringValue_stub);
|
||||||
|
yylex_hook.create(game::yylex.get(), yylex_stub);
|
||||||
|
yy_get_next_buffer_hook.create(game::yy_get_next_buffer.get(), yy_get_next_buffer_stub);
|
||||||
|
yy_get_previous_state_hook.create(game::yy_get_previous_state.get(), yy_get_previous_state_stub);
|
||||||
|
yy_try_NUL_trans_hook.create(game::yy_try_NUL_trans(), yy_try_NUL_trans_stub);
|
||||||
|
yyrestart_hook.create(game::yyrestart.get(), yyrestart_stub);
|
||||||
|
yy_create_buffer_hook.create(game::yy_create_buffer.get(), yy_create_buffer_stub);
|
||||||
|
yy_flush_buffer_hook.create(game::yy_flush_buffer(), yy_flush_buffer_stub);
|
||||||
|
ScriptParse_hook.create(game::ScriptParse(), ScriptParse_stub);
|
||||||
|
|
||||||
|
//Original hook function addresses
|
||||||
|
LowerCase_original = LowerCase_hook.get_original();
|
||||||
|
yyparse_original = yyparse_hook.get_original();
|
||||||
|
StringValue_original = StringValue_hook.get_original();
|
||||||
|
yylex_original = yylex_hook.get_original();
|
||||||
|
yy_get_next_buffer_original = yy_get_next_buffer_hook.get_original();
|
||||||
|
yy_get_previous_state_original = yy_get_previous_state_hook.get_original();
|
||||||
|
yy_try_NUL_trans_original = yy_try_NUL_trans_hook.get_original();
|
||||||
|
yyrestart_original = yyrestart_hook.get_original();
|
||||||
|
yy_create_buffer_original = yy_create_buffer_hook.get_original();
|
||||||
|
yy_flush_buffer_original = yy_flush_buffer_hook.get_original();
|
||||||
|
ScriptParse_original = ScriptParse_hook.get_original();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
}
|
||||||
|
REGISTER_COMPONENT(re_cscr_yacc::component)
|
@ -2254,6 +2254,7 @@ namespace game
|
|||||||
WEAK symbol<dvar_s*> sv_clientside{ 0x0, 0x3882B6C };
|
WEAK symbol<dvar_s*> sv_clientside{ 0x0, 0x3882B6C };
|
||||||
WEAK symbol<char> error_message_buff{ 0x0, 0x3BE1E30 };
|
WEAK symbol<char> error_message_buff{ 0x0, 0x3BE1E30 };
|
||||||
WEAK symbol<scrCompileGlob_t> gScrCompileGlob{ 0x0, 0x3701FE0 };
|
WEAK symbol<scrCompileGlob_t> gScrCompileGlob{ 0x0, 0x3701FE0 };
|
||||||
|
WEAK symbol<scrAnimGlob_t> gScrAnimGlob{ 0x0, 0x36BF320 };
|
||||||
|
|
||||||
WEAK symbol<unsigned char> g_parse_user{ 0x0, 0x234F72E };
|
WEAK symbol<unsigned char> g_parse_user{ 0x0, 0x234F72E };
|
||||||
WEAK symbol<scriptInstance_t> gInst{ 0x0, 0x3BE624C };
|
WEAK symbol<scriptInstance_t> gInst{ 0x0, 0x3BE624C };
|
||||||
@ -2298,11 +2299,6 @@ namespace game
|
|||||||
WEAK symbol<int(jmp_buf buf, int count)>_setjmp3{ 0x0, 0x7E1894 };
|
WEAK symbol<int(jmp_buf buf, int count)>_setjmp3{ 0x0, 0x7E1894 };
|
||||||
WEAK symbol<void(jmp_buf Buf, int Value)>longjmp{ 0x0, 0x7AD57C };
|
WEAK symbol<void(jmp_buf Buf, int Value)>longjmp{ 0x0, 0x7AD57C };
|
||||||
|
|
||||||
inline void* ScriptParse_ADDR() { return CALL_ADDR(0x0, 0x69D710); }
|
|
||||||
void ScriptParse(scriptInstance_t inst, sval_u* parseData, void* call_addr = ScriptParse_ADDR());
|
|
||||||
inline void* Scr_LoadAnimTreeAtIndex_ADDR() { return CALL_ADDR(0x0, 0x67E7D0); }
|
|
||||||
void Scr_LoadAnimTreeAtIndex(scriptInstance_t inst, int user, unsigned int index, void* (__cdecl* Alloc)(int), int modCheckSum, void* call_addr = Scr_LoadAnimTreeAtIndex_ADDR());
|
|
||||||
|
|
||||||
inline void* CScr_SetEntityField_ADDR() { return CALL_ADDR(0x0, 0x671470); }
|
inline void* CScr_SetEntityField_ADDR() { return CALL_ADDR(0x0, 0x671470); }
|
||||||
int CScr_SetEntityField(int ofs, int entnum, unsigned int clientnum, void* call_addr = CScr_SetEntityField_ADDR());
|
int CScr_SetEntityField(int ofs, int entnum, unsigned int clientnum, void* call_addr = CScr_SetEntityField_ADDR());
|
||||||
inline void* Scr_SetObjectField_ADDR() { return CALL_ADDR(0x0, 0x5469C0); }
|
inline void* Scr_SetObjectField_ADDR() { return CALL_ADDR(0x0, 0x5469C0); }
|
||||||
@ -2324,4 +2320,6 @@ namespace game
|
|||||||
#include "cscr_variable.hpp"
|
#include "cscr_variable.hpp"
|
||||||
#include "cscr_vm.hpp"
|
#include "cscr_vm.hpp"
|
||||||
#include "cscr_compiler.hpp"
|
#include "cscr_compiler.hpp"
|
||||||
|
#include "cscr_yacc.hpp"
|
||||||
|
#include "cscr_animtree.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,33 +2,6 @@
|
|||||||
|
|
||||||
namespace game
|
namespace game
|
||||||
{
|
{
|
||||||
// void __usercall ScriptParse(scriptInstance_t a1@<eax>, sval_u *parseData)
|
|
||||||
void ScriptParse(scriptInstance_t inst, sval_u* parseData, void* call_addr)
|
|
||||||
{
|
|
||||||
__asm
|
|
||||||
{
|
|
||||||
push parseData;
|
|
||||||
mov eax, inst;
|
|
||||||
call call_addr;
|
|
||||||
add esp, 0x4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// void __usercall Scr_LoadAnimTreeAtIndex(scriptInstance_t inst@<ecx>, int a2@<eax>, int a3, int (__cdecl *a4)(int), int a5)
|
|
||||||
void Scr_LoadAnimTreeAtIndex(scriptInstance_t inst, int user, unsigned int index, void* (__cdecl* Alloc)(int), int modCheckSum, void* call_addr)
|
|
||||||
{
|
|
||||||
__asm
|
|
||||||
{
|
|
||||||
push modCheckSum;
|
|
||||||
push Alloc;
|
|
||||||
push index;
|
|
||||||
mov eax, user;
|
|
||||||
mov ecx, inst;
|
|
||||||
call call_addr;
|
|
||||||
add esp, 0xC;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int CScr_SetEntityField/*@<eax>*/(int ofs/*@<edx>*/, int entnum/*@<ecx>*/, unsigned int clientnum, void* call_addr)
|
int CScr_SetEntityField/*@<eax>*/(int ofs/*@<edx>*/, int entnum/*@<ecx>*/, unsigned int clientnum, void* call_addr)
|
||||||
{
|
{
|
||||||
int answer;
|
int answer;
|
||||||
|
35
src/game/clientscript/cscr_animtree.hpp
Normal file
35
src/game/clientscript/cscr_animtree.hpp
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace game
|
||||||
|
{
|
||||||
|
WEAK symbol<void(scriptInstance_t inst, const char * errorMsg)>AnimTreeCompileError{ 0x0, 0x67D4B0};
|
||||||
|
WEAK symbol<int(scriptInstance_t inst)>GetAnimTreeParseProperties{ 0x0, 0x67D510};
|
||||||
|
WEAK symbol<char(scriptInstance_t inst, int parentId, int names, int bIncludeParent, int bLoop, int bComplete)>AnimTreeParseInternal{ 0x0, 0x67D770};
|
||||||
|
WEAK symbol<int(scriptInstance_t inst, unsigned int parentNode)>Scr_GetAnimTreeSize{ 0x0, 0x67DE20};
|
||||||
|
WEAK symbol<int(scriptInstance_t inst, unsigned int parentNode, unsigned int rootData, XAnim_s* animtree, unsigned int childIndex, const char* name, unsigned int parentIndex, unsigned int filename, int treeIndex, int flags)>Scr_CreateAnimationTree{ 0x0, 0x67DFB0};
|
||||||
|
WEAK symbol<void(scriptInstance_t inst, unsigned int parentNode)>Scr_PrecacheAnimationTree{ 0x0, 0x67E360};
|
||||||
|
WEAK symbol<void(const char * animtreeName)>Scr_SetAnimTreeConfigstring{ 0x0, 0x67E670};
|
||||||
|
|
||||||
|
inline void* Scr_EmitAnimationInternal_ADDR() { return CALL_ADDR(0x0, 0x67D6B0); }
|
||||||
|
void Scr_EmitAnimationInternal(scriptInstance_t inst, const char * pos, unsigned int animName, unsigned int names, void* call_addr = Scr_EmitAnimationInternal_ADDR());
|
||||||
|
inline void* Scr_AnimTreeParse_ADDR() { return CALL_ADDR(0x0, 0x67DDA0); }
|
||||||
|
void Scr_AnimTreeParse(scriptInstance_t inst, const char * pos, unsigned int parentNode, unsigned int names, void* call_addr = Scr_AnimTreeParse_ADDR());
|
||||||
|
inline void* ConnectScriptToAnim_ADDR() { return CALL_ADDR(0x0, 0x67DEC0); }
|
||||||
|
void ConnectScriptToAnim(unsigned int name, unsigned int names, scriptInstance_t inst, int index, unsigned int filename, int treeIndex, void* call_addr = ConnectScriptToAnim_ADDR());
|
||||||
|
inline void* Scr_GetAnimsIndex_ADDR() { return CALL_ADDR(0x0, 0x67DF90); }
|
||||||
|
int Scr_GetAnimsIndex(XAnim_s * anim, void* call_addr = Scr_GetAnimsIndex_ADDR());
|
||||||
|
inline void* Scr_CheckAnimsDefined_ADDR() { return CALL_ADDR(0x0, 0x67E260); }
|
||||||
|
void Scr_CheckAnimsDefined(unsigned int names, scriptInstance_t a2, unsigned int filename, void* call_addr = Scr_CheckAnimsDefined_ADDR());
|
||||||
|
inline void* Scr_UsingTreeInternal_ADDR() { return CALL_ADDR(0x0, 0x67E420); }
|
||||||
|
unsigned int Scr_UsingTreeInternal(const char * filename, int user, scriptInstance_t inst, unsigned int * index, void* call_addr = Scr_UsingTreeInternal_ADDR());
|
||||||
|
inline void* Scr_UsingTree_ADDR() { return CALL_ADDR(0x0, 0x67E5F0); }
|
||||||
|
void Scr_UsingTree(scriptInstance_t a1, const char * filename, unsigned int sourcePos, void* call_addr = Scr_UsingTree_ADDR());
|
||||||
|
inline void* Scr_LoadAnimTreeInternal_ADDR() { return CALL_ADDR(0x0, 0x67E710); }
|
||||||
|
bool Scr_LoadAnimTreeInternal(const char * animtreeName, scriptInstance_t inst, unsigned int parentNode, unsigned int names, void* call_addr = Scr_LoadAnimTreeInternal_ADDR());
|
||||||
|
inline void* Scr_LoadAnimTreeAtIndex_ADDR() { return CALL_ADDR(0x0, 0x67E7D0); }
|
||||||
|
void Scr_LoadAnimTreeAtIndex(scriptInstance_t inst, int user, unsigned int index, void *(__cdecl * Alloc)(int), int modCheckSum, void* call_addr = Scr_LoadAnimTreeAtIndex_ADDR());
|
||||||
|
inline void* Scr_FindAnimTree_ADDR() { return CALL_ADDR(0x0, 0x67EA70); }
|
||||||
|
scr_animtree_t Scr_FindAnimTree(const char * filename, void* call_addr = Scr_FindAnimTree_ADDR());
|
||||||
|
inline void* Scr_FindAnim_ADDR() { return CALL_ADDR(0x0, 0x67EB10); }
|
||||||
|
void Scr_FindAnim(const char * animName, scr_anim_s a2, int user, void* call_addr = Scr_FindAnim_ADDR());
|
||||||
|
}
|
172
src/game/clientscript/cscr_animtree_w.cpp
Normal file
172
src/game/clientscript/cscr_animtree_w.cpp
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
#include <stdinc.hpp>
|
||||||
|
//#include "codsrc/clientscript/cscr_animtree.hpp"
|
||||||
|
|
||||||
|
namespace game
|
||||||
|
{
|
||||||
|
// void __usercall Scr_EmitAnimationInternal(scriptInstance_t inst@<edi>, const char *pos, unsigned int animName, unsigned int names)
|
||||||
|
void Scr_EmitAnimationInternal(scriptInstance_t inst, const char * pos, unsigned int animName, unsigned int names, void* call_addr)
|
||||||
|
{
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
push names;
|
||||||
|
push animName;
|
||||||
|
push pos;
|
||||||
|
mov edi, inst;
|
||||||
|
call call_addr;
|
||||||
|
add esp, 0xC;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// void __usercall Scr_AnimTreeParse(scriptInstance_t inst@<eax>, const char *pos@<edi>, unsigned int parentNode, unsigned int names)
|
||||||
|
void Scr_AnimTreeParse(scriptInstance_t inst, const char * pos, unsigned int parentNode, unsigned int names, void* call_addr)
|
||||||
|
{
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
push names;
|
||||||
|
push parentNode;
|
||||||
|
mov eax, inst;
|
||||||
|
mov edi, pos;
|
||||||
|
call call_addr;
|
||||||
|
add esp, 0x8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// void __usercall ConnectScriptToAnim(unsigned int name@<eax>, unsigned int names@<edi>, scriptInstance_t inst, int index, unsigned int filename, int treeIndex)
|
||||||
|
void ConnectScriptToAnim(unsigned int name, unsigned int names, scriptInstance_t inst, int index, unsigned int filename, int treeIndex, void* call_addr)
|
||||||
|
{
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
push treeIndex;
|
||||||
|
push filename;
|
||||||
|
push index;
|
||||||
|
push inst;
|
||||||
|
mov eax, name;
|
||||||
|
mov edi, names;
|
||||||
|
call call_addr;
|
||||||
|
add esp, 0x10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// int __usercall Scr_GetAnimsIndex@<eax>(XAnim_s *anim@<ecx>)
|
||||||
|
int Scr_GetAnimsIndex(XAnim_s * anim, void* call_addr)
|
||||||
|
{
|
||||||
|
int answer;
|
||||||
|
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
mov ecx, anim;
|
||||||
|
call call_addr;
|
||||||
|
mov answer, eax;
|
||||||
|
}
|
||||||
|
|
||||||
|
return answer;
|
||||||
|
}
|
||||||
|
|
||||||
|
// void __usercall Scr_CheckAnimsDefined(unsigned int names@<eax>, scriptInstance_t a2@<ecx>, unsigned int filename)
|
||||||
|
void Scr_CheckAnimsDefined(unsigned int names, scriptInstance_t a2, unsigned int filename, void* call_addr)
|
||||||
|
{
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
push filename;
|
||||||
|
mov eax, names;
|
||||||
|
mov ecx, a2;
|
||||||
|
call call_addr;
|
||||||
|
add esp, 0x4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// unsigned int __usercall Scr_UsingTreeInternal@<eax>(const char *filename@<eax>, int user@<ecx>, scriptInstance_t inst, unsigned int *index)
|
||||||
|
unsigned int Scr_UsingTreeInternal(const char * filename, int user, scriptInstance_t inst, unsigned int * index, void* call_addr)
|
||||||
|
{
|
||||||
|
unsigned int answer;
|
||||||
|
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
push index;
|
||||||
|
push inst;
|
||||||
|
mov eax, filename;
|
||||||
|
mov ecx, user;
|
||||||
|
call call_addr;
|
||||||
|
mov answer, eax;
|
||||||
|
add esp, 0x8;
|
||||||
|
}
|
||||||
|
|
||||||
|
return answer;
|
||||||
|
}
|
||||||
|
|
||||||
|
// void __usercall Scr_UsingTree(scriptInstance_t a1@<edi>, const char *filename, unsigned int sourcePos)
|
||||||
|
void Scr_UsingTree(scriptInstance_t a1, const char * filename, unsigned int sourcePos, void* call_addr)
|
||||||
|
{
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
push sourcePos;
|
||||||
|
push filename;
|
||||||
|
mov edi, a1;
|
||||||
|
call call_addr;
|
||||||
|
add esp, 0x8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// bool __usercall Scr_LoadAnimTreeInternal@<al>(const char *animtreeName@<eax>, scriptInstance_t inst@<ecx>, unsigned int parentNode, unsigned int names)
|
||||||
|
bool Scr_LoadAnimTreeInternal(const char * animtreeName, scriptInstance_t inst, unsigned int parentNode, unsigned int names, void* call_addr)
|
||||||
|
{
|
||||||
|
bool answer;
|
||||||
|
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
push names;
|
||||||
|
push parentNode;
|
||||||
|
mov eax, animtreeName;
|
||||||
|
mov ecx, inst;
|
||||||
|
call call_addr;
|
||||||
|
mov answer, al;
|
||||||
|
add esp, 0x8;
|
||||||
|
}
|
||||||
|
|
||||||
|
return answer;
|
||||||
|
}
|
||||||
|
|
||||||
|
// void __usercall Scr_LoadAnimTreeAtIndex(scriptInstance_t inst@<ecx>, int a2@<eax>, int a3, int (__cdecl *a4)(int), int a5)
|
||||||
|
void Scr_LoadAnimTreeAtIndex(scriptInstance_t inst, int user, unsigned int index, void* (__cdecl* Alloc)(int), int modCheckSum, void* call_addr)
|
||||||
|
{
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
push modCheckSum;
|
||||||
|
push Alloc;
|
||||||
|
push index;
|
||||||
|
mov eax, user;
|
||||||
|
mov ecx, inst;
|
||||||
|
call call_addr;
|
||||||
|
add esp, 0xC;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// XAnim_s *__usercall Scr_FindAnimTree@<eax>(const char *filename@<eax>)
|
||||||
|
scr_animtree_t Scr_FindAnimTree(const char * filename, void* call_addr)
|
||||||
|
{
|
||||||
|
scr_animtree_t answer;
|
||||||
|
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
mov eax, filename;
|
||||||
|
call call_addr;
|
||||||
|
mov answer, eax;
|
||||||
|
}
|
||||||
|
|
||||||
|
return answer;
|
||||||
|
}
|
||||||
|
|
||||||
|
// void __usercall Scr_FindAnim(const char *animName@<edx>, scr_anim_s a2, int user)
|
||||||
|
void Scr_FindAnim(const char * animName, scr_anim_s a2, int user, void* call_addr)
|
||||||
|
{
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
push user;
|
||||||
|
push a2;
|
||||||
|
mov edx, animName;
|
||||||
|
call call_addr;
|
||||||
|
add esp, 0x8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
22
src/game/clientscript/cscr_yacc.hpp
Normal file
22
src/game/clientscript/cscr_yacc.hpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace game
|
||||||
|
{
|
||||||
|
WEAK symbol<int()>yyparse{ 0x0, 0x69AEC0 };
|
||||||
|
WEAK symbol<int()>yylex{ 0x0, 0x69C0D0 };
|
||||||
|
WEAK symbol<int()>yy_get_next_buffer{ 0x0, 0x69D300 };
|
||||||
|
WEAK symbol<int()>yy_get_previous_state{ 0x0, 0x69D450 };
|
||||||
|
WEAK symbol<void()>yyrestart{ 0x0, 0x69D5C0 };
|
||||||
|
WEAK symbol<yy_buffer_state* ()>yy_create_buffer{ 0x0, 0x69D620 };
|
||||||
|
|
||||||
|
inline void* LowerCase() { return CALL_ADDR(0x0, 0x69AEA0); }
|
||||||
|
unsigned int LowerCase(unsigned int strVal, void* call_addr = LowerCase());
|
||||||
|
inline void* StringValue() { return CALL_ADDR(0x0, 0x69BFF0); }
|
||||||
|
int StringValue(int len, const char* str_, void* call_addr = StringValue());
|
||||||
|
inline void* yy_try_NUL_trans() { return CALL_ADDR(0x0, 0x69D520); }
|
||||||
|
int yy_try_NUL_trans(int yy_current_state, void* call_addr = yy_try_NUL_trans());
|
||||||
|
inline void* yy_flush_buffer() { return CALL_ADDR(0x0, 0x69D690); }
|
||||||
|
void yy_flush_buffer(yy_buffer_state* result, void* call_addr = yy_flush_buffer());
|
||||||
|
inline void* ScriptParse() { return CALL_ADDR(0x0, 0x69D710); }
|
||||||
|
void ScriptParse(scriptInstance_t a1, sval_u* parseData, void* call_addr = ScriptParse());
|
||||||
|
}
|
73
src/game/clientscript/cscr_yacc_w.cpp
Normal file
73
src/game/clientscript/cscr_yacc_w.cpp
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
#include <stdinc.hpp>
|
||||||
|
//#include "codsrc/clientscript/cscr_yacc.hpp"
|
||||||
|
|
||||||
|
namespace game
|
||||||
|
{
|
||||||
|
// unsigned int __usercall LowerCase@<eax>(unsigned int strVal@<ecx>)
|
||||||
|
unsigned int LowerCase(unsigned int strVal, void* call_addr)
|
||||||
|
{
|
||||||
|
unsigned int answer;
|
||||||
|
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
mov ecx, strVal;
|
||||||
|
call call_addr;
|
||||||
|
mov answer, eax;
|
||||||
|
}
|
||||||
|
|
||||||
|
return answer;
|
||||||
|
}
|
||||||
|
|
||||||
|
// int __usercall StringValue@<eax>(int len@<ecx>, const char *str@<edx>)
|
||||||
|
int StringValue(int len, const char* str_, void* call_addr)
|
||||||
|
{
|
||||||
|
int answer;
|
||||||
|
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
mov ecx, len;
|
||||||
|
mov edx, str_;
|
||||||
|
call call_addr;
|
||||||
|
mov answer, eax;
|
||||||
|
}
|
||||||
|
|
||||||
|
return answer;
|
||||||
|
}
|
||||||
|
|
||||||
|
// int __usercall yy_try_NUL_trans@<eax>(int yy_current_state@<eax>)
|
||||||
|
int yy_try_NUL_trans(int yy_current_state, void* call_addr)
|
||||||
|
{
|
||||||
|
int answer;
|
||||||
|
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
mov eax, yy_current_state;
|
||||||
|
call call_addr;
|
||||||
|
mov answer, eax;
|
||||||
|
}
|
||||||
|
|
||||||
|
return answer;
|
||||||
|
}
|
||||||
|
|
||||||
|
// void __usercall yy_flush_buffer(yy_buffer_state *result@<eax>)
|
||||||
|
void yy_flush_buffer(yy_buffer_state* result, void* call_addr)
|
||||||
|
{
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
mov eax, result;
|
||||||
|
call call_addr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// void __usercall ScriptParse(scriptInstance_t a1@<eax>, sval_u *parseData)
|
||||||
|
void ScriptParse(scriptInstance_t a1, sval_u* parseData, void* call_addr)
|
||||||
|
{
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
push parseData;
|
||||||
|
mov eax, a1;
|
||||||
|
call call_addr;
|
||||||
|
add esp, 0x4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user