diff --git a/src/Components/Modules/Auth.cpp b/src/Components/Modules/Auth.cpp index f150b107..98372d44 100644 --- a/src/Components/Modules/Auth.cpp +++ b/src/Components/Modules/Auth.cpp @@ -273,33 +273,16 @@ namespace Components return value; } - __declspec(naked) void Auth::DirectConnectPrivateClientStub() + int Auth::NET_IsLocalAddressStub(Game::netadr_t adr) { - __asm + if (HasAccessToReservedSlot) { - push eax - - mov al, HasAccessToReservedSlot - test al, al - - pop eax - - je noAccess - - // Set the number of private clients to 0 if the client has the right password - xor eax, eax - jmp safeContinue - - noAccess: - mov eax, dword ptr [edx + 0x10] - - safeContinue: - // Game code skipped by hook - add esp, 0xC - - push 0x460FB3 - ret + // Bypass sv_privateClients if client has the password + return 1; } + + // Only bypass if address is local. Original behaviour + return Utils::Hook::Call(0x402BD0)(adr); } unsigned __int64 Auth::GetKeyHash(const std::string& key) @@ -484,8 +467,7 @@ namespace Components // Install registration hook Utils::Hook(0x6265F9, DirectConnectStub, HOOK_JUMP).install()->quick(); Utils::Hook(0x460EF5, Info_ValueForKeyStub, HOOK_CALL).install()->quick(); - Utils::Hook(0x460FAD, DirectConnectPrivateClientStub, HOOK_JUMP).install()->quick(); - Utils::Hook::Nop(0x460FAD + 5, 1); + Utils::Hook(0x460F89, NET_IsLocalAddressStub, HOOK_CALL).install()->quick(); Utils::Hook(0x41D3E3, SendConnectDataStub, HOOK_CALL).install()->quick(); diff --git a/src/Components/Modules/Auth.hpp b/src/Components/Modules/Auth.hpp index 5ab438ce..9f10db42 100644 --- a/src/Components/Modules/Auth.hpp +++ b/src/Components/Modules/Auth.hpp @@ -51,7 +51,7 @@ namespace Components static void ParseConnectData(Game::msg_t* msg, Game::netadr_t* addr); static void DirectConnectStub(); static char* Info_ValueForKeyStub(const char* s, const char* key); - static void DirectConnectPrivateClientStub(); + static int NET_IsLocalAddressStub(Game::netadr_t adr); static void Frame(); }; diff --git a/src/Components/Modules/Bots.cpp b/src/Components/Modules/Bots.cpp index b679a28c..2deaba89 100644 --- a/src/Components/Modules/Bots.cpp +++ b/src/Components/Modules/Bots.cpp @@ -168,7 +168,7 @@ namespace Components Scheduler::Once([ent] { - Game::Scr_AddString(Utils::String::VA("class%u", Utils::Cryptography::Rand::GenerateInt() % 5u)); + Game::Scr_AddString(Utils::String::Format("class{}", std::rand() % 5)); Game::Scr_AddString("changeclass"); Game::Scr_Notify(ent, static_cast(Game::SL_GetString("menuresponse", 0)), 2); }, Scheduler::Pipeline::SERVER, 1s);