diff --git a/src/Components/Modules/Command.cpp b/src/Components/Modules/Command.cpp index 66ab81cb..43f03b8e 100644 --- a/src/Components/Modules/Command.cpp +++ b/src/Components/Modules/Command.cpp @@ -173,4 +173,37 @@ namespace Components itr->second(¶ms); } } + + bool Command::CL_ShouldSendNotify_Hk(const char* cmd) + { + if (!cmd) + { + return false; + } + + static std::array exceptions = + { + "cmd", + "exec", + "map", + "vstr", + "wait", + }; + + for (const auto& entry : exceptions) + { + if (!_stricmp(cmd, entry)) + { + return false; + } + } + + return true; + } + + Command::Command() + { + // Protect players from invasive servers + Utils::Hook(0x434BD4, CL_ShouldSendNotify_Hk, HOOK_CALL).install()->quick(); // CL_CheckNotify + } } diff --git a/src/Components/Modules/Command.hpp b/src/Components/Modules/Command.hpp index 15e544d3..401685b0 100644 --- a/src/Components/Modules/Command.hpp +++ b/src/Components/Modules/Command.hpp @@ -52,7 +52,7 @@ namespace Components int nesting_; }; - Command() = default; + Command(); static Game::cmd_function_s* Allocate(); @@ -72,5 +72,7 @@ namespace Components static void MainCallback(); static void MainCallbackSV(); + + static bool CL_ShouldSendNotify_Hk(const char* cmd); }; } diff --git a/src/Components/Modules/Dvar.cpp b/src/Components/Modules/Dvar.cpp index 83a591da..344dcca1 100644 --- a/src/Components/Modules/Dvar.cpp +++ b/src/Components/Modules/Dvar.cpp @@ -271,7 +271,7 @@ namespace Components for (const auto& entry : exceptions) { - if (Utils::String::Compare(dvarName, entry)) + if (!_stricmp(dvarName, entry)) { Game::Dvar_SetFromStringByNameFromSource(dvarName, string, Game::DVAR_SOURCE_INTERNAL); return; diff --git a/src/Components/Modules/QuickPatch.cpp b/src/Components/Modules/QuickPatch.cpp index 4eb6a71a..cfd8024b 100644 --- a/src/Components/Modules/QuickPatch.cpp +++ b/src/Components/Modules/QuickPatch.cpp @@ -281,27 +281,6 @@ namespace Components } } - bool QuickPatch::CL_ShouldSendNotify_Hk(const char* cmd) - { - if (!cmd) - { - return false; - } - - static std::vector exceptions = - { - "vstr", - "wait", - }; - - if (std::ranges::find(exceptions, cmd) != exceptions.end()) - { - return false; - } - - return Utils::Hook::Call(0x47A640)(cmd); - } - Game::dvar_t* QuickPatch::Dvar_RegisterConMinicon(const char* dvarName, [[maybe_unused]] bool value, unsigned __int16 flags, const char* description) { #ifdef _DEBUG @@ -368,9 +347,6 @@ namespace Components Utils::Hook::Set(0x4876C6, "Successfully read stats data\n"); - // Protect players from invasive servers - Utils::Hook(0x434BD4, CL_ShouldSendNotify_Hk, HOOK_CALL).install()->quick(); // CL_CheckNotify - // Numerical ping (cg_scoreboardPingText 1) Utils::Hook::Set(0x45888E, 1); Utils::Hook::Set(0x45888C, Game::DVAR_CHEAT); diff --git a/src/Components/Modules/QuickPatch.hpp b/src/Components/Modules/QuickPatch.hpp index fe100e03..8f18c838 100644 --- a/src/Components/Modules/QuickPatch.hpp +++ b/src/Components/Modules/QuickPatch.hpp @@ -34,8 +34,6 @@ namespace Components static void SND_GetAliasOffset_Stub(); - static bool CL_ShouldSendNotify_Hk(const char* cmd); - static Game::dvar_t* Dvar_RegisterConMinicon(const char* dvarName, bool value, unsigned __int16 flags, const char* description); }; }