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.
46 lines
1.8 KiB
C++
46 lines
1.8 KiB
C++
#pragma once
|
|
|
|
class CEngineClient
|
|
{
|
|
public:
|
|
void SetRestrictServerCommands(bool bRestrict);
|
|
bool GetRestrictServerCommands() const;
|
|
void SetRestrictClientCommands(bool bRestrict);
|
|
bool GetRestrictClientCommands() const;
|
|
int GetLocalPlayer(); // Local player index.
|
|
|
|
// Hook statics:
|
|
static void _ClientCmd(CEngineClient* thisptr, const char* const szCmdString);
|
|
};
|
|
|
|
/* ==== CVENGINECLIENT ================================================================================================================================================== */
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
inline CMemory p_CEngineClient__ClientCmd;
|
|
inline void(*CEngineClient__ClientCmd)(CEngineClient* thisptr, const char* const szCmdString);
|
|
|
|
inline CMemory g_pEngineClientVFTable = nullptr;
|
|
inline CEngineClient* g_pEngineClient = nullptr;
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
class HVEngineClient : public IDetour
|
|
{
|
|
virtual void GetAdr(void) const
|
|
{
|
|
LogConAdr("CEngineClient::`vftable'", g_pEngineClientVFTable.GetPtr());
|
|
LogFunAdr("CEngineClient::ClientCmd", p_CEngineClient__ClientCmd.GetPtr());
|
|
}
|
|
virtual void GetFun(void) const
|
|
{
|
|
p_CEngineClient__ClientCmd = g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 80 3D ?? ?? ?? ?? ?? 48 8B DA 74 0C");
|
|
CEngineClient__ClientCmd = p_CEngineClient__ClientCmd.RCast<void(*)(CEngineClient*, const char* const)>();
|
|
}
|
|
virtual void GetVar(void) const { }
|
|
virtual void GetCon(void) const
|
|
{
|
|
g_pEngineClientVFTable = g_GameDll.GetVirtualMethodTable(".?AVCEngineClient@@");
|
|
g_pEngineClient = g_pEngineClientVFTable.RCast<CEngineClient*>();
|
|
}
|
|
virtual void Detour(const bool bAttach) const;
|
|
};
|
|
///////////////////////////////////////////////////////////////////////////////
|