2021-12-25 22:36:38 +01:00
# pragma once
2022-04-09 02:18:57 +02:00
/* ==== CVENGINESERVER ================================================================================================================================================== */
2022-04-18 03:35:08 +02:00
inline CMemory p_IVEngineServer__PersistenceAvailable ;
inline auto IVEngineServer__PersistenceAvailable = p_IVEngineServer__PersistenceAvailable . RCast < bool ( * ) ( void * entidx , int clientidx ) > ( ) ;
2022-01-26 23:43:16 +01:00
2022-04-18 03:35:08 +02:00
inline CMemory p_IVEngineServer__IsDedicatedServer ;
inline auto IVEngineServer__IsDedicatedServer = p_IVEngineServer__IsDedicatedServer . RCast < bool ( * ) ( void ) > ( ) ;
2022-01-26 23:43:16 +01:00
2022-04-18 03:35:08 +02:00
inline CMemory p_IVEngineServer__GetNumHumanPlayers ;
inline auto IVEngineServer__GetNumHumanPlayers = p_IVEngineServer__GetNumHumanPlayers . RCast < int64_t ( * ) ( void ) > ( ) ;
2022-03-26 00:24:13 +01:00
2022-04-18 03:35:08 +02:00
inline CMemory p_IVEngineServer__GetNumFakeClients ;
inline auto IVEngineServer__GetNumFakeClients = p_IVEngineServer__GetNumFakeClients . RCast < int64_t ( * ) ( void ) > ( ) ;
2022-03-26 00:24:13 +01:00
2022-09-18 23:19:50 +02:00
//inline CMemory p_RunFrameServer;
//inline auto v_RunFrameServer = p_RunFrameServer.RCast<void(*)(double flFrameTime, bool bRunOverlays, bool bUniformUpdate)>();
2022-04-18 03:35:08 +02:00
inline bool * g_bDedicated = nullptr ;
2021-12-25 22:36:38 +01:00
///////////////////////////////////////////////////////////////////////////////
2022-03-26 00:24:13 +01:00
bool HIVEngineServer__PersistenceAvailable ( void * entidx , int clientidx ) ;
2021-12-25 22:36:38 +01:00
void IVEngineServer_Attach ( ) ;
void IVEngineServer_Detach ( ) ;
///////////////////////////////////////////////////////////////////////////////
2022-09-18 23:19:50 +02:00
struct ServerPlayer_t
{
2022-09-19 01:28:43 +02:00
ServerPlayer_t ( void )
: m_flCurrentNetProcessTime ( 0.0 )
, m_flLastNetProcessTime ( 0.0 )
2022-09-20 22:48:55 +02:00
, m_flStringCommandQuotaTimeStart ( 0.0 )
, m_nStringCommandQuotaCount ( 0 )
2022-09-19 01:28:43 +02:00
, m_bPersistenceEnabled ( false )
{ }
2022-09-18 23:19:50 +02:00
inline void Reset ( void )
{
m_flCurrentNetProcessTime = 0.0 ;
m_flLastNetProcessTime = 0.0 ;
2022-09-20 22:48:55 +02:00
m_flStringCommandQuotaTimeStart = 0.0 ;
m_nStringCommandQuotaCount = 0 ;
2022-09-18 23:19:50 +02:00
m_bPersistenceEnabled = false ;
}
double m_flCurrentNetProcessTime ;
double m_flLastNetProcessTime ;
2022-09-20 22:48:55 +02:00
double m_flStringCommandQuotaTimeStart ;
int m_nStringCommandQuotaCount ;
2022-09-18 23:19:50 +02:00
bool m_bPersistenceEnabled ;
} ;
extern ServerPlayer_t g_ServerPlayer [ MAX_PLAYERS ] ;
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
{
2022-05-13 14:53:25 +02:00
spdlog : : debug ( " | FUN: IVEngineServer::PersistenceAvailable : {:#18x} | \n " , p_IVEngineServer__PersistenceAvailable . GetPtr ( ) ) ;
spdlog : : debug ( " | FUN: IVEngineServer::IsDedicatedServer : {:#18x} | \n " , p_IVEngineServer__IsDedicatedServer . GetPtr ( ) ) ;
spdlog : : debug ( " | FUN: IVEngineServer::GetNumHumanPlayers : {:#18x} | \n " , p_IVEngineServer__GetNumHumanPlayers . GetPtr ( ) ) ;
spdlog : : debug ( " | FUN: IVEngineServer::GetNumFakeClients : {:#18x} | \n " , p_IVEngineServer__GetNumFakeClients . GetPtr ( ) ) ;
2022-09-18 23:19:50 +02:00
//spdlog::debug("| FUN: RunFrameServer : {:#18x} |\n", p_RunFrameServer.GetPtr());
2022-05-13 14:53:25 +02:00
spdlog : : debug ( " | VAR: g_bDedicated : {:#18x} | \n " , reinterpret_cast < uintptr_t > ( g_bDedicated ) ) ;
spdlog : : debug ( " +----------------------------------------------------------------+ \n " ) ;
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 " ) ;
p_IVEngineServer__IsDedicatedServer = g_GameDll . FindPatternSIMD ( " 0F B6 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC 48 8B 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC 40 53 " ) ;
p_IVEngineServer__GetNumHumanPlayers = g_GameDll . FindPatternSIMD ( " 8B 15 ?? ?? ?? ?? 33 C0 85 D2 7E 24 " ) ;
p_IVEngineServer__GetNumFakeClients = g_GameDll . FindPatternSIMD ( " 8B 05 ?? ?? ?? ?? 33 C9 85 C0 7E 2D " ) ;
// p_RunFrameServer = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 57 48 83 EC 30 0F 29 74 24 ?? 48 8D 0D ?? ?? ?? ??");
2022-04-18 03:35:08 +02:00
2022-09-18 23:19:50 +02:00
IVEngineServer__PersistenceAvailable = p_IVEngineServer__PersistenceAvailable . RCast < bool ( * ) ( void * , int ) > ( ) ; /*3B 15 ?? ?? ?? ?? 7D 33*/
IVEngineServer__IsDedicatedServer = p_IVEngineServer__IsDedicatedServer . RCast < bool ( * ) ( void ) > ( ) ; /*0F B6 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC 48 8B 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC 40 53*/
IVEngineServer__GetNumHumanPlayers = p_IVEngineServer__GetNumHumanPlayers . RCast < int64_t ( * ) ( void ) > ( ) ; /*8B 15 ?? ?? ?? ?? 33 C0 85 D2 7E 24*/
IVEngineServer__GetNumFakeClients = p_IVEngineServer__GetNumFakeClients . RCast < int64_t ( * ) ( void ) > ( ) ; /*8B 05 ?? ?? ?? ?? 33 C9 85 C0 7E 2D*/
// v_RunFrameServer = p_RunFrameServer.RCast<void(*)(double, bool, bool)>(); /*48 89 5C 24 ?? 57 48 83 EC 30 0F 29 74 24 ?? 48 8D 0D ?? ?? ?? ??*/
2022-04-18 03:35:08 +02:00
}
virtual void GetVar ( void ) const
{
2022-08-22 03:53:38 +02:00
g_bDedicated = p_IVEngineServer__IsDedicatedServer . 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 { }
virtual void Attach ( void ) const { }
virtual void Detach ( void ) const { }
2021-12-25 22:36:38 +01:00
} ;
///////////////////////////////////////////////////////////////////////////////
REGISTER ( HVEngineServer ) ;