From 551719fe3760eeef9677b55f98c64e6117f772e0 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 22 Apr 2024 11:51:03 -0300 Subject: [PATCH] Don't prevent windows Display Sleep while paused --- src/Ryujinx/AppHost.cs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Ryujinx/AppHost.cs b/src/Ryujinx/AppHost.cs index 43e7a79eb..96d2a1a6b 100644 --- a/src/Ryujinx/AppHost.cs +++ b/src/Ryujinx/AppHost.cs @@ -343,7 +343,10 @@ namespace Ryujinx.Ava _windowsMultimediaTimerResolution = new WindowsMultimediaTimerResolution(1); } - DisplaySleep.Prevent(); + Dispatcher.UIThread.Post(() => + { + DisplaySleep.Prevent(); + }); NpadManager.Initialize(Device, ConfigurationState.Instance.Hid.InputConfig, ConfigurationState.Instance.Hid.EnableKeyboard, ConfigurationState.Instance.Hid.EnableMouse); TouchScreenManager.Initialize(Device); @@ -456,7 +459,10 @@ namespace Ryujinx.Ava _gpuDoneEvent.WaitOne(); _gpuDoneEvent.Dispose(); - DisplaySleep.Restore(); + Dispatcher.UIThread.Post(() => + { + DisplaySleep.Restore(); + }); NpadManager.Dispose(); TouchScreenManager.Dispose(); @@ -727,6 +733,11 @@ namespace Ryujinx.Ava internal void Resume() { + Dispatcher.UIThread.Post(() => + { + DisplaySleep.Prevent(); + }); + Device?.System.TogglePauseEmulation(false); _viewModel.IsPaused = false; @@ -736,6 +747,11 @@ namespace Ryujinx.Ava internal void Pause() { + Dispatcher.UIThread.Post(() => + { + DisplaySleep.Restore(); + }); + Device?.System.TogglePauseEmulation(true); _viewModel.IsPaused = true;