Add IMDLCache and IFileSystem interfaces

This commit is contained in:
TotallyNotElite 2019-03-17 18:37:40 +01:00
parent 171a3815b8
commit 2658ad6a51
4 changed files with 31 additions and 0 deletions

View File

@ -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();

View File

@ -45,6 +45,8 @@ SharedObject &vstdlib();
SharedObject &tier0();
SharedObject &inputsystem();
SharedObject &materialsystem();
SharedObject &filesystem_stdio();
SharedObject &datacache();
#if ENABLE_VISUALS
SharedObject &vguimatsurface();
SharedObject &vgui2();

View File

@ -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 <typename T> T *BruteforceInterface(std::string name, sharedobj::SharedObject &object, int start = 0)
{
@ -162,6 +167,10 @@ void CreateInterfaces()
g_pGameRules = *reinterpret_cast<CGameRules **>(g_pGameRules_sig + 8);
}
g_IMaterialSystem = BruteforceInterface<IMaterialSystemFixed>("VMaterialSystem", sharedobj::materialsystem());
#if ENABLE_NULL_GRAPHICS
g_IFileSystem = BruteforceInterface<IFileSystem>("VFileSystem", sharedobj::filesystem_stdio());
g_IMDLCache = BruteforceInterface<IMDLCache>("MDLCache", sharedobj::datacache());
#endif
#if ENABLE_VISUALS
g_pUniformStream = **(IUniformRandomStream ***) (gSignatures.GetVstdSignature("A3 ? ? ? ? C3 89 F6") + 0x1);

View File

@ -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()
{