diff --git a/src/Components/Modules/Dedicated.cpp b/src/Components/Modules/Dedicated.cpp index 0b60526d..f16b98f4 100644 --- a/src/Components/Modules/Dedicated.cpp +++ b/src/Components/Modules/Dedicated.cpp @@ -185,56 +185,6 @@ namespace Components Game::Com_Error(code, message); } - __declspec(naked) void Dedicated::OnServerCommandStub() - { - __asm - { - push eax - pushad - - call Dedicated::OnServerCommand - - mov [esp + 20h], eax - popad - pop eax - - test al, al - jnz returnSafe - - push 5944AEh - retn - - returnSafe: - push 594536h - retn - } - } - - int Dedicated::OnServerCommand() - { - Command::ClientParams params; - - ZeroMemory(Dedicated::PlayerGuids, sizeof(Dedicated::PlayerGuids)); - - if (params.length() >= (18 * 2 + 1) && params.get(0)[0] == 20) - { - for (int client = 0; client < 18; client++) - { - Dedicated::PlayerGuids[client][0].bits = strtoull(params.get(2 * client + 1), nullptr, 16); - Dedicated::PlayerGuids[client][1].bits = strtoull(params.get(2 * client + 2), nullptr, 16); - - if(Steam::Proxy::SteamFriends && Dedicated::PlayerGuids[client][1].bits != 0) - { - Steam::Proxy::SteamFriends->SetPlayedWith(Dedicated::PlayerGuids[client][1]); - } - } - - return 1; - } - - return 0; - } - void Dedicated::MapRotate() { if (!Dedicated::IsEnabled() && Dvar::Var("sv_dontrotate").get()) @@ -577,7 +527,23 @@ namespace Components } // Intercept server commands - Utils::Hook(0x59449F, Dedicated::OnServerCommandStub, HOOK_JUMP).install()->quick(); + ServerCommands::OnCommand(20, [](Command::Params* params) { + + for (int client = 0; client < 18; client++) + { + Dedicated::PlayerGuids[client][0].bits = strtoull(params.get(2 * client + 1), nullptr, 16); + Dedicated::PlayerGuids[client][1].bits = strtoull(params.get(2 * client + 2), nullptr, 16); + + if (Steam::Proxy::SteamFriends && Dedicated::PlayerGuids[client][1].bits != 0) + { + Steam::Proxy::SteamFriends->SetPlayedWith(Dedicated::PlayerGuids[client][1]); + } + } + + return true; + + }); + } QuickPatch::OnFrame([]() diff --git a/src/Components/Modules/Dedicated.hpp b/src/Components/Modules/Dedicated.hpp index 9deeaed1..6b07885b 100644 --- a/src/Components/Modules/Dedicated.hpp +++ b/src/Components/Modules/Dedicated.hpp @@ -29,9 +29,6 @@ namespace Components static bool SendChat; - static void OnServerCommandStub(); - static int OnServerCommand(); - static void MapRotate(); static void FrameHandler(); static void FrameStub();