diff options
Diffstat (limited to 'src/yuzu')
40 files changed, 300 insertions, 504 deletions
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 6a87b0811..bc667b39f 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -354,7 +354,7 @@ if (APPLE) if (NOT USE_SYSTEM_MOLTENVK) set(MOLTENVK_PLATFORM "macOS") - set(MOLTENVK_VERSION "v1.2.5") + set(MOLTENVK_VERSION "v1.2.7") download_moltenvk_external(${MOLTENVK_PLATFORM} ${MOLTENVK_VERSION}) endif() find_library(MOLTENVK_LIBRARY MoltenVK REQUIRED) diff --git a/src/yuzu/applets/qt_amiibo_settings.cpp b/src/yuzu/applets/qt_amiibo_settings.cpp index b457a736a..b91796dde 100644 --- a/src/yuzu/applets/qt_amiibo_settings.cpp +++ b/src/yuzu/applets/qt_amiibo_settings.cpp @@ -36,7 +36,7 @@ QtAmiiboSettingsDialog::QtAmiiboSettingsDialog(QWidget* parent, QtAmiiboSettingsDialog::~QtAmiiboSettingsDialog() = default; int QtAmiiboSettingsDialog::exec() { - if (!is_initalized) { + if (!is_initialized) { return QDialog::Rejected; } return QDialog::exec(); @@ -66,7 +66,7 @@ void QtAmiiboSettingsDialog::LoadInfo() { QString::fromStdString(input_subsystem->GetVirtualAmiibo()->GetLastFilePath())); SetSettingsDescription(); - is_initalized = true; + is_initialized = true; } void QtAmiiboSettingsDialog::LoadAmiiboInfo() { diff --git a/src/yuzu/applets/qt_amiibo_settings.h b/src/yuzu/applets/qt_amiibo_settings.h index ee66a0255..3833cf6f2 100644 --- a/src/yuzu/applets/qt_amiibo_settings.h +++ b/src/yuzu/applets/qt_amiibo_settings.h @@ -58,7 +58,7 @@ private: Core::Frontend::CabinetParameters parameters; // If false amiibo settings failed to load - bool is_initalized{}; + bool is_initialized{}; }; class QtAmiiboSettings final : public QObject, public Core::Frontend::CabinetApplet { diff --git a/src/yuzu/applets/qt_controller.cpp b/src/yuzu/applets/qt_controller.cpp index 9e5319716..48ce860ad 100644 --- a/src/yuzu/applets/qt_controller.cpp +++ b/src/yuzu/applets/qt_controller.cpp @@ -9,11 +9,11 @@ #include "common/settings_enums.h" #include "common/string_util.h" #include "core/core.h" -#include "core/hid/emulated_controller.h" -#include "core/hid/hid_core.h" -#include "core/hid/hid_types.h" -#include "core/hle/service/hid/controllers/npad.h" #include "core/hle/service/sm/sm.h" +#include "hid_core/frontend/emulated_controller.h" +#include "hid_core/hid_core.h" +#include "hid_core/hid_types.h" +#include "hid_core/resources/npad/npad.h" #include "ui_qt_controller.h" #include "yuzu/applets/qt_controller.h" #include "yuzu/configuration/configure_input.h" @@ -41,7 +41,7 @@ void UpdateController(Core::HID::EmulatedController* controller, bool IsControllerCompatible(Core::HID::NpadStyleIndex controller_type, Core::Frontend::ControllerParameters parameters) { switch (controller_type) { - case Core::HID::NpadStyleIndex::ProController: + case Core::HID::NpadStyleIndex::Fullkey: return parameters.allow_pro_controller; case Core::HID::NpadStyleIndex::JoyconDual: return parameters.allow_dual_joycons; @@ -462,7 +462,7 @@ void QtControllerSelectorDialog::SetEmulatedControllers(std::size_t player_index }; if (npad_style_set.fullkey == 1) { - add_item(Core::HID::NpadStyleIndex::ProController, tr("Pro Controller")); + add_item(Core::HID::NpadStyleIndex::Fullkey, tr("Pro Controller")); } if (npad_style_set.joycon_dual == 1) { @@ -519,7 +519,7 @@ Core::HID::NpadStyleIndex QtControllerSelectorDialog::GetControllerTypeFromIndex [index](const auto& pair) { return pair.first == index; }); if (it == pairs.end()) { - return Core::HID::NpadStyleIndex::ProController; + return Core::HID::NpadStyleIndex::Fullkey; } return it->second; @@ -549,7 +549,7 @@ void QtControllerSelectorDialog::UpdateControllerIcon(std::size_t player_index) const QString stylesheet = [this, player_index] { switch (GetControllerTypeFromIndex(emulated_controllers[player_index]->currentIndex(), player_index)) { - case Core::HID::NpadStyleIndex::ProController: + case Core::HID::NpadStyleIndex::Fullkey: case Core::HID::NpadStyleIndex::GameCube: return QStringLiteral("image: url(:/controller/applet_pro_controller%0); "); case Core::HID::NpadStyleIndex::JoyconDual: diff --git a/src/yuzu/applets/qt_error.cpp b/src/yuzu/applets/qt_error.cpp index 1dc4f0383..ad35f4126 100644 --- a/src/yuzu/applets/qt_error.cpp +++ b/src/yuzu/applets/qt_error.cpp @@ -25,8 +25,8 @@ void QtErrorDisplay::ShowError(Result error, FinishedCallback finished) const { callback = std::move(finished); emit MainWindowDisplayError( tr("Error Code: %1-%2 (0x%3)") - .arg(static_cast<u32>(error.module.Value()) + 2000, 4, 10, QChar::fromLatin1('0')) - .arg(error.description, 4, 10, QChar::fromLatin1('0')) + .arg(static_cast<u32>(error.GetModule()) + 2000, 4, 10, QChar::fromLatin1('0')) + .arg(error.GetDescription(), 4, 10, QChar::fromLatin1('0')) .arg(error.raw, 8, 16, QChar::fromLatin1('0')), tr("An error has occurred.\nPlease try again or contact the developer of the software.")); } @@ -38,8 +38,8 @@ void QtErrorDisplay::ShowErrorWithTimestamp(Result error, std::chrono::seconds t const QDateTime date_time = QDateTime::fromSecsSinceEpoch(time.count()); emit MainWindowDisplayError( tr("Error Code: %1-%2 (0x%3)") - .arg(static_cast<u32>(error.module.Value()) + 2000, 4, 10, QChar::fromLatin1('0')) - .arg(error.description, 4, 10, QChar::fromLatin1('0')) + .arg(static_cast<u32>(error.GetModule()) + 2000, 4, 10, QChar::fromLatin1('0')) + .arg(error.GetDescription(), 4, 10, QChar::fromLatin1('0')) .arg(error.raw, 8, 16, QChar::fromLatin1('0')), tr("An error occurred on %1 at %2.\nPlease try again or contact the developer of the " "software.") @@ -53,8 +53,8 @@ void QtErrorDisplay::ShowCustomErrorText(Result error, std::string dialog_text, callback = std::move(finished); emit MainWindowDisplayError( tr("Error Code: %1-%2 (0x%3)") - .arg(static_cast<u32>(error.module.Value()) + 2000, 4, 10, QChar::fromLatin1('0')) - .arg(error.description, 4, 10, QChar::fromLatin1('0')) + .arg(static_cast<u32>(error.GetModule()) + 2000, 4, 10, QChar::fromLatin1('0')) + .arg(error.GetDescription(), 4, 10, QChar::fromLatin1('0')) .arg(error.raw, 8, 16, QChar::fromLatin1('0')), tr("An error has occurred.\n\n%1\n\n%2") .arg(QString::fromStdString(dialog_text)) diff --git a/src/yuzu/applets/qt_software_keyboard.cpp b/src/yuzu/applets/qt_software_keyboard.cpp index 4ae49506d..ac81ace9e 100644 --- a/src/yuzu/applets/qt_software_keyboard.cpp +++ b/src/yuzu/applets/qt_software_keyboard.cpp @@ -9,10 +9,10 @@ #include "common/settings.h" #include "common/string_util.h" #include "core/core.h" -#include "core/hid/emulated_controller.h" -#include "core/hid/hid_core.h" -#include "core/hid/hid_types.h" -#include "core/hid/input_interpreter.h" +#include "hid_core/frontend/emulated_controller.h" +#include "hid_core/frontend/input_interpreter.h" +#include "hid_core/hid_core.h" +#include "hid_core/hid_types.h" #include "ui_qt_software_keyboard.h" #include "yuzu/applets/qt_software_keyboard.h" #include "yuzu/main.h" @@ -832,7 +832,7 @@ void QtSoftwareKeyboardDialog::SetControllerImage() { }(); switch (controller_type) { - case Core::HID::NpadStyleIndex::ProController: + case Core::HID::NpadStyleIndex::Fullkey: case Core::HID::NpadStyleIndex::GameCube: ui->icon_controller->setStyleSheet( QStringLiteral("image: url(:/overlay/controller_pro%1.png);").arg(theme)); diff --git a/src/yuzu/applets/qt_web_browser.cpp b/src/yuzu/applets/qt_web_browser.cpp index 28acc0ff8..34c5fd3be 100644 --- a/src/yuzu/applets/qt_web_browser.cpp +++ b/src/yuzu/applets/qt_web_browser.cpp @@ -13,7 +13,7 @@ #include <QWebEngineSettings> #include <QWebEngineUrlScheme> -#include "core/hid/input_interpreter.h" +#include "hid_core/frontend/input_interpreter.h" #include "yuzu/applets/qt_web_browser_scripts.h" #endif diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h index 60edd464c..ae12b3481 100644 --- a/src/yuzu/bootmanager.h +++ b/src/yuzu/bootmanager.h @@ -170,7 +170,7 @@ public: void resizeEvent(QResizeEvent* event) override; - /// Converts a Qt keybard key into NativeKeyboard key + /// Converts a Qt keyboard key into NativeKeyboard key static int QtKeyToSwitchKey(Qt::Key qt_keys); /// Converts a Qt modifier keys into NativeKeyboard modifier keys diff --git a/src/yuzu/configuration/configure_debug_controller.cpp b/src/yuzu/configuration/configure_debug_controller.cpp index 42abe9119..74208d1cc 100644 --- a/src/yuzu/configuration/configure_debug_controller.cpp +++ b/src/yuzu/configuration/configure_debug_controller.cpp @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "core/hid/hid_core.h" +#include "hid_core/hid_core.h" #include "ui_configure_debug_controller.h" #include "yuzu/configuration/configure_debug_controller.h" #include "yuzu/configuration/configure_input_player.h" diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 0836bcb7e..54c931e56 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -224,6 +224,11 @@ void ConfigureGraphics::PopulateVSyncModeSelection(bool use_setting) { } void ConfigureGraphics::UpdateVsyncSetting() const { + const Settings::RendererBackend backend{GetCurrentGraphicsBackend()}; + if (backend == Settings::RendererBackend::Null) { + return; + } + const auto mode = vsync_mode_combobox_enum_map[vsync_mode_combobox->currentIndex()]; const auto vsync_mode = PresentModeToSetting(mode); Settings::values.vsync_mode.SetValue(vsync_mode); diff --git a/src/yuzu/configuration/configure_hotkeys.cpp b/src/yuzu/configuration/configure_hotkeys.cpp index 76fc33e49..3d18670ce 100644 --- a/src/yuzu/configuration/configure_hotkeys.cpp +++ b/src/yuzu/configuration/configure_hotkeys.cpp @@ -6,8 +6,8 @@ #include <QStandardItemModel> #include <QTimer> -#include "core/hid/emulated_controller.h" -#include "core/hid/hid_core.h" +#include "hid_core/frontend/emulated_controller.h" +#include "hid_core/hid_core.h" #include "frontend_common/config.h" #include "ui_configure_hotkeys.h" diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp index 02e23cce6..49ec52546 100644 --- a/src/yuzu/configuration/configure_input.cpp +++ b/src/yuzu/configuration/configure_input.cpp @@ -7,12 +7,12 @@ #include "common/settings.h" #include "common/settings_enums.h" #include "core/core.h" -#include "core/hid/emulated_controller.h" -#include "core/hid/hid_core.h" #include "core/hle/service/am/am.h" #include "core/hle/service/am/applet_ae.h" #include "core/hle/service/am/applet_oe.h" #include "core/hle/service/sm/sm.h" +#include "hid_core/frontend/emulated_controller.h" +#include "hid_core/hid_core.h" #include "ui_configure_input.h" #include "ui_configure_input_advanced.h" #include "ui_configure_input_player.h" diff --git a/src/yuzu/configuration/configure_input_advanced.cpp b/src/yuzu/configuration/configure_input_advanced.cpp index 441cea3f6..d6c4e09ec 100644 --- a/src/yuzu/configuration/configure_input_advanced.cpp +++ b/src/yuzu/configuration/configure_input_advanced.cpp @@ -4,8 +4,8 @@ #include <QColorDialog> #include "common/settings.h" #include "core/core.h" -#include "core/hid/emulated_controller.h" -#include "core/hid/hid_core.h" +#include "hid_core/frontend/emulated_controller.h" +#include "hid_core/hid_core.h" #include "ui_configure_input_advanced.h" #include "yuzu/configuration/configure_input_advanced.h" diff --git a/src/yuzu/configuration/configure_input_per_game.cpp b/src/yuzu/configuration/configure_input_per_game.cpp index 8d9f65a05..eea7ec369 100644 --- a/src/yuzu/configuration/configure_input_per_game.cpp +++ b/src/yuzu/configuration/configure_input_per_game.cpp @@ -3,9 +3,9 @@ #include "common/settings.h" #include "core/core.h" -#include "core/hid/emulated_controller.h" -#include "core/hid/hid_core.h" #include "frontend_common/config.h" +#include "hid_core/frontend/emulated_controller.h" +#include "hid_core/hid_core.h" #include "ui_configure_input_per_game.h" #include "yuzu/configuration/configure_input_per_game.h" #include "yuzu/configuration/input_profiles.h" diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 0f7b3714e..400917f9d 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp @@ -13,10 +13,10 @@ #include "common/assert.h" #include "common/param_package.h" #include "configuration/qt_config.h" -#include "core/hid/emulated_controller.h" -#include "core/hid/hid_core.h" -#include "core/hid/hid_types.h" #include "frontend_common/config.h" +#include "hid_core/frontend/emulated_controller.h" +#include "hid_core/hid_core.h" +#include "hid_core/hid_types.h" #include "input_common/drivers/keyboard.h" #include "input_common/drivers/mouse.h" #include "input_common/main.h" @@ -1094,7 +1094,7 @@ void ConfigureInputPlayer::SetConnectableControllers() { }; if (npad_style_set.fullkey == 1) { - add_item(Core::HID::NpadStyleIndex::ProController, tr("Pro Controller")); + add_item(Core::HID::NpadStyleIndex::Fullkey, tr("Pro Controller")); } if (npad_style_set.joycon_dual == 1) { @@ -1149,7 +1149,7 @@ Core::HID::NpadStyleIndex ConfigureInputPlayer::GetControllerTypeFromIndex(int i [index](const auto& pair) { return pair.first == index; }); if (it == index_controller_type_pairs.end()) { - return Core::HID::NpadStyleIndex::ProController; + return Core::HID::NpadStyleIndex::Fullkey; } return it->second; @@ -1178,7 +1178,7 @@ void ConfigureInputPlayer::UpdateInputDevices() { void ConfigureInputPlayer::UpdateControllerAvailableButtons() { auto layout = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex()); if (debug) { - layout = Core::HID::NpadStyleIndex::ProController; + layout = Core::HID::NpadStyleIndex::Fullkey; } // List of all the widgets that will be hidden by any of the following layouts that need @@ -1206,7 +1206,7 @@ void ConfigureInputPlayer::UpdateControllerAvailableButtons() { std::vector<QWidget*> layout_hidden; switch (layout) { - case Core::HID::NpadStyleIndex::ProController: + case Core::HID::NpadStyleIndex::Fullkey: case Core::HID::NpadStyleIndex::Handheld: layout_hidden = { ui->buttonShoulderButtonsSLSRLeft, @@ -1254,7 +1254,7 @@ void ConfigureInputPlayer::UpdateControllerAvailableButtons() { void ConfigureInputPlayer::UpdateControllerEnabledButtons() { auto layout = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex()); if (debug) { - layout = Core::HID::NpadStyleIndex::ProController; + layout = Core::HID::NpadStyleIndex::Fullkey; } // List of all the widgets that will be disabled by any of the following layouts that need @@ -1271,7 +1271,7 @@ void ConfigureInputPlayer::UpdateControllerEnabledButtons() { std::vector<QWidget*> layout_disable; switch (layout) { - case Core::HID::NpadStyleIndex::ProController: + case Core::HID::NpadStyleIndex::Fullkey: case Core::HID::NpadStyleIndex::JoyconDual: case Core::HID::NpadStyleIndex::Handheld: case Core::HID::NpadStyleIndex::JoyconLeft: @@ -1304,7 +1304,7 @@ void ConfigureInputPlayer::UpdateMotionButtons() { // Show/hide the "Motion 1/2" groupboxes depending on the currently selected controller. switch (GetControllerTypeFromIndex(ui->comboControllerType->currentIndex())) { - case Core::HID::NpadStyleIndex::ProController: + case Core::HID::NpadStyleIndex::Fullkey: case Core::HID::NpadStyleIndex::JoyconLeft: case Core::HID::NpadStyleIndex::Handheld: // Show "Motion 1" and hide "Motion 2". @@ -1333,11 +1333,11 @@ void ConfigureInputPlayer::UpdateMotionButtons() { void ConfigureInputPlayer::UpdateControllerButtonNames() { auto layout = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex()); if (debug) { - layout = Core::HID::NpadStyleIndex::ProController; + layout = Core::HID::NpadStyleIndex::Fullkey; } switch (layout) { - case Core::HID::NpadStyleIndex::ProController: + case Core::HID::NpadStyleIndex::Fullkey: case Core::HID::NpadStyleIndex::JoyconDual: case Core::HID::NpadStyleIndex::Handheld: case Core::HID::NpadStyleIndex::JoyconLeft: @@ -1650,9 +1650,21 @@ void ConfigureInputPlayer::SaveProfile() { void ConfigureInputPlayer::UpdateInputProfiles() { ui->comboProfiles->clear(); - for (const auto& profile_name : profiles->GetInputProfileNames()) { + // Set current profile as empty by default + int profile_index = -1; + + // Add every available profile and search the player profile to set it as current one + auto& current_profile = Settings::values.players.GetValue()[player_index].profile_name; + std::vector<std::string> profile_names = profiles->GetInputProfileNames(); + std::string profile_name; + for (size_t i = 0; i < profile_names.size(); i++) { + profile_name = profile_names[i]; ui->comboProfiles->addItem(QString::fromStdString(profile_name)); + if (current_profile == profile_name) { + profile_index = (int)i; + } } - ui->comboProfiles->setCurrentIndex(-1); + LOG_DEBUG(Frontend, "Setting the current input profile to index {}", profile_index); + ui->comboProfiles->setCurrentIndex(profile_index); } diff --git a/src/yuzu/configuration/configure_input_player_widget.cpp b/src/yuzu/configuration/configure_input_player_widget.cpp index 550cff9a0..b3d9d8006 100644 --- a/src/yuzu/configuration/configure_input_player_widget.cpp +++ b/src/yuzu/configuration/configure_input_player_widget.cpp @@ -6,7 +6,7 @@ #include <QPainter> #include <QTimer> -#include "core/hid/emulated_controller.h" +#include "hid_core/frontend/emulated_controller.h" #include "yuzu/configuration/configure_input_player_widget.h" PlayerControlPreview::PlayerControlPreview(QWidget* parent) : QFrame(parent) { @@ -244,7 +244,7 @@ void PlayerControlPreview::paintEvent(QPaintEvent* event) { case Core::HID::NpadStyleIndex::GameCube: DrawGCController(p, center); break; - case Core::HID::NpadStyleIndex::ProController: + case Core::HID::NpadStyleIndex::Fullkey: default: DrawProController(p, center); break; @@ -845,12 +845,12 @@ void PlayerControlPreview::DrawProController(QPainter& p, const QPointF center) DrawSymbol(p, face_center + QPoint(-face_distance, 1), Symbol::Y, text_size); // D-pad buttons - const QPointF dpad_postion = center + QPoint(-61, 0); - DrawArrowButton(p, dpad_postion, Direction::Up, button_values[DUp]); - DrawArrowButton(p, dpad_postion, Direction::Left, button_values[DLeft]); - DrawArrowButton(p, dpad_postion, Direction::Right, button_values[DRight]); - DrawArrowButton(p, dpad_postion, Direction::Down, button_values[DDown]); - DrawArrowButtonOutline(p, dpad_postion); + const QPointF dpad_position = center + QPoint(-61, 0); + DrawArrowButton(p, dpad_position, Direction::Up, button_values[DUp]); + DrawArrowButton(p, dpad_position, Direction::Left, button_values[DLeft]); + DrawArrowButton(p, dpad_position, Direction::Right, button_values[DRight]); + DrawArrowButton(p, dpad_position, Direction::Down, button_values[DDown]); + DrawArrowButtonOutline(p, dpad_position); // ZL and ZR buttons p.setPen(colors.outline); @@ -935,13 +935,13 @@ void PlayerControlPreview::DrawGCController(QPainter& p, const QPointF center) { DrawSymbol(p, center + QPoint(100, -83), Symbol::Y, text_size); // D-pad buttons - const QPointF dpad_postion = center + QPoint(-61, 37); + const QPointF dpad_position = center + QPoint(-61, 37); const float dpad_size = 0.8f; - DrawArrowButton(p, dpad_postion, Direction::Up, button_values[DUp], dpad_size); - DrawArrowButton(p, dpad_postion, Direction::Left, button_values[DLeft], dpad_size); - DrawArrowButton(p, dpad_postion, Direction::Right, button_values[DRight], dpad_size); - DrawArrowButton(p, dpad_postion, Direction::Down, button_values[DDown], dpad_size); - DrawArrowButtonOutline(p, dpad_postion, dpad_size); + DrawArrowButton(p, dpad_position, Direction::Up, button_values[DUp], dpad_size); + DrawArrowButton(p, dpad_position, Direction::Left, button_values[DLeft], dpad_size); + DrawArrowButton(p, dpad_position, Direction::Right, button_values[DRight], dpad_size); + DrawArrowButton(p, dpad_position, Direction::Down, button_values[DDown], dpad_size); + DrawArrowButtonOutline(p, dpad_position, dpad_size); // Minus and Plus buttons p.setPen(colors.outline); diff --git a/src/yuzu/configuration/configure_input_player_widget.h b/src/yuzu/configuration/configure_input_player_widget.h index a16943c3c..76340912d 100644 --- a/src/yuzu/configuration/configure_input_player_widget.h +++ b/src/yuzu/configuration/configure_input_player_widget.h @@ -10,8 +10,8 @@ #include "common/input.h" #include "common/settings_input.h" #include "common/vector_math.h" -#include "core/hid/emulated_controller.h" -#include "core/hid/hid_types.h" +#include "hid_core/frontend/emulated_controller.h" +#include "hid_core/hid_types.h" class QLabel; diff --git a/src/yuzu/configuration/configure_per_game.h b/src/yuzu/configuration/configure_per_game.h index 805bd47c0..196cb32e6 100644 --- a/src/yuzu/configuration/configure_per_game.h +++ b/src/yuzu/configuration/configure_per_game.h @@ -11,7 +11,7 @@ #include <QList> #include "configuration/shared_widget.h" -#include "core/file_sys/vfs_types.h" +#include "core/file_sys/vfs/vfs_types.h" #include "frontend_common/config.h" #include "vk_device_info.h" #include "yuzu/configuration/configuration_shared.h" diff --git a/src/yuzu/configuration/configure_per_game_addons.cpp b/src/yuzu/configuration/configure_per_game_addons.cpp index 140a7fe5d..568775027 100644 --- a/src/yuzu/configuration/configure_per_game_addons.cpp +++ b/src/yuzu/configuration/configure_per_game_addons.cpp @@ -122,9 +122,8 @@ void ConfigurePerGameAddons::LoadConfiguration() { const auto& disabled = Settings::values.disabled_addons[title_id]; - for (const auto& patch : pm.GetPatchVersionNames(update_raw)) { - const auto name = - QString::fromStdString(patch.first).replace(QStringLiteral("[D] "), QString{}); + for (const auto& patch : pm.GetPatches(update_raw)) { + const auto name = QString::fromStdString(patch.name); auto* const first_item = new QStandardItem; first_item->setText(name); @@ -136,7 +135,7 @@ void ConfigurePerGameAddons::LoadConfiguration() { first_item->setCheckState(patch_disabled ? Qt::Unchecked : Qt::Checked); list_items.push_back(QList<QStandardItem*>{ - first_item, new QStandardItem{QString::fromStdString(patch.second)}}); + first_item, new QStandardItem{QString::fromStdString(patch.version)}}); item_model->appendRow(list_items.back()); } diff --git a/src/yuzu/configuration/configure_per_game_addons.h b/src/yuzu/configuration/configure_per_game_addons.h index 53db405c1..32dc5dde6 100644 --- a/src/yuzu/configuration/configure_per_game_addons.h +++ b/src/yuzu/configuration/configure_per_game_addons.h @@ -8,7 +8,7 @@ #include <QList> -#include "core/file_sys/vfs_types.h" +#include "core/file_sys/vfs/vfs_types.h" namespace Core { class System; diff --git a/src/yuzu/configuration/configure_profile_manager.cpp b/src/yuzu/configuration/configure_profile_manager.cpp index fa5f383d6..12a04b9a0 100644 --- a/src/yuzu/configuration/configure_profile_manager.cpp +++ b/src/yuzu/configuration/configure_profile_manager.cpp @@ -205,6 +205,7 @@ void ConfigureProfileManager::AddUser() { const auto uuid = Common::UUID::MakeRandom(); profile_manager.CreateNewUser(uuid, username.toStdString()); + profile_manager.WriteUserSaveFile(); item_model->appendRow(new QStandardItem{GetIcon(uuid), FormatUserEntryText(username, uuid)}); } @@ -228,6 +229,7 @@ void ConfigureProfileManager::RenameUser() { std::copy(username_std.begin(), username_std.end(), profile.username.begin()); profile_manager.SetProfileBase(*uuid, profile); + profile_manager.WriteUserSaveFile(); item_model->setItem( user, 0, @@ -256,6 +258,8 @@ void ConfigureProfileManager::DeleteUser(const Common::UUID& uuid) { return; } + profile_manager.WriteUserSaveFile(); + item_model->removeRows(tree_view->currentIndex().row(), 1); tree_view->clearSelection(); diff --git a/src/yuzu/configuration/configure_ringcon.cpp b/src/yuzu/configuration/configure_ringcon.cpp index 9572ff43c..9fd094ab6 100644 --- a/src/yuzu/configuration/configure_ringcon.cpp +++ b/src/yuzu/configuration/configure_ringcon.cpp @@ -9,8 +9,8 @@ #include <fmt/format.h> #include "configuration/qt_config.h" -#include "core/hid/emulated_controller.h" -#include "core/hid/hid_core.h" +#include "hid_core/frontend/emulated_controller.h" +#include "hid_core/hid_core.h" #include "input_common/drivers/keyboard.h" #include "input_common/drivers/mouse.h" #include "input_common/main.h" @@ -494,4 +494,4 @@ QString ConfigureRingController::AnalogToText(const Common::ParamPackage& param, } return QObject::tr("[unknown]"); -}
\ No newline at end of file +} diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 7cbf43775..e193b5f95 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -12,9 +12,10 @@ #include <QGraphicsItem> #include <QLineEdit> #include <QMessageBox> +#include <QSpinBox> + #include "common/settings.h" #include "core/core.h" -#include "core/hle/service/time/time_manager.h" #include "ui_configure_system.h" #include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/configure_system.h" @@ -49,6 +50,11 @@ ConfigureSystem::ConfigureSystem(Core::System& system_, : Tab(group_, parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_} { ui->setupUi(this); + const auto posix_time = std::chrono::system_clock::now().time_since_epoch(); + const auto current_time_s = + std::chrono::duration_cast<std::chrono::seconds>(posix_time).count(); + previous_time = current_time_s + Settings::values.custom_rtc_offset.GetValue(); + Setup(builder); const auto locale_check = [this]() { @@ -64,13 +70,28 @@ ConfigureSystem::ConfigureSystem(Core::System& system_, } }; + const auto update_date_offset = [this]() { + if (!checkbox_rtc->isChecked()) { + return; + } + auto offset = date_rtc_offset->value(); + offset += date_rtc->dateTime().toSecsSinceEpoch() - previous_time; + previous_time = date_rtc->dateTime().toSecsSinceEpoch(); + date_rtc_offset->setValue(offset); + }; + const auto update_rtc_date = [this]() { UpdateRtcTime(); }; + connect(combo_language, qOverload<int>(&QComboBox::currentIndexChanged), this, locale_check); connect(combo_region, qOverload<int>(&QComboBox::currentIndexChanged), this, locale_check); + connect(checkbox_rtc, qOverload<int>(&QCheckBox::stateChanged), this, update_rtc_date); + connect(date_rtc_offset, qOverload<int>(&QSpinBox::valueChanged), this, update_rtc_date); + connect(date_rtc, &QDateTimeEdit::dateTimeChanged, this, update_date_offset); ui->label_warn_invalid_locale->setVisible(false); locale_check(); SetConfiguration(); + UpdateRtcTime(); } ConfigureSystem::~ConfigureSystem() = default; @@ -120,14 +141,28 @@ void ConfigureSystem::Setup(const ConfigurationShared::Builder& builder) { continue; } + // Keep track of the region_index (and language_index) combobox to validate the selected + // settings if (setting->Id() == Settings::values.region_index.Id()) { - // Keep track of the region_index (and langauge_index) combobox to validate the selected - // settings combo_region = widget->combobox; - } else if (setting->Id() == Settings::values.language_index.Id()) { + } + + if (setting->Id() == Settings::values.language_index.Id()) { combo_language = widget->combobox; } + if (setting->Id() == Settings::values.custom_rtc.Id()) { + checkbox_rtc = widget->checkbox; + } + + if (setting->Id() == Settings::values.custom_rtc.Id()) { + date_rtc = widget->date_time_edit; + } + + if (setting->Id() == Settings::values.custom_rtc_offset.Id()) { + date_rtc_offset = widget->spinbox; + } + switch (setting->GetCategory()) { case Settings::Category::Core: core_hold.emplace(setting->Id(), widget); @@ -147,6 +182,19 @@ void ConfigureSystem::Setup(const ConfigurationShared::Builder& builder) { } } +void ConfigureSystem::UpdateRtcTime() { + const auto posix_time = std::chrono::system_clock::now().time_since_epoch(); + previous_time = std::chrono::duration_cast<std::chrono::seconds>(posix_time).count(); + date_rtc_offset->setEnabled(checkbox_rtc->isChecked()); + + if (checkbox_rtc->isChecked()) { + previous_time += date_rtc_offset->value(); + } + + const auto date = QDateTime::fromSecsSinceEpoch(previous_time); + date_rtc->setDateTime(date); +} + void ConfigureSystem::SetConfiguration() {} void ConfigureSystem::ApplyConfiguration() { @@ -154,4 +202,5 @@ void ConfigureSystem::ApplyConfiguration() { for (const auto& func : apply_funcs) { func(powered_on); } + UpdateRtcTime(); } diff --git a/src/yuzu/configuration/configure_system.h b/src/yuzu/configuration/configure_system.h index c606c32f5..a01c29dcf 100644 --- a/src/yuzu/configuration/configure_system.h +++ b/src/yuzu/configuration/configure_system.h @@ -45,6 +45,8 @@ private: void Setup(const ConfigurationShared::Builder& builder); + void UpdateRtcTime(); + std::vector<std::function<void(bool)>> apply_funcs{}; std::unique_ptr<Ui::ConfigureSystem> ui; @@ -54,4 +56,8 @@ private: QComboBox* combo_region; QComboBox* combo_language; + QCheckBox* checkbox_rtc; + QDateTimeEdit* date_rtc; + QSpinBox* date_rtc_offset; + u64 previous_time; }; diff --git a/src/yuzu/configuration/configure_vibration.cpp b/src/yuzu/configuration/configure_vibration.cpp index 68c28b320..6b1f4527b 100644 --- a/src/yuzu/configuration/configure_vibration.cpp +++ b/src/yuzu/configuration/configure_vibration.cpp @@ -2,9 +2,9 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "common/settings.h" -#include "core/hid/emulated_controller.h" -#include "core/hid/hid_core.h" -#include "core/hid/hid_types.h" +#include "hid_core/frontend/emulated_controller.h" +#include "hid_core/hid_core.h" +#include "hid_core/hid_types.h" #include "ui_configure_vibration.h" #include "yuzu/configuration/configure_vibration.h" @@ -116,8 +116,8 @@ void ConfigureVibration::VibrateController(Core::HID::ControllerTriggerType type .high_amplitude = 1.0f, .high_frequency = 320.0f, }; - controller->SetVibration(0, vibration); - controller->SetVibration(1, vibration); + controller->SetVibration(Core::HID::DeviceIndex::Left, vibration); + controller->SetVibration(Core::HID::DeviceIndex::Right, vibration); // Restore previous values player.vibration_enabled = old_vibration_enabled; @@ -127,7 +127,7 @@ void ConfigureVibration::VibrateController(Core::HID::ControllerTriggerType type void ConfigureVibration::StopVibrations() { for (std::size_t i = 0; i < NUM_PLAYERS; ++i) { auto controller = hid_core.GetEmulatedControllerByIndex(i); - controller->SetVibration(0, Core::HID::DEFAULT_VIBRATION_VALUE); - controller->SetVibration(1, Core::HID::DEFAULT_VIBRATION_VALUE); + controller->SetVibration(Core::HID::DeviceIndex::Left, Core::HID::DEFAULT_VIBRATION_VALUE); + controller->SetVibration(Core::HID::DeviceIndex::Right, Core::HID::DEFAULT_VIBRATION_VALUE); } } diff --git a/src/yuzu/configuration/input_profiles.cpp b/src/yuzu/configuration/input_profiles.cpp index 716efbccd..ebebadc94 100644 --- a/src/yuzu/configuration/input_profiles.cpp +++ b/src/yuzu/configuration/input_profiles.cpp @@ -5,6 +5,7 @@ #include "common/fs/fs.h" #include "common/fs/path_util.h" +#include "common/logging/log.h" #include "frontend_common/config.h" #include "yuzu/configuration/input_profiles.h" @@ -113,6 +114,8 @@ bool InputProfiles::LoadProfile(const std::string& profile_name, std::size_t pla return false; } + LOG_INFO(Config, "Loading input profile `{}`", profile_name); + map_profiles[profile_name]->ReadQtControlPlayerValues(player_index); return true; } diff --git a/src/yuzu/configuration/qt_config.cpp b/src/yuzu/configuration/qt_config.cpp index 6aca71d7c..1051031f2 100644 --- a/src/yuzu/configuration/qt_config.cpp +++ b/src/yuzu/configuration/qt_config.cpp @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include "common/logging/log.h" #include "input_common/main.h" #include "qt_config.h" #include "uisettings.h" @@ -65,7 +66,7 @@ void QtConfig::ReloadAllValues() { } void QtConfig::SaveAllValues() { - Save(); + SaveValues(); SaveQtValues(); } @@ -327,7 +328,10 @@ void QtConfig::ReadMultiplayerValues() { void QtConfig::SaveQtValues() { if (global) { + LOG_DEBUG(Config, "Saving global Qt configuration values"); SaveUIValues(); + } else { + LOG_DEBUG(Config, "Saving Qt configuration values"); } SaveQtControlValues(); @@ -545,6 +549,7 @@ void QtConfig::ReadQtControlPlayerValues(std::size_t player_index) { void QtConfig::SaveQtControlPlayerValues(std::size_t player_index) { BeginGroup(Settings::TranslateCategory(Settings::Category::Controls)); + LOG_DEBUG(Config, "Saving players control configuration values"); SavePlayerValues(player_index); SaveQtPlayerValues(player_index); diff --git a/src/yuzu/configuration/shared_translation.cpp b/src/yuzu/configuration/shared_translation.cpp index 7e908924c..ed9c7d859 100644 --- a/src/yuzu/configuration/shared_translation.cpp +++ b/src/yuzu/configuration/shared_translation.cpp @@ -143,8 +143,10 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent) { INSERT(Settings, rng_seed, tr("RNG Seed"), QStringLiteral()); INSERT(Settings, rng_seed_enabled, QStringLiteral(), QStringLiteral()); INSERT(Settings, device_name, tr("Device Name"), QStringLiteral()); - INSERT(Settings, custom_rtc, tr("Custom RTC"), QStringLiteral()); + INSERT(Settings, custom_rtc, tr("Custom RTC Date:"), QStringLiteral()); INSERT(Settings, custom_rtc_enabled, QStringLiteral(), QStringLiteral()); + INSERT(Settings, custom_rtc_offset, QStringLiteral(" "), + QStringLiteral("The number of seconds from the current unix time")); INSERT(Settings, language_index, tr("Language:"), tr("Note: this can be overridden when region setting is auto-select")); INSERT(Settings, region_index, tr("Region:"), QStringLiteral()); @@ -228,7 +230,7 @@ std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QWidget* parent) { { PAIR(ShaderBackend, Glsl, tr("GLSL")), PAIR(ShaderBackend, Glasm, tr("GLASM (Assembly Shaders, NVIDIA Only)")), - PAIR(ShaderBackend, SpirV, tr("SPIR-V (Experimental, Mesa Only)")), + PAIR(ShaderBackend, SpirV, tr("SPIR-V (Experimental, AMD/Mesa Only)")), }}); translations->insert({Settings::EnumMetadata<Settings::GpuAccuracy>::Index(), { diff --git a/src/yuzu/configuration/shared_widget.cpp b/src/yuzu/configuration/shared_widget.cpp index 941683a43..85f4f7655 100644 --- a/src/yuzu/configuration/shared_widget.cpp +++ b/src/yuzu/configuration/shared_widget.cpp @@ -750,12 +750,12 @@ Widget::Widget(Settings::BasicSetting* setting_, const TranslationMap& translati } apply_funcs.push_back([load_func, setting_](bool powered_on) { - if (setting_->RuntimeModfiable() || !powered_on) { + if (setting_->RuntimeModifiable() || !powered_on) { load_func(); } }); - bool enable = runtime_lock || setting.RuntimeModfiable(); + bool enable = runtime_lock || setting.RuntimeModifiable(); if (setting.Switchable() && Settings::IsConfiguringGlobal() && !runtime_lock) { enable &= setting.UsingGlobal(); } diff --git a/src/yuzu/debugger/console.h b/src/yuzu/debugger/console.h index fdb7d174c..2491d1ec1 100644 --- a/src/yuzu/debugger/console.h +++ b/src/yuzu/debugger/console.h @@ -10,4 +10,4 @@ namespace Debugger { * get a real qt logging window which would work for all platforms. */ void ToggleConsole(); -} // namespace Debugger
\ No newline at end of file +} // namespace Debugger diff --git a/src/yuzu/debugger/controller.cpp b/src/yuzu/debugger/controller.cpp index e2f55ebae..216d2974d 100644 --- a/src/yuzu/debugger/controller.cpp +++ b/src/yuzu/debugger/controller.cpp @@ -5,8 +5,8 @@ #include <QLayout> #include <QString> #include "common/settings.h" -#include "core/hid/emulated_controller.h" -#include "core/hid/hid_core.h" +#include "hid_core/frontend/emulated_controller.h" +#include "hid_core/hid_core.h" #include "input_common/drivers/tas_input.h" #include "input_common/main.h" #include "yuzu/configuration/configure_input_player_widget.h" diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp index dc006832e..0cbf5f45e 100644 --- a/src/yuzu/game_list_worker.cpp +++ b/src/yuzu/game_list_worker.cpp @@ -17,7 +17,7 @@ #include "core/file_sys/card_image.h" #include "core/file_sys/content_archive.h" #include "core/file_sys/control_metadata.h" -#include "core/file_sys/mode.h" +#include "core/file_sys/fs_filesystem.h" #include "core/file_sys/nca_metadata.h" #include "core/file_sys/patch_manager.h" #include "core/file_sys/registered_cache.h" @@ -164,18 +164,19 @@ QString FormatPatchNameVersions(const FileSys::PatchManager& patch_manager, QString out; FileSys::VirtualFile update_raw; loader.ReadUpdateRaw(update_raw); - for (const auto& kv : patch_manager.GetPatchVersionNames(update_raw)) { - const bool is_update = kv.first == "Update" || kv.first == "[D] Update"; + for (const auto& patch : patch_manager.GetPatches(update_raw)) { + const bool is_update = patch.name == "Update"; if (!updatable && is_update) { continue; } - const QString type = QString::fromStdString(kv.first); + const QString type = + QString::fromStdString(patch.enabled ? patch.name : "[D] " + patch.name); - if (kv.second.empty()) { + if (patch.version.empty()) { out.append(QStringLiteral("%1\n").arg(type)); } else { - auto ver = kv.second; + auto ver = patch.version; // Display container name for packed updates if (is_update && ver == "PACKED") { @@ -346,7 +347,7 @@ void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_pa if (!is_dir && (HasSupportedFileExtension(physical_name) || IsExtractedNCAMain(physical_name))) { - const auto file = vfs->OpenFile(physical_name, FileSys::Mode::Read); + const auto file = vfs->OpenFile(physical_name, FileSys::OpenMode::Read); if (!file) { return true; } diff --git a/src/yuzu/hotkeys.cpp b/src/yuzu/hotkeys.cpp index eebfbf155..b7693ad0d 100644 --- a/src/yuzu/hotkeys.cpp +++ b/src/yuzu/hotkeys.cpp @@ -6,7 +6,7 @@ #include <QTreeWidgetItem> #include <QtGlobal> -#include "core/hid/emulated_controller.h" +#include "hid_core/frontend/emulated_controller.h" #include "yuzu/hotkeys.h" #include "yuzu/uisettings.h" diff --git a/src/yuzu/hotkeys.h b/src/yuzu/hotkeys.h index e11332d2e..bdc081649 100644 --- a/src/yuzu/hotkeys.h +++ b/src/yuzu/hotkeys.h @@ -7,7 +7,7 @@ #include <QKeySequence> #include <QString> #include <QWidget> -#include "core/hid/hid_types.h" +#include "hid_core/hid_types.h" class QDialog; class QSettings; diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index c789c1e59..782bcbb61 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -35,27 +35,28 @@ #include "configuration/configure_per_game.h" #include "configuration/configure_tas.h" #include "core/file_sys/romfs_factory.h" -#include "core/file_sys/vfs.h" -#include "core/file_sys/vfs_real.h" +#include "core/file_sys/vfs/vfs.h" +#include "core/file_sys/vfs/vfs_real.h" #include "core/frontend/applets/cabinet.h" #include "core/frontend/applets/controller.h" #include "core/frontend/applets/general_frontend.h" #include "core/frontend/applets/mii_edit.h" #include "core/frontend/applets/software_keyboard.h" -#include "core/hid/emulated_controller.h" -#include "core/hid/hid_core.h" #include "core/hle/service/acc/profile_manager.h" #include "core/hle/service/am/applet_ae.h" #include "core/hle/service/am/applet_oe.h" #include "core/hle/service/am/applets/applets.h" -#include "core/hle/service/set/set_sys.h" +#include "core/hle/service/set/system_settings_server.h" +#include "frontend_common/content_manager.h" +#include "hid_core/frontend/emulated_controller.h" +#include "hid_core/hid_core.h" #include "yuzu/multiplayer/state.h" #include "yuzu/util/controller_navigation.h" // These are wrappers to avoid the calls to CreateDirectory and CreateFile because of the Windows // defines. static FileSys::VirtualDir VfsFilesystemCreateDirectoryWrapper( - const FileSys::VirtualFilesystem& vfs, const std::string& path, FileSys::Mode mode) { + const FileSys::VirtualFilesystem& vfs, const std::string& path, FileSys::OpenMode mode) { return vfs->CreateDirectory(path, mode); } @@ -422,7 +423,7 @@ GMainWindow::GMainWindow(std::unique_ptr<QtConfig> config_, bool has_broken_vulk RemoveCachedContents(); // Gen keys if necessary - OnReinitializeKeys(ReinitializeKeyBehavior::NoWarning); + OnCheckFirmwareDecryption(); game_list->LoadCompatibilityList(); game_list->PopulateAsync(UISettings::values.game_dirs); @@ -518,12 +519,21 @@ GMainWindow::GMainWindow(std::unique_ptr<QtConfig> config_, bool has_broken_vulk continue; } + int user_arg_idx = ++i; bool argument_ok; - const std::size_t selected_user = args[++i].toUInt(&argument_ok); + std::size_t selected_user = args[user_arg_idx].toUInt(&argument_ok); if (!argument_ok) { - LOG_ERROR(Frontend, "Invalid user argument"); - continue; + // try to look it up by username, only finds the first username that matches. + const std::string user_arg_str = args[user_arg_idx].toStdString(); + const auto user_idx = system->GetProfileManager().GetUserIndex(user_arg_str); + + if (user_idx == std::nullopt) { + LOG_ERROR(Frontend, "Invalid user argument"); + continue; + } + + selected_user = user_idx.value(); } if (!system->GetProfileManager().UserExistsIndex(selected_user)) { @@ -532,6 +542,8 @@ GMainWindow::GMainWindow(std::unique_ptr<QtConfig> config_, bool has_broken_vulk } Settings::values.current_user = static_cast<s32>(selected_user); + + user_flag_cmd_line = true; continue; } @@ -1562,8 +1574,6 @@ void GMainWindow::ConnectMenuEvents() { connect(multiplayer_state, &MultiplayerState::SaveConfig, this, &GMainWindow::OnSaveConfig); // Tools - connect_menu(ui->action_Rederive, std::bind(&GMainWindow::OnReinitializeKeys, this, - ReinitializeKeyBehavior::Warning)); connect_menu(ui->action_Load_Album, &GMainWindow::OnAlbum); connect_menu(ui->action_Load_Cabinet_Nickname_Owner, [this]() { OnCabinet(Service::NFP::CabinetMode::StartNicknameAndOwnerSettings); }); @@ -1870,7 +1880,7 @@ bool GMainWindow::SelectAndSetCurrentUser( void GMainWindow::ConfigureFilesystemProvider(const std::string& filepath) { // Ensure all NCAs are registered before launching the game - const auto file = vfs->OpenFile(filepath, FileSys::Mode::Read); + const auto file = vfs->OpenFile(filepath, FileSys::OpenMode::Read); if (!file) { return; } @@ -1942,7 +1952,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t Settings::LogSettings(); - if (UISettings::values.select_user_on_boot) { + if (UISettings::values.select_user_on_boot && !user_flag_cmd_line) { const Core::Frontend::ProfileSelectParameters parameters{ .mode = Service::AM::Applets::UiMode::UserSelector, .invalid_uid_list = {}, @@ -1954,6 +1964,11 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t } } + // If the user specifies -u (successfully) on the cmd line, don't prompt for a user on first + // game startup only. If the user stops emulation and starts a new one, go back to the expected + // behavior of asking. + user_flag_cmd_line = false; + if (!LoadROM(filename, program_id, program_index, launch_type)) { return; } @@ -2259,7 +2274,7 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target open_target = tr("Save Data"); const auto nand_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir); auto vfs_nand_dir = - vfs->OpenDirectory(Common::FS::PathToUTF8String(nand_dir), FileSys::Mode::Read); + vfs->OpenDirectory(Common::FS::PathToUTF8String(nand_dir), FileSys::OpenMode::Read); if (has_user_save) { // User save data @@ -2292,14 +2307,14 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target ASSERT(user_id); const auto user_save_data_path = FileSys::SaveDataFactory::GetFullPath( - *system, vfs_nand_dir, FileSys::SaveDataSpaceId::NandUser, + {}, vfs_nand_dir, FileSys::SaveDataSpaceId::NandUser, FileSys::SaveDataType::SaveData, program_id, user_id->AsU128(), 0); path = Common::FS::ConcatPathSafe(nand_dir, user_save_data_path); } else { // Device save data const auto device_save_data_path = FileSys::SaveDataFactory::GetFullPath( - *system, vfs_nand_dir, FileSys::SaveDataSpaceId::NandUser, + {}, vfs_nand_dir, FileSys::SaveDataSpaceId::NandUser, FileSys::SaveDataType::SaveData, program_id, {}, 0); path = Common::FS::ConcatPathSafe(nand_dir, device_save_data_path); @@ -2460,10 +2475,8 @@ void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryT } void GMainWindow::RemoveBaseContent(u64 program_id, InstalledEntryType type) { - const auto& fs_controller = system->GetFileSystemController(); - const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) || - fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id); - + const auto res = + ContentManager::RemoveBaseContent(system->GetFileSystemController(), program_id); if (res) { QMessageBox::information(this, tr("Successfully Removed"), tr("Successfully removed the installed base game.")); @@ -2475,11 +2488,7 @@ void GMainWindow::RemoveBaseContent(u64 program_id, InstalledEntryType type) { } void GMainWindow::RemoveUpdateContent(u64 program_id, InstalledEntryType type) { - const auto update_id = program_id | 0x800; - const auto& fs_controller = system->GetFileSystemController(); - const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) || - fs_controller.GetSDMCContents()->RemoveExistingEntry(update_id); - + const auto res = ContentManager::RemoveUpdate(system->GetFileSystemController(), program_id); if (res) { QMessageBox::information(this, tr("Successfully Removed"), tr("Successfully removed the installed update.")); @@ -2490,22 +2499,7 @@ void GMainWindow::RemoveUpdateContent(u64 program_id, InstalledEntryType type) { } void GMainWindow::RemoveAddOnContent(u64 program_id, InstalledEntryType type) { - u32 count{}; - const auto& fs_controller = system->GetFileSystemController(); - const auto dlc_entries = system->GetContentProvider().ListEntriesFilter( - FileSys::TitleType::AOC, FileSys::ContentRecordType::Data); - - for (const auto& entry : dlc_entries) { - if (FileSys::GetBaseTitleID(entry.title_id) == program_id) { - const auto res = - fs_controller.GetUserNANDContents()->RemoveExistingEntry(entry.title_id) || - fs_controller.GetSDMCContents()->RemoveExistingEntry(entry.title_id); - if (res) { - ++count; - } - } - } - + const size_t count = ContentManager::RemoveAllDLC(*system, program_id); if (count == 0) { QMessageBox::warning(this, GetGameListErrorRemoving(type), tr("There are no DLC installed for this title.")); @@ -2659,11 +2653,11 @@ void GMainWindow::RemoveCustomConfiguration(u64 program_id, const std::string& g void GMainWindow::RemoveCacheStorage(u64 program_id) { const auto nand_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir); auto vfs_nand_dir = - vfs->OpenDirectory(Common::FS::PathToUTF8String(nand_dir), FileSys::Mode::Read); + vfs->OpenDirectory(Common::FS::PathToUTF8String(nand_dir), FileSys::OpenMode::Read); const auto cache_storage_path = FileSys::SaveDataFactory::GetFullPath( - *system, vfs_nand_dir, FileSys::SaveDataSpaceId::NandUser, - FileSys::SaveDataType::CacheStorage, 0 /* program_id */, {}, 0); + {}, vfs_nand_dir, FileSys::SaveDataSpaceId::NandUser, FileSys::SaveDataType::CacheStorage, + 0 /* program_id */, {}, 0); const auto path = Common::FS::ConcatPathSafe(nand_dir, cache_storage_path); @@ -2679,7 +2673,8 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa "cancelled the operation.")); }; - const auto loader = Loader::GetLoader(*system, vfs->OpenFile(game_path, FileSys::Mode::Read)); + const auto loader = + Loader::GetLoader(*system, vfs->OpenFile(game_path, FileSys::OpenMode::Read)); if (loader == nullptr) { failed(); return; @@ -2723,7 +2718,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa const FileSys::PatchManager pm{title_id, system->GetFileSystemController(), installed}; auto romfs = pm.PatchRomFS(base_nca.get(), base_romfs, type, packed_update_raw, false); - const auto out = VfsFilesystemCreateDirectoryWrapper(vfs, path, FileSys::Mode::ReadWrite); + const auto out = VfsFilesystemCreateDirectoryWrapper(vfs, path, FileSys::OpenMode::ReadWrite); if (out == nullptr) { failed(); @@ -2790,16 +2785,6 @@ void GMainWindow::OnGameListVerifyIntegrity(const std::string& game_path) { QMessageBox::warning(this, tr("Integrity verification couldn't be performed!"), tr("File contents were not checked for validity.")); }; - const auto Failed = [this] { - QMessageBox::critical(this, tr("Integrity verification failed!"), - tr("File contents may be corrupt.")); - }; - - const auto loader = Loader::GetLoader(*system, vfs->OpenFile(game_path, FileSys::Mode::Read)); - if (loader == nullptr) { - NotImplemented(); - return; - } QProgressDialog progress(tr("Verifying integrity..."), tr("Cancel"), 0, 100, this); progress.setWindowModality(Qt::WindowModal); @@ -2807,30 +2792,25 @@ void GMainWindow::OnGameListVerifyIntegrity(const std::string& game_path) { progress.setAutoClose(false); progress.setAutoReset(false); - const auto QtProgressCallback = [&](size_t processed_size, size_t total_size) { - if (progress.wasCanceled()) { - return false; - } - + const auto QtProgressCallback = [&](size_t total_size, size_t processed_size) { progress.setValue(static_cast<int>((processed_size * 100) / total_size)); - return true; + return progress.wasCanceled(); }; - const auto status = loader->VerifyIntegrity(QtProgressCallback); - if (progress.wasCanceled() || - status == Loader::ResultStatus::ErrorIntegrityVerificationNotImplemented) { + const auto result = ContentManager::VerifyGameContents(*system, game_path, QtProgressCallback); + progress.close(); + switch (result) { + case ContentManager::GameVerificationResult::Success: + QMessageBox::information(this, tr("Integrity verification succeeded!"), + tr("The operation completed successfully.")); + break; + case ContentManager::GameVerificationResult::Failed: + QMessageBox::critical(this, tr("Integrity verification failed!"), + tr("File contents may be corrupt.")); + break; + case ContentManager::GameVerificationResult::NotImplemented: NotImplemented(); - return; - } - - if (status == Loader::ResultStatus::ErrorIntegrityVerificationFailed) { - Failed(); - return; } - - progress.close(); - QMessageBox::information(this, tr("Integrity verification succeeded!"), - tr("The operation completed successfully.")); } void GMainWindow::OnGameListCopyTID(u64 program_id) { @@ -3036,7 +3016,7 @@ void GMainWindow::OnGameListCreateShortcut(u64 program_id, const std::string& ga system->GetContentProvider()}; const auto control = pm.GetControlMetadata(); const auto loader = - Loader::GetLoader(*system, vfs->OpenFile(game_path, FileSys::Mode::Read)); + Loader::GetLoader(*system, vfs->OpenFile(game_path, FileSys::OpenMode::Read)); game_title = fmt::format("{:016X}", program_id); if (control.first != nullptr) { game_title = control.first->GetApplicationName(); @@ -3274,12 +3254,21 @@ void GMainWindow::OnMenuInstallToNAND() { install_progress->setLabelText( tr("Installing file \"%1\"...").arg(QFileInfo(file).fileName())); - QFuture<InstallResult> future; - InstallResult result; + QFuture<ContentManager::InstallResult> future; + ContentManager::InstallResult result; if (file.endsWith(QStringLiteral("nsp"), Qt::CaseInsensitive)) { - - future = QtConcurrent::run([this, &file] { return InstallNSP(file); }); + const auto progress_callback = [this](size_t size, size_t progress) { + emit UpdateInstallProgress(); + if (install_progress->wasCanceled()) { + return true; + } + return false; + }; + future = QtConcurrent::run([this, &file, progress_callback] { + return ContentManager::InstallNSP(*system, *vfs, file.toStdString(), + progress_callback); + }); while (!future.isFinished()) { QCoreApplication::processEvents(); @@ -3295,16 +3284,16 @@ void GMainWindow::OnMenuInstallToNAND() { std::this_thread::sleep_for(std::chrono::milliseconds(10)); switch (result) { - case InstallResult::Success: + case ContentManager::InstallResult::Success: new_files.append(QFileInfo(file).fileName()); break; - case InstallResult::Overwrite: + case ContentManager::InstallResult::Overwrite: overwritten_files.append(QFileInfo(file).fileName()); break; - case InstallResult::Failure: + case ContentManager::InstallResult::Failure: failed_files.append(QFileInfo(file).fileName()); break; - case InstallResult::BaseInstallAttempted: + case ContentManager::InstallResult::BaseInstallAttempted: failed_files.append(QFileInfo(file).fileName()); detected_base_install = true; break; @@ -3338,96 +3327,7 @@ void GMainWindow::OnMenuInstallToNAND() { ui->action_Install_File_NAND->setEnabled(true); } -InstallResult GMainWindow::InstallNSP(const QString& filename) { - const auto qt_raw_copy = [this](const FileSys::VirtualFile& src, - const FileSys::VirtualFile& dest, std::size_t block_size) { - if (src == nullptr || dest == nullptr) { - return false; - } - if (!dest->Resize(src->GetSize())) { - return false; - } - - std::vector<u8> buffer(CopyBufferSize); - - for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) { - if (install_progress->wasCanceled()) { - dest->Resize(0); - return false; - } - - emit UpdateInstallProgress(); - - const auto read = src->Read(buffer.data(), buffer.size(), i); - dest->Write(buffer.data(), read, i); - } - return true; - }; - - std::shared_ptr<FileSys::NSP> nsp; - if (filename.endsWith(QStringLiteral("nsp"), Qt::CaseInsensitive)) { - nsp = std::make_shared<FileSys::NSP>( - vfs->OpenFile(filename.toStdString(), FileSys::Mode::Read)); - if (nsp->IsExtractedType()) { - return InstallResult::Failure; - } - } else { - return InstallResult::Failure; - } - - if (nsp->GetStatus() != Loader::ResultStatus::Success) { - return InstallResult::Failure; - } - const auto res = system->GetFileSystemController().GetUserNANDContents()->InstallEntry( - *nsp, true, qt_raw_copy); - switch (res) { - case FileSys::InstallResult::Success: - return InstallResult::Success; - case FileSys::InstallResult::OverwriteExisting: - return InstallResult::Overwrite; - case FileSys::InstallResult::ErrorBaseInstall: - return InstallResult::BaseInstallAttempted; - default: - return InstallResult::Failure; - } -} - -InstallResult GMainWindow::InstallNCA(const QString& filename) { - const auto qt_raw_copy = [this](const FileSys::VirtualFile& src, - const FileSys::VirtualFile& dest, std::size_t block_size) { - if (src == nullptr || dest == nullptr) { - return false; - } - if (!dest->Resize(src->GetSize())) { - return false; - } - - std::vector<u8> buffer(CopyBufferSize); - - for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) { - if (install_progress->wasCanceled()) { - dest->Resize(0); - return false; - } - - emit UpdateInstallProgress(); - - const auto read = src->Read(buffer.data(), buffer.size(), i); - dest->Write(buffer.data(), read, i); - } - return true; - }; - - const auto nca = - std::make_shared<FileSys::NCA>(vfs->OpenFile(filename.toStdString(), FileSys::Mode::Read)); - const auto id = nca->GetStatus(); - - // Game updates necessary are missing base RomFS - if (id != Loader::ResultStatus::Success && - id != Loader::ResultStatus::ErrorMissingBKTRBaseRomFS) { - return InstallResult::Failure; - } - +ContentManager::InstallResult GMainWindow::InstallNCA(const QString& filename) { const QStringList tt_options{tr("System Application"), tr("System Archive"), tr("System Application Update"), @@ -3448,7 +3348,7 @@ InstallResult GMainWindow::InstallNCA(const QString& filename) { if (!ok || index == -1) { QMessageBox::warning(this, tr("Failed to Install"), tr("The title type you selected for the NCA is invalid.")); - return InstallResult::Failure; + return ContentManager::InstallResult::Failure; } // If index is equal to or past Game, add the jump in TitleType. @@ -3462,15 +3362,15 @@ InstallResult GMainWindow::InstallNCA(const QString& filename) { auto* registered_cache = is_application ? fs_controller.GetUserNANDContents() : fs_controller.GetSystemNANDContents(); - const auto res = registered_cache->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), - true, qt_raw_copy); - if (res == FileSys::InstallResult::Success) { - return InstallResult::Success; - } else if (res == FileSys::InstallResult::OverwriteExisting) { - return InstallResult::Overwrite; - } else { - return InstallResult::Failure; - } + const auto progress_callback = [this](size_t size, size_t progress) { + emit UpdateInstallProgress(); + if (install_progress->wasCanceled()) { + return true; + } + return false; + }; + return ContentManager::InstallNCA(*vfs, filename.toStdString(), *registered_cache, + static_cast<FileSys::TitleType>(index), progress_callback); } void GMainWindow::OnMenuRecentFile() { @@ -3988,7 +3888,7 @@ void GMainWindow::OnToggleDockedMode() { tr("Handheld controller can't be used on docked mode. Pro " "controller will be selected.")); handheld->Disconnect(); - player_1->SetNpadStyleIndex(Core::HID::NpadStyleIndex::ProController); + player_1->SetNpadStyleIndex(Core::HID::NpadStyleIndex::Fullkey); player_1->Connect(); controller_dialog->refreshConfiguration(); } @@ -4205,10 +4105,6 @@ void GMainWindow::OnOpenYuzuFolder() { } void GMainWindow::OnVerifyInstalledContents() { - // Declare sizes. - size_t total_size = 0; - size_t processed_size = 0; - // Initialize a progress dialog. QProgressDialog progress(tr("Verifying integrity..."), tr("Cancel"), 0, 100, this); progress.setWindowModality(Qt::WindowModal); @@ -4216,93 +4112,25 @@ void GMainWindow::OnVerifyInstalledContents() { progress.setAutoClose(false); progress.setAutoReset(false); - // Declare a list of file names which failed to verify. - std::vector<std::string> failed; - // Declare progress callback. - auto QtProgressCallback = [&](size_t nca_processed, size_t nca_total) { - if (progress.wasCanceled()) { - return false; - } - progress.setValue(static_cast<int>(((processed_size + nca_processed) * 100) / total_size)); - return true; + auto QtProgressCallback = [&](size_t total_size, size_t processed_size) { + progress.setValue(static_cast<int>((processed_size * 100) / total_size)); + return progress.wasCanceled(); }; - // Get content registries. - auto bis_contents = system->GetFileSystemController().GetSystemNANDContents(); - auto user_contents = system->GetFileSystemController().GetUserNANDContents(); - - std::vector<FileSys::RegisteredCache*> content_providers; - if (bis_contents) { - content_providers.push_back(bis_contents); - } - if (user_contents) { - content_providers.push_back(user_contents); - } - - // Get associated NCA files. - std::vector<FileSys::VirtualFile> nca_files; - - // Get all installed IDs. - for (auto nca_provider : content_providers) { - const auto entries = nca_provider->ListEntriesFilter(); - - for (const auto& entry : entries) { - auto nca_file = nca_provider->GetEntryRaw(entry.title_id, entry.type); - if (!nca_file) { - continue; - } - - total_size += nca_file->GetSize(); - nca_files.push_back(std::move(nca_file)); - } - } - - // Using the NCA loader, determine if all NCAs are valid. - for (auto& nca_file : nca_files) { - Loader::AppLoader_NCA nca_loader(nca_file); - - auto status = nca_loader.VerifyIntegrity(QtProgressCallback); - if (progress.wasCanceled()) { - break; - } - if (status != Loader::ResultStatus::Success) { - FileSys::NCA nca(nca_file); - const auto title_id = nca.GetTitleId(); - std::string title_name = "unknown"; - - const auto control = provider->GetEntry(FileSys::GetBaseTitleID(title_id), - FileSys::ContentRecordType::Control); - if (control && control->GetStatus() == Loader::ResultStatus::Success) { - const FileSys::PatchManager pm{title_id, system->GetFileSystemController(), - *provider}; - const auto [nacp, logo] = pm.ParseControlNCA(*control); - if (nacp) { - title_name = nacp->GetApplicationName(); - } - } - - if (title_id > 0) { - failed.push_back( - fmt::format("{} ({:016X}) ({})", nca_file->GetName(), title_id, title_name)); - } else { - failed.push_back(fmt::format("{} (unknown)", nca_file->GetName())); - } - } - - processed_size += nca_file->GetSize(); - } - + const std::vector<std::string> result = + ContentManager::VerifyInstalledContents(*system, *provider, QtProgressCallback); progress.close(); - if (failed.size() > 0) { - auto failed_names = QString::fromStdString(fmt::format("{}", fmt::join(failed, "\n"))); + if (result.empty()) { + QMessageBox::information(this, tr("Integrity verification succeeded!"), + tr("The operation completed successfully.")); + } else { + const auto failed_names = + QString::fromStdString(fmt::format("{}", fmt::join(result, "\n"))); QMessageBox::critical( this, tr("Integrity verification failed!"), tr("Verification failed for the following files:\n\n%1").arg(failed_names)); - } else { - QMessageBox::information(this, tr("Integrity verification succeeded!"), - tr("The operation completed successfully.")); } } @@ -4721,122 +4549,20 @@ void GMainWindow::OnMouseActivity() { } } -void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) { - if (behavior == ReinitializeKeyBehavior::Warning) { - const auto res = QMessageBox::information( - this, tr("Confirm Key Rederivation"), - tr("You are about to force rederive all of your keys. \nIf you do not know what " - "this " - "means or what you are doing, \nthis is a potentially destructive action. " - "\nPlease " - "make sure this is what you want \nand optionally make backups.\n\nThis will " - "delete " - "your autogenerated key files and re-run the key derivation module."), - QMessageBox::StandardButtons{QMessageBox::Ok, QMessageBox::Cancel}); - - if (res == QMessageBox::Cancel) - return; - - const auto keys_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::KeysDir); - - Common::FS::RemoveFile(keys_dir / "prod.keys_autogenerated"); - Common::FS::RemoveFile(keys_dir / "console.keys_autogenerated"); - Common::FS::RemoveFile(keys_dir / "title.keys_autogenerated"); - } - - Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); - bool all_keys_present{true}; - - if (keys.BaseDeriveNecessary()) { - Core::Crypto::PartitionDataManager pdm{vfs->OpenDirectory("", FileSys::Mode::Read)}; - - const auto function = [this, &keys, &pdm] { - keys.PopulateFromPartitionData(pdm); - - system->GetFileSystemController().CreateFactories(*vfs); - keys.DeriveETicket(pdm, system->GetContentProvider()); - }; - - QString errors; - if (!pdm.HasFuses()) { - errors += tr("Missing fuses"); - } - if (!pdm.HasBoot0()) { - errors += tr(" - Missing BOOT0"); - } - if (!pdm.HasPackage2()) { - errors += tr(" - Missing BCPKG2-1-Normal-Main"); - } - if (!pdm.HasProdInfo()) { - errors += tr(" - Missing PRODINFO"); - } - if (!errors.isEmpty()) { - all_keys_present = false; - QMessageBox::warning( - this, tr("Derivation Components Missing"), - tr("Encryption keys are missing. " - "<br>Please follow <a href='https://yuzu-emu.org/help/quickstart/'>the yuzu " - "quickstart guide</a> to get all your keys, firmware and " - "games.<br><br><small>(%1)</small>") - .arg(errors)); - } - - QProgressDialog prog(this); - prog.setRange(0, 0); - prog.setLabelText(tr("Deriving keys...\nThis may take up to a minute depending \non your " - "system's performance.")); - prog.setWindowTitle(tr("Deriving Keys")); - - prog.show(); - - auto future = QtConcurrent::run(function); - while (!future.isFinished()) { - QCoreApplication::processEvents(); - } - - prog.close(); - } - +void GMainWindow::OnCheckFirmwareDecryption() { system->GetFileSystemController().CreateFactories(*vfs); - - if (all_keys_present && !this->CheckSystemArchiveDecryption()) { - LOG_WARNING(Frontend, "Mii model decryption failed"); + if (!ContentManager::AreKeysPresent()) { QMessageBox::warning( - this, tr("System Archive Decryption Failed"), - tr("Encryption keys failed to decrypt firmware. " + this, tr("Derivation Components Missing"), + tr("Encryption keys are missing. " "<br>Please follow <a href='https://yuzu-emu.org/help/quickstart/'>the yuzu " "quickstart guide</a> to get all your keys, firmware and " "games.")); } - SetFirmwareVersion(); - - if (behavior == ReinitializeKeyBehavior::Warning) { - game_list->PopulateAsync(UISettings::values.game_dirs); - } - UpdateMenuState(); } -bool GMainWindow::CheckSystemArchiveDecryption() { - constexpr u64 MiiModelId = 0x0100000000000802; - - auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); - if (!bis_system) { - // Not having system BIS files is not an error. - return true; - } - - auto mii_nca = bis_system->GetEntry(MiiModelId, FileSys::ContentRecordType::Data); - if (!mii_nca) { - // Not having the Mii model is not an error. - return true; - } - - // Return whether we are able to decrypt the RomFS of the Mii model. - return mii_nca->GetRomFS().get() != nullptr; -} - bool GMainWindow::CheckFirmwarePresence() { constexpr u64 MiiEditId = static_cast<u64>(Service::AM::Applets::AppletProgramId::MiiEdit); diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 366e806d5..6b72094ff 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -16,6 +16,7 @@ #include "common/announce_multiplayer_room.h" #include "common/common_types.h" #include "configuration/qt_config.h" +#include "frontend_common/content_manager.h" #include "input_common/drivers/tas_input.h" #include "yuzu/compatibility_list.h" #include "yuzu/hotkeys.h" @@ -124,18 +125,6 @@ enum class EmulatedDirectoryTarget { SDMC, }; -enum class InstallResult { - Success, - Overwrite, - Failure, - BaseInstallAttempted, -}; - -enum class ReinitializeKeyBehavior { - NoWarning, - Warning, -}; - namespace VkDeviceInfo { class Record; } @@ -406,7 +395,7 @@ private slots: void OnMiiEdit(); void OnOpenControllerMenu(); void OnCaptureScreenshot(); - void OnReinitializeKeys(ReinitializeKeyBehavior behavior); + void OnCheckFirmwareDecryption(); void OnLanguageChanged(const QString& locale); void OnMouseActivity(); bool OnShutdownBegin(); @@ -427,8 +416,7 @@ private: void RemoveCacheStorage(u64 program_id); bool SelectRomFSDumpTarget(const FileSys::ContentProvider&, u64 program_id, u64* selected_title_id, u8* selected_content_record_type); - InstallResult InstallNSP(const QString& filename); - InstallResult InstallNCA(const QString& filename); + ContentManager::InstallResult InstallNCA(const QString& filename); void MigrateConfigFiles(); void UpdateWindowTitle(std::string_view title_name = {}, std::string_view title_version = {}, std::string_view gpu_vendor = {}); @@ -448,7 +436,6 @@ private: void LoadTranslation(); void OpenPerGameConfiguration(u64 title_id, const std::string& file_name); bool CheckDarkMode(); - bool CheckSystemArchiveDecryption(); bool CheckFirmwarePresence(); void SetFirmwareVersion(); void ConfigureFilesystemProvider(const std::string& filepath); @@ -523,6 +510,8 @@ private: std::unique_ptr<EmuThread> emu_thread; // The path to the game currently running QString current_game_path; + // Whether a user was set on the command line (skips UserSelector if it's forced to show up) + bool user_flag_cmd_line = false; bool auto_paused = false; bool auto_muted = false; diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index e53f9951e..6a6b0821f 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui @@ -224,11 +224,6 @@ <string>&Stop</string> </property> </action> - <action name="action_Rederive"> - <property name="text"> - <string>&Reinitialize keys...</string> - </property> - </action> <action name="action_Verify_installed_contents"> <property name="text"> <string>&Verify Installed Contents</string> diff --git a/src/yuzu/multiplayer/chat_room.cpp b/src/yuzu/multiplayer/chat_room.cpp index dec9696c1..4463616b4 100644 --- a/src/yuzu/multiplayer/chat_room.cpp +++ b/src/yuzu/multiplayer/chat_room.cpp @@ -206,7 +206,7 @@ void ChatRoom::Initialize(Network::RoomNetwork* room_network_) { room_network = room_network_; // setup the callbacks for network updates if (auto member = room_network->GetRoomMember().lock()) { - member->BindOnChatMessageRecieved( + member->BindOnChatMessageReceived( [this](const Network::ChatEntry& chat) { emit ChatReceived(chat); }); member->BindOnStatusMessageReceived( [this](const Network::StatusMessageEntry& status_message) { diff --git a/src/yuzu/util/controller_navigation.cpp b/src/yuzu/util/controller_navigation.cpp index d49ae67cd..0dbfca243 100644 --- a/src/yuzu/util/controller_navigation.cpp +++ b/src/yuzu/util/controller_navigation.cpp @@ -2,8 +2,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "common/settings_input.h" -#include "core/hid/emulated_controller.h" -#include "core/hid/hid_core.h" +#include "hid_core/frontend/emulated_controller.h" +#include "hid_core/hid_core.h" #include "yuzu/util/controller_navigation.h" ControllerNavigation::ControllerNavigation(Core::HID::HIDCore& hid_core, QWidget* parent) { @@ -66,7 +66,7 @@ void ControllerNavigation::ControllerUpdateButton() { } switch (controller_type) { - case Core::HID::NpadStyleIndex::ProController: + case Core::HID::NpadStyleIndex::Fullkey: case Core::HID::NpadStyleIndex::JoyconDual: case Core::HID::NpadStyleIndex::Handheld: case Core::HID::NpadStyleIndex::GameCube: @@ -116,7 +116,7 @@ void ControllerNavigation::ControllerUpdateStick() { } switch (controller_type) { - case Core::HID::NpadStyleIndex::ProController: + case Core::HID::NpadStyleIndex::Fullkey: case Core::HID::NpadStyleIndex::JoyconDual: case Core::HID::NpadStyleIndex::Handheld: case Core::HID::NpadStyleIndex::GameCube: diff --git a/src/yuzu/util/overlay_dialog.cpp b/src/yuzu/util/overlay_dialog.cpp index ee35a3e15..466bbe7b2 100644 --- a/src/yuzu/util/overlay_dialog.cpp +++ b/src/yuzu/util/overlay_dialog.cpp @@ -6,8 +6,8 @@ #include <QWindow> #include "core/core.h" -#include "core/hid/hid_types.h" -#include "core/hid/input_interpreter.h" +#include "hid_core/frontend/input_interpreter.h" +#include "hid_core/hid_types.h" #include "ui_overlay_dialog.h" #include "yuzu/util/overlay_dialog.h" |