mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 23:11:25 +12:00
Add option for preventing display sleep (#5783)
Adds support for preventing the display from sleeping while a game is running. Supports Windows, Linux (with the org.freedesktop.ScreenSaver D-Bus service), and macOS.
This commit is contained in:
parent
07022fd3b6
commit
3ad743ecaa
11 changed files with 118 additions and 16 deletions
|
@ -40,6 +40,8 @@
|
|||
|
||||
#include "Utilities/JIT.h"
|
||||
|
||||
#include "display_sleep_control.h"
|
||||
|
||||
#if defined(_WIN32) || defined(HAVE_VULKAN)
|
||||
#include "Emu/RSX/VK/VulkanAPI.h"
|
||||
#endif
|
||||
|
@ -1655,6 +1657,11 @@ void Emulator::Run()
|
|||
|
||||
idm::select<named_thread<ppu_thread>>(on_select);
|
||||
idm::select<named_thread<spu_thread>>(on_select);
|
||||
|
||||
if (g_cfg.misc.prevent_display_sleep)
|
||||
{
|
||||
disable_display_sleep();
|
||||
}
|
||||
}
|
||||
|
||||
bool Emulator::Pause()
|
||||
|
@ -1682,6 +1689,12 @@ bool Emulator::Pause()
|
|||
|
||||
idm::select<named_thread<ppu_thread>>(on_select);
|
||||
idm::select<named_thread<spu_thread>>(on_select);
|
||||
|
||||
if (g_cfg.misc.prevent_display_sleep)
|
||||
{
|
||||
enable_display_sleep();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1747,6 +1760,11 @@ void Emulator::Resume()
|
|||
idm::select<named_thread<ppu_thread>>(on_select);
|
||||
idm::select<named_thread<spu_thread>>(on_select);
|
||||
GetCallbacks().on_resume();
|
||||
|
||||
if (g_cfg.misc.prevent_display_sleep)
|
||||
{
|
||||
disable_display_sleep();
|
||||
}
|
||||
}
|
||||
|
||||
void Emulator::Stop(bool restart)
|
||||
|
@ -1818,6 +1836,11 @@ void Emulator::Stop(bool restart)
|
|||
klic.clear();
|
||||
|
||||
m_force_boot = false;
|
||||
|
||||
if (g_cfg.misc.prevent_display_sleep)
|
||||
{
|
||||
enable_display_sleep();
|
||||
}
|
||||
}
|
||||
|
||||
std::string cfg_root::node_vfs::get(const cfg::string& _cfg, const char* _def) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue