1
0
mirror of https://github.com/Mauler125/r5sdk.git synced 2025-02-09 19:15:03 +01:00

CClient::GetClient improvements

This commit is contained in:
Kawe Mazidjatari 2022-06-16 18:04:43 +02:00
parent 39dd70f929
commit 034df40755
2 changed files with 5 additions and 7 deletions
r5dev/engine/client

@ -6,6 +6,7 @@
//
//===============================================================================//
// client.cpp: implementation of the CClient class.
//
///////////////////////////////////////////////////////////////////////////////////
#include "core/stdafx.h"
#include "engine/client/client.h"
@ -15,7 +16,8 @@
//---------------------------------------------------------------------------------
CClient* CClient::GetClient(int nIndex) const
{
return (CClient*)(std::uintptr_t)(g_pClientBuffer.GetPtr() + (nIndex * sizeof(CClient)));
return reinterpret_cast<CClient*>(
(reinterpret_cast<uintptr_t>(g_pClient) + (nIndex * sizeof(CClient))));
}
//---------------------------------------------------------------------------------

@ -92,9 +92,6 @@ inline auto v_CClient_Connect = p_CClient_Connect.RCast<bool (*)(CClient* thispt
inline CMemory p_CClient_Clear;
inline auto v_CClient_Clear = p_CClient_Clear.RCast<void (*)(CClient* thisptr)>();
inline CMemory g_pClientBuffer;
extern CClient* g_pClient;
///////////////////////////////////////////////////////////////////////////////
void CBaseClient_Attach();
void CBaseClient_Detach();
@ -119,9 +116,8 @@ class VClient : public IDetour
}
virtual void GetVar(void) const
{
g_pClientBuffer = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x3B\x15\x00\x00\x00\x00\x7D\x33"), "xx????xx")
.FindPatternSelf("48 8D 0D", CMemory::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x3, 0x7);
g_pClient = g_pClientBuffer.RCast<CClient*>();
g_pClient = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x3B\x15\x00\x00\x00\x00\x7D\x33"), "xx????xx")
.FindPatternSelf("48 8D 0D", CMemory::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x3, 0x7).RCast<CClient*>();
}
virtual void GetCon(void) const { }
virtual void Attach(void) const { }