Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DiscordRPC: Add Rcheevos Icon Support #3286

Merged
merged 1 commit into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading