mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 18:53:28 +01:00
Emu: Make prevent_display_sleep dynamic
This commit is contained in:
parent
d91551c277
commit
8d2ce2815c
@ -1618,10 +1618,8 @@ bool Emulator::Pause()
|
|||||||
idm::select<named_thread<ppu_thread>>(on_select);
|
idm::select<named_thread<ppu_thread>>(on_select);
|
||||||
idm::select<named_thread<spu_thread>>(on_select);
|
idm::select<named_thread<spu_thread>>(on_select);
|
||||||
|
|
||||||
if (g_cfg.misc.prevent_display_sleep)
|
// Always Enable display sleep, not only if it was prevented.
|
||||||
{
|
enable_display_sleep();
|
||||||
enable_display_sleep();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1776,10 +1774,8 @@ void Emulator::Stop(bool restart)
|
|||||||
|
|
||||||
m_force_boot = false;
|
m_force_boot = false;
|
||||||
|
|
||||||
if (g_cfg.misc.prevent_display_sleep)
|
// Always Enable display sleep, not only if it was prevented.
|
||||||
{
|
enable_display_sleep();
|
||||||
enable_display_sleep();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (do_exit || full_stop)
|
if (do_exit || full_stop)
|
||||||
{
|
{
|
||||||
|
@ -270,7 +270,7 @@ struct cfg_root : cfg::node
|
|||||||
cfg::_bool autostart{ this, "Automatically start games after boot", true, true };
|
cfg::_bool autostart{ this, "Automatically start games after boot", true, true };
|
||||||
cfg::_bool autoexit{ this, "Exit RPCS3 when process finishes", false, 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 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_trophy_popups{ this, "Show trophy popups", true, true };
|
||||||
cfg::_bool show_shader_compilation_hint{ this, "Show shader compilation hint", 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 };
|
cfg::_bool use_native_interface{ this, "Use native user interface", true };
|
||||||
|
@ -32,6 +32,11 @@ bool display_sleep_control_supported()
|
|||||||
|
|
||||||
void enable_display_sleep()
|
void enable_display_sleep()
|
||||||
{
|
{
|
||||||
|
if (!display_sleep_control_supported())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
SetThreadExecutionState(ES_CONTINUOUS);
|
SetThreadExecutionState(ES_CONTINUOUS);
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
@ -52,6 +57,11 @@ void enable_display_sleep()
|
|||||||
|
|
||||||
void disable_display_sleep()
|
void disable_display_sleep()
|
||||||
{
|
{
|
||||||
|
if (!display_sleep_control_supported())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
|
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "persistent_settings.h"
|
#include "persistent_settings.h"
|
||||||
#include "gs_frame.h"
|
#include "gs_frame.h"
|
||||||
#include "gl_gs_frame.h"
|
#include "gl_gs_frame.h"
|
||||||
|
#include "display_sleep_control.h"
|
||||||
|
|
||||||
#ifdef WITH_DISCORD_RPC
|
#ifdef WITH_DISCORD_RPC
|
||||||
#include "_discord_utils.h"
|
#include "_discord_utils.h"
|
||||||
@ -460,6 +461,18 @@ void gui_application::OnChangeStyleSheetRequest(const QString& path)
|
|||||||
|
|
||||||
void gui_application::OnEmuSettingsChange()
|
void gui_application::OnEmuSettingsChange()
|
||||||
{
|
{
|
||||||
|
if (Emu.IsRunning())
|
||||||
|
{
|
||||||
|
if (g_cfg.misc.prevent_display_sleep)
|
||||||
|
{
|
||||||
|
enable_display_sleep();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
disable_display_sleep();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Emu.ConfigureLogs();
|
Emu.ConfigureLogs();
|
||||||
rsx::overlays::reset_performance_overlay();
|
rsx::overlays::reset_performance_overlay();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user