From 7fb0e7bf2381c705f7a671977aef7d05379e6c16 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Sat, 15 Oct 2016 16:59:04 -0600 Subject: [PATCH] Fix getting IDemoRecorder in CS:GO linux --- hltvserverwrapper.cpp | 9 ++++++++- sourcetvmanager.games.txt | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/hltvserverwrapper.cpp b/hltvserverwrapper.cpp index 781d86b..462dd2d 100644 --- a/hltvserverwrapper.cpp +++ b/hltvserverwrapper.cpp @@ -430,13 +430,20 @@ IDemoRecorder *HLTVServerWrapperManager::GetDemoRecorderPtr(IHLTVServer *hltv) } *(int **)&offset = (int *)addr; + + // See if we have to subtract something from the offset. + int baseOffset = 0; + if (g_pGameConf->GetOffset("CHLTVDemoRecorder_BaseOffset", &baseOffset)) + { + offset -= baseOffset; + } } if (hltv) { IServer *baseServer = hltv->GetBaseServer(); #ifndef WIN32 - return (IDemoRecorder *)((intptr_t)baseServer + offset - 4); + return (IDemoRecorder *)((intptr_t)baseServer + offset); #else #if SOURCE_ENGINE == SE_CSGO return (IDemoRecorder *)((intptr_t)hltv + offset); diff --git a/sourcetvmanager.games.txt b/sourcetvmanager.games.txt index b3505b9..f1483fc 100644 --- a/sourcetvmanager.games.txt +++ b/sourcetvmanager.games.txt @@ -91,6 +91,11 @@ "windows" "52" "linux" "52" } + "CHLTVDemoRecorder_BaseOffset" + { + "windows" "0" + "linux" "12" + } } "Signatures" { @@ -245,6 +250,11 @@ "windows" "40" "linux" "40" } + "CHLTVDemoRecorder_BaseOffset" + { + "windows" "0" + "linux" "4" + } } "Signatures" {