From ed77a516d8061db848329072c70fa6b3d910027c Mon Sep 17 00:00:00 2001 From: BobTheBob9 Date: Sat, 8 Oct 2022 15:14:46 +0100 Subject: improve cvar flag fixup and remove temp thing from findflags --- NorthstarDLL/misccommands.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'NorthstarDLL/misccommands.cpp') 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(); + + 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> 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> 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); -- cgit v1.2.3