2022-10-13 16:48:56 +02:00
|
|
|
#pragma once
|
|
|
|
|
2023-01-20 17:20:50 +01:00
|
|
|
#include "public/engine/IEngineTrace.h"
|
|
|
|
#include "public/cmodel.h"
|
|
|
|
#include "public/trace.h"
|
2022-10-13 16:48:56 +02:00
|
|
|
#include "mathlib/mathlib.h"
|
|
|
|
|
2023-01-20 17:20:50 +01:00
|
|
|
class CEngineTrace : public IEngineTrace
|
2023-01-21 16:24:36 +01:00
|
|
|
{};
|
2022-10-13 16:48:56 +02:00
|
|
|
|
|
|
|
/* ==== CENGINETRACE ======================================================================================================================================================= */
|
2023-01-21 16:24:36 +01:00
|
|
|
#ifndef CLIENT_DLL
|
|
|
|
class CEngineTraceServer : public CEngineTrace
|
|
|
|
{};
|
|
|
|
inline CEngineTraceServer* g_pEngineTraceServer = nullptr;
|
|
|
|
inline CEngineTraceServer* g_pEngineTraceServerVFTable = nullptr;
|
|
|
|
#endif // CLIENT_DLL
|
|
|
|
#ifndef DEDICATED
|
2022-10-13 16:48:56 +02:00
|
|
|
|
2023-01-21 16:24:36 +01:00
|
|
|
class CEngineTraceClient : public CEngineTrace
|
|
|
|
{};
|
|
|
|
inline CEngineTraceClient* g_pEngineTraceClient = nullptr;
|
|
|
|
#endif // DEDICATED
|
2022-10-13 16:48:56 +02:00
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
void CEngineTrace_Attach();
|
|
|
|
void CEngineTrace_Detach();
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2023-01-20 17:20:50 +01:00
|
|
|
class VEngineTrace : public IDetour
|
2022-10-13 16:48:56 +02:00
|
|
|
{
|
2023-01-21 16:24:36 +01:00
|
|
|
virtual void GetAdr(void) const
|
|
|
|
{
|
|
|
|
#ifndef CLIENT_DLL
|
|
|
|
spdlog::debug("| VAR: g_pEngineTraceServer : {:#18x} |\n", reinterpret_cast<uintptr_t>(g_pEngineTraceServer));
|
|
|
|
#endif // CLIENT_DLL
|
|
|
|
#ifndef DEDICATED
|
|
|
|
spdlog::debug("| VAR: g_pEngineTraceClient : {:#18x} |\n", reinterpret_cast<uintptr_t>(g_pEngineTraceClient));
|
|
|
|
#endif // DEDICATED
|
|
|
|
spdlog::debug("+----------------------------------------------------------------+\n");
|
|
|
|
}
|
2022-10-13 16:48:56 +02:00
|
|
|
virtual void GetFun(void) const { }
|
|
|
|
virtual void GetVar(void) const { }
|
2023-01-21 16:24:36 +01:00
|
|
|
virtual void GetCon(void) const
|
|
|
|
{
|
|
|
|
#ifndef CLIENT_DLL
|
|
|
|
g_pEngineTraceServerVFTable = g_GameDll.GetVirtualMethodTable(".?AVCEngineTraceServer@@").RCast<CEngineTraceServer*>();
|
|
|
|
g_pEngineTraceServer = reinterpret_cast<CEngineTraceServer*>(&g_pEngineTraceServerVFTable); // Must be done for virtual calls.
|
|
|
|
#endif // CLIENT_DLL
|
|
|
|
}
|
2022-10-13 16:48:56 +02:00
|
|
|
virtual void Attach(void) const { }
|
|
|
|
virtual void Detach(void) const { }
|
|
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2023-01-20 17:20:50 +01:00
|
|
|
REGISTER(VEngineTrace);
|