mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Improve dedicated server performance
Prevent 'CClientState::Disconnect()' from being ran in 'Host_Disconnect()'.
This commit is contained in:
parent
604e25e046
commit
72a2d07e66
@ -1,23 +1,11 @@
|
||||
#ifndef CLIENT_H
|
||||
#define CLIENT_H
|
||||
|
||||
inline CMemory CClientState__RunFrame;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class VClient : public IDetour
|
||||
{
|
||||
virtual void GetAdr(void) const
|
||||
{
|
||||
spdlog::debug("| FUN: CClientState::RunFrame : {:#18x} |\n", CClientState__RunFrame.GetPtr());
|
||||
spdlog::debug("+----------------------------------------------------------------+\n");
|
||||
}
|
||||
virtual void GetFun(void) const
|
||||
{
|
||||
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
||||
CClientState__RunFrame = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x89\x4C\x24\x00\x57\x48\x81\xEC\x00\x00\x00\x00\x83\xB9\x00\x00\x00\x00\x00"), "xxxx?xxxx????xx?????");
|
||||
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
|
||||
CClientState__RunFrame = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x40\x53\x48\x81\xEC\x00\x00\x00\x00\x83\xB9\x00\x00\x00\x00\x00\x48\x8B\xD9\x7D\x0B"), "xxxxx????xx?????xxxxx");
|
||||
#endif
|
||||
}
|
||||
virtual void GetAdr(void) const { }
|
||||
virtual void GetFun(void) const { }
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "engine/cl_main.h"
|
||||
#include "engine/sv_main.h"
|
||||
#include "engine/sys_getmodes.h"
|
||||
#include "engine/baseclientstate.h"
|
||||
#include "game/server/ai_networkmanager.h"
|
||||
#include "game/server/fairfight_impl.h"
|
||||
#include "rtech/rtech_game.h"
|
||||
@ -62,7 +63,8 @@ void Dedicated_Init()
|
||||
//-------------------------------------------------------------------------
|
||||
{
|
||||
/*MOV EAX, 0*/
|
||||
CClientState__RunFrame.Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Always return false for pending client snapshots (inline CClientState call in '_Host_RunFrame()')
|
||||
p_CClientState__RunFrame.Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Always return false for pending client snapshots (inline CClientState call in '_Host_RunFrame()')
|
||||
p_CClientState__Disconnect.Patch({ 0xB8, 0x00, 0x00, 0x00, 0x00, 0xC3 }); // FUN --> RET | Always return false for keeping client persistent data after disconnect (CLIENT ONLY).
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
@ -173,28 +173,54 @@ public:
|
||||
extern CBaseClientState* g_pBaseClientState;
|
||||
|
||||
/* ==== CCLIENTSTATE ==================================================================================================================================================== */
|
||||
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
||||
//inline CMemory p_CClientState__CheckForResend = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x89\x5C\x24\x00\x56\x57\x41\x57\x00\x81\xEC\x20\x04\x00\x00\x45\x0F\xB6\xF9\x00\x00\x00\x00\x8B\xF1\x48"), "xxxx?xxxx?xxxx?xxxxx????xxx"); /*48 89 5C 24 ?? 56 57 41 57 ?? 81 EC 20 04 ?? 00 45 0F B6 F9 ?? ?? ?? ?? 8B F1 48*/
|
||||
//inline auto CClientState__CheckForResend = p_CClientState__CheckForResend.RCast<void(*)(CBaseClientState* thisptr, const char* a2, std::int64_t a3, char a4, int a5, std::uint8_t* a6)>();
|
||||
#elif defined (GAMEDLL_S2)
|
||||
//inline CMemory p_CClientState__CheckForResend = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x89\x5C\x24\x00\x48\x89\x74\x24\x00\x48\x89\x7C\x24\x00\x41\x56\x48\x81\xEC\x00\x00\x00\x00\x45\x0F\xB6"), "xxxx?xxxx?xxxx?xxxxx????xxx"); /*48 89 5C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 48 81 EC ?? ?? ?? ?? 45 0F B6*/
|
||||
//inline auto CClientState__CheckForResend = p_CClientState__CheckForResend.RCast<void(*)(CBaseClientState* thisptr, const char* a2, std::int64_t a3, char a4, int a5, std::uint8_t* a6)>();
|
||||
#elif defined (GAMEDLL_S3)
|
||||
//inline CMemory p_CClientState__CheckForResend = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x89\x5C\x24\x00\x48\x89\x74\x24\x00\x48\x89\x7C\x24\x00\x41\x56\x48\x81\xEC\x00\x00\x00\x00\x48\x8B\x32"), "xxxx?xxxx?xxxx?xxxxx????xxx"); /*48 89 5C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 48 81 EC ?? ?? ?? ?? 48 8B 32*/
|
||||
//inline auto CClientState__CheckForResend = p_CClientState__CheckForResend.RCast<void(*)(CBaseClientState* thisptr, const char* a2, std::int64_t a3, char a4, int a5, std::uint8_t* a6)>();
|
||||
#endif
|
||||
inline CMemory p_CClientState__RunFrame;
|
||||
inline auto CClientState__RunFrame = p_CClientState__RunFrame.RCast<void(*)(CBaseClientState* thisptr)>();
|
||||
|
||||
inline CMemory p_CClientState__CheckForResend; /*48 89 5C 24 ?? 56 57 41 57 ?? 81 EC 20 04 ?? 00 45 0F B6 F9 ?? ?? ?? ?? 8B F1 48*/
|
||||
inline auto CClientState__CheckForResend = p_CClientState__CheckForResend.RCast<void(*)(CBaseClientState* thisptr, const char* a2, std::int64_t a3, char a4, int a5, std::uint8_t* a6)>();
|
||||
|
||||
inline CMemory p_CClientState__Disconnect; /*48 89 5C 24 ?? 55 57 41 56 48 83 EC 30 0F B6 EA*/
|
||||
inline auto CClientState__Disconnect = p_CClientState__Disconnect.RCast<void(*)(CBaseClientState* thisptr, bool bSendTrackingContext)>();
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class VBaseClientState : public IDetour
|
||||
{
|
||||
virtual void GetAdr(void) const
|
||||
{
|
||||
//spdlog::debug("| FUN: CClientState::CheckForResend : {:#18x} |\n", p_CClientState__CheckForResend.GetPtr());
|
||||
spdlog::debug("| FUN: CClientState::RunFrame : {:#18x} |\n", p_CClientState__RunFrame.GetPtr());
|
||||
spdlog::debug("| FUN: CClientState::Disconnect : {:#18x} |\n", p_CClientState__Disconnect.GetPtr());
|
||||
spdlog::debug("| FUN: CClientState::CheckForResend : {:#18x} |\n", p_CClientState__CheckForResend.GetPtr());
|
||||
spdlog::debug("| VAR: cl_m_bPaused : {:#18x} |\n", reinterpret_cast<uintptr_t>(cl_m_bPaused));
|
||||
spdlog::debug("| VAR: cl_host_tickcount : {:#18x} |\n", reinterpret_cast<uintptr_t>(cl_host_tickcount));
|
||||
spdlog::debug("+----------------------------------------------------------------+\n");
|
||||
}
|
||||
virtual void GetFun(void) const { }
|
||||
virtual void GetFun(void) const
|
||||
{
|
||||
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
||||
p_CClientState__RunFrame = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x89\x4C\x24\x00\x57\x48\x81\xEC\x00\x00\x00\x00\x83\xB9\x00\x00\x00\x00\x00"), "xxxx?xxxx????xx?????");
|
||||
CClientState__RunFrame = p_CClientState__RunFrame.RCast<void(*)(CBaseClientState* thisptr)>();
|
||||
|
||||
p_CClientState__CheckForResend = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x89\x5C\x24\x00\x56\x57\x41\x57\x00\x81\xEC\x20\x04\x00\x00\x45\x0F\xB6\xF9\x00\x00\x00\x00\x8B\xF1\x48"), "xxxx?xxxx?xxxx?xxxxx????xxx");
|
||||
CClientState__CheckForResend = p_CClientState__CheckForResend.RCast<void(*)(CBaseClientState* thisptr, const char* a2, std::int64_t a3, char a4, int a5, std::uint8_t* a6)>(); /*48 89 5C 24 ?? 56 57 41 57 ?? 81 EC 20 04 ?? 00 45 0F B6 F9 ?? ?? ?? ?? 8B F1 48*/
|
||||
|
||||
p_CClientState__Disconnect = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x89\x5C\x24\x00\x55\x57\x41\x56\x48\x83\xEC\x30\x0F\xB6\xEA"), "xxxx?xxxxxxxxxxx");
|
||||
CClientState__Disconnect = p_CClientState__Disconnect.RCast<void(*)(CBaseClientState* thisptr, bool bSendTrackingContext)>(); /*48 89 5C 24 ?? 55 57 41 56 48 83 EC 30 0F B6 EA*/
|
||||
#elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
|
||||
p_CClientState__RunFrame = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x40\x53\x48\x81\xEC\x00\x00\x00\x00\x83\xB9\x00\x00\x00\x00\x00\x48\x8B\xD9\x7D\x0B"), "xxxxx????xx?????xxxxx");
|
||||
CClientState__RunFrame = p_CClientState__RunFrame.RCast<void(*)(CBaseClientState* thisptr)>();
|
||||
|
||||
p_CClientState__Disconnect = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x40\x56\x57\x41\x54\x41\x55\x41\x57\x48\x83\xEC\x30\x44\x0F\xB6\xFA"), "xxxxxxxxxxxxxxxxx");
|
||||
CClientState__Disconnect = p_CClientState__Disconnect.RCast<void(*)(CBaseClientState* thisptr, bool bSendTrackingContext)>(); /*40 56 57 41 54 41 55 41 57 48 83 EC 30 44 0F B6 FA*/
|
||||
#endif
|
||||
#if defined (GAMEDLL_S2)
|
||||
p_CClientState__CheckForResend = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x89\x5C\x24\x00\x48\x89\x74\x24\x00\x48\x89\x7C\x24\x00\x41\x56\x48\x81\xEC\x00\x00\x00\x00\x45\x0F\xB6"), "xxxx?xxxx?xxxx?xxxxx????xxx");
|
||||
CClientState__CheckForResend = p_CClientState__CheckForResend.RCast<void(*)(CBaseClientState* thisptr, const char* a2, std::int64_t a3, char a4, int a5, std::uint8_t* a6)>(); /*48 89 5C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 48 81 EC ?? ?? ?? ?? 45 0F B6*/
|
||||
#elif defined (GAMEDLL_S3)
|
||||
p_CClientState__CheckForResend = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x89\x5C\x24\x00\x48\x89\x74\x24\x00\x48\x89\x7C\x24\x00\x41\x56\x48\x81\xEC\x00\x00\x00\x00\x48\x8B\x32"), "xxxx?xxxx?xxxx?xxxxx????xxx");
|
||||
CClientState__CheckForResend = p_CClientState__CheckForResend.RCast<void(*)(CBaseClientState* thisptr, const char* a2, std::int64_t a3, char a4, int a5, std::uint8_t* a6)>(); /*48 89 5C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 48 81 EC ?? ?? ?? ?? 48 8B 32*/
|
||||
#endif
|
||||
}
|
||||
virtual void GetVar(void) const
|
||||
{
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user