From 7c7c50f6216bff47a69106a80465bf4c782f3785 Mon Sep 17 00:00:00 2001 From: Silent Date: Tue, 12 Dec 2023 19:04:36 +0100 Subject: [PATCH] DiscordRPC: Show session time in Discord Rich Presence --- pcsx2/VMManager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pcsx2/VMManager.cpp b/pcsx2/VMManager.cpp index 3ebb2d6de7db26..6a64224e6ed775 100644 --- a/pcsx2/VMManager.cpp +++ b/pcsx2/VMManager.cpp @@ -192,6 +192,7 @@ static bool s_screensaver_inhibited = false; static PINEServer s_pine_server; static bool s_discord_presence_active = false; +static time_t s_discord_presence_time_epoch = std::time(nullptr); bool VMManager::PerformEarlyHardwareChecks(const char** error) { @@ -2775,6 +2776,7 @@ void VMManager::SaveSessionTime(const std::string& prev_serial) } s_session_start_time = ctime; + s_discord_presence_time_epoch = std::time(nullptr); } u64 VMManager::GetSessionPlayedTime() @@ -3108,7 +3110,7 @@ void VMManager::UpdateDiscordPresence() DiscordRichPresence rp = {}; rp.largeImageKey = "4k-pcsx2"; rp.largeImageText = "PCSX2 Emulator"; - rp.startTimestamp = std::time(nullptr); + rp.startTimestamp = s_discord_presence_time_epoch; rp.details = s_title.empty() ? "No Game Running" : s_title.c_str(); std::string state_string;