DiscordRPC: Add Rcheevos Icon Support (#3286)
This commit is contained in:
parent
69865a339e
commit
d34d0404f1
|
@ -523,6 +523,11 @@ const std::string& Achievements::GetGameIconPath()
|
||||||
return s_game_icon;
|
return s_game_icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string& Achievements::GetGameIconURL()
|
||||||
|
{
|
||||||
|
return s_game_icon_url;
|
||||||
|
}
|
||||||
|
|
||||||
const std::string& Achievements::GetRichPresenceString()
|
const std::string& Achievements::GetRichPresenceString()
|
||||||
{
|
{
|
||||||
return s_rich_presence_string;
|
return s_rich_presence_string;
|
||||||
|
|
|
@ -115,6 +115,9 @@ bool HasRichPresence();
|
||||||
/// Should be called with the lock held.
|
/// Should be called with the lock held.
|
||||||
const std::string& GetRichPresenceString();
|
const std::string& GetRichPresenceString();
|
||||||
|
|
||||||
|
/// Returns the URL for the current icon of the game
|
||||||
|
const std::string& GetGameIconURL();
|
||||||
|
|
||||||
/// Returns the RetroAchievements title for the current game.
|
/// Returns the RetroAchievements title for the current game.
|
||||||
/// Should be called with the lock held.
|
/// Should be called with the lock held.
|
||||||
const std::string& GetGameTitle();
|
const std::string& GetGameTitle();
|
||||||
|
|
|
@ -5892,6 +5892,8 @@ void System::UpdateRichPresence(bool update_session_time)
|
||||||
const auto lock = Achievements::GetLock();
|
const auto lock = Achievements::GetLock();
|
||||||
state_string = StringUtil::Ellipsise(Achievements::GetRichPresenceString(), 128);
|
state_string = StringUtil::Ellipsise(Achievements::GetRichPresenceString(), 128);
|
||||||
rp.state = state_string.c_str();
|
rp.state = state_string.c_str();
|
||||||
|
if (const std::string& icon_url = Achievements::GetGameIconURL(); !icon_url.empty())
|
||||||
|
rp.largeImageKey = icon_url.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
dyn_libs::Discord_UpdatePresence(&rp);
|
dyn_libs::Discord_UpdatePresence(&rp);
|
||||||
|
|
Loading…
Reference in New Issue