From 4b841e634340df0304385b7db19706796ff851a1 Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Sun, 1 Dec 2024 19:53:05 +0200 Subject: [PATCH] Add Discord RPC reloading --- include/discord_rpc.hpp | 2 ++ src/emulator.cpp | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/discord_rpc.hpp b/include/discord_rpc.hpp index 9b244fafc..62bd0c6b9 100644 --- a/include/discord_rpc.hpp +++ b/include/discord_rpc.hpp @@ -17,6 +17,8 @@ namespace Discord { void init(); void update(RPCStatus status, const std::string& title); void stop(); + + bool running() const { return enabled; } }; } // namespace Discord diff --git a/src/emulator.cpp b/src/emulator.cpp index 6b79b6346..1bb117b5d 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -451,4 +451,17 @@ void Emulator::reloadSettings() { if (Renderdoc::isSupported() && config.enableRenderdoc && !Renderdoc::isLoaded()) { loadRenderdoc(); } + +#ifdef PANDA3DS_ENABLE_DISCORD_RPC + // Reload RPC setting if we're compiling with RPC support + + if (discordRpc.running() != config.discordRpcEnabled) { + if (config.discordRpcEnabled) { + discordRpc.init(); + updateDiscord(); + } else { + discordRpc.stop(); + } + } +#endif } \ No newline at end of file