[Auth]: Undo this (#929)

This commit is contained in:
Edo 2023-04-16 11:05:51 +02:00 committed by GitHub
parent e945652dc1
commit d53fc404b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 9 deletions

View File

@ -273,16 +273,33 @@ namespace Components
return value;
}
int Auth::NET_IsLocalAddressStub(Game::netadr_t adr)
__declspec(naked) void Auth::DirectConnectPrivateClientStub()
{
if (HasAccessToReservedSlot)
__asm
{
// Bypass sv_privateClients if client has the password
return 1;
}
push eax
// Only bypass if address is local. Original behaviour
return Utils::Hook::Call<int(Game::netadr_t)>(0x402BD0)(adr);
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
}
}
unsigned __int64 Auth::GetKeyHash(const std::string& key)
@ -467,7 +484,8 @@ namespace Components
// Install registration hook
Utils::Hook(0x6265F9, DirectConnectStub, HOOK_JUMP).install()->quick();
Utils::Hook(0x460EF5, Info_ValueForKeyStub, HOOK_CALL).install()->quick();
Utils::Hook(0x460F89, NET_IsLocalAddressStub, HOOK_CALL).install()->quick();
Utils::Hook(0x460FAD, DirectConnectPrivateClientStub, HOOK_JUMP).install()->quick();
Utils::Hook::Nop(0x460FAD + 5, 1);
Utils::Hook(0x41D3E3, SendConnectDataStub, HOOK_CALL).install()->quick();

View File

@ -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 int NET_IsLocalAddressStub(Game::netadr_t adr);
static void DirectConnectPrivateClientStub();
static void Frame();
};