diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-11-27 01:35:22 +0000 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-11-27 01:35:22 +0000 |
commit | f66ea9ce2af44a00e49e6defaa7ec6ef4f100bb4 (patch) | |
tree | fce15e55515c16ba5f1884545643ae45e52c6e7f /NorthstarDedicatedTest/convar.cpp | |
parent | 3d3d2c2a13a292a9093ad3029563a1c543a07ab7 (diff) | |
download | NorthstarLauncher-f66ea9ce2af44a00e49e6defaa7ec6ef4f100bb4.tar.gz NorthstarLauncher-f66ea9ce2af44a00e49e6defaa7ec6ef4f100bb4.zip |
more masterserver stuff and support for devonly/hidden cvars
Diffstat (limited to 'NorthstarDedicatedTest/convar.cpp')
-rw-r--r-- | NorthstarDedicatedTest/convar.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/convar.cpp b/NorthstarDedicatedTest/convar.cpp index 156301b6..ed7e8dac 100644 --- a/NorthstarDedicatedTest/convar.cpp +++ b/NorthstarDedicatedTest/convar.cpp @@ -1,5 +1,7 @@ #include "pch.h" #include "convar.h" +#include "hookutils.h" +#include "gameutils.h" #include <set> // should this be in modmanager? @@ -7,6 +9,8 @@ std::unordered_map<std::string, ConVar*> g_CustomConvars; // this is used in mod typedef void(*ConVarConstructorType)(ConVar* newVar, const char* name, const char* defaultValue, int flags, const char* helpString); ConVarConstructorType conVarConstructor; +typedef bool(*CvarIsFlagSetType)(ConVar* self, int flags); +CvarIsFlagSetType CvarIsFlagSet; ConVar* RegisterConVar(const char* name, const char* defaultValue, int flags, const char* helpString) { @@ -21,7 +25,19 @@ ConVar* RegisterConVar(const char* name, const char* defaultValue, int flags, co return newVar; } +bool CvarIsFlagSetHook(ConVar* self, int flags) +{ + // unrestrict FCVAR_DEVELOPMENTONLY and FCVAR_HIDDEN + if (self && flags == FCVAR_DEVELOPMENTONLY || flags == FCVAR_HIDDEN) + return false; + + return CvarIsFlagSet(self, flags); +} + void InitialiseConVars(HMODULE baseAddress) { conVarConstructor = (ConVarConstructorType)((char*)baseAddress + 0x416200); + + HookEnabler hook; + ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x417FA0, &CvarIsFlagSetHook, reinterpret_cast<LPVOID*>(&CvarIsFlagSet)); }
\ No newline at end of file |