From 6b344ad52ff64ee45df57399c1a115e671ef5ca1 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 15 Oct 2023 10:32:35 +0200 Subject: [PATCH] Only compile signature results in dev mode --- src/core/init.cpp | 9 ++++++--- src/tier0/tier0_iface.cpp | 24 +++++++++++++++++++++--- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/core/init.cpp b/src/core/init.cpp index 8aeb249c..f8928046 100644 --- a/src/core/init.cpp +++ b/src/core/init.cpp @@ -397,20 +397,23 @@ void CheckCPU() // Respawn's engine and our SDK utilize POPCNT, SSE3 and SSSE3 ( void DetourInit() // Run the sigscan { - const bool bLogAdr = CommandLine()->CheckParm("-sig_toconsole") ? true : false; const bool bNoSmap = CommandLine()->CheckParm("-nosmap") ? true : false; + const bool bLogAdr = CommandLine()->CheckParm("-sig_toconsole") ? true : false; bool bInitDivider = false; g_SigCache.SetDisabled(bNoSmap); g_SigCache.LoadCache(SIGDB_FILE); + // No debug logging in non dev builds. + const bool bDevMode = !IsCert() && !IsRetail(); + for (const IDetour* Detour : g_DetourVec) { Detour->GetCon(); // Constants. Detour->GetFun(); // Functions. Detour->GetVar(); // Variables. - if (bLogAdr) + if (bDevMode && bLogAdr) { if (!bInitDivider) { @@ -429,7 +432,7 @@ void DetourInit() // Run the sigscan g_SigCache.WriteCache(SIGDB_FILE); g_SigCache.InvalidateMap(); -} + } void DetourAddress() // Test the sigscan results { diff --git a/src/tier0/tier0_iface.cpp b/src/tier0/tier0_iface.cpp index b08675b6..2eb2cc05 100644 --- a/src/tier0/tier0_iface.cpp +++ b/src/tier0/tier0_iface.cpp @@ -22,13 +22,31 @@ static const char* const s_AdrFmt = "| {:s}: {:42s}: {:#18x} |\n"; void LogFunAdr(const char* const szFun, const uintptr_t nAdr) // Logging function addresses. { - spdlog::debug(s_AdrFmt, "FUN", szFun, nAdr); + if (!IsCert() && !IsRetail()) + spdlog::debug(s_AdrFmt, "FUN", szFun, nAdr); + else + { + NOTE_UNUSED(szFun); + NOTE_UNUSED(nAdr); + } } void LogVarAdr(const char* const szVar, const uintptr_t nAdr) // Logging variable addresses. { - spdlog::debug(s_AdrFmt, "VAR", szVar, nAdr); + if (!IsCert() && !IsRetail()) + spdlog::debug(s_AdrFmt, "VAR", szVar, nAdr); + else + { + NOTE_UNUSED(szVar); + NOTE_UNUSED(nAdr); + } } void LogConAdr(const char* const szCon, const uintptr_t nAdr) // Logging constant addresses. { - spdlog::debug(s_AdrFmt, "CON", szCon, nAdr); + if (!IsCert() && !IsRetail()) + spdlog::debug(s_AdrFmt, "CON", szCon, nAdr); + else + { + NOTE_UNUSED(szCon); + NOTE_UNUSED(nAdr); + } }