From d19a7c3782d8402a5c3d8c730fb2ef080da7a8b5 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 28 Sep 2025 18:43:01 +0200 Subject: [PATCH 1/3] [service] unstub process winding (#2590) It's used on FW19+ and FW20+ but since all 20+ applets stuck on HID, you still can't boot into applets. Should fix: Bioshock Infinite on FW19 Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2590 Reviewed-by: Shinmegumi Reviewed-by: MaranBr Co-authored-by: unknown Co-committed-by: unknown --- src/core/hle/service/am/applet.h | 5 ++ .../am/service/process_winding_controller.cpp | 54 ++++++++++++++++--- .../am/service/process_winding_controller.h | 10 ++++ .../service/am/service/self_controller.cpp | 12 +++++ .../hle/service/am/service/self_controller.h | 4 ++ 5 files changed, 79 insertions(+), 6 deletions(-) diff --git a/src/core/hle/service/am/applet.h b/src/core/hle/service/am/applet.h index 6cc8cdf741..ad84f39dc7 100644 --- a/src/core/hle/service/am/applet.h +++ b/src/core/hle/service/am/applet.h @@ -8,6 +8,7 @@ #include #include +#include #include "common/math_util.h" #include "core/hle/service/apm/apm_controller.h" @@ -23,6 +24,7 @@ #include "core/hle/service/am/hid_registration.h" #include "core/hle/service/am/lifecycle_manager.h" #include "core/hle/service/am/process_holder.h" +#include "core/hle/service/am/service/storage.h" namespace Service::AM { @@ -97,6 +99,9 @@ struct Applet { std::deque> preselected_user_launch_parameter{}; std::deque> friend_invitation_storage_channel{}; + // Context Stack + std::stack> context_stack{}; + // Caller applet std::weak_ptr caller_applet{}; std::shared_ptr caller_applet_broker{}; diff --git a/src/core/hle/service/am/service/process_winding_controller.cpp b/src/core/hle/service/am/service/process_winding_controller.cpp index 10df830d70..30529de550 100644 --- a/src/core/hle/service/am/service/process_winding_controller.cpp +++ b/src/core/hle/service/am/service/process_winding_controller.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -15,12 +18,12 @@ IProcessWindingController::IProcessWindingController(Core::System& system_, static const FunctionInfo functions[] = { {0, D<&IProcessWindingController::GetLaunchReason>, "GetLaunchReason"}, {11, D<&IProcessWindingController::OpenCallingLibraryApplet>, "OpenCallingLibraryApplet"}, - {21, nullptr, "PushContext"}, - {22, nullptr, "PopContext"}, - {23, nullptr, "CancelWindingReservation"}, - {30, nullptr, "WindAndDoReserved"}, - {40, nullptr, "ReserveToStartAndWaitAndUnwindThis"}, - {41, nullptr, "ReserveToStartAndWait"}, + {21, D<&IProcessWindingController::PushContext>, "PushContext"}, + {22, D<&IProcessWindingController::PopContext>, "PopContext"}, + {23, D<&IProcessWindingController::CancelWindingReservation>, "CancelWindingReservation"}, + {30, D<&IProcessWindingController::WindAndDoReserved>, "WindAndDoReserved"}, + {40, D<&IProcessWindingController::ReserveToStartAndWaitAndUnwindThis>, "ReserveToStartAndWaitAndUnwindThis"}, + {41, D<&IProcessWindingController::ReserveToStartAndWait>, "ReserveToStartAndWait"}, }; // clang-format on @@ -51,4 +54,43 @@ Result IProcessWindingController::OpenCallingLibraryApplet( R_SUCCEED(); } +Result IProcessWindingController::PushContext(SharedPointer context) { + LOG_INFO(Service_AM, "called"); + m_applet->context_stack.push(context); + R_SUCCEED(); +} + +Result IProcessWindingController::PopContext(Out> out_context) { + LOG_INFO(Service_AM, "called"); + + if (m_applet->context_stack.empty()) { + LOG_ERROR(Service_AM, "Context stack is empty"); + R_THROW(ResultUnknown); + } + + *out_context = m_applet->context_stack.top(); + m_applet->context_stack.pop(); + R_SUCCEED(); +} + +Result IProcessWindingController::CancelWindingReservation() { + LOG_WARNING(Service_AM, "STUBBED"); + R_SUCCEED(); +} + +Result IProcessWindingController::WindAndDoReserved() { + LOG_WARNING(Service_AM, "STUBBED"); + R_SUCCEED(); +} + +Result IProcessWindingController::ReserveToStartAndWaitAndUnwindThis() { + LOG_WARNING(Service_AM, "STUBBED"); + R_SUCCEED(); +} + +Result IProcessWindingController::ReserveToStartAndWait() { + LOG_WARNING(Service_AM, "STUBBED"); + R_SUCCEED(); +} + } // namespace Service::AM diff --git a/src/core/hle/service/am/service/process_winding_controller.h b/src/core/hle/service/am/service/process_winding_controller.h index 4408af1f1d..0d53223033 100644 --- a/src/core/hle/service/am/service/process_winding_controller.h +++ b/src/core/hle/service/am/service/process_winding_controller.h @@ -1,8 +1,12 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #pragma once +#include "core/hle/service/am/service/storage.h" #include "core/hle/service/am/am_types.h" #include "core/hle/service/cmif_types.h" #include "core/hle/service/service.h" @@ -21,6 +25,12 @@ private: Result GetLaunchReason(Out out_launch_reason); Result OpenCallingLibraryApplet( Out> out_calling_library_applet); + Result PushContext(SharedPointer in_context); + Result PopContext(Out> out_context); + Result CancelWindingReservation(); + Result WindAndDoReserved(); + Result ReserveToStartAndWaitAndUnwindThis(); + Result ReserveToStartAndWait(); const std::shared_ptr m_applet; }; diff --git a/src/core/hle/service/am/service/self_controller.cpp b/src/core/hle/service/am/service/self_controller.cpp index 1db02b88fd..1b58cbea27 100644 --- a/src/core/hle/service/am/service/self_controller.cpp +++ b/src/core/hle/service/am/service/self_controller.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -67,6 +70,7 @@ ISelfController::ISelfController(Core::System& system_, std::shared_ptr {110, nullptr, "SetApplicationAlbumUserData"}, {120, D<&ISelfController::SaveCurrentScreenshot>, "SaveCurrentScreenshot"}, {130, D<&ISelfController::SetRecordVolumeMuted>, "SetRecordVolumeMuted"}, + {230, D<&ISelfController::Unknown230>, "Unknown230"}, {1000, nullptr, "GetDebugStorageChannel"}, }; // clang-format on @@ -404,4 +408,12 @@ Result ISelfController::SetRecordVolumeMuted(bool muted) { R_SUCCEED(); } +Result ISelfController::Unknown230(u32 in_val, Out out_val) { + LOG_WARNING(Service_AM, "(STUBBED) called, in_val={}", in_val); + + *out_val = 0; + + R_SUCCEED(); +} + } // namespace Service::AM diff --git a/src/core/hle/service/am/service/self_controller.h b/src/core/hle/service/am/service/self_controller.h index eca083cfe5..86cd9f1118 100644 --- a/src/core/hle/service/am/service/self_controller.h +++ b/src/core/hle/service/am/service/self_controller.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -63,6 +66,7 @@ private: Result SetAlbumImageTakenNotificationEnabled(bool enabled); Result SaveCurrentScreenshot(Capture::AlbumReportOption album_report_option); Result SetRecordVolumeMuted(bool muted); + Result Unknown230(u32 in_val, Out out_val); Kernel::KProcess* const m_process; const std::shared_ptr m_applet; From 7717b20ff4996406e6aea1a5368441c5da8aafdf Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Thu, 18 Sep 2025 23:31:56 -0300 Subject: [PATCH 2/3] [meta] Add option to FORCE X11 as Graphics Backend * save the option on a external file because settings are loaded AFTER Qt window is created and then the graphics backend is already applied Signed-off-by: Caio Oliveira --- src/common/settings.h | 4 ++ src/qt_common/CMakeLists.txt | 4 ++ src/qt_common/gui_settings.cpp | 25 +++++++++++ src/qt_common/gui_settings.h | 14 ++++++ src/qt_common/shared_translation.cpp | 4 ++ src/yuzu/main.cpp | 64 ++++++++++++++++++++++++++++ src/yuzu/main.h | 3 ++ 7 files changed, 118 insertions(+) create mode 100644 src/qt_common/gui_settings.cpp create mode 100644 src/qt_common/gui_settings.h diff --git a/src/common/settings.h b/src/common/settings.h index 8605445837..6279088909 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -643,6 +643,10 @@ struct Values { // Linux SwitchableSetting enable_gamemode{linkage, true, "enable_gamemode", Category::Linux}; +#ifdef __unix__ + SwitchableSetting gui_force_x11{linkage, false, "gui_force_x11", Category::Linux}; + Setting gui_hide_backend_warning{linkage, false, "gui_hide_backend_warning", Category::Linux}; +#endif // Controls InputSetting> players; diff --git a/src/qt_common/CMakeLists.txt b/src/qt_common/CMakeLists.txt index eb36de4cf2..21f3f7dd50 100644 --- a/src/qt_common/CMakeLists.txt +++ b/src/qt_common/CMakeLists.txt @@ -30,6 +30,10 @@ add_library(qt_common STATIC ) +if (UNIX) + target_sources(qt_common PRIVATE gui_settings.cpp gui_settings.h) +endif() + create_target_directory_groups(qt_common) # TODO(crueter) diff --git a/src/qt_common/gui_settings.cpp b/src/qt_common/gui_settings.cpp new file mode 100644 index 0000000000..982d28bbcb --- /dev/null +++ b/src/qt_common/gui_settings.cpp @@ -0,0 +1,25 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "gui_settings.h" +#include "common/fs/fs.h" +#include "common/fs/path_util.h" + +namespace FS = Common::FS; + +namespace GraphicsBackend { + +QString GuiConfigPath() { + return QString::fromStdString(FS::PathToUTF8String(FS::GetEdenPath(FS::EdenPath::ConfigDir) / "gui_config.ini")); +} + +void SetForceX11(bool state) { + (void)FS::CreateParentDir(GuiConfigPath().toStdString()); + QSettings(GuiConfigPath(), QSettings::IniFormat).setValue("gui_force_x11", state); +} + +bool GetForceX11() { + return QSettings(GuiConfigPath(), QSettings::IniFormat).value("gui_force_x11", false).toBool(); +} + +} // namespace GraphicsBackend diff --git a/src/qt_common/gui_settings.h b/src/qt_common/gui_settings.h new file mode 100644 index 0000000000..f37572bb71 --- /dev/null +++ b/src/qt_common/gui_settings.h @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include + +namespace GraphicsBackend { + +void SetForceX11(bool state); +bool GetForceX11(); + +} // namespace GraphicsBackend diff --git a/src/qt_common/shared_translation.cpp b/src/qt_common/shared_translation.cpp index 98a55e1fcf..d450681e79 100644 --- a/src/qt_common/shared_translation.cpp +++ b/src/qt_common/shared_translation.cpp @@ -446,6 +446,10 @@ std::unique_ptr InitializeTranslations(QObject* parent) // Linux INSERT(Settings, enable_gamemode, tr("Enable Gamemode"), QString()); +#ifdef __unix__ + INSERT(Settings, gui_force_x11, tr("Force X11 as Graphics Backend"), QString()); + INSERT(Settings, gui_hide_backend_warning, QString(), QString()); +#endif // Ui Debugging diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index d2c12c9d40..948ed0601d 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -21,6 +21,7 @@ #ifdef __unix__ #include #include +#include "qt_common/gui_settings.h" #endif #ifdef __linux__ #include "common/linux/gamemode.h" @@ -544,6 +545,10 @@ GMainWindow::GMainWindow(bool has_broken_vulkan) // Gen keys if necessary OnCheckFirmwareDecryption(); +#ifdef __unix__ + OnCheckGraphicsBackend(); +#endif + game_list->LoadCompatibilityList(); // force reload on first load to ensure add-ons get updated game_list->PopulateAsync(UISettings::values.game_dirs); @@ -3420,6 +3425,9 @@ void GMainWindow::OnConfigure() { #ifdef __linux__ const bool old_gamemode = Settings::values.enable_gamemode.GetValue(); #endif +#ifdef __unix__ + const bool old_force_x11 = Settings::values.gui_force_x11.GetValue(); +#endif Settings::SetConfiguringGlobal(true); ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(), @@ -3484,6 +3492,11 @@ void GMainWindow::OnConfigure() { SetGamemodeEnabled(Settings::values.enable_gamemode.GetValue()); } #endif +#ifdef __unix__ + if (Settings::values.gui_force_x11.GetValue() != old_force_x11) { + GraphicsBackend::SetForceX11(Settings::values.gui_force_x11.GetValue()); + } +#endif if (!multiplayer_state->IsHostingPublicRoom()) { multiplayer_state->UpdateCredentials(); @@ -4448,6 +4461,54 @@ void GMainWindow::OnCheckFirmwareDecryption() { UpdateMenuState(); } +#ifdef __unix__ +void GMainWindow::OnCheckGraphicsBackend() { + const QString platformName = QGuiApplication::platformName(); + const QByteArray qtPlatform = qgetenv("QT_QPA_PLATFORM"); + + if (platformName == QStringLiteral("xcb") || qtPlatform == "xcb") + return; + + const bool isWayland = platformName.startsWith(QStringLiteral("wayland"), Qt::CaseInsensitive) || qtPlatform.startsWith("wayland"); + if (!isWayland) + return; + + const bool currently_hidden = Settings::values.gui_hide_backend_warning.GetValue(); + if (currently_hidden) + return; + + QMessageBox msgbox(this); + msgbox.setWindowTitle(tr("Wayland Detected!")); + msgbox.setText(tr("You are running Eden under Wayland Graphics Backend.\n\n" + "It's recommended to use X11 for the best compatibility.\n\n" + "There's no plan to support Wayland at moment\nExpect crashes!")); + msgbox.setIcon(QMessageBox::Warning); + + QPushButton* okButton = msgbox.addButton(tr("Use X11"), QMessageBox::AcceptRole); + QPushButton* cancelButton = msgbox.addButton(tr("Continue with Wayland"), QMessageBox::RejectRole); + msgbox.setDefaultButton(okButton); + + QCheckBox* cb = new QCheckBox(tr("Don't show again"), &msgbox); + cb->setChecked(currently_hidden); + msgbox.setCheckBox(cb); + + msgbox.exec(); + + const bool hide = cb->isChecked(); + if (hide != currently_hidden) { + Settings::values.gui_hide_backend_warning.SetValue(hide); + } + + if (msgbox.clickedButton() == okButton) { + Settings::values.gui_force_x11.SetValue(true); + GraphicsBackend::SetForceX11(true); + QMessageBox::information(this, + tr("Restart Required"), + tr("Restart Eden to apply the X11 backend.")); + } +} +#endif + bool GMainWindow::CheckFirmwarePresence() { return FirmwareManager::CheckFirmwarePresence(*QtCommon::system.get()); } @@ -4937,6 +4998,9 @@ int main(int argc, char* argv[]) { qputenv("DISPLAY", ":0"); } + if (GraphicsBackend::GetForceX11()) + qputenv("QT_QPA_PLATFORM", "xcb"); + // Fix the Wayland appId. This needs to match the name of the .desktop file without the .desktop // suffix. QGuiApplication::setDesktopFileName(QStringLiteral("dev.eden_emu.eden")); diff --git a/src/yuzu/main.h b/src/yuzu/main.h index e3922759b0..3515238280 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -411,6 +411,9 @@ private slots: void OnCreateHomeMenuApplicationMenuShortcut(); void OnCaptureScreenshot(); void OnCheckFirmwareDecryption(); +#ifdef __unix__ + void OnCheckGraphicsBackend(); +#endif void OnLanguageChanged(const QString& locale); void OnMouseActivity(); bool OnShutdownBegin(); From 86909fb4ed13cb47e716473e55836f1ea2668e09 Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Thu, 18 Sep 2025 23:31:56 -0300 Subject: [PATCH 3/3] [meta] Add option to FORCE X11 as Graphics Backend * save the option on a external file because settings are loaded AFTER Qt window is created and then the graphics backend is already applied Signed-off-by: Caio Oliveira --- src/common/settings.h | 4 ++ src/qt_common/CMakeLists.txt | 4 ++ src/qt_common/gui_settings.cpp | 25 +++++++++++ src/qt_common/gui_settings.h | 14 ++++++ src/qt_common/shared_translation.cpp | 4 ++ src/yuzu/main.cpp | 64 ++++++++++++++++++++++++++++ src/yuzu/main.h | 3 ++ 7 files changed, 118 insertions(+) create mode 100644 src/qt_common/gui_settings.cpp create mode 100644 src/qt_common/gui_settings.h diff --git a/src/common/settings.h b/src/common/settings.h index 8605445837..6279088909 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -643,6 +643,10 @@ struct Values { // Linux SwitchableSetting enable_gamemode{linkage, true, "enable_gamemode", Category::Linux}; +#ifdef __unix__ + SwitchableSetting gui_force_x11{linkage, false, "gui_force_x11", Category::Linux}; + Setting gui_hide_backend_warning{linkage, false, "gui_hide_backend_warning", Category::Linux}; +#endif // Controls InputSetting> players; diff --git a/src/qt_common/CMakeLists.txt b/src/qt_common/CMakeLists.txt index eb36de4cf2..21f3f7dd50 100644 --- a/src/qt_common/CMakeLists.txt +++ b/src/qt_common/CMakeLists.txt @@ -30,6 +30,10 @@ add_library(qt_common STATIC ) +if (UNIX) + target_sources(qt_common PRIVATE gui_settings.cpp gui_settings.h) +endif() + create_target_directory_groups(qt_common) # TODO(crueter) diff --git a/src/qt_common/gui_settings.cpp b/src/qt_common/gui_settings.cpp new file mode 100644 index 0000000000..982d28bbcb --- /dev/null +++ b/src/qt_common/gui_settings.cpp @@ -0,0 +1,25 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "gui_settings.h" +#include "common/fs/fs.h" +#include "common/fs/path_util.h" + +namespace FS = Common::FS; + +namespace GraphicsBackend { + +QString GuiConfigPath() { + return QString::fromStdString(FS::PathToUTF8String(FS::GetEdenPath(FS::EdenPath::ConfigDir) / "gui_config.ini")); +} + +void SetForceX11(bool state) { + (void)FS::CreateParentDir(GuiConfigPath().toStdString()); + QSettings(GuiConfigPath(), QSettings::IniFormat).setValue("gui_force_x11", state); +} + +bool GetForceX11() { + return QSettings(GuiConfigPath(), QSettings::IniFormat).value("gui_force_x11", false).toBool(); +} + +} // namespace GraphicsBackend diff --git a/src/qt_common/gui_settings.h b/src/qt_common/gui_settings.h new file mode 100644 index 0000000000..f37572bb71 --- /dev/null +++ b/src/qt_common/gui_settings.h @@ -0,0 +1,14 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include +#include + +namespace GraphicsBackend { + +void SetForceX11(bool state); +bool GetForceX11(); + +} // namespace GraphicsBackend diff --git a/src/qt_common/shared_translation.cpp b/src/qt_common/shared_translation.cpp index 98a55e1fcf..d450681e79 100644 --- a/src/qt_common/shared_translation.cpp +++ b/src/qt_common/shared_translation.cpp @@ -446,6 +446,10 @@ std::unique_ptr InitializeTranslations(QObject* parent) // Linux INSERT(Settings, enable_gamemode, tr("Enable Gamemode"), QString()); +#ifdef __unix__ + INSERT(Settings, gui_force_x11, tr("Force X11 as Graphics Backend"), QString()); + INSERT(Settings, gui_hide_backend_warning, QString(), QString()); +#endif // Ui Debugging diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index d2c12c9d40..948ed0601d 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -21,6 +21,7 @@ #ifdef __unix__ #include #include +#include "qt_common/gui_settings.h" #endif #ifdef __linux__ #include "common/linux/gamemode.h" @@ -544,6 +545,10 @@ GMainWindow::GMainWindow(bool has_broken_vulkan) // Gen keys if necessary OnCheckFirmwareDecryption(); +#ifdef __unix__ + OnCheckGraphicsBackend(); +#endif + game_list->LoadCompatibilityList(); // force reload on first load to ensure add-ons get updated game_list->PopulateAsync(UISettings::values.game_dirs); @@ -3420,6 +3425,9 @@ void GMainWindow::OnConfigure() { #ifdef __linux__ const bool old_gamemode = Settings::values.enable_gamemode.GetValue(); #endif +#ifdef __unix__ + const bool old_force_x11 = Settings::values.gui_force_x11.GetValue(); +#endif Settings::SetConfiguringGlobal(true); ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(), @@ -3484,6 +3492,11 @@ void GMainWindow::OnConfigure() { SetGamemodeEnabled(Settings::values.enable_gamemode.GetValue()); } #endif +#ifdef __unix__ + if (Settings::values.gui_force_x11.GetValue() != old_force_x11) { + GraphicsBackend::SetForceX11(Settings::values.gui_force_x11.GetValue()); + } +#endif if (!multiplayer_state->IsHostingPublicRoom()) { multiplayer_state->UpdateCredentials(); @@ -4448,6 +4461,54 @@ void GMainWindow::OnCheckFirmwareDecryption() { UpdateMenuState(); } +#ifdef __unix__ +void GMainWindow::OnCheckGraphicsBackend() { + const QString platformName = QGuiApplication::platformName(); + const QByteArray qtPlatform = qgetenv("QT_QPA_PLATFORM"); + + if (platformName == QStringLiteral("xcb") || qtPlatform == "xcb") + return; + + const bool isWayland = platformName.startsWith(QStringLiteral("wayland"), Qt::CaseInsensitive) || qtPlatform.startsWith("wayland"); + if (!isWayland) + return; + + const bool currently_hidden = Settings::values.gui_hide_backend_warning.GetValue(); + if (currently_hidden) + return; + + QMessageBox msgbox(this); + msgbox.setWindowTitle(tr("Wayland Detected!")); + msgbox.setText(tr("You are running Eden under Wayland Graphics Backend.\n\n" + "It's recommended to use X11 for the best compatibility.\n\n" + "There's no plan to support Wayland at moment\nExpect crashes!")); + msgbox.setIcon(QMessageBox::Warning); + + QPushButton* okButton = msgbox.addButton(tr("Use X11"), QMessageBox::AcceptRole); + QPushButton* cancelButton = msgbox.addButton(tr("Continue with Wayland"), QMessageBox::RejectRole); + msgbox.setDefaultButton(okButton); + + QCheckBox* cb = new QCheckBox(tr("Don't show again"), &msgbox); + cb->setChecked(currently_hidden); + msgbox.setCheckBox(cb); + + msgbox.exec(); + + const bool hide = cb->isChecked(); + if (hide != currently_hidden) { + Settings::values.gui_hide_backend_warning.SetValue(hide); + } + + if (msgbox.clickedButton() == okButton) { + Settings::values.gui_force_x11.SetValue(true); + GraphicsBackend::SetForceX11(true); + QMessageBox::information(this, + tr("Restart Required"), + tr("Restart Eden to apply the X11 backend.")); + } +} +#endif + bool GMainWindow::CheckFirmwarePresence() { return FirmwareManager::CheckFirmwarePresence(*QtCommon::system.get()); } @@ -4937,6 +4998,9 @@ int main(int argc, char* argv[]) { qputenv("DISPLAY", ":0"); } + if (GraphicsBackend::GetForceX11()) + qputenv("QT_QPA_PLATFORM", "xcb"); + // Fix the Wayland appId. This needs to match the name of the .desktop file without the .desktop // suffix. QGuiApplication::setDesktopFileName(QStringLiteral("dev.eden_emu.eden")); diff --git a/src/yuzu/main.h b/src/yuzu/main.h index e3922759b0..3515238280 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -411,6 +411,9 @@ private slots: void OnCreateHomeMenuApplicationMenuShortcut(); void OnCaptureScreenshot(); void OnCheckFirmwareDecryption(); +#ifdef __unix__ + void OnCheckGraphicsBackend(); +#endif void OnLanguageChanged(const QString& locale); void OnMouseActivity(); bool OnShutdownBegin();