aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/convar.cpp
blob: ca5d8ef3c6667c2518fca4810b81f1a5c71cf51c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "pch.h"
#include "convar.h"
#include <set>

std::set<std::string> g_CustomConvars; // this is used in modloading code to determine whether we've registered a mod convar already

typedef void(*ConVarConstructorType)(ConVar* newVar, const char* name, const char* defaultValue, int flags, const char* helpString);
ConVarConstructorType conVarConstructor;

ConVar* RegisterConVar(const char* name, const char* defaultValue, int flags, const char* helpString)
{
	spdlog::info("Registering Convar {}", name);

	// no need to free this ever really, it should exist as long as game does
	ConVar* newVar = new ConVar;
	conVarConstructor(newVar, name, defaultValue, flags, helpString);

	g_CustomConvars.insert(name);

	return newVar;
}

void InitialiseConVars(HMODULE baseAddress)
{
	conVarConstructor = (ConVarConstructorType)((char*)baseAddress + 0x416200);
}