Skip to content

Commit

Permalink
DiscordRPC: Add Rcheevos Icon Support
Browse files Browse the repository at this point in the history
  • Loading branch information
kamfretoz committed Sep 1, 2024
1 parent a8cca76 commit a00ed1b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/achievements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,11 @@ const std::string& Achievements::GetGameIconPath()
return s_game_icon;
}

const std::string& Achievements::GetGameIconURL()
{
return s_game_icon_url;
}

const std::string& Achievements::GetRichPresenceString()
{
return s_rich_presence_string;
Expand Down
3 changes: 3 additions & 0 deletions src/core/achievements.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ bool HasRichPresence();
/// Should be called with the lock held.
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.
/// Should be called with the lock held.
const std::string& GetGameTitle();
Expand Down
2 changes: 2 additions & 0 deletions src/core/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5892,6 +5892,8 @@ void System::UpdateRichPresence(bool update_session_time)
const auto lock = Achievements::GetLock();
state_string = StringUtil::Ellipsise(Achievements::GetRichPresenceString(), 128);
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);
Expand Down

0 comments on commit a00ed1b

Please sign in to comment.