From abacd1c284aaaf3a8e8ef60af567d5a4a61a4510 Mon Sep 17 00:00:00 2001 From: Diavolo Date: Sat, 18 Jun 2022 19:42:56 +0200 Subject: [PATCH] [General] Name the last two remaining used dvar flags --- src/Components/Modules/Branding.cpp | 2 +- src/Components/Modules/Dvar.cpp | 6 +++--- src/Components/Modules/Gamepad.cpp | 4 ++-- src/Components/Modules/Maps.cpp | 4 ++-- src/Components/Modules/News.cpp | 2 +- src/Components/Modules/Party.cpp | 4 ++-- src/Components/Modules/Security.cpp | 4 ++-- src/Components/Modules/StartupMessages.cpp | 6 +++--- src/Game/Structs.hpp | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Components/Modules/Branding.cpp b/src/Components/Modules/Branding.cpp index 605d0fdf..c0f61cab 100644 --- a/src/Components/Modules/Branding.cpp +++ b/src/Components/Modules/Branding.cpp @@ -75,7 +75,7 @@ namespace Components [[maybe_unused]] float y, float min, float max, [[maybe_unused]] int flags, const char* description) { return Game::Dvar_RegisterVec2(dvarName, -60.0f, - 474.0f, min, max, Game::dvar_flag::DVAR_READONLY, description); + 474.0f, min, max, Game::dvar_flag::DVAR_ROM, description); } void Branding::RegisterBrandingDvars() diff --git a/src/Components/Modules/Dvar.cpp b/src/Components/Modules/Dvar.cpp index bd8506b8..bb29d9fb 100644 --- a/src/Components/Modules/Dvar.cpp +++ b/src/Components/Modules/Dvar.cpp @@ -328,7 +328,7 @@ namespace Components Utils::Hook::Xor(0x4F9992, Game::dvar_flag::DVAR_ARCHIVE); // remove write protection from fs_game - Utils::Hook::Xor(0x6431EA, Game::dvar_flag::DVAR_WRITEPROTECTED); + Utils::Hook::Xor(0x6431EA, Game::dvar_flag::DVAR_INIT); // set cg_fov max to 160.0 // because that's the max on SP @@ -349,8 +349,8 @@ namespace Components Utils::Hook(0x40531C, Dvar::Dvar_RegisterName, HOOK_CALL).install()->quick(); // un-cheat safeArea_* and add archive flags - Utils::Hook::Xor(0x42E3F5, Game::dvar_flag::DVAR_READONLY | Game::dvar_flag::DVAR_ARCHIVE); //safeArea_adjusted_horizontal - Utils::Hook::Xor(0x42E423, Game::dvar_flag::DVAR_READONLY | Game::dvar_flag::DVAR_ARCHIVE); //safeArea_adjusted_vertical + Utils::Hook::Xor(0x42E3F5, Game::dvar_flag::DVAR_ROM | Game::dvar_flag::DVAR_ARCHIVE); //safeArea_adjusted_horizontal + Utils::Hook::Xor(0x42E423, Game::dvar_flag::DVAR_ROM | Game::dvar_flag::DVAR_ARCHIVE); //safeArea_adjusted_vertical Utils::Hook::Xor(0x42E398, Game::dvar_flag::DVAR_CHEAT | Game::dvar_flag::DVAR_ARCHIVE); //safeArea_horizontal Utils::Hook::Xor(0x42E3C4, Game::dvar_flag::DVAR_CHEAT | Game::dvar_flag::DVAR_ARCHIVE); //safeArea_vertical diff --git a/src/Components/Modules/Gamepad.cpp b/src/Components/Modules/Gamepad.cpp index a951bd85..ad3ab9d0 100644 --- a/src/Components/Modules/Gamepad.cpp +++ b/src/Components/Modules/Gamepad.cpp @@ -1711,8 +1711,8 @@ namespace Components { gpad_enabled = Dvar::Register("gpad_enabled", false, Game::DVAR_ARCHIVE, "Game pad enabled"); gpad_debug = Dvar::Register("gpad_debug", false, Game::DVAR_NONE, "Game pad debugging"); - gpad_present = Dvar::Register("gpad_present", false, Game::DVAR_READONLY, "Game pad present"); - gpad_in_use = Dvar::Register("gpad_in_use", false, Game::DVAR_READONLY, "A game pad is in use"); + gpad_present = Dvar::Register("gpad_present", false, Game::DVAR_ROM, "Game pad present"); + gpad_in_use = Dvar::Register("gpad_in_use", false, Game::DVAR_ROM, "A game pad is in use"); gpad_style = Dvar::Register("gpad_style", false, Game::DVAR_ARCHIVE, "Switch between Xbox and PS HUD"); gpad_sticksConfig = Dvar::Register("gpad_sticksConfig", "", Game::DVAR_ARCHIVE, "Game pad stick configuration"); gpad_buttonConfig = Dvar::Register("gpad_buttonConfig", "", Game::DVAR_ARCHIVE, "Game pad button configuration"); diff --git a/src/Components/Modules/Maps.cpp b/src/Components/Modules/Maps.cpp index cb4cf148..a68966f8 100644 --- a/src/Components/Modules/Maps.cpp +++ b/src/Components/Modules/Maps.cpp @@ -546,7 +546,7 @@ namespace Components } } - Dvar::Register(Utils::String::VA("isDlcInstalled_%d", dlc.index), false, Game::DVAR_EXTERNAL | Game::DVAR_WRITEPROTECTED, ""); + Dvar::Register(Utils::String::VA("isDlcInstalled_%d", dlc.index), false, Game::DVAR_EXTERNAL | Game::DVAR_INIT, ""); Maps::DlcPacks.push_back(dlc); Maps::UpdateDlcStatus(); @@ -776,7 +776,7 @@ namespace Components { Scheduler::Once([] { - Dvar::Register("isDlcInstalled_All", false, Game::DVAR_EXTERNAL | Game::DVAR_WRITEPROTECTED, ""); + Dvar::Register("isDlcInstalled_All", false, Game::DVAR_EXTERNAL | Game::DVAR_INIT, ""); Maps::RListSModels = Dvar::Register("r_listSModels", false, Game::DVAR_NONE, "Display a list of visible SModels"); Maps::AddDlc({ 1, "Stimulus Pack", {"mp_complex", "mp_compact", "mp_storm", "mp_overgrown", "mp_crash"} }); diff --git a/src/Components/Modules/News.cpp b/src/Components/Modules/News.cpp index 57791c46..7ac977fe 100644 --- a/src/Components/Modules/News.cpp +++ b/src/Components/Modules/News.cpp @@ -41,7 +41,7 @@ namespace Components Dvar::Register("g_firstLaunch", true, Game::DVAR_ARCHIVE, ""); - Dvar::Register("cl_updateoldversion", REVISION, REVISION, REVISION, Game::DVAR_WRITEPROTECTED, "Current version number."); + Dvar::Register("cl_updateoldversion", REVISION, REVISION, REVISION, Game::DVAR_INIT, "Current version number."); UIScript::Add("checkFirstLaunch", [](UIScript::Token) { diff --git a/src/Components/Modules/Party.cpp b/src/Components/Modules/Party.cpp index 7d1e2d64..7f293e4f 100644 --- a/src/Components/Modules/Party.cpp +++ b/src/Components/Modules/Party.cpp @@ -78,7 +78,7 @@ namespace Components Game::dvar_t* Party::RegisterMinPlayers(const char* name, int /*value*/, int /*min*/, int max, Game::dvar_flag flag, const char* description) { - return Dvar::Register(name, 1, 1, max, Game::dvar_flag::DVAR_WRITEPROTECTED | flag, description).get(); + return Dvar::Register(name, 1, 1, max, Game::dvar_flag::DVAR_INIT | flag, description).get(); } bool Party::PlaylistAwaiting() @@ -155,7 +155,7 @@ namespace Components Party::Party() { Party::PartyEnable = Dvar::Register("party_enable", Dedicated::IsEnabled(), Game::dvar_flag::DVAR_NONE, "Enable party system"); - Dvar::Register("xblive_privatematch", true, Game::dvar_flag::DVAR_WRITEPROTECTED, ""); + Dvar::Register("xblive_privatematch", true, Game::dvar_flag::DVAR_INIT, ""); // various changes to SV_DirectConnect-y stuff to allow non-party joinees Utils::Hook::Set(0x460D96, 0x90E9); diff --git a/src/Components/Modules/Security.cpp b/src/Components/Modules/Security.cpp index 8be9579f..370d467e 100644 --- a/src/Components/Modules/Security.cpp +++ b/src/Components/Modules/Security.cpp @@ -61,8 +61,8 @@ namespace Components return; } - constexpr auto disallowedFlags = (Game::DVAR_CHEAT | Game::DVAR_WRITEPROTECTED - | Game::DVAR_READONLY | Game::DVAR_EXTERNAL | Game::DVAR_LATCH); + constexpr auto disallowedFlags = (Game::DVAR_CHEAT | Game::DVAR_INIT + | Game::DVAR_ROM | Game::DVAR_EXTERNAL | Game::DVAR_LATCH); // If it's a dvar check that it does not have disallowed flags if ((dvar->flags & disallowedFlags) != 0) diff --git a/src/Components/Modules/StartupMessages.cpp b/src/Components/Modules/StartupMessages.cpp index 6e8fac3d..0d52cf51 100644 --- a/src/Components/Modules/StartupMessages.cpp +++ b/src/Components/Modules/StartupMessages.cpp @@ -9,9 +9,9 @@ namespace Components { Scheduler::Once([] { - Dvar::Register("ui_startupMessage", "", Game::DVAR_EXTERNAL | Game::DVAR_WRITEPROTECTED, ""); - Dvar::Register("ui_startupMessageTitle", "", Game::DVAR_EXTERNAL | Game::DVAR_WRITEPROTECTED, ""); - Dvar::Register("ui_startupNextButtonText", "", Game::DVAR_EXTERNAL | Game::DVAR_WRITEPROTECTED, ""); + Dvar::Register("ui_startupMessage", "", Game::DVAR_EXTERNAL | Game::DVAR_INIT, ""); + Dvar::Register("ui_startupMessageTitle", "", Game::DVAR_EXTERNAL | Game::DVAR_INIT, ""); + Dvar::Register("ui_startupNextButtonText", "", Game::DVAR_EXTERNAL | Game::DVAR_INIT, ""); }, Scheduler::Pipeline::MAIN); UIScript::Add("nextStartupMessage", [](UIScript::Token) diff --git a/src/Game/Structs.hpp b/src/Game/Structs.hpp index 135e4d02..3f7de5c0 100644 --- a/src/Game/Structs.hpp +++ b/src/Game/Structs.hpp @@ -148,9 +148,9 @@ namespace Game DVAR_EXTERNAL = 1 << 8, // Created by a set command DVAR_USERINFO = 1 << 9, // Sent to server on connect or change DVAR_SERVERINFO = 1 << 10, // Sent in response to front end requests - DVAR_WRITEPROTECTED = 1 << 11, + DVAR_INIT = 1 << 11, // Don't allow change from console at all DVAR_SYSTEMINFO = 1 << 12, // Will be duplicated on all clients - DVAR_READONLY = 1 << 13, // Read only (same as DVAR_WRITEPROTECTED?) + DVAR_ROM = 1 << 13, // Display only, cannot be set by user at all DVAR_SAVED = 1 << 14, DVAR_AUTOEXEC = 1 << 15, // isLoadingAutoExecGlobalFlag is always false so it should be never set by the game };