mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-27 14:08:39 +01:00
Made some friends function behavior more accurate.
This commit is contained in:
parent
fb7c8ea35b
commit
5cf841c603
1 changed files with 51 additions and 20 deletions
|
@ -222,10 +222,10 @@ EFriendRelationship GetFriendRelationship( CSteamID steamIDFriend )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendRelationship %llu\n", steamIDFriend.ConvertToUint64());
|
PRINT_DEBUG("Steam_Friends::GetFriendRelationship %llu\n", steamIDFriend.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
EFriendRelationship r = k_EFriendRelationshipNone;
|
if (steamIDFriend == settings->get_local_steam_id()) return k_EFriendRelationshipNone; //Real steam behavior
|
||||||
if (find_friend(steamIDFriend)) r = k_EFriendRelationshipFriend;
|
if (find_friend(steamIDFriend)) return k_EFriendRelationshipFriend;
|
||||||
|
|
||||||
return r;
|
return k_EFriendRelationshipNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -261,7 +261,6 @@ const char *GetFriendPersonaName( CSteamID steamIDFriend )
|
||||||
if (f) name = f->name().c_str();
|
if (f) name = f->name().c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,23 +268,36 @@ const char *GetFriendPersonaName( CSteamID steamIDFriend )
|
||||||
// returns true if the friend is actually in a game, and fills in pFriendGameInfo with an extra details
|
// returns true if the friend is actually in a game, and fills in pFriendGameInfo with an extra details
|
||||||
bool GetFriendGamePlayed( CSteamID steamIDFriend, STEAM_OUT_STRUCT() FriendGameInfo_t *pFriendGameInfo )
|
bool GetFriendGamePlayed( CSteamID steamIDFriend, STEAM_OUT_STRUCT() FriendGameInfo_t *pFriendGameInfo )
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendGamePlayed\n");
|
PRINT_DEBUG("Steam_Friends::GetFriendGamePlayed %llu\n", steamIDFriend.ConvertToUint64());
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
Friend *f = find_friend(steamIDFriend);
|
|
||||||
if (f) {
|
if (steamIDFriend == settings->get_local_steam_id()) {
|
||||||
if (pFriendGameInfo) {
|
if (pFriendGameInfo) {
|
||||||
pFriendGameInfo->m_gameID = CGameID(f->appid());
|
pFriendGameInfo->m_gameID = settings->get_local_game_id();
|
||||||
pFriendGameInfo->m_unGameIP = 0;
|
pFriendGameInfo->m_unGameIP = 0;
|
||||||
pFriendGameInfo->m_usGamePort = 0;
|
pFriendGameInfo->m_usGamePort = 0;
|
||||||
pFriendGameInfo->m_usQueryPort = 0;
|
pFriendGameInfo->m_usQueryPort = 0;
|
||||||
pFriendGameInfo->m_steamIDLobby = CSteamID((uint64)f->lobby_id());
|
pFriendGameInfo->m_steamIDLobby = settings->get_lobby();
|
||||||
PRINT_DEBUG("%u %llu\n", f->appid(), f->lobby_id());
|
PRINT_DEBUG("self %llu %llu\n", settings->get_local_game_id().ToUint64(), settings->get_lobby().ConvertToUint64());
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
} else {
|
||||||
|
Friend *f = find_friend(steamIDFriend);
|
||||||
|
if (f) {
|
||||||
|
if (pFriendGameInfo) {
|
||||||
|
pFriendGameInfo->m_gameID = CGameID(f->appid());
|
||||||
|
pFriendGameInfo->m_unGameIP = 0;
|
||||||
|
pFriendGameInfo->m_usGamePort = 0;
|
||||||
|
pFriendGameInfo->m_usQueryPort = 0;
|
||||||
|
pFriendGameInfo->m_steamIDLobby = CSteamID((uint64)f->lobby_id());
|
||||||
|
PRINT_DEBUG("%u %llu\n", f->appid(), f->lobby_id());
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -679,13 +691,18 @@ const char *GetFriendRichPresence( CSteamID steamIDFriend, const char *pchKey )
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
const char *value = "";
|
const char *value = "";
|
||||||
|
|
||||||
Friend *f = find_friend(steamIDFriend);
|
Friend *f = NULL;
|
||||||
if (f && isSameAppId(f)) {
|
if (settings->get_local_steam_id() == steamIDFriend) {
|
||||||
|
f = &us;
|
||||||
|
} else {
|
||||||
|
f = find_friend(steamIDFriend);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f && isAppIdCompatible(f)) {
|
||||||
auto result = f->rich_presence().find(pchKey);
|
auto result = f->rich_presence().find(pchKey);
|
||||||
if (result != f->rich_presence().end()) value = result->second.c_str();
|
if (result != f->rich_presence().end()) value = result->second.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -694,8 +711,15 @@ int GetFriendRichPresenceKeyCount( CSteamID steamIDFriend )
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendRichPresenceKeyCount\n");
|
PRINT_DEBUG("Steam_Friends::GetFriendRichPresenceKeyCount\n");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
int num = 0;
|
int num = 0;
|
||||||
Friend *f = find_friend(steamIDFriend);
|
|
||||||
if (f && isSameAppId(f)) num = f->rich_presence().size();
|
Friend *f = NULL;
|
||||||
|
if (settings->get_local_steam_id() == steamIDFriend) {
|
||||||
|
f = &us;
|
||||||
|
} else {
|
||||||
|
f = find_friend(steamIDFriend);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f && isAppIdCompatible(f)) num = f->rich_presence().size();
|
||||||
|
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
@ -705,8 +729,15 @@ const char *GetFriendRichPresenceKeyByIndex( CSteamID steamIDFriend, int iKey )
|
||||||
PRINT_DEBUG("Steam_Friends::GetFriendRichPresenceKeyByIndex\n");
|
PRINT_DEBUG("Steam_Friends::GetFriendRichPresenceKeyByIndex\n");
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
const char *key = "";
|
const char *key = "";
|
||||||
Friend *f = find_friend(steamIDFriend);
|
|
||||||
if (f && isSameAppId(f) && f->rich_presence().size() > iKey && iKey >= 0) {
|
Friend *f = NULL;
|
||||||
|
if (settings->get_local_steam_id() == steamIDFriend) {
|
||||||
|
f = &us;
|
||||||
|
} else {
|
||||||
|
f = find_friend(steamIDFriend);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f && isAppIdCompatible(f) && f->rich_presence().size() > iKey && iKey >= 0) {
|
||||||
auto friend_data = f->rich_presence().begin();
|
auto friend_data = f->rich_presence().begin();
|
||||||
for (int i = 0; i < iKey; ++i) ++friend_data;
|
for (int i = 0; i < iKey; ++i) ++friend_data;
|
||||||
key = friend_data->first.c_str();
|
key = friend_data->first.c_str();
|
||||||
|
@ -962,7 +993,7 @@ void Callback(Common_Message *msg)
|
||||||
|
|
||||||
if (map1 != map2) {
|
if (map1 != map2) {
|
||||||
//The App ID of the game. This should always be the current game.
|
//The App ID of the game. This should always be the current game.
|
||||||
if (isSameAppId(f)) {
|
if (isAppIdCompatible(f)) {
|
||||||
rich_presence_updated((uint64)msg->friend_().id(), (uint64)msg->friend_().appid());
|
rich_presence_updated((uint64)msg->friend_().id(), (uint64)msg->friend_().appid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue