diff --git a/src/Components/Modules/Dedicated.cpp b/src/Components/Modules/Dedicated.cpp index 3ebd4b6b..d7b7d4d7 100644 --- a/src/Components/Modules/Dedicated.cpp +++ b/src/Components/Modules/Dedicated.cpp @@ -144,11 +144,6 @@ namespace Components Network::SendCommand(master, "heartbeat", "IW4"); } - Game::dvar_t* Dedicated::Dvar_RegisterSVNetworkFps(const char* dvarName, int, int min, int, int, const char* description) - { - return Game::Dvar_RegisterInt(dvarName, 1000, min, 1000, Game::DVAR_NONE, description); - } - Dedicated::Dedicated() { COMLogFilter = Dvar::Register("com_logFilter", true, @@ -200,9 +195,6 @@ namespace Components // isHost script call return 0 Utils::Hook::Set(0x5DEC04, 0); - // Manually register sv_network_fps - Utils::Hook(0x4D3C7B, Dvar_RegisterSVNetworkFps, HOOK_CALL).install()->quick(); - // r_loadForRenderer default to 0 Utils::Hook::Set(0x519DDF, 0); diff --git a/src/Components/Modules/Dedicated.hpp b/src/Components/Modules/Dedicated.hpp index b32e3564..729d6f74 100644 --- a/src/Components/Modules/Dedicated.hpp +++ b/src/Components/Modules/Dedicated.hpp @@ -26,7 +26,5 @@ namespace Components static void TransmitGuids(); static void TimeWrapStub(Game::errorParm_t code, const char* message); - - static Game::dvar_t* Dvar_RegisterSVNetworkFps(const char* dvarName, int value, int min, int max, int flags, const char* description); }; } diff --git a/src/Components/Modules/Dvar.cpp b/src/Components/Modules/Dvar.cpp index d75cc065..f354a1d1 100644 --- a/src/Components/Modules/Dvar.cpp +++ b/src/Components/Modules/Dvar.cpp @@ -203,7 +203,7 @@ namespace Components return Game::Dvar_RegisterFloat(dvarName, value, min, max, flag, description); } - Game::dvar_t* Dvar::Dvar_RegisterName(const char* name, const char* /*default*/, std::uint16_t flags, const char* description) + const Game::dvar_t* Dvar::Dvar_RegisterName(const char* dvarName, const char* /*value*/, std::uint16_t flags, const char* description) { // Name watcher if (!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled()) @@ -237,16 +237,21 @@ namespace Components { const char* steamName = Steam::Proxy::SteamFriends->GetPersonaName(); - if (steamName && *steamName != '\0') + if (steamName && *steamName) { username = steamName; } } - Name = Register(name, username.data(), flags | Game::DVAR_ARCHIVE, description); + Name = Register(dvarName, username.data(), flags | Game::DVAR_ARCHIVE, description); return Name.get(); } + const Game::dvar_t* Dvar::Dvar_RegisterSVNetworkFps(const char* dvarName, int /*value*/, int min, int /*max*/, std::uint16_t /*flags*/, const char* description) + { + return Game::Dvar_RegisterInt(dvarName, 1000, min, 1000, Game::DVAR_NONE, description); + } + void Dvar::SetFromStringByNameSafeExternal(const char* dvarName, const char* string) { static std::array exceptions = @@ -409,6 +414,9 @@ namespace Components // Hook dvar 'name' registration Utils::Hook(0x40531C, Dvar_RegisterName, HOOK_CALL).install()->quick(); + // Hook dvar 'sv_network_fps' registration + Utils::Hook(0x4D3C7B, Dvar_RegisterSVNetworkFps, HOOK_CALL).install()->quick(); + // un-cheat safeArea_* and add archive flags Utils::Hook::Xor(0x42E3F5, Game::DVAR_ROM | Game::DVAR_ARCHIVE); //safeArea_adjusted_horizontal Utils::Hook::Xor(0x42E423, Game::DVAR_ROM | Game::DVAR_ARCHIVE); //safeArea_adjusted_vertical diff --git a/src/Components/Modules/Dvar.hpp b/src/Components/Modules/Dvar.hpp index dfdfc246..d77ca29b 100644 --- a/src/Components/Modules/Dvar.hpp +++ b/src/Components/Modules/Dvar.hpp @@ -40,7 +40,8 @@ namespace Components private: static Var Name; - static Game::dvar_t* Dvar_RegisterName(const char* name, const char* defaultVal, std::uint16_t flags, const char* description); + static const Game::dvar_t* Dvar_RegisterName(const char* dvarName, const char* value, std::uint16_t flags, const char* description); + static const Game::dvar_t* Dvar_RegisterSVNetworkFps(const char* dvarName, int value, int min, int max, std::uint16_t flags, const char* description); static void SetFromStringByNameExternal(const char* dvarName, const char* string); static void SetFromStringByNameSafeExternal(const char* dvarName, const char* string);