r5sdk/r5dev/engine/modelinfo.h
Kawe Mazidjatari edc52ad669 IDetour: remove extraneous pointer assignments
Originally, we store the search results in a CMemory instance which we then assign to the actual function pointer. CMemory is just a pointer class; we can assign the results directly to the actual function pointer. This commit reduces a lot of code verbosity, and also reduced roughly 2KiB worth of static pointers in the resulting executable. This commit also officially deprecates the support for any GameDLL's below S3 (Season 3), since it makes more sense to port the assets from earlier/later games back to the version this SDK supports.
2024-04-05 17:19:32 +02:00

68 lines
2.4 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", g_pModelInfoServer);
#endif // CLIENT_DLL
#ifndef DEDICATED
LogFunAdr("g_pModelInfoClient", 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 Detour(const bool bAttach) const { }
};
///////////////////////////////////////////////////////////////////////////////
#endif // ENGINE_MODELINFO_H