diff --git a/r5dev/core/init.cpp b/r5dev/core/init.cpp index ccf9a232..ff341fa5 100644 --- a/r5dev/core/init.cpp +++ b/r5dev/core/init.cpp @@ -492,7 +492,7 @@ void DetourRegister() // Register detour classes to be searched and hooked. REGISTER(VHostState); REGISTER(VModelLoader); REGISTER(VNet); - REGISTER(VNetChannel); + REGISTER(VNetChan); REGISTER(VSys_Dll); REGISTER(VSys_Dll2); diff --git a/r5dev/engine/net_chan.cpp b/r5dev/engine/net_chan.cpp index 420ec9c4..43c1369e 100644 --- a/r5dev/engine/net_chan.cpp +++ b/r5dev/engine/net_chan.cpp @@ -241,12 +241,32 @@ bool CNetChan::ProcessMessages(CNetChan* pChan, bf_read* pMsg) #endif } +//----------------------------------------------------------------------------- +// Purpose: sets the remote frame times +// Input : flFrameTime - +// flFrameTimeStdDeviation - +//----------------------------------------------------------------------------- +void CNetChan::SetRemoteFramerate(float flFrameTime, float flFrameTimeStdDeviation) +{ + m_flRemoteFrameTime = flFrameTime; + m_flRemoteFrameTimeStdDeviation = flFrameTimeStdDeviation; +} + +//----------------------------------------------------------------------------- +// Purpose: sets the remote cpu statistics +// Input : nStats - +//----------------------------------------------------------------------------- +void CNetChan::SetRemoteCPUStatistics(uint8_t nStats) +{ + m_nServerCPU = nStats; +} + /////////////////////////////////////////////////////////////////////////////// -void VNetChannel::Attach() const +void VNetChan::Attach() const { DetourAttach(&v_NetChan_ProcessMessages, &CNetChan::ProcessMessages); } -void VNetChannel::Detach() const +void VNetChan::Detach() const { DetourDetach(&v_NetChan_ProcessMessages, &CNetChan::ProcessMessages); } diff --git a/r5dev/engine/net_chan.h b/r5dev/engine/net_chan.h index 6a1617f5..0e829e02 100644 --- a/r5dev/engine/net_chan.h +++ b/r5dev/engine/net_chan.h @@ -104,6 +104,9 @@ public: void Clear(bool bStopProcessing); static bool ProcessMessages(CNetChan* pChan, bf_read* pMsg); + + void SetRemoteFramerate(float flFrameTime, float flFrameTimeStdDeviation); + void SetRemoteCPUStatistics(uint8_t nStats); //----------------------------------------------------------------------------- private: bool m_bProcessingMessages; @@ -181,7 +184,7 @@ inline auto v_NetChan_Clear = p_NetChan_Clear.RCast<void (*)(CNetChan* pChannel, inline CMemory p_NetChan_ProcessMessages; inline auto v_NetChan_ProcessMessages = p_NetChan_ProcessMessages.RCast<bool (*)(CNetChan* pChan, bf_read* pMsg)>(); /////////////////////////////////////////////////////////////////////////////// -class VNetChannel : public IDetour +class VNetChan : public IDetour { virtual void GetAdr(void) const { diff --git a/r5dev/public/inetchannel.h b/r5dev/public/inetchannel.h index 2cb1b6e9..e9123875 100644 --- a/r5dev/public/inetchannel.h +++ b/r5dev/public/inetchannel.h @@ -72,8 +72,8 @@ typedef struct nettick_s float m_flHostFrameTime; float m_flHostFrameTimeStdDeviation; bool m_bStruggling; - char m_nServerCPU; - int command_number; + uint8_t m_nServerCPU; + int m_nCommandTick; } nettick_t; static_assert(sizeof(nettick_s) == 0x18);