mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
This change was planned for a long time. This moves all REGISTER calls to a single translation unit, this is required as we currently added a very dirty workaround for not registering duplicates by checking if VFTable pointer was already present in the vector... Registering from single translation unit prevents duplicate instances that gets created if header is included by more cpp files. Reworking this reduced 100kb+ of compiled code. This commit also reworked the way functions/variables/constant gets logged with their addresses; the new code formats them on the fly, and allows for resize at any time. Formatting is no longer required by programmer. TODO: currently there are some compile errors for dedicated and client dll's. These will be resolved very soon as they need to be properly worked out still (server & client only stuff needs to be properly split). Use the 'main' (stable) branch for the time being if you need to compile these dll's.
69 lines
2.5 KiB
C++
69 lines
2.5 KiB
C++
//===== Copyright (c) 1996-2005, Valve Corporation, All rights reserved. =====//
|
|
//
|
|
// Purpose:
|
|
//
|
|
// $Workfile: $
|
|
// $NoKeywords: $
|
|
//===========================================================================//
|
|
#ifndef ENGINE_MODELINFO_H
|
|
#define ENGINE_MODELINFO_H
|
|
#include "public/engine/IVModelInfo.h"
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// shared implementation of IVModelInfo
|
|
//-----------------------------------------------------------------------------
|
|
class CModelInfo : public IVModelInfoClient
|
|
{};
|
|
|
|
#ifndef CLIENT_DLL
|
|
//-----------------------------------------------------------------------------
|
|
// implementation of IVModelInfo for server
|
|
//-----------------------------------------------------------------------------
|
|
class CModelInfoServer : public CModelInfo
|
|
{};
|
|
extern CModelInfoServer* g_pModelInfoServer;
|
|
inline CModelInfoServer* g_pModelInfoServer_VFTable;
|
|
#endif // CLIENT_DLL
|
|
|
|
#ifndef DEDICATED
|
|
//-----------------------------------------------------------------------------
|
|
// implementation of IVModelInfo for client
|
|
//-----------------------------------------------------------------------------
|
|
class CModelInfoClient : public CModelInfo
|
|
{};
|
|
extern CModelInfoClient* g_pModelInfoClient;
|
|
inline CModelInfoClient* g_pModelInfoClient_VFTable;
|
|
#endif // DEDICATED
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
class VModelInfo : public IDetour
|
|
{
|
|
virtual void GetAdr(void) const
|
|
{
|
|
#ifndef CLIENT_DLL
|
|
LogFunAdr("g_pModelInfoServer", reinterpret_cast<uintptr_t>(g_pModelInfoServer));
|
|
#endif // CLIENT_DLL
|
|
#ifndef DEDICATED
|
|
LogFunAdr("g_pModelInfoClient", reinterpret_cast<uintptr_t>(g_pModelInfoClient));
|
|
#endif // DEDICATED
|
|
}
|
|
virtual void GetFun(void) const { }
|
|
virtual void GetVar(void) const
|
|
{
|
|
#ifndef CLIENT_DLL
|
|
g_pModelInfoServer_VFTable = g_GameDll.GetVirtualMethodTable(".?AVCModelInfoServer@@").RCast<CModelInfoServer*>();
|
|
g_pModelInfoServer = reinterpret_cast<CModelInfoServer*>(&g_pModelInfoServer_VFTable);
|
|
#endif // CLIENT_DLL
|
|
#ifndef DEDICATED
|
|
g_pModelInfoClient_VFTable = g_GameDll.GetVirtualMethodTable(".?AVCModelInfoClient@@").RCast<CModelInfoClient*>();
|
|
g_pModelInfoClient = reinterpret_cast<CModelInfoClient*>(&g_pModelInfoClient_VFTable);
|
|
#endif // DEDICATED
|
|
}
|
|
virtual void GetCon(void) const { }
|
|
virtual void Attach(void) const { }
|
|
virtual void Detach(void) const { }
|
|
};
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
#endif // ENGINE_MODELINFO_H
|