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.
This commit is contained in:
F1F7Y 2023-10-10 02:28:32 +02:00 committed by GitHub
parent a040bff98c
commit c1745b29ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -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()