[Dedicated] Updated friend discovery hook
This commit is contained in:
parent
0661972f68
commit
f798af7840
@ -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<bool>())
|
||||
@ -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([]()
|
||||
|
@ -29,9 +29,6 @@ namespace Components
|
||||
|
||||
static bool SendChat;
|
||||
|
||||
static void OnServerCommandStub();
|
||||
static int OnServerCommand();
|
||||
|
||||
static void MapRotate();
|
||||
static void FrameHandler();
|
||||
static void FrameStub();
|
||||
|
Loading…
Reference in New Issue
Block a user