diff --git a/forwards.h b/forwards.h index 85ff809..8829af1 100644 --- a/forwards.h +++ b/forwards.h @@ -66,8 +66,8 @@ public: void HookRecorder(IDemoRecorder *recorder); void UnhookRecorder(IDemoRecorder *recorder); - void HookServer(IServer *server); - void UnhookServer(IServer *server); + void HookServer(HLTVServerWrapper *server); + void UnhookServer(HLTVServerWrapper *server); void CallOnServerStart(IHLTVServer *server); void CallOnServerShutdown(IHLTVServer *server); @@ -110,4 +110,4 @@ private: extern CForwardManager g_pSTVForwards; -#endif // _INCLUDE_SOURCEMOD_EXTENSION_FORWARDS_H_ \ No newline at end of file +#endif // _INCLUDE_SOURCEMOD_EXTENSION_FORWARDS_H_ diff --git a/hltvserverwrapper.cpp b/hltvserverwrapper.cpp index f2c25ef..532d21a 100644 --- a/hltvserverwrapper.cpp +++ b/hltvserverwrapper.cpp @@ -93,7 +93,8 @@ void HLTVServerWrapper::Hook() return; g_pSTVForwards.HookServer(this); - g_pSTVForwards.HookRecorder(m_DemoRecorder); + if (m_DemoRecorder) + g_pSTVForwards.HookRecorder(m_DemoRecorder); if (g_HLTVServers.HasShutdownOffset()) SH_ADD_MANUALHOOK(CHLTVServer_Shutdown, m_HLTVServer->GetBaseServer(), SH_MEMBER(this, &HLTVServerWrapper::OnHLTVServerShutdown), false); @@ -118,7 +119,8 @@ void HLTVServerWrapper::Unhook() return; g_pSTVForwards.UnhookServer(this); - g_pSTVForwards.UnhookRecorder(m_DemoRecorder); + if (m_DemoRecorder) + g_pSTVForwards.UnhookRecorder(m_DemoRecorder); if (g_HLTVServers.HasShutdownOffset()) SH_REMOVE_MANUALHOOK(CHLTVServer_Shutdown, m_HLTVServer->GetBaseServer(), SH_MEMBER(this, &HLTVServerWrapper::OnHLTVServerShutdown), false); @@ -359,8 +361,12 @@ IDemoRecorder *HLTVServerWrapperManager::GetDemoRecorderPtr(IHLTVServer *hltv) return (IDemoRecorder *)((intptr_t)hltv + offset); #else IServer *baseServer = hltv->GetBaseServer(); +#ifndef WIN32 + return (IDemoRecorder *)((intptr_t)baseServer + offset - 4); +#else return (IDemoRecorder *)((intptr_t)baseServer + offset); -#endif +#endif // WIN32 +#endif // SOURCE_ENGINE == SE_CSGO } else { @@ -391,4 +397,4 @@ bool HLTVServerWrapperManager::OnHLTVBotNetChanSendNetMsg(INetMessage &msg, bool } #endif -HLTVServerWrapperManager g_HLTVServers; \ No newline at end of file +HLTVServerWrapperManager g_HLTVServers;