mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Fully implemented ConVar class so we could statically construct all SDK convars, this avoids a level of indirection, and allows for creating ConVar's everywhere in the project. This patch also removed the settings tab of the ImGui server browser, as it has threading issues, while it technically never caused a crash yet, it has been removed as there was no point keeping it vs the work required to make it thread save (it only managed 2 convars which are perfectly manageable through cfg's or the in-game console). Also temporarily disabled the creation of ConVar's in the mod system due to a memory leak, we would allocate and register a convar based on details parsed out of a mod file definition, but never unregister and free it.
64 lines
2.2 KiB
C++
64 lines
2.2 KiB
C++
#include "core/stdafx.h"
|
|
#include "miles_impl.h"
|
|
#include "tier0/fasttimer.h"
|
|
#include "tier1/cvar.h"
|
|
|
|
ConVar miles_debug("miles_debug", "0", FCVAR_RELEASE, "Enables debug prints for the Miles Sound System", "1 = print; 0 (zero) = no print");
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose: logs debug output emitted from the Miles Sound System
|
|
// Input : nLogLevel -
|
|
// pszMessage -
|
|
//-----------------------------------------------------------------------------
|
|
void AIL_LogFunc(int64_t nLogLevel, const char* pszMessage)
|
|
{
|
|
Msg(eDLL_T::AUDIO, "%s\n", pszMessage);
|
|
v_AIL_LogFunc(nLogLevel, pszMessage);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose: initializes the miles sound system
|
|
// Output : true on success, false otherwise
|
|
//-----------------------------------------------------------------------------
|
|
bool Miles_Initialize()
|
|
{
|
|
const char* pszLanguage = miles_language->GetString();
|
|
if (!pszLanguage[0])
|
|
{
|
|
pszLanguage = MILES_DEFAULT_LANGUAGE;
|
|
}
|
|
|
|
Msg(eDLL_T::AUDIO, "%s: initializing MSS with language: '%s'\n", __FUNCTION__, pszLanguage);
|
|
CFastTimer initTimer;
|
|
|
|
initTimer.Start();
|
|
bool bResult = v_Miles_Initialize();
|
|
initTimer.End();
|
|
|
|
Msg(eDLL_T::AUDIO, "%s: %s ('%f' seconds)\n", __FUNCTION__, bResult ? "success" : "failure", initTimer.GetDuration().GetSeconds());
|
|
return bResult;
|
|
}
|
|
|
|
void MilesQueueEventRun(Miles::Queue* queue, const char* eventName)
|
|
{
|
|
if(miles_debug.GetBool())
|
|
Msg(eDLL_T::AUDIO, "%s: running event: '%s'\n", __FUNCTION__, eventName);
|
|
|
|
v_MilesQueueEventRun(queue, eventName);
|
|
}
|
|
|
|
void MilesBankPatch(Miles::Bank* bank, char* streamPatch, char* localizedStreamPatch)
|
|
{
|
|
// TODO [REXX]: add print for patch loading when Miles::Bank struct is mapped out a bit better with file name
|
|
v_MilesBankPatch(bank, streamPatch, localizedStreamPatch);
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
void MilesCore::Detour(const bool bAttach) const
|
|
{
|
|
DetourSetup(&v_AIL_LogFunc, &AIL_LogFunc, bAttach);
|
|
DetourSetup(&v_Miles_Initialize, &Miles_Initialize, bAttach);
|
|
DetourSetup(&v_MilesQueueEventRun, &MilesQueueEventRun, bAttach);
|
|
DetourSetup(&v_MilesBankPatch, &MilesBankPatch, bAttach);
|
|
}
|