aboutsummaryrefslogtreecommitdiff
path: root/primedev/client/clientruihooks.cpp
blob: e49e6f63ae2d8c490dad248c83275cfd0b567cba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "core/convar/convar.h"

ConVar* Cvar_rui_drawEnable;

static bool (*__fastcall o_pDrawRUIFunc)(void* a1, float* a2) = nullptr;
static bool __fastcall h_DrawRUIFunc(void* a1, float* a2)
{
	if (!Cvar_rui_drawEnable->GetBool())
		return 0;

	return o_pDrawRUIFunc(a1, a2);
}

ON_DLL_LOAD_CLIENT_RELIESON("engine.dll", RUI, ConVar, (CModule module))
{
	o_pDrawRUIFunc = module.Offset(0xFC500).RCast<decltype(o_pDrawRUIFunc)>();
	HookAttach(&(PVOID&)o_pDrawRUIFunc, (PVOID)h_DrawRUIFunc);

	Cvar_rui_drawEnable = new ConVar("rui_drawEnable", "1", FCVAR_CLIENTDLL, "Controls whether RUI should be drawn");
}