Fix OnStopRecording forward not firing
We check if the demorecorder IsRecording a demo before calling the forward to prevent it from being called while the sourcetv server doesn't record. Need to pre hook StopRecording instead of post, to still be able to check that.
This commit is contained in:
parent
bbf7818776
commit
db1d080b4a
19
forwards.cpp
19
forwards.cpp
@ -131,7 +131,7 @@ void CForwardManager::HookRecorder(IDemoRecorder *recorder)
|
||||
{
|
||||
#ifdef WIN32
|
||||
SH_ADD_HOOK(IDemoRecorder, StartRecording, recorder, SH_MEMBER(this, &CForwardManager::OnStartRecording_Post), true);
|
||||
SH_ADD_HOOK(IDemoRecorder, StopRecording, recorder, SH_MEMBER(this, &CForwardManager::OnStopRecording_Post), true);
|
||||
SH_ADD_HOOK(IDemoRecorder, StopRecording, recorder, SH_MEMBER(this, &CForwardManager::OnStopRecording), false);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ void CForwardManager::UnhookRecorder(IDemoRecorder *recorder)
|
||||
{
|
||||
#ifdef WIN32
|
||||
SH_REMOVE_HOOK(IDemoRecorder, StartRecording, recorder, SH_MEMBER(this, &CForwardManager::OnStartRecording_Post), true);
|
||||
SH_REMOVE_HOOK(IDemoRecorder, StopRecording, recorder, SH_MEMBER(this, &CForwardManager::OnStopRecording_Post), true);
|
||||
SH_REMOVE_HOOK(IDemoRecorder, StopRecording, recorder, SH_MEMBER(this, &CForwardManager::OnStopRecording), false);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -384,9 +384,9 @@ void CForwardManager::OnStartRecording_Post(const char *filename, bool bContinuo
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
void CForwardManager::OnStopRecording_Post(CGameInfo const *info)
|
||||
void CForwardManager::OnStopRecording(CGameInfo const *info)
|
||||
#else
|
||||
void CForwardManager::OnStopRecording_Post()
|
||||
void CForwardManager::OnStopRecording()
|
||||
#endif
|
||||
{
|
||||
IDemoRecorder *recorder = META_IFACEPTR(IDemoRecorder);
|
||||
@ -447,15 +447,14 @@ DETOUR_DECL_MEMBER1(DetourHLTVStopRecording, void, CGameInfo const *, info)
|
||||
DETOUR_DECL_MEMBER0(DetourHLTVStopRecording, void)
|
||||
#endif
|
||||
{
|
||||
// Call the original first.
|
||||
IDemoRecorder *recorder = (IDemoRecorder *)this;
|
||||
g_pSTVForwards.CallOnStopRecording(recorder);
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
DETOUR_MEMBER_CALL(DetourHLTVStopRecording)(info);
|
||||
#else
|
||||
DETOUR_MEMBER_CALL(DetourHLTVStopRecording)();
|
||||
#endif
|
||||
|
||||
IDemoRecorder *recorder = (IDemoRecorder *)this;
|
||||
g_pSTVForwards.CallOnStopRecording(recorder);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CForwardManager::CreateStartRecordingDetour()
|
||||
@ -498,7 +497,7 @@ bool CForwardManager::CreateStopRecordingDetour()
|
||||
m_bStopRecordingDetoured = true;
|
||||
return true;
|
||||
}
|
||||
smutils->LogError(myself, "CHLTVDemoRecorder::StartRecording detour could not be initialized.");
|
||||
smutils->LogError(myself, "CHLTVDemoRecorder::StopRecording detour could not be initialized.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -89,10 +89,10 @@ private:
|
||||
private:
|
||||
void OnStartRecording_Post(const char *filename, bool bContinuously);
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
void OnStopRecording_Post(CGameInfo const *info);
|
||||
void OnStopRecording(CGameInfo const *info);
|
||||
IClient *OnSpectatorConnect(const netadr_t & address, int nProtocol, int iChallenge, int nAuthProtocol, const char *pchName, const char *pchPassword, const char *pCookie, int cbCookie, CUtlVector<NetMsg_SplitPlayerConnect *> &pSplitPlayerConnectVector, bool bUnknown, CrossPlayPlatform_t platform, const unsigned char *pUnknown, int iUnknown);
|
||||
#else
|
||||
void OnStopRecording_Post();
|
||||
void OnStopRecording();
|
||||
IClient *OnSpectatorConnect(netadr_t &address, int nProtocol, int iChallenge, int iClientChallenge, int nAuthProtocol, const char *pchName, const char *pchPassword, const char *pCookie, int cbCookie);
|
||||
#endif
|
||||
void OnSpectatorDisconnect(const char *reason);
|
||||
|
Loading…
Reference in New Issue
Block a user