[cmake, core] Unbreak FreeBSD Building Process

This commit is contained in:
SDK Chan 2025-07-24 17:33:44 +00:00 committed by crueter
parent b9c21a5c50
commit e09d39630f
3 changed files with 734 additions and 737 deletions

View file

@ -1,22 +1,23 @@
# SPDX-FileCopyrightText: 2018 yuzu Emulator Project # SPDX-FileCopyrightText: 2018 yuzu Emulator Project SPDX-License-Identifier:
# SPDX-License-Identifier: GPL-2.0-or-later # GPL-2.0-or-later
if (DEFINED ENV{AZURECIREPO}) if(DEFINED ENV{AZURECIREPO})
set(BUILD_REPOSITORY $ENV{AZURECIREPO}) set(BUILD_REPOSITORY $ENV{AZURECIREPO})
endif() endif()
if (DEFINED ENV{TITLEBARFORMATIDLE}) if(DEFINED ENV{TITLEBARFORMATIDLE})
set(TITLE_BAR_FORMAT_IDLE $ENV{TITLEBARFORMATIDLE}) set(TITLE_BAR_FORMAT_IDLE $ENV{TITLEBARFORMATIDLE})
endif () endif()
if (DEFINED ENV{TITLEBARFORMATRUNNING}) if(DEFINED ENV{TITLEBARFORMATRUNNING})
set(TITLE_BAR_FORMAT_RUNNING $ENV{TITLEBARFORMATRUNNING}) set(TITLE_BAR_FORMAT_RUNNING $ENV{TITLEBARFORMATRUNNING})
endif () endif()
if (DEFINED ENV{DISPLAYVERSION}) if(DEFINED ENV{DISPLAYVERSION})
set(DISPLAY_VERSION $ENV{DISPLAYVERSION}) set(DISPLAY_VERSION $ENV{DISPLAYVERSION})
endif () endif()
include(GenerateSCMRev) include(GenerateSCMRev)
add_library(common STATIC add_library(
common STATIC
address_space.cpp address_space.cpp
address_space.h address_space.h
algorithm.h algorithm.h
@ -158,32 +159,26 @@ add_library(common STATIC
wall_clock.cpp wall_clock.cpp
wall_clock.h wall_clock.h
zstd_compression.cpp zstd_compression.cpp
zstd_compression.h zstd_compression.h)
)
if (YUZU_ENABLE_PORTABLE) if(YUZU_ENABLE_PORTABLE)
add_compile_definitions(YUZU_ENABLE_PORTABLE) add_compile_definitions(YUZU_ENABLE_PORTABLE)
endif() endif()
if (WIN32) if(WIN32)
target_sources(common PRIVATE target_sources(common PRIVATE windows/timer_resolution.cpp
windows/timer_resolution.cpp windows/timer_resolution.h)
windows/timer_resolution.h
)
target_link_libraries(common PRIVATE ntdll) target_link_libraries(common PRIVATE ntdll)
endif() endif()
if (NOT WIN32) if(NOT WIN32)
target_sources(common PRIVATE target_sources(common PRIVATE signal_chain.cpp signal_chain.h)
signal_chain.cpp
signal_chain.h
)
endif() endif()
if(ANDROID) if(ANDROID)
target_sources(common target_sources(
PUBLIC common
fs/fs_android.cpp PUBLIC fs/fs_android.cpp
fs/fs_android.h fs/fs_android.h
android/android_common.cpp android/android_common.cpp
android/android_common.h android/android_common.h
@ -192,23 +187,19 @@ if(ANDROID)
android/multiplayer/multiplayer.cpp android/multiplayer/multiplayer.cpp
android/multiplayer/multiplayer.h android/multiplayer/multiplayer.h
android/applets/software_keyboard.cpp android/applets/software_keyboard.cpp
android/applets/software_keyboard.h android/applets/software_keyboard.h)
)
endif() endif()
if (UNIX AND NOT APPLE) if(LINUX AND NOT APPLE)
target_sources(common PRIVATE target_sources(common PRIVATE linux/gamemode.cpp linux/gamemode.h)
linux/gamemode.cpp
linux/gamemode.h
)
target_link_libraries(common PRIVATE gamemode::headers) target_link_libraries(common PRIVATE gamemode::headers)
endif() endif()
if(ARCHITECTURE_x86_64) if(ARCHITECTURE_x86_64)
target_sources(common target_sources(
PRIVATE common
x64/cpu_detect.cpp PRIVATE x64/cpu_detect.cpp
x64/cpu_detect.h x64/cpu_detect.h
x64/cpu_wait.cpp x64/cpu_wait.cpp
x64/cpu_wait.h x64/cpu_wait.h
@ -217,63 +208,68 @@ if(ARCHITECTURE_x86_64)
x64/rdtsc.cpp x64/rdtsc.cpp
x64/rdtsc.h x64/rdtsc.h
x64/xbyak_abi.h x64/xbyak_abi.h
x64/xbyak_util.h x64/xbyak_util.h)
)
target_link_libraries(common PRIVATE xbyak::xbyak) target_link_libraries(common PRIVATE xbyak::xbyak)
endif() endif()
if (HAS_NCE) if(HAS_NCE)
target_sources(common target_sources(common PRIVATE arm64/native_clock.cpp arm64/native_clock.h)
PRIVATE
arm64/native_clock.cpp
arm64/native_clock.h
)
endif() endif()
if (MSVC) if(MSVC)
target_compile_definitions(common PRIVATE target_compile_definitions(
# The standard library doesn't provide any replacement for codecvt yet common
# so we can disable this deprecation warning for the time being. PRIVATE # The standard library doesn't provide any replacement for codecvt
_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING # yet so we can disable this deprecation warning for the time being.
) _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING)
target_compile_options(common PRIVATE target_compile_options(
/we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data common
/we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data PRIVATE /we4242 # 'identifier': conversion from 'type1' to 'type2', possible
/we4800 # Implicit conversion from 'type' to bool. Possible information loss # loss of data
/we4254 # 'operator': conversion from 'type1:field_bits' to
# 'type2:field_bits', possible loss of data
/we4800 # Implicit conversion from 'type' to bool. Possible
# information loss
) )
else() else()
set_source_files_properties(stb.cpp PROPERTIES COMPILE_OPTIONS "-Wno-implicit-fallthrough;-Wno-missing-declarations;-Wno-missing-field-initializers") set_source_files_properties(
stb.cpp
PROPERTIES
COMPILE_OPTIONS
"-Wno-implicit-fallthrough;-Wno-missing-declarations;-Wno-missing-field-initializers"
)
# Get around GCC failing with intrinsics in Debug # Get around GCC failing with intrinsics in Debug
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_BUILD_TYPE MATCHES "Debug") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_BUILD_TYPE MATCHES "Debug")
set_property( set_property(
SOURCE stb.cpp SOURCE stb.cpp
APPEND APPEND
PROPERTY COMPILE_OPTIONS ";-O2" PROPERTY COMPILE_OPTIONS ";-O2")
)
endif() endif()
endif() endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(common PRIVATE target_compile_options(common PRIVATE -fsized-deallocation
-fsized-deallocation -Werror=unreachable-code-aggressive)
-Werror=unreachable-code-aggressive target_compile_definitions(
) common
target_compile_definitions(common PRIVATE PRIVATE
# Clang 14 and earlier have errors when explicitly instantiating Settings::Setting # Clang 14 and earlier have errors when explicitly instantiating
# Settings::Setting
$<$<VERSION_LESS:$<CXX_COMPILER_VERSION>,15>:CANNOT_EXPLICITLY_INSTANTIATE> $<$<VERSION_LESS:$<CXX_COMPILER_VERSION>,15>:CANNOT_EXPLICITLY_INSTANTIATE>
) )
endif() endif()
target_link_libraries(common PUBLIC Boost::headers fmt::fmt microprofile stb::headers Threads::Threads) target_link_libraries(common PUBLIC Boost::headers fmt::fmt microprofile
stb::headers Threads::Threads)
target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd LLVM::Demangle) target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd LLVM::Demangle)
if (ANDROID) if(ANDROID)
# For ASharedMemory_create # For ASharedMemory_create
target_link_libraries(common PRIVATE android) target_link_libraries(common PRIVATE android)
endif() endif()
if (YUZU_USE_PRECOMPILED_HEADERS) if(YUZU_USE_PRECOMPILED_HEADERS)
target_precompile_headers(common PRIVATE precompiled_headers.h) target_precompile_headers(common PRIVATE precompiled_headers.h)
endif() endif()

View file

@ -20,6 +20,8 @@
#ifdef __unix__ #ifdef __unix__
#include <csignal> #include <csignal>
#include <sys/socket.h> #include <sys/socket.h>
#endif
#ifdef __linux__
#include "common/linux/gamemode.h" #include "common/linux/gamemode.h"
#endif #endif
@ -37,8 +39,8 @@
#include "configuration/configure_input.h" #include "configuration/configure_input.h"
#include "configuration/configure_per_game.h" #include "configuration/configure_per_game.h"
#include "configuration/configure_tas.h" #include "configuration/configure_tas.h"
#include "core/file_sys/romfs_factory.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/file_sys/romfs_factory.h"
#include "core/file_sys/vfs/vfs.h" #include "core/file_sys/vfs/vfs.h"
#include "core/file_sys/vfs/vfs_real.h" #include "core/file_sys/vfs/vfs_real.h"
#include "core/frontend/applets/cabinet.h" #include "core/frontend/applets/cabinet.h"
@ -313,8 +315,7 @@ bool GMainWindow::CheckDarkMode() {
GMainWindow::GMainWindow(bool has_broken_vulkan) GMainWindow::GMainWindow(bool has_broken_vulkan)
: ui{std::make_unique<Ui::MainWindow>()}, system{std::make_unique<Core::System>()}, : ui{std::make_unique<Ui::MainWindow>()}, system{std::make_unique<Core::System>()},
input_subsystem{std::make_shared<InputCommon::InputSubsystem>()}, input_subsystem{std::make_shared<InputCommon::InputSubsystem>()}, user_data_migrator{this},
user_data_migrator{this},
vfs{std::make_shared<FileSys::RealVfsFilesystem>()}, vfs{std::make_shared<FileSys::RealVfsFilesystem>()},
provider{std::make_unique<FileSys::ManualContentProvider>()} { provider{std::make_unique<FileSys::ManualContentProvider>()} {
Common::FS::CreateEdenPaths(); Common::FS::CreateEdenPaths();
@ -322,7 +323,8 @@ GMainWindow::GMainWindow(bool has_broken_vulkan)
if (user_data_migrator.migrated) { if (user_data_migrator.migrated) {
// Sort-of hack whereby we only move the old dir if it's a subfolder of the user dir // Sort-of hack whereby we only move the old dir if it's a subfolder of the user dir
#define MIGRATE_DIR(type) std::string type##path = Common::FS::GetEdenPathString(Common::FS::EdenPath::type##Dir); \ #define MIGRATE_DIR(type) \
std::string type##path = Common::FS::GetEdenPathString(Common::FS::EdenPath::type##Dir); \
if (type##path.starts_with(user_data_migrator.selected_emu.get_user_dir())) { \ if (type##path.starts_with(user_data_migrator.selected_emu.get_user_dir())) { \
boost::replace_all(type##path, user_data_migrator.selected_emu.lower_name(), "eden"); \ boost::replace_all(type##path, user_data_migrator.selected_emu.lower_name(), "eden"); \
Common::FS::SetEdenPath(Common::FS::EdenPath::type##Dir, type##path); \ Common::FS::SetEdenPath(Common::FS::EdenPath::type##Dir, type##path); \
@ -333,13 +335,17 @@ GMainWindow::GMainWindow(bool has_broken_vulkan)
MIGRATE_DIR(Dump) MIGRATE_DIR(Dump)
MIGRATE_DIR(Load) MIGRATE_DIR(Load)
#undef MIGRATE_DIR #undef MIGRATE_DIR
} }
#ifdef __unix__ #ifdef __unix__
SetupSigInterrupts(); SetupSigInterrupts();
#endif
#ifdef __linux__
SetGamemodeEnabled(Settings::values.enable_gamemode.GetValue()); SetGamemodeEnabled(Settings::values.enable_gamemode.GetValue());
#endif #endif
UISettings::RestoreWindowState(config); UISettings::RestoreWindowState(config);
system->Initialize(); system->Initialize();
@ -436,8 +442,7 @@ GMainWindow::GMainWindow(bool has_broken_vulkan)
#ifdef ENABLE_QT_UPDATE_CHECKER #ifdef ENABLE_QT_UPDATE_CHECKER
if (UISettings::values.check_for_updates) { if (UISettings::values.check_for_updates) {
update_future = QtConcurrent::run([]() -> QString { update_future = QtConcurrent::run([]() -> QString {
const bool is_prerelease = const bool is_prerelease = ((strstr(Common::g_build_version, "pre-alpha") != NULL) ||
((strstr(Common::g_build_version, "pre-alpha") != NULL) ||
(strstr(Common::g_build_version, "alpha") != NULL) || (strstr(Common::g_build_version, "alpha") != NULL) ||
(strstr(Common::g_build_version, "beta") != NULL) || (strstr(Common::g_build_version, "beta") != NULL) ||
(strstr(Common::g_build_version, "rc") != NULL)); (strstr(Common::g_build_version, "rc") != NULL));
@ -1441,7 +1446,7 @@ void GMainWindow::InitializeHotkeys() {
connect(hotkey, &QShortcut::activated, this, function); connect(hotkey, &QShortcut::activated, this, function);
connect(controller_hotkey, &ControllerShortcut::Activated, this, function, connect(controller_hotkey, &ControllerShortcut::Activated, this, function,
Qt::QueuedConnection); Qt::QueuedConnection);
}; };
connect_shortcut(QStringLiteral("Exit Fullscreen"), [&] { connect_shortcut(QStringLiteral("Exit Fullscreen"), [&] {
if (emulation_running && ui->action_Fullscreen->isChecked()) { if (emulation_running && ui->action_Fullscreen->isChecked()) {
@ -1605,7 +1610,7 @@ void GMainWindow::ConnectMenuEvents() {
addAction(action); addAction(action);
// Add actions to the render window so that they work outside of single window mode // Add actions to the render window so that they work outside of single window mode
render_window->addAction(action); render_window->addAction(action);
}; };
// File // File
connect_menu(ui->action_Load_File, &GMainWindow::OnMenuLoadFile); connect_menu(ui->action_Load_File, &GMainWindow::OnMenuLoadFile);
@ -1667,7 +1672,8 @@ void GMainWindow::ConnectMenuEvents() {
connect_menu(ui->action_Load_Home_Menu, &GMainWindow::OnHomeMenu); connect_menu(ui->action_Load_Home_Menu, &GMainWindow::OnHomeMenu);
connect_menu(ui->action_Open_Setup, &GMainWindow::OnInitialSetup); connect_menu(ui->action_Open_Setup, &GMainWindow::OnInitialSetup);
connect_menu(ui->action_Desktop, &GMainWindow::OnCreateHomeMenuDesktopShortcut); connect_menu(ui->action_Desktop, &GMainWindow::OnCreateHomeMenuDesktopShortcut);
connect_menu(ui->action_Application_Menu, &GMainWindow::OnCreateHomeMenuApplicationMenuShortcut); connect_menu(ui->action_Application_Menu,
&GMainWindow::OnCreateHomeMenuApplicationMenuShortcut);
connect_menu(ui->action_Capture_Screenshot, &GMainWindow::OnCaptureScreenshot); connect_menu(ui->action_Capture_Screenshot, &GMainWindow::OnCaptureScreenshot);
// TAS // TAS
@ -1872,7 +1878,6 @@ bool GMainWindow::LoadROM(const QString& filename, Service::AM::FrontendAppletPa
system->GetUserChannel().clear(); system->GetUserChannel().clear();
} }
system->SetFrontendAppletSet({ system->SetFrontendAppletSet({
std::make_unique<QtAmiiboSettings>(*this), // Amiibo Settings std::make_unique<QtAmiiboSettings>(*this), // Amiibo Settings
(UISettings::values.controller_applet_disabled.GetValue() == true) (UISettings::values.controller_applet_disabled.GetValue() == true)
@ -1894,26 +1899,29 @@ bool GMainWindow::LoadROM(const QString& filename, Service::AM::FrontendAppletPa
QSettings settings; QSettings settings;
QStringList currentIgnored = settings.value("ignoredBadUpdates", {}).toStringList(); QStringList currentIgnored = settings.value("ignoredBadUpdates", {}).toStringList();
if (std::find(bad_update_games.begin(), bad_update_games.end(), params.program_id) != bad_update_games.end() if (std::find(bad_update_games.begin(), bad_update_games.end(), params.program_id) !=
&& !currentIgnored.contains(QString::number(params.program_id))) { bad_update_games.end() &&
QMessageBox *msg = new QMessageBox(this); !currentIgnored.contains(QString::number(params.program_id))) {
QMessageBox* msg = new QMessageBox(this);
msg->setWindowTitle(tr("Game Updates Warning")); msg->setWindowTitle(tr("Game Updates Warning"));
msg->setIcon(QMessageBox::Warning); msg->setIcon(QMessageBox::Warning);
msg->setText(tr("The game you are trying to launch is known to have performance or booting " msg->setText(
tr("The game you are trying to launch is known to have performance or booting "
"issues when updates are applied. Please try increasing the memory layout to " "issues when updates are applied. Please try increasing the memory layout to "
"6GB or 8GB if any issues occur.<br><br>Press \"OK\" to continue launching, or " "6GB or 8GB if any issues occur.<br><br>Press \"OK\" to continue launching, or "
"\"Cancel\" to cancel the launch.")); "\"Cancel\" to cancel the launch."));
msg->setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); msg->setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
QCheckBox *dontShowAgain = new QCheckBox(msg); QCheckBox* dontShowAgain = new QCheckBox(msg);
dontShowAgain->setText(tr("Don't show again for this game")); dontShowAgain->setText(tr("Don't show again for this game"));
msg->setCheckBox(dontShowAgain); msg->setCheckBox(dontShowAgain);
int result = msg->exec(); int result = msg->exec();
// wtf // wtf
QMessageBox::ButtonRole role = msg->buttonRole(msg->button((QMessageBox::StandardButton) result)); QMessageBox::ButtonRole role =
msg->buttonRole(msg->button((QMessageBox::StandardButton)result));
switch (role) { switch (role) {
case QMessageBox::RejectRole: case QMessageBox::RejectRole:
@ -1929,11 +1937,13 @@ bool GMainWindow::LoadROM(const QString& filename, Service::AM::FrontendAppletPa
} }
} }
if (FirmwareManager::GameRequiresFirmware(params.program_id) && !FirmwareManager::CheckFirmwarePresence(*system)) { if (FirmwareManager::GameRequiresFirmware(params.program_id) &&
QMessageBox *msg = new QMessageBox(this); !FirmwareManager::CheckFirmwarePresence(*system)) {
QMessageBox* msg = new QMessageBox(this);
msg->setWindowTitle(tr("Game Requires Firmware")); msg->setWindowTitle(tr("Game Requires Firmware"));
msg->setIcon(QMessageBox::Warning); msg->setIcon(QMessageBox::Warning);
msg->setText(tr("The game you are trying to launch requires firmware to boot or to get past the " msg->setText(
tr("The game you are trying to launch requires firmware to boot or to get past the "
"opening menu. Please <a href='https://yuzu-mirror.github.io/help/quickstart'>" "opening menu. Please <a href='https://yuzu-mirror.github.io/help/quickstart'>"
"dump and install firmware</a>, or press \"OK\" to launch anyways.")); "dump and install firmware</a>, or press \"OK\" to launch anyways."));
@ -1941,7 +1951,8 @@ bool GMainWindow::LoadROM(const QString& filename, Service::AM::FrontendAppletPa
int exec_result = msg->exec(); int exec_result = msg->exec();
QMessageBox::ButtonRole role = msg->buttonRole(msg->button((QMessageBox::StandardButton) exec_result)); QMessageBox::ButtonRole role =
msg->buttonRole(msg->button((QMessageBox::StandardButton)exec_result));
switch (role) { switch (role) {
case QMessageBox::RejectRole: case QMessageBox::RejectRole:
@ -1970,7 +1981,8 @@ bool GMainWindow::LoadROM(const QString& filename, Service::AM::FrontendAppletPa
"outdated format that has been superseded by others such as NCA, NAX, XCI, or " "outdated format that has been superseded by others such as NCA, NAX, XCI, or "
"NSP. Deconstructed ROM directories lack icons, metadata, and update " "NSP. Deconstructed ROM directories lack icons, metadata, and update "
"support.<br><br>For an explanation of the various Switch formats Eden supports, <a " "support.<br><br>For an explanation of the various Switch formats Eden supports, <a "
"href='https://eden-emulator.github.io/wiki/overview-of-switch-game-formats'>check out our " "href='https://eden-emulator.github.io/wiki/overview-of-switch-game-formats'>check "
"out our "
"wiki</a>. This message will not be shown again.")); "wiki</a>. This message will not be shown again."));
} }
@ -2300,7 +2312,7 @@ void GMainWindow::OnEmulationStopped() {
discord_rpc->Update(); discord_rpc->Update();
#ifdef __unix__ #ifdef __linux__
Common::Linux::StopGamemode(); Common::Linux::StopGamemode();
#endif #endif
@ -2996,7 +3008,8 @@ void GMainWindow::OnGameListNavigateToGamedbEntry(u64 program_id,
directory = it->second.second; directory = it->second.second;
} }
QDesktopServices::openUrl(QUrl(QStringLiteral("https://eden-emulator.github.io/game/") + directory)); QDesktopServices::openUrl(
QUrl(QStringLiteral("https://eden-emulator.github.io/game/") + directory));
} }
bool GMainWindow::CreateShortcutLink(const std::filesystem::path& shortcut_path, bool GMainWindow::CreateShortcutLink(const std::filesystem::path& shortcut_path,
@ -3485,7 +3498,7 @@ void GMainWindow::OnStartGame() {
discord_rpc->Update(); discord_rpc->Update();
#ifdef __unix__ #ifdef __linux__
Common::Linux::StartGamemode(); Common::Linux::StartGamemode();
#endif #endif
} }
@ -3509,7 +3522,7 @@ void GMainWindow::OnPauseGame() {
UpdateMenuState(); UpdateMenuState();
AllowOSSleep(); AllowOSSleep();
#ifdef __unix__ #ifdef __linux__
Common::Linux::StopGamemode(); Common::Linux::StopGamemode();
#endif #endif
} }
@ -3621,7 +3634,8 @@ void GMainWindow::OnMenuReportCompatibility() {
} else { } else {
QMessageBox::critical( QMessageBox::critical(
this, tr("Missing yuzu Account"), this, tr("Missing yuzu Account"),
tr("In order to submit a game compatibility test case, you must set up your web token and " tr("In order to submit a game compatibility test case, you must set up your web token "
"and "
"username.<br><br/>To link your eden account, go to Emulation &gt; Configuration " "username.<br><br/>To link your eden account, go to Emulation &gt; Configuration "
"&gt; " "&gt; "
"Web.")); "Web."));
@ -3653,8 +3667,7 @@ void GMainWindow::OnOpenFAQ() {
OpenURL(QUrl(QStringLiteral("https://eden-emu.dev"))); OpenURL(QUrl(QStringLiteral("https://eden-emu.dev")));
} }
void GMainWindow::OnOpenDiscord() void GMainWindow::OnOpenDiscord() {
{
OpenURL(QUrl(QStringLiteral("https://discord.gg/edenemu"))); OpenURL(QUrl(QStringLiteral("https://discord.gg/edenemu")));
} }
@ -3798,7 +3811,7 @@ void GMainWindow::OnConfigure() {
const auto old_theme = UISettings::values.theme; const auto old_theme = UISettings::values.theme;
const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue(); const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue();
const auto old_language_index = Settings::values.language_index.GetValue(); const auto old_language_index = Settings::values.language_index.GetValue();
#ifdef __unix__ #ifdef __linux__
const bool old_gamemode = Settings::values.enable_gamemode.GetValue(); const bool old_gamemode = Settings::values.enable_gamemode.GetValue();
#endif #endif
@ -3860,7 +3873,7 @@ void GMainWindow::OnConfigure() {
if (UISettings::values.enable_discord_presence.GetValue() != old_discord_presence) { if (UISettings::values.enable_discord_presence.GetValue() != old_discord_presence) {
SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue()); SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue());
} }
#ifdef __unix__ #ifdef __linux__
if (Settings::values.enable_gamemode.GetValue() != old_gamemode) { if (Settings::values.enable_gamemode.GetValue() != old_gamemode) {
SetGamemodeEnabled(Settings::values.enable_gamemode.GetValue()); SetGamemodeEnabled(Settings::values.enable_gamemode.GetValue());
} }
@ -4185,30 +4198,26 @@ void GMainWindow::LoadAmiibo(const QString& filename) {
} }
void GMainWindow::OnOpenRootDataFolder() { void GMainWindow::OnOpenRootDataFolder() {
QDesktopServices::openUrl(QUrl( QDesktopServices::openUrl(
QString::fromStdString(Common::FS::GetEdenPathString(Common::FS::EdenPath::EdenDir)))); QUrl(QString::fromStdString(Common::FS::GetEdenPathString(Common::FS::EdenPath::EdenDir))));
} }
void GMainWindow::OnOpenNANDFolder() void GMainWindow::OnOpenNANDFolder() {
{
QDesktopServices::openUrl(QUrl::fromLocalFile( QDesktopServices::openUrl(QUrl::fromLocalFile(
QString::fromStdString(Common::FS::GetEdenPathString(Common::FS::EdenPath::NANDDir)))); QString::fromStdString(Common::FS::GetEdenPathString(Common::FS::EdenPath::NANDDir))));
} }
void GMainWindow::OnOpenSDMCFolder() void GMainWindow::OnOpenSDMCFolder() {
{
QDesktopServices::openUrl(QUrl::fromLocalFile( QDesktopServices::openUrl(QUrl::fromLocalFile(
QString::fromStdString(Common::FS::GetEdenPathString(Common::FS::EdenPath::SDMCDir)))); QString::fromStdString(Common::FS::GetEdenPathString(Common::FS::EdenPath::SDMCDir))));
} }
void GMainWindow::OnOpenModFolder() void GMainWindow::OnOpenModFolder() {
{
QDesktopServices::openUrl(QUrl::fromLocalFile( QDesktopServices::openUrl(QUrl::fromLocalFile(
QString::fromStdString(Common::FS::GetEdenPathString(Common::FS::EdenPath::LoadDir)))); QString::fromStdString(Common::FS::GetEdenPathString(Common::FS::EdenPath::LoadDir))));
} }
void GMainWindow::OnOpenLogFolder() void GMainWindow::OnOpenLogFolder() {
{
QDesktopServices::openUrl(QUrl::fromLocalFile( QDesktopServices::openUrl(QUrl::fromLocalFile(
QString::fromStdString(Common::FS::GetEdenPathString(Common::FS::EdenPath::LogDir)))); QString::fromStdString(Common::FS::GetEdenPathString(Common::FS::EdenPath::LogDir))));
} }
@ -4243,8 +4252,7 @@ void GMainWindow::OnVerifyInstalledContents() {
} }
} }
void GMainWindow::InstallFirmware(const QString &location, bool recursive) void GMainWindow::InstallFirmware(const QString& location, bool recursive) {
{
QProgressDialog progress(tr("Installing Firmware..."), tr("Cancel"), 0, 100, this); QProgressDialog progress(tr("Installing Firmware..."), tr("Cancel"), 0, 100, this);
progress.setWindowModality(Qt::WindowModal); progress.setWindowModality(Qt::WindowModal);
progress.setMinimumDuration(100); progress.setMinimumDuration(100);
@ -4281,9 +4289,11 @@ void GMainWindow::InstallFirmware(const QString &location, bool recursive)
QtProgressCallback(100, 10); QtProgressCallback(100, 10);
if (recursive) { if (recursive) {
Common::FS::IterateDirEntriesRecursively(firmware_source_path, callback, Common::FS::DirEntryFilter::File); Common::FS::IterateDirEntriesRecursively(firmware_source_path, callback,
Common::FS::DirEntryFilter::File);
} else { } else {
Common::FS::IterateDirEntries(firmware_source_path, callback, Common::FS::DirEntryFilter::File); Common::FS::IterateDirEntries(firmware_source_path, callback,
Common::FS::DirEntryFilter::File);
} }
if (out.size() <= 0) { if (out.size() <= 0) {
@ -4391,8 +4401,7 @@ void GMainWindow::OnInstallFirmware() {
InstallFirmware(firmware_source_location); InstallFirmware(firmware_source_location);
} }
void GMainWindow::OnInstallFirmwareFromZIP() void GMainWindow::OnInstallFirmwareFromZIP() {
{
// Don't do this while emulation is running, that'd probably be a bad idea. // Don't do this while emulation is running, that'd probably be a bad idea.
if (emu_thread != nullptr && emu_thread->IsRunning()) { if (emu_thread != nullptr && emu_thread->IsRunning()) {
return; return;
@ -4442,17 +4451,18 @@ void GMainWindow::OnInstallFirmwareFromZIP()
if (ec) { if (ec) {
QMessageBox::warning(this, tr("Firmware cleanup failed"), QMessageBox::warning(this, tr("Firmware cleanup failed"),
tr("Failed to clean up extracted firmware cache.\n" tr("Failed to clean up extracted firmware cache.\n"
"Check write permissions in the system temp directory and try again.\nOS reported error: %1") "Check write permissions in the system temp directory and try "
"again.\nOS reported error: %1")
.arg(QString::fromStdString(ec.message()))); .arg(QString::fromStdString(ec.message())));
} }
return; return;
} }
unzipFailed: unzipFailed:
QMessageBox::critical(this, tr("Firmware unzip failed"), QMessageBox::critical(
this, tr("Firmware unzip failed"),
tr("Check write permissions in the system temp directory and try again.")); tr("Check write permissions in the system temp directory and try again."));
return; return;
} }
void GMainWindow::OnInstallDecryptionKeys() { void GMainWindow::OnInstallDecryptionKeys() {
@ -4468,7 +4478,8 @@ void GMainWindow::OnInstallDecryptionKeys() {
return; return;
} }
FirmwareManager::KeyInstallResult result = FirmwareManager::InstallKeys(key_source_location.toStdString(), "keys"); FirmwareManager::KeyInstallResult result =
FirmwareManager::InstallKeys(key_source_location.toStdString(), "keys");
system->GetFileSystemController().CreateFactories(*vfs); system->GetFileSystemController().CreateFactories(*vfs);
game_list->PopulateAsync(UISettings::values.game_dirs); game_list->PopulateAsync(UISettings::values.game_dirs);
@ -4479,8 +4490,7 @@ void GMainWindow::OnInstallDecryptionKeys() {
tr("Decryption Keys were successfully installed")); tr("Decryption Keys were successfully installed"));
break; break;
default: default:
QMessageBox::critical( QMessageBox::critical(this, tr("Decryption Keys install failed"),
this, tr("Decryption Keys install failed"),
tr(FirmwareManager::GetKeyInstallResultString(result))); tr(FirmwareManager::GetKeyInstallResultString(result)));
break; break;
} }
@ -4507,8 +4517,7 @@ void GMainWindow::OnToggleStatusBar() {
statusBar()->setVisible(ui->action_Show_Status_Bar->isChecked()); statusBar()->setVisible(ui->action_Show_Status_Bar->isChecked());
} }
void GMainWindow::OnGameListRefresh() void GMainWindow::OnGameListRefresh() {
{
// force reload add-ons etc // force reload add-ons etc
game_list->ForceRefreshGameDirectory(); game_list->ForceRefreshGameDirectory();
} }
@ -4631,8 +4640,7 @@ void GMainWindow::OnHomeMenu() {
BootGame(filename, LibraryAppletParameters(QLaunchId, Service::AM::AppletId::QLaunch)); BootGame(filename, LibraryAppletParameters(QLaunchId, Service::AM::AppletId::QLaunch));
} }
void GMainWindow::OnInitialSetup() void GMainWindow::OnInitialSetup() {
{
constexpr u64 Starter = static_cast<u64>(Service::AM::AppletProgramId::Starter); constexpr u64 Starter = static_cast<u64>(Service::AM::AppletProgramId::Starter);
auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); auto bis_system = system->GetFileSystemController().GetSystemNANDContents();
if (!bis_system) { if (!bis_system) {
@ -4655,18 +4663,15 @@ void GMainWindow::OnInitialSetup()
BootGame(filename, LibraryAppletParameters(Starter, Service::AM::AppletId::Starter)); BootGame(filename, LibraryAppletParameters(Starter, Service::AM::AppletId::Starter));
} }
void GMainWindow::OnCreateHomeMenuDesktopShortcut() void GMainWindow::OnCreateHomeMenuDesktopShortcut() {
{
OnCreateHomeMenuShortcut(GameListShortcutTarget::Desktop); OnCreateHomeMenuShortcut(GameListShortcutTarget::Desktop);
} }
void GMainWindow::OnCreateHomeMenuApplicationMenuShortcut() void GMainWindow::OnCreateHomeMenuApplicationMenuShortcut() {
{
OnCreateHomeMenuShortcut(GameListShortcutTarget::Applications); OnCreateHomeMenuShortcut(GameListShortcutTarget::Applications);
} }
std::filesystem::path GMainWindow::GetEdenCommand() std::filesystem::path GMainWindow::GetEdenCommand() {
{
std::filesystem::path command; std::filesystem::path command;
QString appimage = QString::fromLocal8Bit(getenv("APPIMAGE")); QString appimage = QString::fromLocal8Bit(getenv("APPIMAGE"));
@ -4685,8 +4690,7 @@ std::filesystem::path GMainWindow::GetEdenCommand()
return command; return command;
} }
std::filesystem::path GMainWindow::GetShortcutPath(GameListShortcutTarget target) std::filesystem::path GMainWindow::GetShortcutPath(GameListShortcutTarget target) {
{
std::filesystem::path shortcut_path{}; std::filesystem::path shortcut_path{};
if (target == GameListShortcutTarget::Desktop) { if (target == GameListShortcutTarget::Desktop) {
shortcut_path = shortcut_path =
@ -4699,7 +4703,9 @@ std::filesystem::path GMainWindow::GetShortcutPath(GameListShortcutTarget target
return shortcut_path; return shortcut_path;
} }
void GMainWindow::CreateShortcut(const std::string &game_path, const u64 program_id, const std::string& game_title_, GameListShortcutTarget target, std::string arguments_, const bool needs_title) { void GMainWindow::CreateShortcut(const std::string& game_path, const u64 program_id,
const std::string& game_title_, GameListShortcutTarget target,
std::string arguments_, const bool needs_title) {
// Get path to yuzu executable // Get path to yuzu executable
std::filesystem::path command = GetEdenCommand(); std::filesystem::path command = GetEdenCommand();
@ -4780,8 +4786,8 @@ void GMainWindow::CreateShortcut(const std::string &game_path, const u64 program
const std::string categories = "Game;Emulator;Qt;"; const std::string categories = "Game;Emulator;Qt;";
const std::string keywords = "Switch;Nintendo;"; const std::string keywords = "Switch;Nintendo;";
if (GMainWindow::CreateShortcutLink(shortcut_path, comment, out_icon_path, command, if (GMainWindow::CreateShortcutLink(shortcut_path, comment, out_icon_path, command, arguments,
arguments, categories, keywords, game_title)) { categories, keywords, game_title)) {
GMainWindow::CreateShortcutMessagesGUI(this, GMainWindow::CREATE_SHORTCUT_MSGBOX_SUCCESS, GMainWindow::CreateShortcutMessagesGUI(this, GMainWindow::CREATE_SHORTCUT_MSGBOX_SUCCESS,
qgame_title); qgame_title);
return; return;
@ -4790,8 +4796,7 @@ void GMainWindow::CreateShortcut(const std::string &game_path, const u64 program
qgame_title); qgame_title);
} }
void GMainWindow::OnCreateHomeMenuShortcut(GameListShortcutTarget target) void GMainWindow::OnCreateHomeMenuShortcut(GameListShortcutTarget target) {
{
constexpr u64 QLaunchId = static_cast<u64>(Service::AM::AppletProgramId::QLaunch); constexpr u64 QLaunchId = static_cast<u64>(Service::AM::AppletProgramId::QLaunch);
auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); auto bis_system = system->GetFileSystemController().GetSystemNANDContents();
if (!bis_system) { if (!bis_system) {
@ -4884,8 +4889,8 @@ void GMainWindow::OnEmulatorUpdateAvailable() {
update_prompt.setIcon(QMessageBox::Information); update_prompt.setIcon(QMessageBox::Information);
update_prompt.addButton(QMessageBox::Yes); update_prompt.addButton(QMessageBox::Yes);
update_prompt.addButton(QMessageBox::Ignore); update_prompt.addButton(QMessageBox::Ignore);
update_prompt.setText(tr("Update %1 for Eden is available.\nWould you like to download it?") update_prompt.setText(
.arg(version_string)); tr("Update %1 for Eden is available.\nWould you like to download it?").arg(version_string));
update_prompt.exec(); update_prompt.exec();
if (update_prompt.button(QMessageBox::Yes) == update_prompt.clickedButton()) { if (update_prompt.button(QMessageBox::Yes) == update_prompt.clickedButton()) {
QDesktopServices::openUrl( QDesktopServices::openUrl(
@ -5015,7 +5020,8 @@ void GMainWindow::UpdateStatusBar() {
} }
game_fps_label->setText( game_fps_label->setText(
tr("Game: %1 FPS").arg(std::round(results.average_game_fps), 0, 'f', 0) + tr(Settings::values.use_speed_limit ? "" : " (Unlocked)")); tr("Game: %1 FPS").arg(std::round(results.average_game_fps), 0, 'f', 0) +
tr(Settings::values.use_speed_limit ? "" : " (Unlocked)"));
emu_frametime_label->setText(tr("Frame: %1 ms").arg(results.frametime * 1000.0, 0, 'f', 2)); emu_frametime_label->setText(tr("Frame: %1 ms").arg(results.frametime * 1000.0, 0, 'f', 2));
@ -5142,24 +5148,21 @@ void GMainWindow::OnMouseActivity() {
void GMainWindow::OnCheckFirmwareDecryption() { void GMainWindow::OnCheckFirmwareDecryption() {
system->GetFileSystemController().CreateFactories(*vfs); system->GetFileSystemController().CreateFactories(*vfs);
if (!ContentManager::AreKeysPresent()) { if (!ContentManager::AreKeysPresent()) {
QMessageBox::warning( QMessageBox::warning(this, tr("Derivation Components Missing"),
this, tr("Derivation Components Missing"),
tr("Encryption keys are missing.")); tr("Encryption keys are missing."));
} }
SetFirmwareVersion(); SetFirmwareVersion();
UpdateMenuState(); UpdateMenuState();
} }
void GMainWindow::OnCheckFirmware() void GMainWindow::OnCheckFirmware() {
{
auto result = FirmwareManager::VerifyFirmware(*system.get()); auto result = FirmwareManager::VerifyFirmware(*system.get());
switch (result) { switch (result) {
case FirmwareManager::FirmwareGood: case FirmwareManager::FirmwareGood:
break; break;
default: default:
QMessageBox::warning( QMessageBox::warning(this, tr("Firmware Read Error"),
this, tr("Firmware Read Error"),
tr(FirmwareManager::GetFirmwareCheckString(result))); tr(FirmwareManager::GetFirmwareCheckString(result)));
break; break;
} }
@ -5476,7 +5479,7 @@ void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) {
discord_rpc->Update(); discord_rpc->Update();
} }
#ifdef __unix__ #ifdef __linux__
void GMainWindow::SetGamemodeEnabled(bool state) { void GMainWindow::SetGamemodeEnabled(bool state) {
if (emulation_running) { if (emulation_running) {
Common::Linux::SetGamemodeState(state); Common::Linux::SetGamemodeState(state);

View file

@ -68,7 +68,7 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
} }
#endif #endif
#ifdef __unix__ #ifdef __linux__
#include "common/linux/gamemode.h" #include "common/linux/gamemode.h"
#endif #endif
@ -410,9 +410,7 @@ int main(int argc, char** argv) {
"While attempting to load the ROM requested, an error occurred. Please " "While attempting to load the ROM requested, an error occurred. Please "
"refer to the Eden wiki for more information or the Eden discord for " "refer to the Eden wiki for more information or the Eden discord for "
"additional help.\n\nError Code: {:04X}-{:04X}\nError Description: {}", "additional help.\n\nError Code: {:04X}-{:04X}\nError Description: {}",
loader_id, loader_id, error_id, static_cast<Loader::ResultStatus>(error_id));
error_id,
static_cast<Loader::ResultStatus>(error_id));
} }
break; break;
} }
@ -447,7 +445,7 @@ int main(int argc, char** argv) {
exit(0); exit(0);
}); });
#ifdef __unix__ #ifdef __linux__
Common::Linux::StartGamemode(); Common::Linux::StartGamemode();
#endif #endif
@ -462,7 +460,7 @@ int main(int argc, char** argv) {
void(system.Pause()); void(system.Pause());
system.ShutdownMainProcess(); system.ShutdownMainProcess();
#ifdef __unix__ #ifdef __linux__
Common::Linux::StopGamemode(); Common::Linux::StopGamemode();
#endif #endif