Initialize pointer to CVEngineServer VFTable

This commit is contained in:
Kawe Mazidjatari 2023-01-17 00:07:53 +01:00
parent 76e7111101
commit 909a3d7876
3 changed files with 11 additions and 4 deletions

View File

@ -8,6 +8,8 @@
#ifndef EIFACE_H
#define EIFACE_H
#include "edict.h"
#include "tier1/bitbuf.h"
#include "vpc/keyvalues.h"
//-----------------------------------------------------------------------------
// Forward declarations
@ -58,7 +60,7 @@ public:
virtual bool IsDedicatedServer(void) = 0;
// Is this server active?
virtual bool IsActive(void) = 0;
virtual void NullSub0(void) = 0;
virtual void NullSub0(void) = 0;
// get arbitrary launch options
virtual KeyValues* GetLaunchOptions(void) = 0;

View File

@ -52,3 +52,6 @@ void IVEngineServer_Detach()
///////////////////////////////////////////////////////////////////////////////
ServerPlayer_t g_ServerPlayer[MAX_PLAYERS];
IVEngineServer* g_pEngineServerVFTable = nullptr;
CVEngineServer* g_pEngineServer = reinterpret_cast<CVEngineServer*>(&g_pEngineServerVFTable);

View File

@ -60,10 +60,10 @@ extern ServerPlayer_t g_ServerPlayer[MAX_PLAYERS];
class CVEngineServer : public IVEngineServer
{
// Implementation in GameDLL.
};
inline CVEngineServer* g_pEngineServer;
extern CVEngineServer* g_pEngineServer;
extern IVEngineServer* g_pEngineServerVFTable;
///////////////////////////////////////////////////////////////////////////////
class HVEngineServer : public IDetour
@ -77,6 +77,7 @@ class HVEngineServer : public IDetour
spdlog::debug("| FUN: CVEngineServer::CreateFakeClient : {:#18x} |\n", p_IVEngineServer__CreateFakeClient.GetPtr());
//spdlog::debug("| FUN: RunFrameServer : {:#18x} |\n", p_RunFrameServer.GetPtr());
spdlog::debug("| VAR: g_bDedicated : {:#18x} |\n", reinterpret_cast<uintptr_t>(g_bDedicated));
spdlog::debug("| VAR: g_pEngineServerVFTable : {:#18x} |\n", reinterpret_cast<uintptr_t>(g_pEngineServerVFTable));
spdlog::debug("+----------------------------------------------------------------+\n");
}
virtual void GetFun(void) const
@ -98,6 +99,7 @@ class HVEngineServer : public IDetour
virtual void GetVar(void) const
{
g_bDedicated = p_IVEngineServer__IsDedicatedServer.ResolveRelativeAddress(0x3, 0x7).RCast<bool*>();
g_pEngineServerVFTable = g_GameDll.GetVirtualMethodTable(".?AVCVEngineServer@@", 0).RCast<CVEngineServer*>();
}
virtual void GetCon(void) const { }
virtual void Attach(void) const { }