Don't cache replay_enable value when evaling whether to use FileExists hook.

Speculative fix for #1581
This commit is contained in:
Nick Hastings 2021-10-23 12:16:48 -04:00 committed by Nicholas Hastings
parent 636161e183
commit f9309c83d2
2 changed files with 7 additions and 6 deletions

View File

@ -65,6 +65,9 @@ SH_DECL_HOOK2_void(INetChannel, ProcessPacket, SH_NOATTRIB, 0, struct netpacket_
SourceHook::CallClass<IBaseFileSystem> *basefilesystemPatch = NULL; SourceHook::CallClass<IBaseFileSystem> *basefilesystemPatch = NULL;
CHookManager::CHookManager() CHookManager::CHookManager()
#if SOURCE_ENGINE == SE_TF2
: replay_enabled("replay_enabled", false)
#endif
{ {
m_usercmdsFwd = NULL; m_usercmdsFwd = NULL;
m_usercmdsPostFwd = NULL; m_usercmdsPostFwd = NULL;
@ -188,10 +191,6 @@ void CHookManager::Shutdown()
void CHookManager::OnMapStart() void CHookManager::OnMapStart()
{ {
m_bFSTranHookWarned = false; m_bFSTranHookWarned = false;
#if SOURCE_ENGINE == SE_TF2
static ConVarRef replay_enable("replay_enable");
m_bReplayEnabled = replay_enable.GetBool();
#endif
} }
void CHookManager::OnClientConnect(int client) void CHookManager::OnClientConnect(int client)
@ -410,7 +409,7 @@ void CHookManager::NetChannelHook(int client)
/* Initial Hook */ /* Initial Hook */
#if SOURCE_ENGINE == SE_TF2 #if SOURCE_ENGINE == SE_TF2
if (m_bReplayEnabled) if (replay_enabled.GetBool())
{ {
if (!m_bFSTranHookWarned) if (!m_bFSTranHookWarned)
{ {

View File

@ -89,7 +89,9 @@ private:
#endif #endif
INetChannel *m_pActiveNetChannel; INetChannel *m_pActiveNetChannel;
bool m_bFSTranHookWarned = false; bool m_bFSTranHookWarned = false;
bool m_bReplayEnabled = false; #if SOURCE_ENGINE == SE_TF2
ConVarRef replay_enabled;
#endif
}; };
extern CHookManager g_Hooks; extern CHookManager g_Hooks;