From c1745b29ad4cae0279d905265cd3eadf79c46e12 Mon Sep 17 00:00:00 2001 From: F1F7Y <64418963+F1F7Y@users.noreply.github.com> Date: Tue, 10 Oct 2023 02:28:32 +0200 Subject: Add `mileslog_enable` convar (#515) Adds a convar to toggle whether we should log from the miles log func Most of these warnings are warnings about events being starved, in some cases slowing down the game due to the number of log calls. --- NorthstarDLL/client/audio.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/NorthstarDLL/client/audio.cpp b/NorthstarDLL/client/audio.cpp index 9fcac982..66d34404 100644 --- a/NorthstarDLL/client/audio.cpp +++ b/NorthstarDLL/client/audio.cpp @@ -16,6 +16,7 @@ extern "C" extern void* __fastcall Audio_GetParentEvent(); } +ConVar* Cvar_mileslog_enable; ConVar* Cvar_ns_print_played_sounds; CustomAudioManager g_CustomAudioManager; @@ -494,9 +495,17 @@ AUTOHOOK(MilesLog, client.dll + 0x57DAD0, void, __fastcall, (int level, const char* string)) // clang-format on { + if (!Cvar_mileslog_enable->GetBool()) + return; + spdlog::info("[MSS] {} - {}", level, string); } +ON_DLL_LOAD_RELIESON("engine.dll", MilesLogFuncHooks, ConVar, (CModule module)) +{ + Cvar_mileslog_enable = new ConVar("mileslog_enable", "0", FCVAR_NONE, "Enables/disables whether the mileslog func should be logged"); +} + ON_DLL_LOAD_CLIENT_RELIESON("client.dll", AudioHooks, ConVar, (CModule module)) { AUTOHOOK_DISPATCH() -- cgit v1.2.3