UI: Reset RPC state when AppHost stops

This commit is contained in:
Evan Husted 2024-10-19 16:40:28 -05:00
parent 741eba2798
commit 2facad4be3
2 changed files with 7 additions and 3 deletions

View file

@ -86,6 +86,8 @@ namespace Ryujinx.UI.Common
}); });
} }
public static void SwitchToMainState() => _discordClient?.SetPresence(_discordPresenceMain);
private static string TruncateToByteLength(string input) private static string TruncateToByteLength(string input)
{ {
if (Encoding.UTF8.GetByteCount(input) <= ApplicationByteLimit) if (Encoding.UTF8.GetByteCount(input) <= ApplicationByteLimit)

View file

@ -498,6 +498,7 @@ namespace Ryujinx.Ava
public void Stop() public void Stop()
{ {
_isActive = false; _isActive = false;
DiscordIntegrationModule.SwitchToMainState();
} }
private void Exit() private void Exit()
@ -511,6 +512,7 @@ namespace Ryujinx.Ava
_isStopped = true; _isStopped = true;
_isActive = false; _isActive = false;
DiscordIntegrationModule.SwitchToMainState();
} }
public void DisposeContext() public void DisposeContext()
@ -962,10 +964,10 @@ namespace Ryujinx.Ava
{ {
if (_viewModel.StartGamesInFullscreen) if (_viewModel.StartGamesInFullscreen)
{ {
_viewModel.WindowState = WindowState.FullScreen; _viewModel.WindowState = MainWindow.FullScreenWindowState;
} }
if (_viewModel.WindowState == WindowState.FullScreen) if (_viewModel.WindowState == MainWindow.FullScreenWindowState)
{ {
_viewModel.ShowMenuAndStatusBar = false; _viewModel.ShowMenuAndStatusBar = false;
} }
@ -1136,7 +1138,7 @@ namespace Ryujinx.Ava
Dispatcher.UIThread.Post(() => 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(); Device.Processes.ActiveApplication.DiskCacheLoadState?.Cancel();
} }