Obtain debug overlay interface through factory

This commit is contained in:
Kawe Mazidjatari 2023-01-22 13:08:02 +01:00
parent 4b5d24a51f
commit 2cd28ab304
2 changed files with 3 additions and 23 deletions

View File

@ -30,6 +30,7 @@
#include "game/client/cliententitylist.h" #include "game/client/cliententitylist.h"
#include "gameui/IConsole.h" #include "gameui/IConsole.h"
#endif // !DEDICATED #endif // !DEDICATED
#include "public/idebugoverlay.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Purpose: // Purpose:
@ -74,14 +75,15 @@ bool CModAppSystemGroup::Create(CModAppSystemGroup* pModAppSystemGroup)
//InitPluginSystem(pModAppSystemGroup); //InitPluginSystem(pModAppSystemGroup);
//CALL_PLUGIN_CALLBACKS(g_pPluginSystem->GetCreateCallbacks(), pModAppSystemGroup); //CALL_PLUGIN_CALLBACKS(g_pPluginSystem->GetCreateCallbacks(), pModAppSystemGroup);
g_pDebugOverlay = g_pFactory->GetFactoryPtr(VDEBUG_OVERLAY_INTERFACE_VERSION, false).RCast<CIVDebugOverlay*>();
#ifndef CLIENT_DLL #ifndef CLIENT_DLL
g_pServerGameDLL = g_pFactory->GetFactoryPtr(INTERFACEVERSION_SERVERGAMEDLL, false).RCast<CServerGameDLL*>(); g_pServerGameDLL = g_pFactory->GetFactoryPtr(INTERFACEVERSION_SERVERGAMEDLL, false).RCast<CServerGameDLL*>();
g_pServerGameClients = g_pFactory->GetFactoryPtr(INTERFACEVERSION_SERVERGAMECLIENTS_NEW, false).RCast<CServerGameClients*>(); g_pServerGameClients = g_pFactory->GetFactoryPtr(INTERFACEVERSION_SERVERGAMECLIENTS_NEW, false).RCast<CServerGameClients*>();
if (!g_pServerGameClients) if (!g_pServerGameClients)
g_pServerGameClients = g_pFactory->GetFactoryPtr(INTERFACEVERSION_SERVERGAMECLIENTS, false).RCast<CServerGameClients*>(); g_pServerGameClients = g_pFactory->GetFactoryPtr(INTERFACEVERSION_SERVERGAMECLIENTS, false).RCast<CServerGameClients*>();
g_pServerGameEntities = g_pFactory->GetFactoryPtr(INTERFACEVERSION_SERVERGAMEENTS, false).RCast<CServerGameEnts*>(); g_pServerGameEntities = g_pFactory->GetFactoryPtr(INTERFACEVERSION_SERVERGAMEENTS, false).RCast<CServerGameEnts*>();
#endif // !CLIENT_DLL
#endif // !CLIENT_DLL
#ifndef DEDICATED #ifndef DEDICATED
g_pClientEntityList = g_pFactory->GetFactoryPtr(VCLIENTENTITYLIST_INTERFACE_VERSION, false).RCast<CClientEntityList*>(); g_pClientEntityList = g_pFactory->GetFactoryPtr(VCLIENTENTITYLIST_INTERFACE_VERSION, false).RCast<CClientEntityList*>();
g_pEngineTraceClient = g_pFactory->GetFactoryPtr(INTERFACEVERSION_ENGINETRACE_CLIENT, false).RCast<CEngineTraceClient*>(); g_pEngineTraceClient = g_pFactory->GetFactoryPtr(INTERFACEVERSION_ENGINETRACE_CLIENT, false).RCast<CEngineTraceClient*>();

View File

@ -40,26 +40,4 @@ public:
}; };
inline CIVDebugOverlay* g_pDebugOverlay = nullptr; inline CIVDebugOverlay* g_pDebugOverlay = nullptr;
///////////////////////////////////////////////////////////////////////////////
class VDebugOverlayBase : public IDetour
{
virtual void GetAdr(void) const
{
spdlog::debug("| VAR: g_pDebugOverlay : {:#18x} |\n", reinterpret_cast<uintptr_t>(g_pDebugOverlay));
spdlog::debug("+----------------------------------------------------------------+\n");
}
virtual void GetFun(void) const { }
virtual void GetVar(void) const
{
g_pDebugOverlay = g_GameDll.FindPatternSIMD("48 8D 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC 48 8D 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC 48 83 EC 28 F3 0F 10 41 ??")
.ResolveRelativeAddressSelf(0x3, 0x7).RCast<CIVDebugOverlay*>();
}
virtual void GetCon(void) const { }
virtual void Attach(void) const { }
virtual void Detach(void) const { }
};
///////////////////////////////////////////////////////////////////////////////
REGISTER(VDebugOverlayBase);
#endif // IDEBUGOVERLAY_H #endif // IDEBUGOVERLAY_H