From 2e3b4205c0413b6bd34fa0056b66fe900394f119 Mon Sep 17 00:00:00 2001 From: rexx <67599507+r-ex@users.noreply.github.com> Date: Thu, 21 Jul 2022 17:05:19 +0100 Subject: [PATCH] remove streamoverlay hook --- r5dev/rtech/rtech_utils.cpp | 12 ------------ r5dev/rtech/rtech_utils.h | 4 +--- r5dev/tier1/IConVar.cpp | 1 + r5dev/tier1/cvar.cpp | 1 + r5dev/tier1/cvar.h | 1 + r5dev/vgui/vgui_debugpanel.cpp | 6 ++++-- 6 files changed, 8 insertions(+), 17 deletions(-) diff --git a/r5dev/rtech/rtech_utils.cpp b/r5dev/rtech/rtech_utils.cpp index 7baacf75..face9775 100644 --- a/r5dev/rtech/rtech_utils.cpp +++ b/r5dev/rtech/rtech_utils.cpp @@ -654,21 +654,10 @@ RPakLoadedInfo_t* RTech::GetPakLoadedInfo(const char* szPakName) return nullptr; } -#if not defined DEDICATED && defined (GAMEDLL_S3) -void RTech_GetStreamOverlay(const char* mode, char* buf, size_t bufSize) -{ - // call original first to populate the buffer - GetStreamOverlay(mode, buf, bufSize); - - s_StreamOverlayBuf = std::string(buf); -} -#endif - void RTech_Utils_Attach() { #if not defined DEDICATED && defined (GAMEDLL_S3) DetourAttach((LPVOID*)&RTech_CreateDXTexture, &RTech::CreateDXTexture); - DetourAttach((LPVOID*)&GetStreamOverlay, &RTech_GetStreamOverlay); #endif } @@ -676,7 +665,6 @@ void RTech_Utils_Detach() { #if not defined DEDICATED && defined (GAMEDLL_S3) DetourDetach((LPVOID*)&RTech_CreateDXTexture, &RTech::CreateDXTexture); - DetourDetach((LPVOID*)&GetStreamOverlay, &RTech_GetStreamOverlay); #endif } diff --git a/r5dev/rtech/rtech_utils.h b/r5dev/rtech/rtech_utils.h index ea57f867..1e688631 100644 --- a/r5dev/rtech/rtech_utils.h +++ b/r5dev/rtech/rtech_utils.h @@ -452,9 +452,7 @@ inline CMemory p_RTech_CreateDXTexture; inline auto RTech_CreateDXTexture = p_RTech_CreateDXTexture.RCast(); inline CMemory p_GetStreamOverlay; -inline auto GetStreamOverlay = p_GetStreamOverlay.RCast(); - -inline std::string s_StreamOverlayBuf; +inline auto GetStreamOverlay = p_GetStreamOverlay.RCast(); #endif inline RPakLoadedInfo_t* g_pLoadedPakInfo; diff --git a/r5dev/tier1/IConVar.cpp b/r5dev/tier1/IConVar.cpp index 3b89e1f3..90bc5dc2 100644 --- a/r5dev/tier1/IConVar.cpp +++ b/r5dev/tier1/IConVar.cpp @@ -194,6 +194,7 @@ void ConVar::InitShipped(void) const staticProp_no_fade_scalar = g_pCVar->FindVar("staticProp_no_fade_scalar"); staticProp_gather_size_weight = g_pCVar->FindVar("staticProp_gather_size_weight"); stream_overlay = g_pCVar->FindVar("stream_overlay"); + stream_overlay_mode = g_pCVar->FindVar("stream_overlay_mode"); old_gather_props = g_pCVar->FindVar("old_gather_props"); mp_gamemode = g_pCVar->FindVar("mp_gamemode"); hostname = g_pCVar->FindVar("hostname"); diff --git a/r5dev/tier1/cvar.cpp b/r5dev/tier1/cvar.cpp index 042c43bf..04195e61 100644 --- a/r5dev/tier1/cvar.cpp +++ b/r5dev/tier1/cvar.cpp @@ -40,6 +40,7 @@ ConVar* r_drawWorldMeshesDepthOnly = nullptr; ConVar* r_drawWorldMeshesDepthAtTheEnd = nullptr; ConVar* stream_overlay = nullptr; +ConVar* stream_overlay_mode = nullptr; //----------------------------------------------------------------------------- // SERVER | ConVar* ai_ainDumpOnLoad = nullptr; diff --git a/r5dev/tier1/cvar.h b/r5dev/tier1/cvar.h index 59a0af1b..553c6f9c 100644 --- a/r5dev/tier1/cvar.h +++ b/r5dev/tier1/cvar.h @@ -39,6 +39,7 @@ extern ConVar* r_drawWorldMeshesDepthOnly; extern ConVar* r_drawWorldMeshesDepthAtTheEnd; extern ConVar* stream_overlay; +extern ConVar* stream_overlay_mode; //------------------------------------------------------------------------- // SERVER | #ifndef CLIENT_DLL diff --git a/r5dev/vgui/vgui_debugpanel.cpp b/r5dev/vgui/vgui_debugpanel.cpp index b5365aed..5b2e6680 100644 --- a/r5dev/vgui/vgui_debugpanel.cpp +++ b/r5dev/vgui/vgui_debugpanel.cpp @@ -218,11 +218,13 @@ void CLogSystem::DrawCrosshairMaterial(void) const void CLogSystem::DrawStreamOverlay(void) const { - std::string buf = s_StreamOverlayBuf; + char buf[4096]{}; + + GetStreamOverlay(stream_overlay_mode->GetString(), buf, sizeof(buf)); static Color c = { 255, 255, 255, 255 }; - CMatSystemSurface_DrawColoredText(g_pMatSystemSurface, v_Rui_GetFontFace(), m_nFontHeight, 20, 300, c.r(), c.g(), c.b(), c.a(), (char*)buf.c_str()); + CMatSystemSurface_DrawColoredText(g_pMatSystemSurface, v_Rui_GetFontFace(), m_nFontHeight, 20, 300, c.r(), c.g(), c.b(), c.a(), buf); } //-----------------------------------------------------------------------------