interfaces.cpp: always load CGlobalVarsBase* from found pointer

It fixes problem with cathook pointing to invalid CGlobalVarsBase when injected too early (through LD_PRELOAD)
This commit is contained in:
Unnamed 2019-02-14 09:11:31 +00:00 committed by TotallyNotElite
parent 3343fe6c89
commit 8f3b63e61c
2 changed files with 4 additions and 4 deletions

View File

@ -67,7 +67,8 @@ extern IBaseClientDLL *g_IBaseClient;
extern IEngineTrace *g_ITrace;
extern IVModelInfoClient *g_IModelInfo;
extern IInputSystem *g_IInputSystem;
extern CGlobalVarsBase *g_GlobalVars;
extern CGlobalVarsBase **rg_GlobalVars;
#define g_GlobalVars (*rg_GlobalVars)
extern IPrediction *g_IPrediction;
extern IGameMovement *g_IGameMovement;
extern IInput *g_IInput;

View File

@ -31,7 +31,7 @@ IBaseClientDLL *g_IBaseClient = nullptr;
IEngineTrace *g_ITrace = nullptr;
IVModelInfoClient *g_IModelInfo = nullptr;
IInputSystem *g_IInputSystem = nullptr;
CGlobalVarsBase *g_GlobalVars = nullptr;
CGlobalVarsBase **rg_GlobalVars = nullptr;
IPrediction *g_IPrediction = nullptr;
IGameMovement *g_IGameMovement = nullptr;
IInput *g_IInput = nullptr;
@ -127,8 +127,7 @@ void CreateInterfaces()
// FIXME SIGNATURE
g_ISteamFriends = g_ISteamClient->GetISteamFriends(su, sp, "SteamFriends002");
}
// g_GlobalVars = **(reinterpret_cast<CGlobalVarsBase ***>((uintptr_t) 11 + gSignatures.GetClientSignature("55 89 E5 83 EC ? 8B 45 08 8B 15 ? ? ? ? F3 0F 10")));
g_GlobalVars = **reinterpret_cast<CGlobalVarsBase ***>(gSignatures.GetClientSignature("8B 15 ? ? ? ? F3 0F 10 88 D0 08 00 00") + 2);
rg_GlobalVars = *reinterpret_cast<CGlobalVarsBase ***>(gSignatures.GetClientSignature("8B 15 ? ? ? ? F3 0F 10 88 D0 08 00 00") + 2);
g_IPrediction = BruteforceInterface<IPrediction>("VClientPrediction", sharedobj::client());
g_IGameMovement = BruteforceInterface<IGameMovement>("GameMovement", sharedobj::client());
IF_GAME(IsTF2())