diff --git a/src/client/component/branding.cpp b/src/client/component/branding.cpp index 6e981794..95a62748 100644 --- a/src/client/component/branding.cpp +++ b/src/client/component/branding.cpp @@ -23,7 +23,7 @@ namespace branding return; } - if (game::environment::is_mp) + if (game::environment::is_mp()) { localized_strings::override("LUA_MENU_MULTIPLAYER_CAPS", "H1-Mod: MULTIPLAYER\n"); localized_strings::override("MENU_MULTIPLAYER_CAPS", "H1-Mod: MULTIPLAYER"); diff --git a/src/client/component/command.cpp b/src/client/component/command.cpp index 5fe14c71..6df69d53 100644 --- a/src/client/component/command.cpp +++ b/src/client/component/command.cpp @@ -76,7 +76,7 @@ namespace command const auto reset = game::Dvar_ValueToString(dvar, dvar->reset, 0); game_console::print(game_console::con_type_info, "\"%s\" is: \"%s\" default: \"%s\" hash: %i", - args[0], current, reset, dvar->name); + args[0], current, reset, dvar->hash); game_console::print(game_console::con_type_info, " %s\n", dvars::dvar_get_domain(dvar->type, dvar->domain).data()); diff --git a/src/client/component/game_console.cpp b/src/client/component/game_console.cpp index 192870ad..f76852f2 100644 --- a/src/client/component/game_console.cpp +++ b/src/client/component/game_console.cpp @@ -693,8 +693,6 @@ namespace game_console //history.clear(); //}); - char a2[1] = {}; - // add our dvars dvars::con_inputBoxColor = dvars::register_vec4( "con_inputBoxColor", diff --git a/src/client/game/dvars.cpp b/src/client/game/dvars.cpp index 5a185e99..95898098 100644 --- a/src/client/game/dvars.cpp +++ b/src/client/game/dvars.cpp @@ -464,12 +464,24 @@ namespace dvars "custom_timelimit" }; + bool can_add_dvar_to_list(std::string name) + { + for (std::uint32_t i = 0; i < dvar_list.size(); i++) + { + if (dvar_list[i] == name) + { + return false; + } + } + return true; + } + game::dvar_t* register_int(const std::string& name, int value, int min, int max, game::DvarFlags flags, bool add_to_list) { const auto hash = game::generateHashValue(name.data()); - if (add_to_list) + if (add_to_list && can_add_dvar_to_list(name)) { dvar_list.push_back(name); } @@ -482,7 +494,7 @@ namespace dvars { const auto hash = game::generateHashValue(name.data()); - if (add_to_list) + if (add_to_list && can_add_dvar_to_list(name)) { dvar_list.push_back(name); } @@ -495,7 +507,7 @@ namespace dvars { const auto hash = game::generateHashValue(name.data()); - if (add_to_list) + if (add_to_list && can_add_dvar_to_list(name)) { dvar_list.push_back(name); } @@ -509,7 +521,7 @@ namespace dvars { const auto hash = game::generateHashValue(name.data()); - if (add_to_list) + if (add_to_list && can_add_dvar_to_list(name)) { dvar_list.push_back(name); } @@ -522,7 +534,7 @@ namespace dvars { const auto hash = game::generateHashValue(name.data()); - if (add_to_list) + if (add_to_list && can_add_dvar_to_list(name)) { dvar_list.push_back(name); } @@ -536,7 +548,7 @@ namespace dvars { const auto hash = game::generateHashValue(name.data()); - if (add_to_list) + if (add_to_list && can_add_dvar_to_list(name)) { dvar_list.push_back(name); } diff --git a/src/client/game/structs.hpp b/src/client/game/structs.hpp index 5004de2b..4b3968a8 100644 --- a/src/client/game/structs.hpp +++ b/src/client/game/structs.hpp @@ -932,7 +932,7 @@ namespace game struct dvar_t { - const char* name; + int hash; unsigned int flags; dvar_type type; bool modified; diff --git a/src/client/main.cpp b/src/client/main.cpp index 9e7ffcb3..f4e74580 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -110,14 +110,15 @@ void remove_crash_file() utils::io::remove_file("__h1Exe"); } -/*void verify_mwr_version() +void verify_mwr_version() { const auto value = *reinterpret_cast(0x140001337); - if (value != 0x24AFEB05 && value != 0x1D860F04) //S1 + //sp && mp + if (value != 0xFFB8006D && value != 0xFFB80080) { - throw std::runtime_error("Unsupported Call of Duty: Advanced Warfare version"s); + throw std::runtime_error("Unsupported Call of Duty: Modern Warfare Remastered version"s); } -}*/ +} void enable_dpi_awareness() { @@ -202,7 +203,7 @@ int main() if (!component_loader::post_load()) return 0; - //verify_mwr_version(); + verify_mwr_version(); premature_shutdown = false; }