Skip to content

Commit

Permalink
UI: Reset RPC state when AppHost stops
Browse files Browse the repository at this point in the history
  • Loading branch information
GreemDev committed Oct 19, 2024
1 parent 741eba2 commit 2facad4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/Ryujinx.UI.Common/DiscordIntegrationModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ public static void SwitchToPlayingState(ApplicationMetadata appMeta, ProcessResu
});
}

public static void SwitchToMainState() => _discordClient?.SetPresence(_discordPresenceMain);

private static string TruncateToByteLength(string input)
{
if (Encoding.UTF8.GetByteCount(input) <= ApplicationByteLimit)
Expand Down
8 changes: 5 additions & 3 deletions src/Ryujinx/AppHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ public void ToggleVSync()
public void Stop()
{
_isActive = false;
DiscordIntegrationModule.SwitchToMainState();
}

private void Exit()
Expand All @@ -511,6 +512,7 @@ private void Exit()

_isStopped = true;
_isActive = false;
DiscordIntegrationModule.SwitchToMainState();
}

public void DisposeContext()
Expand Down Expand Up @@ -962,10 +964,10 @@ private void RenderLoop()
{
if (_viewModel.StartGamesInFullscreen)
{
_viewModel.WindowState = WindowState.FullScreen;
_viewModel.WindowState = MainWindow.FullScreenWindowState;
}

if (_viewModel.WindowState == WindowState.FullScreen)
if (_viewModel.WindowState == MainWindow.FullScreenWindowState)
{
_viewModel.ShowMenuAndStatusBar = false;
}
Expand Down Expand Up @@ -1136,7 +1138,7 @@ private bool UpdateFrame()

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();
}
Expand Down

0 comments on commit 2facad4

Please sign in to comment.