From 8bc02e2df2fbb1b0bfb2e4843abd6ac5eb77caf6 Mon Sep 17 00:00:00 2001 From: Jamiras Date: Sun, 27 Sep 2020 14:35:17 -0600 Subject: [PATCH] don't update discord rich presence from retroachievements when paused --- network/discord.h | 1 - retroarch.c | 12 ++++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/network/discord.h b/network/discord.h index 1ddd09bad5..abeb471376 100644 --- a/network/discord.h +++ b/network/discord.h @@ -29,7 +29,6 @@ enum discord_presence DISCORD_PRESENCE_MENU, DISCORD_PRESENCE_GAME, DISCORD_PRESENCE_GAME_PAUSED, - DISCORD_PRESENCE_CHEEVO_UNLOCKED, DISCORD_PRESENCE_NETPLAY_HOSTING, DISCORD_PRESENCE_NETPLAY_CLIENT, DISCORD_PRESENCE_NETPLAY_NETPLAY_STOPPED, diff --git a/retroarch.c b/retroarch.c index 80568b1f9a..42d040ea0d 100644 --- a/retroarch.c +++ b/retroarch.c @@ -8995,7 +8995,7 @@ void discord_update(enum discord_presence presence) discord_st->presence.details = msg_hash_to_str( MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME_PAUSED); discord_st->pause_time = time(0); - discord_st->elapsed_time = difftime(time(0), + discord_st->elapsed_time = difftime(discord_st->pause_time, discord_st->start_time); discord_st->presence.startTimestamp = discord_st->pause_time; break; @@ -9045,7 +9045,12 @@ void discord_update(enum discord_presence presence) discord_st->presence.smallImageText = msg_hash_to_str( MENU_ENUM_LABEL_VALUE_DISCORD_STATUS_PLAYING); discord_st->presence.startTimestamp = discord_st->start_time; - discord_st->presence.details = msg_hash_to_str( + +#ifdef HAVE_CHEEVOS + discord_st->presence.details = rcheevos_get_richpresence(); + if (!discord_st->presence.details || !*discord_st->presence.details) +#endif + discord_st->presence.details = msg_hash_to_str( MENU_ENUM_LABEL_VALUE_DISCORD_IN_GAME); discord_st->presence.state = label; @@ -9116,6 +9121,9 @@ void discord_update(enum discord_presence presence) break; #ifdef HAVE_CHEEVOS case DISCORD_PRESENCE_RETROACHIEVEMENTS: + if (discord_st->pause_time) + return; + discord_st->presence.details = rcheevos_get_richpresence(); presence = DISCORD_PRESENCE_GAME; break;