mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
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.
32 lines
1.1 KiB
C++
32 lines
1.1 KiB
C++
#ifndef PERSISTENCE_H
|
|
#define PERSISTENCE_H
|
|
|
|
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
|
inline CMemory p_Persistence_SetXP;
|
|
inline bool(*v_Persistence_SetXP)(int a1, int* a2);
|
|
#endif
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
class VPersistence : public IDetour
|
|
{
|
|
virtual void GetAdr(void) const
|
|
{
|
|
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
|
LogFunAdr("Persistence_SetXP", p_Persistence_SetXP.GetPtr());
|
|
#endif
|
|
}
|
|
virtual void GetFun(void) const
|
|
{
|
|
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
|
p_Persistence_SetXP = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 33 FF 48 8B F2 3B 0D ?? ?? ?? ??");
|
|
v_Persistence_SetXP = p_Persistence_SetXP.RCast<bool (*)(int a1, int* a2)>(); /*48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 33 FF 48 8B F2 3B 0D ?? ?? ?? ??*/
|
|
#endif
|
|
}
|
|
virtual void GetVar(void) const { }
|
|
virtual void GetCon(void) const { }
|
|
virtual void Detour(const bool bAttach) const;
|
|
};
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
#endif // PERSISTENCE_H
|