From 2658ad6a5135d997faaaf137b2cac46207a791ac Mon Sep 17 00:00:00 2001 From: TotallyNotElite <1yourexperiment@protonmail.com> Date: Sun, 17 Mar 2019 18:37:40 +0100 Subject: [PATCH] Add IMDLCache and IFileSystem interfaces --- include/core/interfaces.hpp | 7 +++++++ include/core/sharedobj.hpp | 2 ++ src/core/interfaces.cpp | 9 +++++++++ src/core/sharedobj.cpp | 13 +++++++++++++ 4 files changed, 31 insertions(+) diff --git a/include/core/interfaces.hpp b/include/core/interfaces.hpp index 330a73a9..d84435b3 100644 --- a/include/core/interfaces.hpp +++ b/include/core/interfaces.hpp @@ -52,6 +52,8 @@ class TFGCClientSystem; class CGameRules; class IEngineVGui; class IUniformRandomStream; +class IFileSystem; +class IMDLCache; extern TFGCClientSystem *g_TFGCClientSystem; extern CHud *g_CHUD; @@ -87,5 +89,10 @@ extern IGameEventManager *g_IGameEventManager; extern CGameRules *g_pGameRules; extern IEngineVGui *g_IEngineVGui; extern IUniformRandomStream *g_pUniformStream; +extern int *g_PredictionRandomSeed; +#if ENABLE_NULL_GRAPHICS +extern IFileSystem *g_IFileSystem; +extern IMDLCache *g_IMDLCache; +#endif void CreateInterfaces(); diff --git a/include/core/sharedobj.hpp b/include/core/sharedobj.hpp index 74bdde86..46938f42 100644 --- a/include/core/sharedobj.hpp +++ b/include/core/sharedobj.hpp @@ -45,6 +45,8 @@ SharedObject &vstdlib(); SharedObject &tier0(); SharedObject &inputsystem(); SharedObject &materialsystem(); +SharedObject &filesystem_stdio(); +SharedObject &datacache(); #if ENABLE_VISUALS SharedObject &vguimatsurface(); SharedObject &vgui2(); diff --git a/src/core/interfaces.cpp b/src/core/interfaces.cpp index b9421783..05d2cefe 100644 --- a/src/core/interfaces.cpp +++ b/src/core/interfaces.cpp @@ -51,6 +51,11 @@ CHud *g_CHUD = nullptr; CGameRules *g_pGameRules = nullptr; IEngineVGui *g_IEngineVGui = nullptr; IUniformRandomStream *g_pUniformStream = nullptr; +int *g_PredictionRandomSeed = nullptr; +#if ENABLE_NULL_GRAPHICS +IFileSystem *g_IFileSystem = nullptr; +IMDLCache *g_IMDLCache = nullptr; +#endif template T *BruteforceInterface(std::string name, sharedobj::SharedObject &object, int start = 0) { @@ -162,6 +167,10 @@ void CreateInterfaces() g_pGameRules = *reinterpret_cast(g_pGameRules_sig + 8); } g_IMaterialSystem = BruteforceInterface("VMaterialSystem", sharedobj::materialsystem()); +#if ENABLE_NULL_GRAPHICS + g_IFileSystem = BruteforceInterface("VFileSystem", sharedobj::filesystem_stdio()); + g_IMDLCache = BruteforceInterface("MDLCache", sharedobj::datacache()); +#endif #if ENABLE_VISUALS g_pUniformStream = **(IUniformRandomStream ***) (gSignatures.GetVstdSignature("A3 ? ? ? ? C3 89 F6") + 0x1); diff --git a/src/core/sharedobj.cpp b/src/core/sharedobj.cpp index a764ef76..9413291e 100644 --- a/src/core/sharedobj.cpp +++ b/src/core/sharedobj.cpp @@ -96,6 +96,8 @@ void LoadAllSharedObjects() tier0().Load(); inputsystem().Load(); materialsystem().Load(); + filesystem_stdio().Load(); + datacache().Load(); #if ENABLE_VISUALS vguimatsurface().Load(); vgui2().Load(); @@ -149,6 +151,17 @@ SharedObject &materialsystem() static SharedObject obj("materialsystem.so", true); return obj; } + +SharedObject &filesystem_stdio() +{ + static SharedObject obj("filesystem_stdio.so", true); + return obj; +} +SharedObject &datacache() +{ + static SharedObject obj("datacache.so", true); + return obj; +} #if ENABLE_VISUALS SharedObject &vguimatsurface() {