aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/misccommands.cpp
diff options
context:
space:
mode:
authorBobTheBob9 <for.oliver.kirkham@gmail.com>2022-10-08 15:14:46 +0100
committerBobTheBob9 <for.oliver.kirkham@gmail.com>2022-10-08 15:14:46 +0100
commited77a516d8061db848329072c70fa6b3d910027c (patch)
tree4f66a0f7c4b2a231bd4f8a505bc03a5cb9643f4b /NorthstarDLL/misccommands.cpp
parent629a66772694e632982a3f86491761438aafd4e7 (diff)
downloadNorthstarLauncher-ed77a516d8061db848329072c70fa6b3d910027c.tar.gz
NorthstarLauncher-ed77a516d8061db848329072c70fa6b3d910027c.zip
improve cvar flag fixup and remove temp thing from findflags
Diffstat (limited to 'NorthstarDLL/misccommands.cpp')
-rw-r--r--NorthstarDLL/misccommands.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/NorthstarDLL/misccommands.cpp b/NorthstarDLL/misccommands.cpp
index f5698448..b316571c 100644
--- a/NorthstarDLL/misccommands.cpp
+++ b/NorthstarDLL/misccommands.cpp
@@ -95,15 +95,24 @@ void FixupCvarFlags()
spdlog::info("Removed {} hidden/devonly cvar flags", iNumCvarsAltered);
}
+ // make all engine client commands FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS
+ // these are usually checked through CGameClient::IsEngineClientCommand, but we get more control over this if we just do it through
+ // cvar flags
+ const char** ppEngineClientCommands = CModule("engine.dll").Offset(0x7C5EF0).As<const char**>();
+
+ int i = 0;
+ do
+ {
+ ConCommandBase* pCommand = R2::g_pCVar->FindCommandBase(ppEngineClientCommands[i]);
+ if (pCommand) // not all the commands in this array actually exist in respawn source
+ pCommand->m_nFlags |= FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS;
+ } while (ppEngineClientCommands[++i]);
+
const std::vector<std::tuple<const char*, uint32_t>> CVAR_FIXUP_ADD_FLAGS = {
// system commands (i.e. necessary for proper functionality)
// servers need to be able to disconnect
{"disconnect", FCVAR_SERVER_CAN_EXECUTE},
- // clients need to be able to run these on server, which will then print the results of them on client
- {"status", FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS},
- {"ping", FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS},
-
// cheat commands
{"give", FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS},
{"give_server", FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS},
@@ -131,8 +140,10 @@ void FixupCvarFlags()
const std::vector<std::tuple<const char*, uint32_t>> CVAR_FIXUP_REMOVE_FLAGS = {
// unsure how this command works, not even sure it's used on retail servers, deffo shouldn't be used on northstar
- {"migrateme", FCVAR_SERVER_CAN_EXECUTE},
- };
+ {"migrateme", FCVAR_SERVER_CAN_EXECUTE | FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS},
+ {"recheck", FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS}, // we don't need this on northstar servers, it's for communities
+ {"rpt_client_enable", FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS},
+ {"rpt_password", FCVAR_GAMEDLL_FOR_REMOTE_CLIENTS}};
for (auto& fixup : CVAR_FIXUP_ADD_FLAGS)
R2::g_pCVar->FindCommandBase(std::get<0>(fixup))->m_nFlags |= std::get<1>(fixup);