mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Removed all extraneous copies by adding the class 'InterfaceReg' which will construct a new interface, and link it to the engine's static register. The Source Engine macro 'EXPOSE_INTERFACE_FN' will help utilizing this. The game module from the plugin is not obtained through the process environment block, so the executable is no longer sensitive to names.
88 lines
4.1 KiB
C++
88 lines
4.1 KiB
C++
#pragma once
|
|
#include "tier1/interface.h"
|
|
#include "pluginsdk/ifactory.h"
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
* _interfaces.h
|
|
*-----------------------------------------------------------------------------*/
|
|
|
|
#define VENGINE_LAUNCHER_API_VERSION "VENGINE_LAUNCHER_API_VERSION004"
|
|
#define VENGINE_GAMEUIFUNCS_VERSION "VENGINE_GAMEUIFUNCS_VERSION005"
|
|
|
|
#define VENGINE_RENDERVIEW_INTERFACE_VERSION "VEngineRenderView014"
|
|
#define VENGINE_RANDOM_INTERFACE_VERSION "VEngineRandom001"
|
|
#define VENGINE_HUDMODEL_INTERFACE_VERSION "VEngineModel016"
|
|
#define MATERIALSYSTEM_CONFIG_VERSION "VMaterialSystemConfig004"
|
|
|
|
#define SERVER_DLL_SHARED_APPSYSTEMS "VServerDllSharedAppSystems001"
|
|
#define INTERFACEVERSION_SERVERGAMECLIENTS_NEW "ServerGameClients004"
|
|
#define INTERFACEVERSION_SERVERGAMECLIENTS "ServerGameClients003"
|
|
#define INTERFACEVERSION_SERVERGAMEENTS "ServerGameEnts002"
|
|
#define INTERFACEVERSION_SERVERGAMEDLL "ServerGameDLL005"
|
|
|
|
#define VCLIENT_PREDICTION_INTERFACE_VERSION "VClientPrediction001"
|
|
#define VCLIENTENTITYLIST_INTERFACE_VERSION "VClientEntityList003"
|
|
#define CLIENT_DLL_INTERFACE_VERSION "VClient018"
|
|
#define CLIENTRENDERTARGETS_INTERFACE_VERSION "ClientRenderTargets001"
|
|
#define INTERFACEVERSION_ENGINETRACE_CLIENT "EngineTraceClient004"
|
|
#define INTERFACEVERSION_ENGINETRACEDECALS_CLIENT "EngineTraceClientDecals004"
|
|
|
|
#define VGUI_SYSTEM_INTERFACE_VERSION "VGUI_System010"
|
|
#define GAMEUI_INTERFACE_VERSION "GameUI011"
|
|
|
|
#define RUNGAMEENGINE_INTERFACE_VERSION "RunGameEngine005"
|
|
#define EVENTSYSTEM_INTERFACE_VERSION "EventSystem001"
|
|
|
|
#define CVAR_QUERY_INTERFACE_VERSION "VCvarQuery001"
|
|
#define VPHYSICS_DEBUG_OVERLAY_INTERFACE_VERSION "VPhysicsDebugOverlay001"
|
|
#define VDEBUG_OVERLAY_INTERFACE_VERSION "VDebugOverlay004"
|
|
#define SOUNDCARD_INTERFACE_VERSION "ISoundC002"
|
|
|
|
#define SHADERSYSTEM_INTERFACE_VERSION "ShaderSystem002"
|
|
#define FACTORY_INTERFACE_VERSION "VFactorySystem002"
|
|
#define FILESYSTEM_INTERFACE_VERSION "VFileSystem017"
|
|
#define BASEFILESYSTEM_INTERFACE_VERSION "VBaseFileSystem011"
|
|
#define KEYVALUESSYSTEM_INTERFACE_VERSION "VKeyValuesSystem001"
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Class to hold all factories (interfaces)
|
|
//-----------------------------------------------------------------------------
|
|
class CFactorySystem : public IFactorySystem
|
|
{
|
|
public:
|
|
virtual void AddFactory(InstantiateInterfaceFn createFn, const char* pName) const override;
|
|
virtual void* GetFactory(const char* pName) const override;
|
|
virtual const char* GetVersion(void) const override;
|
|
};
|
|
|
|
extern CFactorySystem* g_pFactorySystem;
|
|
PLATFORM_INTERFACE IFactorySystem* GetFactorySystem();
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
inline CMemory p_CreateInterfaceInternal;
|
|
inline void*(*CreateInterfaceInternal)(const char* pName, int* pReturnCode);
|
|
|
|
class VFactory : public IDetour
|
|
{
|
|
virtual void GetAdr(void) const
|
|
{
|
|
LogFunAdr("CreateInterfaceInternal", reinterpret_cast<uintptr_t>(s_ppInterfaceRegs));
|
|
LogVarAdr("s_pInterfaceRegs", reinterpret_cast<uintptr_t>(s_ppInterfaceRegs));
|
|
}
|
|
virtual void GetFun(void) const
|
|
{
|
|
p_CreateInterfaceInternal = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B 1D ?? ?? ?? ?? 48 8B FA");
|
|
CreateInterfaceInternal = p_CreateInterfaceInternal.RCast<void*(*)(const char*, int*)>();
|
|
}
|
|
virtual void GetVar(void) const
|
|
{
|
|
s_ppInterfaceRegs = g_GameDll.FindPatternSIMD("E9 ?? ?? ?? ?? CC CC 89 91 ?? ?? ?? ??")
|
|
.FollowNearCallSelf().FindPatternSelf("48 8B 1D", CMemory::Direction::DOWN).ResolveRelativeAddressSelf(0x3, 0x7).RCast<InterfaceReg**>();
|
|
}
|
|
virtual void GetCon(void) const { }
|
|
virtual void Attach(void) const { }
|
|
virtual void Detach(void) const { }
|
|
};
|
|
///////////////////////////////////////////////////////////////////////////////
|