diff --git a/src/core/system.cpp b/src/core/system.cpp index 820009ec6..be838ae62 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -255,6 +255,9 @@ void System::Internal::ProcessStartup() #endif if (g_settings.achievements_enabled) Achievements::Initialize(); + + if (g_settings.enable_discord_presence) + InitializeDiscordPresence(); } void System::Internal::ProcessShutdown() @@ -322,6 +325,11 @@ bool System::IsValid() return s_state == State::Running || s_state == State::Paused; } +bool System::IsValidOrInitializing() +{ + return s_state == State::Starting || s_state == State::Running || s_state == State::Paused; +} + bool System::IsExecuting() { DebugAssert(s_state != State::Shutdown); @@ -4722,7 +4730,20 @@ void System::UpdateDiscordPresence() rp.largeImageKey = "duckstation_logo"; rp.largeImageText = "DuckStation PS1/PSX Emulator"; rp.startTimestamp = std::time(nullptr); - rp.details = System::IsValid() ? System::GetGameTitle().c_str() : "No Game Running"; + rp.details = "No Game Running"; + if (IsValidOrInitializing()) + { + // Use disc set name if it's not a custom title. + if (s_running_game_entry && !s_running_game_entry->disc_set_name.empty() && + s_running_game_title == s_running_game_entry->title) + { + rp.details = s_running_game_entry->disc_set_name.c_str(); + } + else + { + rp.details = s_running_game_title.empty() ? "Unknown Game" : s_running_game_title.c_str(); + } + } std::string state_string; if (Achievements::HasRichPresence()) diff --git a/src/core/system.h b/src/core/system.h index 8f592fa7a..077b1df77 100644 --- a/src/core/system.h +++ b/src/core/system.h @@ -144,6 +144,7 @@ bool IsExecutionInterrupted(); bool IsPaused(); bool IsShutdown(); bool IsValid(); +bool IsValidOrInitializing(); bool IsExecuting(); bool IsStartupCancelled();