Skip to content

Commit 45291c5

Browse files
authored
DiscordRPC: Add Rcheevos Icon Support (#3286)
1 parent 895c489 commit 45291c5

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/core/achievements.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,11 @@ const std::string& Achievements::GetGameIconPath()
523523
return s_game_icon;
524524
}
525525

526+
const std::string& Achievements::GetGameIconURL()
527+
{
528+
return s_game_icon_url;
529+
}
530+
526531
const std::string& Achievements::GetRichPresenceString()
527532
{
528533
return s_rich_presence_string;

src/core/achievements.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ bool HasRichPresence();
115115
/// Should be called with the lock held.
116116
const std::string& GetRichPresenceString();
117117

118+
/// Returns the URL for the current icon of the game
119+
const std::string& GetGameIconURL();
120+
118121
/// Returns the RetroAchievements title for the current game.
119122
/// Should be called with the lock held.
120123
const std::string& GetGameTitle();

src/core/system.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5892,6 +5892,8 @@ void System::UpdateRichPresence(bool update_session_time)
58925892
const auto lock = Achievements::GetLock();
58935893
state_string = StringUtil::Ellipsise(Achievements::GetRichPresenceString(), 128);
58945894
rp.state = state_string.c_str();
5895+
if (const std::string& icon_url = Achievements::GetGameIconURL(); !icon_url.empty())
5896+
rp.largeImageKey = icon_url.c_str();
58955897
}
58965898

58975899
dyn_libs::Discord_UpdatePresence(&rp);

0 commit comments

Comments
 (0)