[Friends]

This commit is contained in:
sr0 2019-01-10 21:18:18 +01:00
parent d01d27a3e9
commit 6ee814cef5
4 changed files with 19 additions and 6 deletions

View File

@ -86,7 +86,7 @@ namespace Components
return; return;
} }
if (Steam::Enabled() && !Dvar::Var("cl_anonymous").get<bool>() && Steam::Proxy::SteamUser_) if (Steam::Enabled() && !Friends::IsInvisible() && !Dvar::Var("cl_anonymous").get<bool>() && Steam::Proxy::SteamUser_)
{ {
infostr.set("realsteamId", Utils::String::VA("%llX", Steam::Proxy::SteamUser_->GetSteamID().bits)); infostr.set("realsteamId", Utils::String::VA("%llX", Steam::Proxy::SteamUser_->GetSteamID().bits));
} }

View File

@ -124,7 +124,7 @@ namespace Components
void Friends::UpdateState(bool force) void Friends::UpdateState(bool force)
{ {
if (Dvar::Var("cl_anonymous").get<bool>() || !Steam::Enabled()) return; if (Dvar::Var("cl_anonymous").get<bool>() || Friends::IsInvisible() || !Steam::Enabled()) return;
if (force) if (force)
{ {
@ -228,7 +228,7 @@ namespace Components
void Friends::SetPresence(const std::string& key, const std::string& value) void Friends::SetPresence(const std::string& key, const std::string& value)
{ {
if (Steam::Proxy::ClientFriends && Steam::Proxy::SteamUtils && !Dvar::Var("cl_anonymous").get<bool>() && Steam::Enabled()) if (Steam::Proxy::ClientFriends && Steam::Proxy::SteamUtils && !Dvar::Var("cl_anonymous").get<bool>() && !Friends::IsInvisible() && Steam::Enabled())
{ {
Friends::SetRawPresence(key.data(), value.data()); Friends::SetRawPresence(key.data(), value.data());
} }
@ -494,6 +494,11 @@ namespace Components
return appId; return appId;
} }
bool Friends::IsInvisible()
{
return Friends::InitialState == 7;
}
void Friends::UpdateTimeStamp() void Friends::UpdateTimeStamp()
{ {
Friends::SetPresence("iw4x_playing", Utils::String::VA("%d", Steam::SteamUtils()->GetServerRealTime())); Friends::SetPresence("iw4x_playing", Utils::String::VA("%d", Steam::SteamUtils()->GetServerRealTime()));
@ -696,10 +701,10 @@ namespace Components
{ {
if (Steam::Proxy::SteamFriends) 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<bool>() || !Steam::Enabled()) if (Dvar::Var("cl_anonymous").get<bool>() || Friends::IsInvisible() || !Steam::Enabled())
{ {
if (Steam::Proxy::ClientFriends) if (Steam::Proxy::ClientFriends)
{ {

View File

@ -23,6 +23,8 @@ namespace Components
static int GetGame(SteamID user); static int GetGame(SteamID user);
static bool IsInvisible();
private: private:
#pragma pack(push, 4) #pragma pack(push, 4)
struct FriendRichPresenceUpdate struct FriendRichPresenceUpdate

View File

@ -86,7 +86,11 @@ namespace Steam
if (ud_insn_mnemonic(&ud) == UD_Iret) if (ud_insn_mnemonic(&ud) == UD_Iret)
{ {
const ud_operand* operand = ud_insn_opr(&ud, 0); 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) if (operand->type == UD_OP_IMM && operand->size == 16)
{ {
@ -110,6 +114,8 @@ namespace Steam
} }
} }
} }
if (*reinterpret_cast<unsigned char*>(ud.pc) == 0xCC) break;
} }
return false; return false;