r5sdk/r5dev/engine/client/cl_ents_parse.h
Kawe Mazidjatari 144d5f62e1 IDetour: code refactor
Utilize the new IDetour::DetourSetup() code, IDetour::Attach and IDetour::Detach have been removed in favor of this (significantly reduces chance of user error). Since the template check happens in the idetour header, it is much more aggressive on type mismatches, such as a difference in parameter types, between the function and detour, will now raise a compile time error. As a result, some type mismatches have been fixed in this commit as well.
2024-04-05 16:41:09 +02:00

30 lines
1.0 KiB
C++

#ifndef CL_ENTS_PARSE_H
#define CL_ENTS_PARSE_H
inline CMemory p_CL_CopyExistingEntity;
inline bool(*v_CL_CopyExistingEntity)(__int64 a1, unsigned int* a2, char* a3);
bool CL_CopyExistingEntity(__int64 a1, unsigned int* a2, char* a3);
///////////////////////////////////////////////////////////////////////////////
class V_CL_Ents_Parse : public IDetour
{
virtual void GetAdr(void) const
{
LogFunAdr("CL_CopyExistingEntity", p_CL_CopyExistingEntity.GetPtr());
}
virtual void GetFun(void) const
{
p_CL_CopyExistingEntity = g_GameDll.FindPatternSIMD("40 53 48 83 EC 70 4C 63 51 28");
v_CL_CopyExistingEntity = p_CL_CopyExistingEntity.RCast<bool (*)(__int64, unsigned int*, char*)>(); /*40 53 48 83 EC 70 4C 63 51 28*/
}
virtual void GetVar(void) const { }
virtual void GetCon(void) const { }
virtual void Detour(const bool bAttach) const
{
DetourSetup(&v_CL_CopyExistingEntity, &CL_CopyExistingEntity, bAttach);
}
};
///////////////////////////////////////////////////////////////////////////////
#endif // !CL_ENTS_PARSE_H