diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-01-30 03:04:25 +0000 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-01-30 03:04:25 +0000 |
commit | a589bb0082cbae6d326644292179c9427e76e795 (patch) | |
tree | 1a40c5cb171af28a7bcd5c6ec75bcbc855bb0ef4 /NorthstarDedicatedTest/concommand.cpp | |
parent | cd1631d782b1a1e4f6840e3964617bac95814dec (diff) | |
download | NorthstarLauncher-a589bb0082cbae6d326644292179c9427e76e795.tar.gz NorthstarLauncher-a589bb0082cbae6d326644292179c9427e76e795.zip |
add FindConVar and FindConCommand
Diffstat (limited to 'NorthstarDedicatedTest/concommand.cpp')
-rw-r--r-- | NorthstarDedicatedTest/concommand.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/concommand.cpp b/NorthstarDedicatedTest/concommand.cpp index d81796d8..2952e7e7 100644 --- a/NorthstarDedicatedTest/concommand.cpp +++ b/NorthstarDedicatedTest/concommand.cpp @@ -16,6 +16,14 @@ void RegisterConCommand(const char* name, void(*callback)(const CCommand&), cons conCommandConstructor(newCommand, name, callback, helpString, flags, nullptr); } +ConCommand* FindConCommand(const char* name) +{ + ICvar* icvar = *g_pCvar; // hellish call because i couldn't get icvar vtable stuff in convar.h to get the right offset for whatever reason + typedef ConCommand* (*FindCommandBaseType)(ICvar* self, const char* varName); + FindCommandBaseType FindCommandBase = *(FindCommandBaseType*)((*(char**)icvar) + 112); + return FindCommandBase(icvar, name); +} + void InitialiseConCommands(HMODULE baseAddress) { conCommandConstructor = (ConCommandConstructorType)((char*)baseAddress + 0x415F60); |