r5sdk/r5dev/vpc/interfaces.h

87 lines
4.1 KiB
C
Raw Normal View History

Code base refactor + major performance and readability improvement. Read description for details. * Codebase restructured to SourceSDK codebase style and .cpp/.h assertion paths in the game executable. * Document most functions with valve style 'Purpose' blocks. * Rename variables to match the rest of the codebase and Valve's naming convention. * Dedicated DLL and the SDKLauncher now share the same codebase as the DevSDK. * Obtain globals or pointers directly instead of waiting for runtime initialized data. * Dynamically search for all functions and globals (this doesn't count for dedicated yet!). * Initialize most in-SDK variables. * Move certain prints and other utilities under ConVars to reduce verbosity and increase performance. * Print all pattern scan results through a virtual function to make it easier to add and debug new patterns in the future. * Type global var pointers appropriately if class or type is known and implemented. * Forward declare 'CClient' class to avoid having 2 'g_pClient' copies. * Add IDA's pseudo definitions for easier prototyping with decompiled assembly code. * RPAK decompress Command callback implementation. * Load decompressed RPaks from 'paks\Win32\' overriding the ones in 'paks\Win64\' (the decompress callback will automatically fix the header and write it to 'paks\Win32\'). * VPK decompress Command callback implementation. * Move CRC32 ands Adler32 to implementation files. * Server will print out more details about the connecting client. * Upgrade ImGui lib to v1.86. * Don't compile id3dx.h for dedicated. * Don't compile id3dx.cpp for dedicated * Implement DevMsg print function allowing to print information to the in-game VGUI/RUI console overlay, ImGui console overlay and the external windows console * Fixed bug where the Error function would not properly terminate the process when an error is called. This caused access violations for critical/non-recoverable errors. * Fixed bug where the game would crash if the console or server browser was enabled while the game was still starting up. * Several bug fixes for the dedicated server (warning: dedicated is still considered work-in-progress!).
2021-12-25 22:36:38 +01:00
#pragma once
#include "tier1/interface.h"
#include "pluginsdk/ifactory.h"
Code base refactor + major performance and readability improvement. Read description for details. * Codebase restructured to SourceSDK codebase style and .cpp/.h assertion paths in the game executable. * Document most functions with valve style 'Purpose' blocks. * Rename variables to match the rest of the codebase and Valve's naming convention. * Dedicated DLL and the SDKLauncher now share the same codebase as the DevSDK. * Obtain globals or pointers directly instead of waiting for runtime initialized data. * Dynamically search for all functions and globals (this doesn't count for dedicated yet!). * Initialize most in-SDK variables. * Move certain prints and other utilities under ConVars to reduce verbosity and increase performance. * Print all pattern scan results through a virtual function to make it easier to add and debug new patterns in the future. * Type global var pointers appropriately if class or type is known and implemented. * Forward declare 'CClient' class to avoid having 2 'g_pClient' copies. * Add IDA's pseudo definitions for easier prototyping with decompiled assembly code. * RPAK decompress Command callback implementation. * Load decompressed RPaks from 'paks\Win32\' overriding the ones in 'paks\Win64\' (the decompress callback will automatically fix the header and write it to 'paks\Win32\'). * VPK decompress Command callback implementation. * Move CRC32 ands Adler32 to implementation files. * Server will print out more details about the connecting client. * Upgrade ImGui lib to v1.86. * Don't compile id3dx.h for dedicated. * Don't compile id3dx.cpp for dedicated * Implement DevMsg print function allowing to print information to the in-game VGUI/RUI console overlay, ImGui console overlay and the external windows console * Fixed bug where the Error function would not properly terminate the process when an error is called. This caused access violations for critical/non-recoverable errors. * Fixed bug where the game would crash if the console or server browser was enabled while the game was still starting up. * Several bug fixes for the dedicated server (warning: dedicated is still considered work-in-progress!).
2021-12-25 22:36:38 +01:00
/*-----------------------------------------------------------------------------
* _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", p_CreateInterfaceInternal.GetPtr());
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 Detour(const bool bAttach) const { }
};
///////////////////////////////////////////////////////////////////////////////