Fix OnStartRecording and OnStopRecording forwards on linux

CHLTVServer::StartRecording is called directly in tv_record on linux,
ignoring the vtable.
Add a detour on linux for these two functions, so we always notice when
recording starts.
Windows actually always uses the vtable to get the function address, so
we don't need to detour anything on windows.
This commit is contained in:
Peace-Maker
2016-03-09 23:04:28 +01:00
parent 22c3803718
commit 7c4048690b
7 changed files with 189 additions and 19 deletions
+11
View File
@@ -261,6 +261,11 @@ void HLTVServerWrapperManager::InitHooks()
void HLTVServerWrapperManager::ShutdownHooks()
{
#ifndef WIN32
g_pSTVForwards.RemoveStartRecordingDetour();
g_pSTVForwards.RemoveStopRecordingDetour();
#endif
#if SOURCE_ENGINE != SE_CSGO
if (m_bSendNetMsgHooked)
{
@@ -272,6 +277,12 @@ void HLTVServerWrapperManager::ShutdownHooks()
void HLTVServerWrapperManager::AddServer(IHLTVServer *hltvserver)
{
#ifndef WIN32
// Create the detours once the first sourcetv server is created.
g_pSTVForwards.CreateStartRecordingDetour();
g_pSTVForwards.CreateStopRecordingDetour();
#endif
HLTVServerWrapper *wrapper = new HLTVServerWrapper(hltvserver);
m_HLTVServers.append(wrapper);
}