2021-12-25 22:36:38 +01:00
|
|
|
#pragma once
|
2023-01-16 21:09:21 +01:00
|
|
|
#include "public/edict.h"
|
2023-01-16 23:05:36 +01:00
|
|
|
#include "public/eiface.h"
|
2023-01-16 16:54:01 +01:00
|
|
|
|
2022-04-09 02:18:57 +02:00
|
|
|
/* ==== CVENGINESERVER ================================================================================================================================================== */
|
2022-04-18 03:35:08 +02:00
|
|
|
inline CMemory p_IVEngineServer__PersistenceAvailable;
|
2023-07-02 23:01:29 +02:00
|
|
|
inline bool(*IVEngineServer__PersistenceAvailable)(void* entidx, int clientidx);
|
2022-01-26 23:43:16 +01:00
|
|
|
|
2023-01-31 22:40:15 +01:00
|
|
|
inline bool* m_bIsDedicated = nullptr;
|
2021-12-25 22:36:38 +01:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2022-09-18 23:19:50 +02:00
|
|
|
|
|
|
|
struct ServerPlayer_t
|
|
|
|
{
|
2022-09-19 01:28:43 +02:00
|
|
|
ServerPlayer_t(void)
|
2023-09-16 16:18:18 +02:00
|
|
|
{
|
|
|
|
Reset();
|
|
|
|
}
|
2022-09-18 23:19:50 +02:00
|
|
|
inline void Reset(void)
|
|
|
|
{
|
|
|
|
m_flCurrentNetProcessTime = 0.0;
|
|
|
|
m_flLastNetProcessTime = 0.0;
|
2023-12-30 01:17:39 +01:00
|
|
|
m_flLastClockSyncTime = 0.0;
|
2022-09-20 22:48:55 +02:00
|
|
|
m_flStringCommandQuotaTimeStart = 0.0;
|
2023-09-16 16:18:18 +02:00
|
|
|
m_nStringCommandQuotaCount = NULL;
|
2023-12-30 01:17:39 +01:00
|
|
|
m_bRetryClockSync = false;
|
2023-09-16 16:18:18 +02:00
|
|
|
m_bInitialConVarsSet = false;
|
2022-09-18 23:19:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
double m_flCurrentNetProcessTime;
|
|
|
|
double m_flLastNetProcessTime;
|
2023-12-30 01:17:39 +01:00
|
|
|
double m_flLastClockSyncTime;
|
2022-09-20 22:48:55 +02:00
|
|
|
double m_flStringCommandQuotaTimeStart;
|
|
|
|
int m_nStringCommandQuotaCount;
|
2023-12-30 01:17:39 +01:00
|
|
|
bool m_bRetryClockSync;
|
2023-09-16 16:18:18 +02:00
|
|
|
bool m_bInitialConVarsSet;
|
2022-09-18 23:19:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern ServerPlayer_t g_ServerPlayer[MAX_PLAYERS];
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2023-01-16 23:05:36 +01:00
|
|
|
class CVEngineServer : public IVEngineServer
|
|
|
|
{
|
2023-01-17 00:32:08 +01:00
|
|
|
public:
|
|
|
|
static bool PersistenceAvailable(void* entidx, int clientidx);
|
2023-01-17 00:07:53 +01:00
|
|
|
// Implementation in GameDLL.
|
2023-01-16 23:05:36 +01:00
|
|
|
};
|
2023-01-17 00:07:53 +01:00
|
|
|
extern CVEngineServer* g_pEngineServer;
|
|
|
|
extern IVEngineServer* g_pEngineServerVFTable;
|
2023-01-16 23:05:36 +01:00
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
class HVEngineServer : public IDetour
|
|
|
|
{
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetAdr(void) const
|
2021-12-25 22:36:38 +01:00
|
|
|
{
|
2023-01-31 16:21:51 +01:00
|
|
|
LogConAdr("CVEngineServer::`vftable'", reinterpret_cast<uintptr_t>(g_pEngineServerVFTable));
|
2023-01-25 02:26:52 +01:00
|
|
|
LogFunAdr("CVEngineServer::PersistenceAvailable", p_IVEngineServer__PersistenceAvailable.GetPtr());
|
2023-01-31 22:40:15 +01:00
|
|
|
LogVarAdr("m_bIsDedicated", reinterpret_cast<uintptr_t>(m_bIsDedicated)); // !TODO: part of CServer!
|
2021-12-25 22:36:38 +01:00
|
|
|
}
|
2022-04-18 03:35:08 +02:00
|
|
|
virtual void GetFun(void) const
|
|
|
|
{
|
2022-12-01 22:44:55 +01:00
|
|
|
p_IVEngineServer__PersistenceAvailable = g_GameDll.FindPatternSIMD("3B 15 ?? ?? ?? ?? 7D 33");
|
2023-01-24 00:53:45 +01:00
|
|
|
IVEngineServer__PersistenceAvailable = p_IVEngineServer__PersistenceAvailable.RCast<bool (*)(void*, int)>();
|
2022-04-18 03:35:08 +02:00
|
|
|
}
|
|
|
|
virtual void GetVar(void) const
|
|
|
|
{
|
2023-01-17 00:32:08 +01:00
|
|
|
CMemory pEngineServerVFTable = g_GameDll.GetVirtualMethodTable(".?AVCVEngineServer@@", 0);
|
|
|
|
|
|
|
|
g_pEngineServerVFTable = pEngineServerVFTable.RCast<CVEngineServer*>();
|
2023-01-31 22:40:15 +01:00
|
|
|
m_bIsDedicated = pEngineServerVFTable.WalkVTableSelf(3).DerefSelf().ResolveRelativeAddress(0x3, 0x7).RCast<bool*>();
|
2022-04-18 03:35:08 +02:00
|
|
|
}
|
2022-04-11 01:44:30 +02:00
|
|
|
virtual void GetCon(void) const { }
|
2023-11-26 13:21:20 +01:00
|
|
|
virtual void Detour(const bool bAttach) const;
|
2021-12-25 22:36:38 +01:00
|
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|