r5sdk/r5dev/rtech/rui/rui.cpp
Kawe Mazidjatari 609d705a0c Tier1: static construction of ConVar objects during link time
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.
2024-04-05 18:13:32 +02:00

32 lines
924 B
C++

//=============================================================================//
//
// Purpose: rUI Utilities
//
//=============================================================================//
#include "core/stdafx.h"
#ifndef DEDICATED
#include "rui.h"
#include "tier1/cvar.h"
static ConVar rui_drawEnable("rui_drawEnable", "1", FCVAR_RELEASE, "Draws the RUI if set", false, 0.f, false, 0.f, "1 = draw; 0 (zero) = no draw");
//-----------------------------------------------------------------------------
// Purpose: draw RUI frame
//-----------------------------------------------------------------------------
bool __fastcall Rui_Draw(__int64* a1, __m128* a2, const __m128i* a3, __int64 a4, __m128* a5)
{
if (!rui_drawEnable.GetBool())
return false;
return v_Rui_Draw(a1, a2, a3, a4, a5);
}
void V_Rui::Detour(const bool bAttach) const
{
DetourSetup(&v_Rui_Draw, &Rui_Draw, bAttach);
}
#endif // !DEDICATED