From 8acc208e61c03bb04a1461f67a44203519233766 Mon Sep 17 00:00:00 2001 From: PixieCore <41352111+PixieCore@users.noreply.github.com> Date: Sat, 7 May 2022 17:52:41 +0200 Subject: [PATCH] Getting games CBaseClientState now. --- r5dev/client/vengineclient_impl.cpp | 1 - r5dev/client/vengineclient_impl.h | 2 +- r5dev/engine/baseclientstate.cpp | 10 +++++----- r5dev/engine/baseclientstate.h | 8 ++++---- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/r5dev/client/vengineclient_impl.cpp b/r5dev/client/vengineclient_impl.cpp index fb61326f..f08610cb 100644 --- a/r5dev/client/vengineclient_impl.cpp +++ b/r5dev/client/vengineclient_impl.cpp @@ -52,7 +52,6 @@ bool CEngineClient::GetRestrictClientCommands() const return *m_bRestrictClientCommands; } - //--------------------------------------------------------------------------------- // Purpose: get local player // Input : diff --git a/r5dev/client/vengineclient_impl.h b/r5dev/client/vengineclient_impl.h index 6c85f962..6cda9793 100644 --- a/r5dev/client/vengineclient_impl.h +++ b/r5dev/client/vengineclient_impl.h @@ -29,7 +29,7 @@ class HVEngineClient : public IDetour { virtual void GetAdr(void) const { - std::cout << "| FUN: IVEngineClient::CommandExecute : 0x" << std::hex << std::uppercase << p_CEngineClient_CommandExecute.GetPtr() << std::setw(nPad) << " |" << std::endl; + std::cout << "| FUN: IVEngineClient::CommandExecute : 0x" << std::hex << std::uppercase << p_CEngineClient_CommandExecute.GetPtr() << std::setw(nPad) << " |" << std::endl; std::cout << "| VAR: m_bRestrictServerCommands : 0x" << std::hex << std::uppercase << m_bRestrictServerCommands << std::setw(0) << " |" << std::endl; std::cout << "| VAR: m_bRestrictClientCommands : 0x" << std::hex << std::uppercase << m_bRestrictClientCommands << std::setw(0) << " |" << std::endl; std::cout << "| CON: g_ppEngineClient : 0x" << std::hex << std::uppercase << g_ppEngineClient << std::setw(0) << " |" << std::endl; diff --git a/r5dev/engine/baseclientstate.cpp b/r5dev/engine/baseclientstate.cpp index fa4abc83..6204e96a 100644 --- a/r5dev/engine/baseclientstate.cpp +++ b/r5dev/engine/baseclientstate.cpp @@ -15,7 +15,7 @@ //------------------------------------------------------------------------------ bool CBaseClientState::IsPaused() { - return **m_bPaused; + return *cl_m_bPaused; } //------------------------------------------------------------------------------ @@ -26,7 +26,7 @@ float CBaseClientState::GetClientTime() { if (*cl_time_use_host_tickcount) { - return (float)(int)**host_tickcount * (float)*client_debugdraw_int_unk; + return (float)(int)*cl_host_tickcount * (float)*client_debugdraw_int_unk; } else { @@ -39,7 +39,7 @@ float CBaseClientState::GetClientTime() //------------------------------------------------------------------------------ int CBaseClientState::GetClientTickCount() const { - return **host_tickcount; + return *cl_host_tickcount; } //------------------------------------------------------------------------------ @@ -47,7 +47,7 @@ int CBaseClientState::GetClientTickCount() const //------------------------------------------------------------------------------ void CBaseClientState::SetClientTickCount(int tick) { - **host_tickcount = tick; + *cl_host_tickcount = tick; } -CBaseClientState* g_pBaseClientState = new CBaseClientState(); +CBaseClientState* g_pBaseClientState = nullptr; diff --git a/r5dev/engine/baseclientstate.h b/r5dev/engine/baseclientstate.h index a1a9ada0..6c3dcb89 100644 --- a/r5dev/engine/baseclientstate.h +++ b/r5dev/engine/baseclientstate.h @@ -8,9 +8,6 @@ inline int* cl_host_tickcount = nullptr; class CBaseClientState { public: - bool** m_bPaused = &cl_m_bPaused; // pauses the client side simulation in apex. - int** host_tickcount = &cl_host_tickcount; // client simulation tick count. - bool IsPaused(); float GetClientTime(); int GetClientTickCount() const; // Get the client tick count. @@ -63,7 +60,10 @@ class HClientState : public IDetour .FindPatternSelf("66 0F 6E", CMemory::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x4, 0x8).RCast(); #endif } - virtual void GetCon(void) const { } + virtual void GetCon(void) const + { + g_pBaseClientState = g_mGameDll.FindPatternSIMD(reinterpret_cast("\x0F\x84\x00\x00\x00\x00\x48\x8D\x0D\x00\x00\x00\x00\x48\x83\xC4\x28"), "xx????xxx????xxxx").FindPatternSelf("48 8D").ResolveRelativeAddressSelf(0x3, 0x7).RCast(); /*0F 84 ? ? ? ? 48 8D 0D ? ? ? ? 48 83 C4 28*/ + } virtual void Attach(void) const { } virtual void Detach(void) const { } };