Add cross-platform "disable screen saver" setting (#497)

This commit is contained in:
lisa-wolfgang 2023-02-24 15:10:07 -06:00 committed by GitHub
parent 80b1c50b50
commit 4c697d3755
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 65 additions and 7 deletions

View file

@ -49,6 +49,8 @@
#include "Cafe/TitleList/TitleList.h"
#include "wxHelper.h"
#include "util/ScreenSaver/ScreenSaver.h"
const wxString kDirectSound(wxT("DirectSound"));
const wxString kXAudio27(wxT("XAudio2.7"));
const wxString kXAudio2(wxT("XAudio2"));
@ -172,6 +174,10 @@ wxPanel* GeneralSettings2::AddGeneralPage(wxNotebook* notebook)
m_permanent_storage = new wxCheckBox(box, wxID_ANY, _("Use permanent storage"));
m_permanent_storage->SetToolTip(_("Cemu will remember your custom mlc path in %LOCALAPPDATA%/Cemu for new installations."));
second_row->Add(m_permanent_storage, 0, botflag, 5);
second_row->AddSpacer(10);
m_disable_screensaver = new wxCheckBox(box, wxID_ANY, _("Disable screen saver"));
m_disable_screensaver->SetToolTip(_("Prevents the system from activating the screen saver or going to sleep while running a game."));
second_row->Add(m_disable_screensaver, 0, botflag, 5);
box_sizer->Add(second_row, 0, wxEXPAND, 5);
}
@ -882,6 +888,13 @@ void GeneralSettings2::StoreConfig()
config.permanent_storage = use_ps;
}
config.disable_screensaver = m_disable_screensaver->IsChecked();
// Toggle while a game is running
if (CafeSystem::IsTitleRunning())
{
ScreenSaver::SetInhibit(config.disable_screensaver);
}
if (!LaunchSettings::GetMLCPath().has_value())
config.SetMLCPath(wxHelper::MakeFSPath(m_mlc_path->GetValue()), false);
@ -1494,7 +1507,8 @@ void GeneralSettings2::ApplyConfig()
m_save_screenshot->SetValue(config.save_screenshot);
m_permanent_storage->SetValue(config.permanent_storage);
m_disable_screensaver->SetValue(config.disable_screensaver);
for (auto& path : config.game_paths)
{
m_game_paths->Append(path);