r5sdk/r5dev/engine/traceinit.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

26 lines
941 B
C++

#ifndef TRACEINIT_H
#define TRACEINIT_H
inline CMemory p_TRACEINIT;
inline void(*v_TRACEINIT)(void* undef, const char* initfunc, const char* shutdownfunc);
///////////////////////////////////////////////////////////////////////////////
class VTraceInit : public IDetour
{
virtual void GetAdr(void) const
{
LogFunAdr("TRACEINIT", p_TRACEINIT.GetPtr());
}
virtual void GetFun(void) const
{
p_TRACEINIT = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B 05 ?? ?? ?? ?? 49 8B F8 48 8B F2 48 85 C0");
v_TRACEINIT = p_TRACEINIT.RCast<void (*)(void*, const char*, const char*)>(); /*48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 48 8B 05 ? ? ? ? 49 8B F8 48 8B F2 48 85 C0*/
}
virtual void GetVar(void) const { }
virtual void GetCon(void) const { }
virtual void Detour(const bool bAttach) const { }
};
///////////////////////////////////////////////////////////////////////////////
#endif // TRACEINIT_H