diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index b5967324b8..d38fa06c7a 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -1618,10 +1618,8 @@ bool Emulator::Pause() idm::select>(on_select); idm::select>(on_select); - if (g_cfg.misc.prevent_display_sleep) - { - enable_display_sleep(); - } + // Always Enable display sleep, not only if it was prevented. + enable_display_sleep(); return true; } @@ -1776,10 +1774,8 @@ void Emulator::Stop(bool restart) m_force_boot = false; - if (g_cfg.misc.prevent_display_sleep) - { - enable_display_sleep(); - } + // Always Enable display sleep, not only if it was prevented. + enable_display_sleep(); if (do_exit || full_stop) { diff --git a/rpcs3/Emu/system_config.h b/rpcs3/Emu/system_config.h index 07b61a870e..fb18e429a1 100644 --- a/rpcs3/Emu/system_config.h +++ b/rpcs3/Emu/system_config.h @@ -270,7 +270,7 @@ struct cfg_root : cfg::node cfg::_bool autostart{ this, "Automatically start games after boot", true, true }; cfg::_bool autoexit{ this, "Exit RPCS3 when process finishes", false, true }; cfg::_bool start_fullscreen{ this, "Start games in fullscreen mode", false, true }; - cfg::_bool prevent_display_sleep{ this, "Prevent display sleep while running games", true }; + cfg::_bool prevent_display_sleep{ this, "Prevent display sleep while running games", true, true }; cfg::_bool show_trophy_popups{ this, "Show trophy popups", true, true }; cfg::_bool show_shader_compilation_hint{ this, "Show shader compilation hint", true, true }; cfg::_bool use_native_interface{ this, "Use native user interface", true }; diff --git a/rpcs3/display_sleep_control.cpp b/rpcs3/display_sleep_control.cpp index 669094073c..d02119190f 100644 --- a/rpcs3/display_sleep_control.cpp +++ b/rpcs3/display_sleep_control.cpp @@ -32,6 +32,11 @@ bool display_sleep_control_supported() void enable_display_sleep() { + if (!display_sleep_control_supported()) + { + return; + } + #ifdef _WIN32 SetThreadExecutionState(ES_CONTINUOUS); #elif defined(__APPLE__) @@ -52,6 +57,11 @@ void enable_display_sleep() void disable_display_sleep() { + if (!display_sleep_control_supported()) + { + return; + } + #ifdef _WIN32 SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED); #elif defined(__APPLE__) diff --git a/rpcs3/rpcs3qt/gui_application.cpp b/rpcs3/rpcs3qt/gui_application.cpp index 654c501900..df8bef4703 100644 --- a/rpcs3/rpcs3qt/gui_application.cpp +++ b/rpcs3/rpcs3qt/gui_application.cpp @@ -8,6 +8,7 @@ #include "persistent_settings.h" #include "gs_frame.h" #include "gl_gs_frame.h" +#include "display_sleep_control.h" #ifdef WITH_DISCORD_RPC #include "_discord_utils.h" @@ -460,6 +461,18 @@ void gui_application::OnChangeStyleSheetRequest(const QString& path) void gui_application::OnEmuSettingsChange() { + if (Emu.IsRunning()) + { + if (g_cfg.misc.prevent_display_sleep) + { + enable_display_sleep(); + } + else + { + disable_display_sleep(); + } + } + Emu.ConfigureLogs(); rsx::overlays::reset_performance_overlay(); }