mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Replace CServer::Think with CServer::FrameJob
Actual hook where we could also run anything in the server frame thread (the earliest function where equality to server thread id could be performed).
This commit is contained in:
parent
a9244cd8ea
commit
811ecade86
@ -122,7 +122,7 @@ CClient* CServer::ConnectClient(CServer* pServer, user_creds_s* pChallenge)
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: Rejects connection request and sends back a message
|
||||
// Input : *iSocket -
|
||||
// Input : iSocket -
|
||||
// *pChallenge -
|
||||
// *szMessage -
|
||||
//---------------------------------------------------------------------------------
|
||||
@ -131,15 +131,28 @@ void CServer::RejectConnection(int iSocket, v_netadr_t* pNetAdr, const char* szM
|
||||
v_CServer_RejectConnection(this, iSocket, pNetAdr, szMessage);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: Runs the server frame
|
||||
// Input : flFrameTime -
|
||||
// bRunOverlays -
|
||||
// bUniformSnapshotInterval -
|
||||
//---------------------------------------------------------------------------------
|
||||
void CServer::FrameJob(double flFrameTime, bool bRunOverlays, bool bUniformSnapshotInterval)
|
||||
{
|
||||
v_CServer_FrameJob(flFrameTime, bRunOverlays, bUniformSnapshotInterval);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void CServer_Attach()
|
||||
{
|
||||
DetourAttach((LPVOID*)&v_CServer_ConnectClient, &CServer::ConnectClient);
|
||||
DetourAttach((LPVOID*)&v_CServer_FrameJob, &CServer::FrameJob);
|
||||
}
|
||||
|
||||
void CServer_Detach()
|
||||
{
|
||||
DetourDetach((LPVOID*)&v_CServer_ConnectClient, &CServer::ConnectClient);
|
||||
DetourDetach((LPVOID*)&v_CServer_FrameJob, &CServer::FrameJob);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
bool AuthClient(user_creds_s* pChallenge);
|
||||
void RejectConnection(int iSocket, v_netadr_t* pNetAdr, const char* szMessage);
|
||||
static CClient* ConnectClient(CServer* pServer, user_creds_s* pChallenge);
|
||||
static void FrameJob(double flFrameTime, bool bRunOverlays, bool bUniformSnapshotInterval);
|
||||
#endif // !CLIENT_DLL
|
||||
|
||||
private:
|
||||
@ -84,8 +85,8 @@ static_assert(sizeof(CServer) == 0x4A4C0);
|
||||
extern CServer* g_pServer;
|
||||
|
||||
/* ==== CSERVER ========================================================================================================================================================= */
|
||||
inline CMemory p_CServer_Think;
|
||||
inline auto v_CServer_Think = p_CServer_Think.RCast<void (*)(bool bCheckClockDrift, bool bIsSimulating)>();
|
||||
inline CMemory p_CServer_FrameJob;
|
||||
inline auto v_CServer_FrameJob = p_CServer_FrameJob.RCast<void (*)(double flFrameTime, bool bRunOverlays, bool bUniformSnapshotInterval)>();
|
||||
|
||||
inline CMemory p_CServer_Authenticate;
|
||||
inline auto v_CServer_ConnectClient = p_CServer_Authenticate.RCast<CClient* (*)(CServer* pServer, user_creds_s* pCreds)>();
|
||||
@ -104,7 +105,7 @@ class VServer : public IDetour
|
||||
virtual void GetAdr(void) const
|
||||
{
|
||||
#ifndef CLIENT_DLL
|
||||
spdlog::debug("| FUN: CServer::Think : {:#18x} |\n", p_CServer_Think.GetPtr());
|
||||
spdlog::debug("| FUN: CServer::FrameJob : {:#18x} |\n", p_CServer_FrameJob.GetPtr());
|
||||
spdlog::debug("| FUN: CServer::ConnectClient : {:#18x} |\n", p_CServer_Authenticate.GetPtr());
|
||||
spdlog::debug("| FUN: CServer::RejectConnection : {:#18x} |\n", p_CServer_RejectConnection.GetPtr());
|
||||
spdlog::debug("| VAR: g_pServer[128] : {:#18x} |\n", reinterpret_cast<uintptr_t>(g_pServer));
|
||||
@ -114,7 +115,7 @@ class VServer : public IDetour
|
||||
virtual void GetFun(void) const
|
||||
{
|
||||
#ifndef CLIENT_DLL
|
||||
p_CServer_Think = g_GameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x89\x5C\x24\x00\x48\x89\x74\x24\x00\x57\x48\x81\xEC\x00\x00\x00\x00\x80\x3D\x00\x00\x00\x00\x00"), "xxxx?xxxx?xxxx????xx?????");
|
||||
p_CServer_FrameJob = g_GameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x89\x6C\x24\x00\x56\x41\x54\x41\x56"), "xxxx?xxxxx");
|
||||
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
||||
p_CServer_Authenticate = g_GameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x44\x89\x44\x24\x00\x55\x56\x57\x48\x8D\xAC\x24\x00\x00\x00\x00"), "xxxx?xxxxxxx????");
|
||||
#elif defined (GAMEDLL_S2)
|
||||
@ -124,7 +125,7 @@ class VServer : public IDetour
|
||||
#endif
|
||||
p_CServer_RejectConnection = g_GameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x4C\x89\x4C\x24\x00\x53\x55\x56\x57\x48\x81\xEC\x00\x00\x00\x00\x49\x8B\xD9"), "xxxx?xxxxxxx????xxx");
|
||||
|
||||
v_CServer_Think = p_CServer_Think.RCast<void (*)(bool, bool)>(); /*48 89 5C 24 ?? 48 89 74 24 ?? 57 48 81 EC ?? ?? ?? ?? 80 3D ?? ?? ?? ?? ??*/
|
||||
v_CServer_FrameJob = p_CServer_FrameJob.RCast<void (*)(double, bool, bool)>(); /*48 89 6C 24 ?? 56 41 54 41 56*/
|
||||
v_CServer_ConnectClient = p_CServer_Authenticate.RCast<CClient* (*)(CServer*, user_creds_s*)>(); /*40 55 57 41 55 41 57 48 8D AC 24 ?? ?? ?? ??*/
|
||||
v_CServer_RejectConnection = p_CServer_RejectConnection.RCast<void* (*)(CServer*, int, v_netadr_t*, const char*)>(); /*4C 89 4C 24 ?? 53 55 56 57 48 81 EC ?? ?? ?? ?? 49 8B D9*/
|
||||
#endif // !CLIENT_DLL
|
||||
|
Loading…
x
Reference in New Issue
Block a user