From cb9570e2293075944c3461710719ac6a5417ed51 Mon Sep 17 00:00:00 2001 From: goeiecool9999 <7033575+goeiecool9999@users.noreply.github.com> Date: Thu, 30 Mar 2023 11:32:25 +0200 Subject: [PATCH] Fix disable screensaver workaround (#728) --- src/config/CemuConfig.cpp | 2 +- src/config/CemuConfig.h | 10 +++++++++- src/gui/GeneralSettings2.cpp | 9 +++++++-- src/util/ScreenSaver/ScreenSaver.h | 3 ++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/config/CemuConfig.cpp b/src/config/CemuConfig.cpp index ac24f4e9..e51dfbed 100644 --- a/src/config/CemuConfig.cpp +++ b/src/config/CemuConfig.cpp @@ -60,7 +60,7 @@ void CemuConfig::Load(XMLConfigParser& parser) did_show_macos_disclaimer = parser.get("macos_disclaimer", did_show_macos_disclaimer); fullscreen = parser.get("fullscreen", fullscreen); proxy_server = parser.get("proxy_server", ""); - disable_screensaver = parser.get("disable_screensaver", true); + disable_screensaver = parser.get("disable_screensaver", disable_screensaver); // cpu_mode = parser.get("cpu_mode", cpu_mode.GetInitValue()); //console_region = parser.get("console_region", console_region.GetInitValue()); diff --git a/src/config/CemuConfig.h b/src/config/CemuConfig.h index baf47377..ad591ee8 100644 --- a/src/config/CemuConfig.h +++ b/src/config/CemuConfig.h @@ -367,7 +367,15 @@ struct CemuConfig ConfigValue fullscreen_menubar{ false }; ConfigValue fullscreen{ false }; ConfigValue proxy_server{}; - ConfigValue disable_screensaver{true}; + + // temporary workaround because feature crashes on macOS +#if BOOST_OS_MACOS +#define DISABLE_SCREENSAVER_DEFAULT false +#else +#define DISABLE_SCREENSAVER_DEFAULT true +#endif + ConfigValue disable_screensaver{DISABLE_SCREENSAVER_DEFAULT}; +#undef DISABLE_SCREENSAVER_DEFAULT std::vector game_paths; std::mutex game_cache_entries_mutex; diff --git a/src/gui/GeneralSettings2.cpp b/src/gui/GeneralSettings2.cpp index 5a62ce71..a897d46b 100644 --- a/src/gui/GeneralSettings2.cpp +++ b/src/gui/GeneralSettings2.cpp @@ -178,8 +178,9 @@ wxPanel* GeneralSettings2::AddGeneralPage(wxNotebook* notebook) 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); -#ifdef BOOST_OS_MACOS - m_disable_screensaver->SetValue(false); + + // temporary workaround because feature crashes on macOS +#if BOOST_OS_MACOS m_disable_screensaver->Enable(false); #endif @@ -1507,6 +1508,10 @@ void GeneralSettings2::ApplyConfig() m_permanent_storage->SetValue(config.permanent_storage); m_disable_screensaver->SetValue(config.disable_screensaver); + // temporary workaround because feature crashes on macOS +#if BOOST_OS_MACOS + m_disable_screensaver->SetValue(false); +#endif for (auto& path : config.game_paths) { diff --git a/src/util/ScreenSaver/ScreenSaver.h b/src/util/ScreenSaver/ScreenSaver.h index eafdaaee..83c52868 100644 --- a/src/util/ScreenSaver/ScreenSaver.h +++ b/src/util/ScreenSaver/ScreenSaver.h @@ -6,7 +6,8 @@ class ScreenSaver public: static void SetInhibit(bool inhibit) { -#ifdef BOOST_OS_MACOS + // temporary workaround because feature crashes on macOS +#if BOOST_OS_MACOS return; #endif // Initialize video subsystem if necessary