Don't enable FileExists hook (SendFile forward) on TF2 servers with Replay. (#512)
It will crash. See PR #493 for details.
This commit is contained in:
parent
57c6e09fcf
commit
5edc46c994
@ -313,6 +313,7 @@ void SDKTools::OnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax
|
||||
{
|
||||
InitTeamNatives();
|
||||
GetResourceEntity();
|
||||
g_Hooks.OnMapStart();
|
||||
}
|
||||
|
||||
bool SDKTools::QueryRunning(char *error, size_t maxlength)
|
||||
|
@ -111,6 +111,15 @@ void CHookManager::Shutdown()
|
||||
sharesys->DropCapabilityProvider(myself, this, FEATURECAP_PLAYERRUNCMD_11PARAMS);
|
||||
}
|
||||
|
||||
void CHookManager::OnMapStart()
|
||||
{
|
||||
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)
|
||||
{
|
||||
NetChannelHook(client);
|
||||
@ -238,6 +247,17 @@ void CHookManager::NetChannelHook(int client)
|
||||
size_t iter;
|
||||
|
||||
/* Initial Hook */
|
||||
#if SOURCE_ENGINE == SE_TF2
|
||||
if (m_bReplayEnabled)
|
||||
{
|
||||
if (!m_bFSTranHookWarned)
|
||||
{
|
||||
g_pSM->LogError(myself, "OnFileSend hooks are not currently working on TF2 servers with Replay enabled.");
|
||||
m_bFSTranHookWarned = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (!m_netChannelHooks.length())
|
||||
{
|
||||
CVTableHook filehook(basefilesystem);
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
void OnClientConnect(int client);
|
||||
void OnClientPutInServer(int client);
|
||||
void PlayerRunCmd(CUserCmd *ucmd, IMoveHelper *moveHelper);
|
||||
void OnMapStart();
|
||||
public: /* NetChannel/Related Hooks */
|
||||
bool FileExists(const char *filename, const char *pathID);
|
||||
#if SOURCE_ENGINE >= SE_ALIENSWARM || SOURCE_ENGINE == SE_LEFT4DEAD || SOURCE_ENGINE == SE_LEFT4DEAD2
|
||||
@ -75,6 +76,8 @@ private:
|
||||
ke::Vector<CVTableHook *> m_runUserCmdHooks;
|
||||
ke::Vector<CVTableHook *> m_netChannelHooks;
|
||||
INetChannel *m_pActiveNetChannel;
|
||||
bool m_bFSTranHookWarned = false;
|
||||
bool m_bReplayEnabled = false;
|
||||
};
|
||||
|
||||
extern CHookManager g_Hooks;
|
||||
|
Loading…
Reference in New Issue
Block a user