[Proxy] Get rid of legacy friends interface

This commit is contained in:
momo5502 2017-02-18 00:02:42 +01:00
parent b7340583fb
commit 6d7236cb5e
4 changed files with 7 additions and 22 deletions

View File

@ -126,10 +126,10 @@ namespace Components
if(force) if(force)
{ {
if (Steam::Proxy::SteamLegacyFriends) if (Steam::Proxy::ClientFriends && Steam::Proxy::SteamFriends)
{ {
int state = Steam::Proxy::SteamLegacyFriends->GetPersonaState(); int state = Steam::Proxy::SteamFriends->GetPersonaState();
Steam::Proxy::SteamLegacyFriends->SetPersonaState((state == 1 ? 2 : 1)); Steam::Proxy::ClientFriends.invoke<void>("SetPersonaState", (state == 1 ? 2 : 1));
} }
} }
else else
@ -571,17 +571,17 @@ namespace Components
} }
#endif #endif
if(Steam::Proxy::SteamLegacyFriends) if(Steam::Proxy::ClientFriends)
{ {
Steam::Proxy::SteamLegacyFriends->SetPersonaState(Friends::InitialState); Steam::Proxy::ClientFriends.invoke<void>("SetPersonaState", Friends::InitialState);
} }
}); });
QuickPatch::Once([]() QuickPatch::Once([]()
{ {
if (Steam::Proxy::SteamLegacyFriends) if (Steam::Proxy::SteamFriends)
{ {
Friends::InitialState = Steam::Proxy::SteamLegacyFriends->GetPersonaState(); Friends::InitialState = Steam::Proxy::SteamFriends->GetPersonaState();
} }
if(Dvar::Var("cl_anonymous").get<bool>()) if(Dvar::Var("cl_anonymous").get<bool>())

View File

@ -111,14 +111,4 @@ namespace Steam
virtual uint64_t IsFollowing(SteamID steamID) = 0; virtual uint64_t IsFollowing(SteamID steamID) = 0;
virtual uint64_t EnumerateFollowingList(uint32_t unStartIndex) = 0; virtual uint64_t EnumerateFollowingList(uint32_t unStartIndex) = 0;
}; };
class Friends2
{
public:
virtual const char *GetPersonaName() = 0;
virtual void SetPersonaName(const char *pchPersonaName) = 0;
virtual int GetPersonaState() = 0;
virtual void SetPersonaState(int ePersonaState) = 0;
// [...]
};
} }

View File

@ -14,7 +14,6 @@ namespace Steam
void* Proxy::SteamUser = nullptr; void* Proxy::SteamUser = nullptr;
Friends15* Proxy::SteamFriends = nullptr; Friends15* Proxy::SteamFriends = nullptr;
Friends2* Proxy::SteamLegacyFriends = nullptr;
Utils* Proxy::SteamUtils = nullptr; Utils* Proxy::SteamUtils = nullptr;
User* Proxy::SteamUser_ = nullptr; User* Proxy::SteamUser_ = nullptr;
@ -320,9 +319,6 @@ namespace Steam
Proxy::SteamFriends = reinterpret_cast<Friends15*>(Proxy::SteamClient->GetISteamFriends(Proxy::SteamUser, Proxy::SteamPipe, "SteamFriends015")); Proxy::SteamFriends = reinterpret_cast<Friends15*>(Proxy::SteamClient->GetISteamFriends(Proxy::SteamUser, Proxy::SteamPipe, "SteamFriends015"));
if (!Proxy::SteamFriends) return false; if (!Proxy::SteamFriends) return false;
Proxy::SteamLegacyFriends = reinterpret_cast<Friends2*>(Proxy::SteamClient->GetISteamFriends(Proxy::SteamUser, Proxy::SteamPipe, "SteamFriends002"));
if (!Proxy::SteamLegacyFriends) return false;
Proxy::SteamUtils = reinterpret_cast<Utils*>(Proxy::SteamClient->GetISteamUtils(Proxy::SteamPipe, "SteamUtils005")); Proxy::SteamUtils = reinterpret_cast<Utils*>(Proxy::SteamClient->GetISteamUtils(Proxy::SteamPipe, "SteamUtils005"));
if (!Proxy::SteamUtils) return false; if (!Proxy::SteamUtils) return false;

View File

@ -204,7 +204,6 @@ namespace Steam
static void UnregisterCallback(int32_t callId); static void UnregisterCallback(int32_t callId);
static Friends15* SteamFriends; static Friends15* SteamFriends;
static Friends2* SteamLegacyFriends;
static Utils* SteamUtils; static Utils* SteamUtils;
static User* SteamUser_; static User* SteamUser_;
static Interface ClientFriends; static Interface ClientFriends;