From 2facad4be3208bb1915deafc9783cecdf9b14589 Mon Sep 17 00:00:00 2001 From: Evan Husted Date: Sat, 19 Oct 2024 16:40:28 -0500 Subject: [PATCH] UI: Reset RPC state when AppHost stops --- src/Ryujinx.UI.Common/DiscordIntegrationModule.cs | 2 ++ src/Ryujinx/AppHost.cs | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Ryujinx.UI.Common/DiscordIntegrationModule.cs b/src/Ryujinx.UI.Common/DiscordIntegrationModule.cs index d5a9c3089..c83872c09 100644 --- a/src/Ryujinx.UI.Common/DiscordIntegrationModule.cs +++ b/src/Ryujinx.UI.Common/DiscordIntegrationModule.cs @@ -86,6 +86,8 @@ namespace Ryujinx.UI.Common }); } + public static void SwitchToMainState() => _discordClient?.SetPresence(_discordPresenceMain); + private static string TruncateToByteLength(string input) { if (Encoding.UTF8.GetByteCount(input) <= ApplicationByteLimit) diff --git a/src/Ryujinx/AppHost.cs b/src/Ryujinx/AppHost.cs index 6b983a09d..9e1194ca1 100644 --- a/src/Ryujinx/AppHost.cs +++ b/src/Ryujinx/AppHost.cs @@ -498,6 +498,7 @@ namespace Ryujinx.Ava public void Stop() { _isActive = false; + DiscordIntegrationModule.SwitchToMainState(); } private void Exit() @@ -511,6 +512,7 @@ namespace Ryujinx.Ava _isStopped = true; _isActive = false; + DiscordIntegrationModule.SwitchToMainState(); } public void DisposeContext() @@ -962,10 +964,10 @@ namespace Ryujinx.Ava { if (_viewModel.StartGamesInFullscreen) { - _viewModel.WindowState = WindowState.FullScreen; + _viewModel.WindowState = MainWindow.FullScreenWindowState; } - if (_viewModel.WindowState == WindowState.FullScreen) + if (_viewModel.WindowState == MainWindow.FullScreenWindowState) { _viewModel.ShowMenuAndStatusBar = false; } @@ -1136,7 +1138,7 @@ namespace Ryujinx.Ava Dispatcher.UIThread.Post(() => { - if (_keyboardInterface.GetKeyboardStateSnapshot().IsPressed(Key.Delete) && _viewModel.WindowState != WindowState.FullScreen) + if (_keyboardInterface.GetKeyboardStateSnapshot().IsPressed(Key.Delete) && _viewModel.WindowState != MainWindow.FullScreenWindowState) { Device.Processes.ActiveApplication.DiskCacheLoadState?.Cancel(); }