From 6ee814cef52983784677033e3619ec67e5119260 Mon Sep 17 00:00:00 2001 From: sr0 Date: Thu, 10 Jan 2019 21:18:18 +0100 Subject: [PATCH] [Friends] --- src/Components/Modules/Auth.cpp | 2 +- src/Components/Modules/Friends.cpp | 13 +++++++++---- src/Components/Modules/Friends.hpp | 2 ++ src/Steam/Proxy.cpp | 8 +++++++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/Components/Modules/Auth.cpp b/src/Components/Modules/Auth.cpp index 4a0ea9fc..a4fbefd8 100644 --- a/src/Components/Modules/Auth.cpp +++ b/src/Components/Modules/Auth.cpp @@ -86,7 +86,7 @@ namespace Components return; } - if (Steam::Enabled() && !Dvar::Var("cl_anonymous").get() && Steam::Proxy::SteamUser_) + if (Steam::Enabled() && !Friends::IsInvisible() && !Dvar::Var("cl_anonymous").get() && Steam::Proxy::SteamUser_) { infostr.set("realsteamId", Utils::String::VA("%llX", Steam::Proxy::SteamUser_->GetSteamID().bits)); } diff --git a/src/Components/Modules/Friends.cpp b/src/Components/Modules/Friends.cpp index b065e6d2..3b4c1efc 100644 --- a/src/Components/Modules/Friends.cpp +++ b/src/Components/Modules/Friends.cpp @@ -124,7 +124,7 @@ namespace Components void Friends::UpdateState(bool force) { - if (Dvar::Var("cl_anonymous").get() || !Steam::Enabled()) return; + if (Dvar::Var("cl_anonymous").get() || Friends::IsInvisible() || !Steam::Enabled()) return; if (force) { @@ -228,7 +228,7 @@ namespace Components void Friends::SetPresence(const std::string& key, const std::string& value) { - if (Steam::Proxy::ClientFriends && Steam::Proxy::SteamUtils && !Dvar::Var("cl_anonymous").get() && Steam::Enabled()) + if (Steam::Proxy::ClientFriends && Steam::Proxy::SteamUtils && !Dvar::Var("cl_anonymous").get() && !Friends::IsInvisible() && Steam::Enabled()) { Friends::SetRawPresence(key.data(), value.data()); } @@ -494,6 +494,11 @@ namespace Components return appId; } + bool Friends::IsInvisible() + { + return Friends::InitialState == 7; + } + void Friends::UpdateTimeStamp() { Friends::SetPresence("iw4x_playing", Utils::String::VA("%d", Steam::SteamUtils()->GetServerRealTime())); @@ -696,10 +701,10 @@ namespace Components { if (Steam::Proxy::SteamFriends) { - Friends::InitialState = Steam::Proxy::SteamFriends->GetPersonaState(); + Friends::InitialState = Steam::Proxy::SteamFriends->GetFriendPersonaState(Steam::Proxy::SteamUser_->GetSteamID()); } - if (Dvar::Var("cl_anonymous").get() || !Steam::Enabled()) + if (Dvar::Var("cl_anonymous").get() || Friends::IsInvisible() || !Steam::Enabled()) { if (Steam::Proxy::ClientFriends) { diff --git a/src/Components/Modules/Friends.hpp b/src/Components/Modules/Friends.hpp index e9bdb469..db1ec171 100644 --- a/src/Components/Modules/Friends.hpp +++ b/src/Components/Modules/Friends.hpp @@ -23,6 +23,8 @@ namespace Components static int GetGame(SteamID user); + static bool IsInvisible(); + private: #pragma pack(push, 4) struct FriendRichPresenceUpdate diff --git a/src/Steam/Proxy.cpp b/src/Steam/Proxy.cpp index b834a423..36641634 100644 --- a/src/Steam/Proxy.cpp +++ b/src/Steam/Proxy.cpp @@ -86,7 +86,11 @@ namespace Steam if (ud_insn_mnemonic(&ud) == UD_Iret) { const ud_operand* operand = ud_insn_opr(&ud, 0); - if (!operand) break; + if (!operand) + { + *params = 0; + return true; + } if (operand->type == UD_OP_IMM && operand->size == 16) { @@ -110,6 +114,8 @@ namespace Steam } } } + + if (*reinterpret_cast(ud.pc) == 0xCC) break; } return false;