From e71409da286b78e4d2f109e273cb55fa57bf87dd Mon Sep 17 00:00:00 2001 From: momo5502 Date: Fri, 17 Feb 2017 12:26:07 +0100 Subject: [PATCH] [Dedicated] Transmit original steam ids --- src/Components/Modules/Auth.cpp | 13 +++++++++++++ src/Components/Modules/Dedicated.cpp | 17 ++++++++++++----- src/Components/Modules/Dedicated.hpp | 2 +- src/Components/Modules/Friends.cpp | 2 +- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/Components/Modules/Auth.cpp b/src/Components/Modules/Auth.cpp index e67ddd05..1b7341fc 100644 --- a/src/Components/Modules/Auth.cpp +++ b/src/Components/Modules/Auth.cpp @@ -86,6 +86,19 @@ namespace Components return; } + if(Steam::Proxy::SteamUser_) + { + infostr.set("realsteamId", Utils::String::VA("%llX", Steam::Proxy::SteamUser_->GetSteamID().Bits)); + } + + // Build new connect string + connectString.clear(); + connectString.append(params[0]); + connectString.append(" "); + connectString.append(params[1]); + connectString.append(" "); + connectString.append("\"" + infostr.build() + "\""); + Game::SV_Cmd_EndTokenizedString(); Proto::Auth::Connect connectData; diff --git a/src/Components/Modules/Dedicated.cpp b/src/Components/Modules/Dedicated.cpp index babede9a..4cd1684b 100644 --- a/src/Components/Modules/Dedicated.cpp +++ b/src/Components/Modules/Dedicated.cpp @@ -5,7 +5,7 @@ namespace Components Utils::Signal Dedicated::FrameSignal; Utils::Signal Dedicated::FrameOnceSignal; - SteamID Dedicated::PlayerGuids[18]; + SteamID Dedicated::PlayerGuids[18][2]; bool Dedicated::SendChat; @@ -149,10 +149,13 @@ namespace Components if (Game::svs_clients[i].state >= 3) { list.append(Utils::String::VA(" %llX", Game::svs_clients[i].steamid)); + + Utils::InfoString info(Game::svs_clients[i].connectInfoString); + list.append(Utils::String::VA(" %llX", strtoull(info.get("realsteamId").data(), nullptr, 16))); } else { - list.append(" 0"); + list.append(" 0 0"); } } @@ -211,11 +214,14 @@ namespace Components { Command::ClientParams params; - if (params.length() > 17 && params.get(0)[0] == 20) + 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].Bits = strtoull(params.get(client + 1), nullptr, 16); + 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); } return 1; @@ -546,7 +552,8 @@ namespace Components { for(int i = 0; i < ARRAYSIZE(Dedicated::PlayerGuids); ++i) { - Dedicated::PlayerGuids[i].Bits = 0; + Dedicated::PlayerGuids[i][0].Bits = 0; + Dedicated::PlayerGuids[i][1].Bits = 0; } // Intercept server commands diff --git a/src/Components/Modules/Dedicated.hpp b/src/Components/Modules/Dedicated.hpp index 491b5063..9deeaed1 100644 --- a/src/Components/Modules/Dedicated.hpp +++ b/src/Components/Modules/Dedicated.hpp @@ -14,7 +14,7 @@ namespace Components const char* getName() override { return "Dedicated"; }; #endif - static SteamID PlayerGuids[18]; + static SteamID PlayerGuids[18][2]; static bool IsEnabled(); diff --git a/src/Components/Modules/Friends.cpp b/src/Components/Modules/Friends.cpp index 328639e1..20f6255d 100644 --- a/src/Components/Modules/Friends.cpp +++ b/src/Components/Modules/Friends.cpp @@ -211,7 +211,7 @@ namespace Components if (clientNum < 0 || clientNum >= ARRAYSIZE(Dedicated::PlayerGuids)) return false; std::lock_guard _(Friends::Mutex); - SteamID guid = Dedicated::PlayerGuids[clientNum]; + SteamID guid = Dedicated::PlayerGuids[clientNum][0]; for (auto entry : Friends::FriendsList) {