Skip to content

Commit

Permalink
DiscordRPC: Show session time in Discord Rich Presence
Browse files Browse the repository at this point in the history
  • Loading branch information
CookiePLMonster committed Dec 12, 2023
1 parent 4154784 commit 7c7c50f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pcsx2/VMManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7c7c50f

Please sign in to comment.