Only compile signature results in dev mode

This commit is contained in:
Kawe Mazidjatari 2023-10-15 10:32:35 +02:00
parent 0eddec2473
commit 6b344ad52f
2 changed files with 27 additions and 6 deletions

View File

@ -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
{

View File

@ -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);
}
}