diff options
| author | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-11-01 16:21:45 -0500 |
|---|---|---|
| committer | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-11-01 16:21:45 -0500 |
| commit | a41d11108b6478ad862fc7fcac36ab51c83b8602 (patch) | |
| tree | 2c16c13764e6ef2b48c7327055fde64d7af2cd37 /src/yuzu | |
| parent | 01effa81ab0e151f8cfd674bf4da952d24645943 (diff) | |
| parent | ac22c4087d9a6380c1937337530a5d4e54808ad1 (diff) | |
Merge remote-tracking branch 'origin/nx2' into merge/nx2-experimental-1101
# Conflicts:
# src/core/loader/deconstructed_rom_directory.cpp
Diffstat (limited to 'src/yuzu')
| -rw-r--r-- | src/yuzu/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/yuzu/Info.plist | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_graphics.cpp | 3 | ||||
| -rw-r--r-- | src/yuzu/configuration/shared_widget.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/game/game_list.cpp | 1 | ||||
| -rw-r--r-- | src/yuzu/main_window.cpp | 20 | ||||
| -rw-r--r-- | src/yuzu/main_window.h | 3 | ||||
| -rw-r--r-- | src/yuzu/util/macos_sleep.cpp | 25 | ||||
| -rw-r--r-- | src/yuzu/util/macos_sleep.h | 12 |
9 files changed, 66 insertions, 4 deletions
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index e6906a4ef0..40ff1d45f9 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -358,6 +358,8 @@ target_sources(yuzu # TODO(crueter): Move Assets.car/icon/icns handling to its own Module. if (APPLE) + target_sources(yuzu PRIVATE util/macos_sleep.cpp util/macos_sleep.h) + # Xcode will automatically generate the Assets.car and icns file for us. set(_dist "${CMAKE_SOURCE_DIR}/dist") if (CMAKE_GENERATOR MATCHES "Xcode") diff --git a/src/yuzu/Info.plist b/src/yuzu/Info.plist index cf6f597e99..9b6d49b87a 100644 --- a/src/yuzu/Info.plist +++ b/src/yuzu/Info.plist @@ -13,7 +13,7 @@ SPDX-License-Identifier: GPL-2.0-or-later <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleExecutable</key> - <string>${EXECUTABLE_NAME}</string> + <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string> <key>CFBundleGetInfoString</key> <string></string> <key>CFBundleIconFile</key> diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 641f65d82a..e4a140fff5 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -225,6 +225,9 @@ void ConfigureGraphics::Setup(const ConfigurationShared::Builder& builder) { continue; } #endif + if (setting->Id() == Settings::values.frame_gen.Id()) { + continue; + } ConfigurationShared::Widget* widget = [&]() { if (setting->Id() == Settings::values.fsr_sharpening_slider.Id()) { diff --git a/src/yuzu/configuration/shared_widget.cpp b/src/yuzu/configuration/shared_widget.cpp index 5e8e04be58..0e829e9100 100644 --- a/src/yuzu/configuration/shared_widget.cpp +++ b/src/yuzu/configuration/shared_widget.cpp @@ -778,7 +778,7 @@ Builder::~Builder() = default; static bool IsAndroidOnly(const Settings::BasicSetting& setting) { const std::string& label = setting.GetLabel(); - return label.starts_with("frame_gen") || label == "emulate_bgr565"; + return label == "emulate_bgr565"; } Widget* Builder::BuildWidget(Settings::BasicSetting* setting, diff --git a/src/yuzu/game/game_list.cpp b/src/yuzu/game/game_list.cpp index 6b89e59253..cd7fc19de4 100644 --- a/src/yuzu/game/game_list.cpp +++ b/src/yuzu/game/game_list.cpp @@ -295,7 +295,6 @@ void GameList::OnPopulatingCompleted(const QStringList& watch_list) { if (!chunk.isEmpty()) { callback(chunk); } - QCoreApplication::processEvents(); } }; diff --git a/src/yuzu/main_window.cpp b/src/yuzu/main_window.cpp index d59ac16c07..ab6d243046 100644 --- a/src/yuzu/main_window.cpp +++ b/src/yuzu/main_window.cpp @@ -85,6 +85,10 @@ #include <QStatusBar> #include <QtConcurrentRun> +#ifdef __APPLE__ +#include "util/macos_sleep.h" +#endif + // Qt Common // #include "qt_common/config/shared_translation.h" #include "qt_common/config/uisettings.h" @@ -493,7 +497,8 @@ MainWindow::MainWindow(bool has_broken_vulkan) VkDeviceInfo::PopulateRecords(vk_device_records, this->window()->windowHandle()); } -#if !defined(_WIN32) + // On macOS, SDL video would pump AppKit events alongside Qt and disrupt native menus. +#if !defined(_WIN32) && !defined(__APPLE__) SDL_InitSubSystem(SDL_INIT_VIDEO); // Set a screensaver inhibition reason string. Currently passed to DBus by SDL and visible to @@ -549,6 +554,10 @@ MainWindow::MainWindow(bool has_broken_vulkan) } MainWindow::~MainWindow() { +#ifdef __APPLE__ + AllowOSSleep(); +#endif + // will get automatically deleted otherwise if (render_window->parent() == nullptr) { delete render_window; @@ -1758,6 +1767,10 @@ void MainWindow::OnSigInterruptNotifierActivated() { void MainWindow::PreventOSSleep() { #ifdef _WIN32 SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED); +#elif defined(__APPLE__) + if (sleep_assertion_id == 0) { + sleep_assertion_id = MacOS::PreventSleep(); + } #else SDL_DisableScreenSaver(); #endif @@ -1766,6 +1779,11 @@ void MainWindow::PreventOSSleep() { void MainWindow::AllowOSSleep() { #ifdef _WIN32 SetThreadExecutionState(ES_CONTINUOUS); +#elif defined(__APPLE__) + if (sleep_assertion_id != 0) { + MacOS::AllowSleep(sleep_assertion_id); + sleep_assertion_id = 0; + } #else SDL_EnableScreenSaver(); #endif diff --git a/src/yuzu/main_window.h b/src/yuzu/main_window.h index 627ade4f6b..5181b3fc68 100644 --- a/src/yuzu/main_window.h +++ b/src/yuzu/main_window.h @@ -547,6 +547,9 @@ private: bool auto_paused = false; bool auto_muted = false; +#ifdef __APPLE__ + u32 sleep_assertion_id = 0; +#endif QTimer mouse_hide_timer; QTimer update_input_timer; diff --git a/src/yuzu/util/macos_sleep.cpp b/src/yuzu/util/macos_sleep.cpp new file mode 100644 index 0000000000..7525c37dca --- /dev/null +++ b/src/yuzu/util/macos_sleep.cpp @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#include <IOKit/pwr_mgt/IOPMLib.h> +#include "common/logging.h" +#include "yuzu/util/macos_sleep.h" + +namespace MacOS { + +u32 PreventSleep() { + IOPMAssertionID assertion_id = kIOPMNullAssertionID; + const auto result = + IOPMAssertionCreateWithName(kIOPMAssertionTypePreventUserIdleDisplaySleep, + kIOPMAssertionLevelOn, CFSTR("Running a game"), &assertion_id); + if (result != kIOReturnSuccess) { + LOG_WARNING(Frontend, "Failed to prevent display sleep: {}", result); + return kIOPMNullAssertionID; + } + return assertion_id; +} + +void AllowSleep(u32 assertion_id) { + IOPMAssertionRelease(assertion_id); +} + +} // namespace MacOS diff --git a/src/yuzu/util/macos_sleep.h b/src/yuzu/util/macos_sleep.h new file mode 100644 index 0000000000..600dd7c553 --- /dev/null +++ b/src/yuzu/util/macos_sleep.h @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "common/common_types.h" + +namespace MacOS { + +u32 PreventSleep(); +void AllowSleep(u32 assertion_id); + +} // namespace MacOS |
