From 16a7e69292ae7629b0f37d35b1f4b368ea5960ac Mon Sep 17 00:00:00 2001 From: Indev Date: Mon, 11 Sep 2023 13:01:29 +0300 Subject: [PATCH] Don't init discord rich presence untill discordrp is set to On Haven't tested this since i'm on linux and the feature looks like it is windows only --- src/discord.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/discord.c b/src/discord.c index 6926b4e1c..a845b6104 100644 --- a/src/discord.c +++ b/src/discord.c @@ -47,6 +47,8 @@ discordRequest_t *discordRequestList = NULL; static char self_ip[IP_SIZE]; +boolean drpc_init = false; + /*-------------------------------------------------- static char *DRPC_XORIPString(const char *input) @@ -315,6 +317,9 @@ void DRPC_RemoveRequest(discordRequest_t *removeRequest) --------------------------------------------------*/ void DRPC_Init(void) { + if (drpc_init || !cv_discordrp.value) return; + + drpc_init = true; DiscordEventHandlers handlers; memset(&handlers, 0, sizeof(handlers)); @@ -402,6 +407,10 @@ static void DRPC_EmptyRequests(void) --------------------------------------------------*/ void DRPC_UpdatePresence(void) { + if (!cv_discordrp.value) return; + + if (!drpc_init) DRPC_Init(); + char detailstr[48+1]; char mapimg[8+1];