diff options
Diffstat (limited to 'src')
75 files changed, 717 insertions, 655 deletions
diff --git a/src/yuzu/applets/qt_controller.cpp b/src/yuzu/applets/qt_controller.cpp index 97106d2cc..bf8445a89 100644 --- a/src/yuzu/applets/qt_controller.cpp +++ b/src/yuzu/applets/qt_controller.cpp | |||
| @@ -37,17 +37,14 @@ constexpr std::array<std::array<bool, 4>, 8> led_patterns{{ | |||
| 37 | }}; | 37 | }}; |
| 38 | 38 | ||
| 39 | void UpdateController(Settings::ControllerType controller_type, std::size_t npad_index, | 39 | void UpdateController(Settings::ControllerType controller_type, std::size_t npad_index, |
| 40 | bool connected) { | 40 | bool connected, Core::System& system) { |
| 41 | Core::System& system{Core::System::GetInstance()}; | ||
| 42 | |||
| 43 | if (!system.IsPoweredOn()) { | 41 | if (!system.IsPoweredOn()) { |
| 44 | return; | 42 | return; |
| 45 | } | 43 | } |
| 46 | 44 | ||
| 47 | Service::SM::ServiceManager& sm = system.ServiceManager(); | ||
| 48 | |||
| 49 | auto& npad = | 45 | auto& npad = |
| 50 | sm.GetService<Service::HID::Hid>("hid") | 46 | system.ServiceManager() |
| 47 | .GetService<Service::HID::Hid>("hid") | ||
| 51 | ->GetAppletResource() | 48 | ->GetAppletResource() |
| 52 | ->GetController<Service::HID::Controller_NPad>(Service::HID::HidController::NPad); | 49 | ->GetController<Service::HID::Controller_NPad>(Service::HID::HidController::NPad); |
| 53 | 50 | ||
| @@ -79,10 +76,10 @@ bool IsControllerCompatible(Settings::ControllerType controller_type, | |||
| 79 | 76 | ||
| 80 | QtControllerSelectorDialog::QtControllerSelectorDialog( | 77 | QtControllerSelectorDialog::QtControllerSelectorDialog( |
| 81 | QWidget* parent, Core::Frontend::ControllerParameters parameters_, | 78 | QWidget* parent, Core::Frontend::ControllerParameters parameters_, |
| 82 | InputCommon::InputSubsystem* input_subsystem_) | 79 | InputCommon::InputSubsystem* input_subsystem_, Core::System& system_) |
| 83 | : QDialog(parent), ui(std::make_unique<Ui::QtControllerSelectorDialog>()), | 80 | : QDialog(parent), ui(std::make_unique<Ui::QtControllerSelectorDialog>()), |
| 84 | parameters(std::move(parameters_)), input_subsystem{input_subsystem_}, | 81 | parameters(std::move(parameters_)), input_subsystem{input_subsystem_}, |
| 85 | input_profiles(std::make_unique<InputProfiles>()) { | 82 | input_profiles(std::make_unique<InputProfiles>(system_)), system{system_} { |
| 86 | ui->setupUi(this); | 83 | ui->setupUi(this); |
| 87 | 84 | ||
| 88 | player_widgets = { | 85 | player_widgets = { |
| @@ -245,7 +242,7 @@ int QtControllerSelectorDialog::exec() { | |||
| 245 | void QtControllerSelectorDialog::ApplyConfiguration() { | 242 | void QtControllerSelectorDialog::ApplyConfiguration() { |
| 246 | const bool pre_docked_mode = Settings::values.use_docked_mode.GetValue(); | 243 | const bool pre_docked_mode = Settings::values.use_docked_mode.GetValue(); |
| 247 | Settings::values.use_docked_mode.SetValue(ui->radioDocked->isChecked()); | 244 | Settings::values.use_docked_mode.SetValue(ui->radioDocked->isChecked()); |
| 248 | OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue()); | 245 | OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue(), system); |
| 249 | 246 | ||
| 250 | Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); | 247 | Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); |
| 251 | Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); | 248 | Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); |
| @@ -293,7 +290,7 @@ void QtControllerSelectorDialog::CallConfigureMotionTouchDialog() { | |||
| 293 | } | 290 | } |
| 294 | 291 | ||
| 295 | void QtControllerSelectorDialog::CallConfigureInputProfileDialog() { | 292 | void QtControllerSelectorDialog::CallConfigureInputProfileDialog() { |
| 296 | ConfigureInputProfileDialog dialog(this, input_subsystem, input_profiles.get()); | 293 | ConfigureInputProfileDialog dialog(this, input_subsystem, input_profiles.get(), system); |
| 297 | 294 | ||
| 298 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | | 295 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | |
| 299 | Qt::WindowSystemMenuHint); | 296 | Qt::WindowSystemMenuHint); |
| @@ -533,7 +530,7 @@ void QtControllerSelectorDialog::UpdateControllerState(std::size_t player_index) | |||
| 533 | } | 530 | } |
| 534 | 531 | ||
| 535 | // Disconnect the controller first. | 532 | // Disconnect the controller first. |
| 536 | UpdateController(controller_type, player_index, false); | 533 | UpdateController(controller_type, player_index, false, system); |
| 537 | 534 | ||
| 538 | player.controller_type = controller_type; | 535 | player.controller_type = controller_type; |
| 539 | player.connected = player_connected; | 536 | player.connected = player_connected; |
| @@ -548,7 +545,7 @@ void QtControllerSelectorDialog::UpdateControllerState(std::size_t player_index) | |||
| 548 | } | 545 | } |
| 549 | handheld.connected = player_groupboxes[player_index]->isChecked() && | 546 | handheld.connected = player_groupboxes[player_index]->isChecked() && |
| 550 | controller_type == Settings::ControllerType::Handheld; | 547 | controller_type == Settings::ControllerType::Handheld; |
| 551 | UpdateController(Settings::ControllerType::Handheld, 8, handheld.connected); | 548 | UpdateController(Settings::ControllerType::Handheld, 8, handheld.connected, system); |
| 552 | } | 549 | } |
| 553 | 550 | ||
| 554 | if (!player.connected) { | 551 | if (!player.connected) { |
| @@ -560,7 +557,7 @@ void QtControllerSelectorDialog::UpdateControllerState(std::size_t player_index) | |||
| 560 | using namespace std::chrono_literals; | 557 | using namespace std::chrono_literals; |
| 561 | std::this_thread::sleep_for(60ms); | 558 | std::this_thread::sleep_for(60ms); |
| 562 | 559 | ||
| 563 | UpdateController(controller_type, player_index, player_connected); | 560 | UpdateController(controller_type, player_index, player_connected, system); |
| 564 | } | 561 | } |
| 565 | 562 | ||
| 566 | void QtControllerSelectorDialog::UpdateLEDPattern(std::size_t player_index) { | 563 | void QtControllerSelectorDialog::UpdateLEDPattern(std::size_t player_index) { |
| @@ -659,7 +656,8 @@ void QtControllerSelectorDialog::DisableUnsupportedPlayers() { | |||
| 659 | for (std::size_t index = max_supported_players; index < NUM_PLAYERS; ++index) { | 656 | for (std::size_t index = max_supported_players; index < NUM_PLAYERS; ++index) { |
| 660 | // Disconnect any unsupported players here and disable or hide them if applicable. | 657 | // Disconnect any unsupported players here and disable or hide them if applicable. |
| 661 | Settings::values.players.GetValue()[index].connected = false; | 658 | Settings::values.players.GetValue()[index].connected = false; |
| 662 | UpdateController(Settings::values.players.GetValue()[index].controller_type, index, false); | 659 | UpdateController(Settings::values.players.GetValue()[index].controller_type, index, false, |
| 660 | system); | ||
| 663 | // Hide the player widgets when max_supported_controllers is less than or equal to 4. | 661 | // Hide the player widgets when max_supported_controllers is less than or equal to 4. |
| 664 | if (max_supported_players <= 4) { | 662 | if (max_supported_players <= 4) { |
| 665 | player_widgets[index]->hide(); | 663 | player_widgets[index]->hide(); |
diff --git a/src/yuzu/applets/qt_controller.h b/src/yuzu/applets/qt_controller.h index 9b57aea1a..037325f50 100644 --- a/src/yuzu/applets/qt_controller.h +++ b/src/yuzu/applets/qt_controller.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <memory> | 8 | #include <memory> |
| 9 | #include <QDialog> | 9 | #include <QDialog> |
| 10 | #include "core/core.h" | ||
| 10 | #include "core/frontend/applets/controller.h" | 11 | #include "core/frontend/applets/controller.h" |
| 11 | 12 | ||
| 12 | class GMainWindow; | 13 | class GMainWindow; |
| @@ -36,7 +37,8 @@ class QtControllerSelectorDialog final : public QDialog { | |||
| 36 | public: | 37 | public: |
| 37 | explicit QtControllerSelectorDialog(QWidget* parent, | 38 | explicit QtControllerSelectorDialog(QWidget* parent, |
| 38 | Core::Frontend::ControllerParameters parameters_, | 39 | Core::Frontend::ControllerParameters parameters_, |
| 39 | InputCommon::InputSubsystem* input_subsystem_); | 40 | InputCommon::InputSubsystem* input_subsystem_, |
| 41 | Core::System& system_); | ||
| 40 | ~QtControllerSelectorDialog() override; | 42 | ~QtControllerSelectorDialog() override; |
| 41 | 43 | ||
| 42 | int exec() override; | 44 | int exec() override; |
| @@ -103,6 +105,8 @@ private: | |||
| 103 | 105 | ||
| 104 | std::unique_ptr<InputProfiles> input_profiles; | 106 | std::unique_ptr<InputProfiles> input_profiles; |
| 105 | 107 | ||
| 108 | Core::System& system; | ||
| 109 | |||
| 106 | // This is true if and only if all parameters are met. Otherwise, this is false. | 110 | // This is true if and only if all parameters are met. Otherwise, this is false. |
| 107 | // This determines whether the "OK" button can be clicked to exit the applet. | 111 | // This determines whether the "OK" button can be clicked to exit the applet. |
| 108 | bool parameters_met{false}; | 112 | bool parameters_met{false}; |
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 8b9e186b0..c75f5e1ee 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp | |||
| @@ -42,7 +42,7 @@ | |||
| 42 | #include "yuzu/bootmanager.h" | 42 | #include "yuzu/bootmanager.h" |
| 43 | #include "yuzu/main.h" | 43 | #include "yuzu/main.h" |
| 44 | 44 | ||
| 45 | EmuThread::EmuThread() = default; | 45 | EmuThread::EmuThread(Core::System& system_) : system{system_} {} |
| 46 | 46 | ||
| 47 | EmuThread::~EmuThread() = default; | 47 | EmuThread::~EmuThread() = default; |
| 48 | 48 | ||
| @@ -51,7 +51,6 @@ void EmuThread::run() { | |||
| 51 | MicroProfileOnThreadCreate(name.c_str()); | 51 | MicroProfileOnThreadCreate(name.c_str()); |
| 52 | Common::SetCurrentThreadName(name.c_str()); | 52 | Common::SetCurrentThreadName(name.c_str()); |
| 53 | 53 | ||
| 54 | auto& system = Core::System::GetInstance(); | ||
| 55 | auto& gpu = system.GPU(); | 54 | auto& gpu = system.GPU(); |
| 56 | auto stop_token = stop_source.get_token(); | 55 | auto stop_token = stop_source.get_token(); |
| 57 | 56 | ||
| @@ -285,8 +284,10 @@ static Core::Frontend::EmuWindow::WindowSystemInfo GetWindowSystemInfo(QWindow* | |||
| 285 | } | 284 | } |
| 286 | 285 | ||
| 287 | GRenderWindow::GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_, | 286 | GRenderWindow::GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_, |
| 288 | std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_) | 287 | std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_, |
| 289 | : QWidget(parent), emu_thread(emu_thread_), input_subsystem{std::move(input_subsystem_)} { | 288 | Core::System& system_) |
| 289 | : QWidget(parent), | ||
| 290 | emu_thread(emu_thread_), input_subsystem{std::move(input_subsystem_)}, system{system_} { | ||
| 290 | setWindowTitle(QStringLiteral("yuzu %1 | %2-%3") | 291 | setWindowTitle(QStringLiteral("yuzu %1 | %2-%3") |
| 291 | .arg(QString::fromUtf8(Common::g_build_name), | 292 | .arg(QString::fromUtf8(Common::g_build_name), |
| 292 | QString::fromUtf8(Common::g_scm_branch), | 293 | QString::fromUtf8(Common::g_scm_branch), |
| @@ -629,8 +630,7 @@ void GRenderWindow::ReleaseRenderTarget() { | |||
| 629 | } | 630 | } |
| 630 | 631 | ||
| 631 | void GRenderWindow::CaptureScreenshot(u32 res_scale, const QString& screenshot_path) { | 632 | void GRenderWindow::CaptureScreenshot(u32 res_scale, const QString& screenshot_path) { |
| 632 | auto& renderer = Core::System::GetInstance().Renderer(); | 633 | VideoCore::RendererBase& renderer = system.Renderer(); |
| 633 | |||
| 634 | if (res_scale == 0) { | 634 | if (res_scale == 0) { |
| 635 | res_scale = VideoCore::GetResolutionScaleFactor(renderer); | 635 | res_scale = VideoCore::GetResolutionScaleFactor(renderer); |
| 636 | } | 636 | } |
diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h index 54c4e2142..8d7ab8c2e 100644 --- a/src/yuzu/bootmanager.h +++ b/src/yuzu/bootmanager.h | |||
| @@ -34,13 +34,14 @@ enum class MouseButton; | |||
| 34 | 34 | ||
| 35 | namespace VideoCore { | 35 | namespace VideoCore { |
| 36 | enum class LoadCallbackStage; | 36 | enum class LoadCallbackStage; |
| 37 | } | 37 | class RendererBase; |
| 38 | } // namespace VideoCore | ||
| 38 | 39 | ||
| 39 | class EmuThread final : public QThread { | 40 | class EmuThread final : public QThread { |
| 40 | Q_OBJECT | 41 | Q_OBJECT |
| 41 | 42 | ||
| 42 | public: | 43 | public: |
| 43 | explicit EmuThread(); | 44 | explicit EmuThread(Core::System& system_); |
| 44 | ~EmuThread() override; | 45 | ~EmuThread() override; |
| 45 | 46 | ||
| 46 | /** | 47 | /** |
| @@ -101,6 +102,7 @@ private: | |||
| 101 | std::condition_variable_any running_cv; | 102 | std::condition_variable_any running_cv; |
| 102 | Common::Event running_wait{}; | 103 | Common::Event running_wait{}; |
| 103 | std::atomic_bool running_guard{false}; | 104 | std::atomic_bool running_guard{false}; |
| 105 | Core::System& system; | ||
| 104 | 106 | ||
| 105 | signals: | 107 | signals: |
| 106 | /** | 108 | /** |
| @@ -131,7 +133,8 @@ class GRenderWindow : public QWidget, public Core::Frontend::EmuWindow { | |||
| 131 | 133 | ||
| 132 | public: | 134 | public: |
| 133 | explicit GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_, | 135 | explicit GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_, |
| 134 | std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_); | 136 | std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_, |
| 137 | Core::System& system_); | ||
| 135 | ~GRenderWindow() override; | 138 | ~GRenderWindow() override; |
| 136 | 139 | ||
| 137 | // EmuWindow implementation. | 140 | // EmuWindow implementation. |
| @@ -232,6 +235,8 @@ private: | |||
| 232 | 235 | ||
| 233 | std::array<std::size_t, 16> touch_ids{}; | 236 | std::array<std::size_t, 16> touch_ids{}; |
| 234 | 237 | ||
| 238 | Core::System& system; | ||
| 239 | |||
| 235 | protected: | 240 | protected: |
| 236 | void showEvent(QShowEvent* event) override; | 241 | void showEvent(QShowEvent* event) override; |
| 237 | bool eventFilter(QObject* object, QEvent* event) override; | 242 | bool eventFilter(QObject* object, QEvent* event) override; |
diff --git a/src/yuzu/compatdb.cpp b/src/yuzu/compatdb.cpp index a470056ef..2442bb3c3 100644 --- a/src/yuzu/compatdb.cpp +++ b/src/yuzu/compatdb.cpp | |||
| @@ -8,14 +8,13 @@ | |||
| 8 | #include <QtConcurrent/qtconcurrentrun.h> | 8 | #include <QtConcurrent/qtconcurrentrun.h> |
| 9 | #include "common/logging/log.h" | 9 | #include "common/logging/log.h" |
| 10 | #include "common/telemetry.h" | 10 | #include "common/telemetry.h" |
| 11 | #include "core/core.h" | ||
| 12 | #include "core/telemetry_session.h" | 11 | #include "core/telemetry_session.h" |
| 13 | #include "ui_compatdb.h" | 12 | #include "ui_compatdb.h" |
| 14 | #include "yuzu/compatdb.h" | 13 | #include "yuzu/compatdb.h" |
| 15 | 14 | ||
| 16 | CompatDB::CompatDB(QWidget* parent) | 15 | CompatDB::CompatDB(Core::TelemetrySession& telemetry_session_, QWidget* parent) |
| 17 | : QWizard(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint), | 16 | : QWizard(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint), |
| 18 | ui{std::make_unique<Ui::CompatDB>()} { | 17 | ui{std::make_unique<Ui::CompatDB>()}, telemetry_session{telemetry_session_} { |
| 19 | ui->setupUi(this); | 18 | ui->setupUi(this); |
| 20 | connect(ui->radioButton_Perfect, &QRadioButton::clicked, this, &CompatDB::EnableNext); | 19 | connect(ui->radioButton_Perfect, &QRadioButton::clicked, this, &CompatDB::EnableNext); |
| 21 | connect(ui->radioButton_Great, &QRadioButton::clicked, this, &CompatDB::EnableNext); | 20 | connect(ui->radioButton_Great, &QRadioButton::clicked, this, &CompatDB::EnableNext); |
| @@ -53,16 +52,15 @@ void CompatDB::Submit() { | |||
| 53 | case CompatDBPage::Final: | 52 | case CompatDBPage::Final: |
| 54 | back(); | 53 | back(); |
| 55 | LOG_DEBUG(Frontend, "Compatibility Rating: {}", compatibility->checkedId()); | 54 | LOG_DEBUG(Frontend, "Compatibility Rating: {}", compatibility->checkedId()); |
| 56 | Core::System::GetInstance().TelemetrySession().AddField( | 55 | telemetry_session.AddField(Common::Telemetry::FieldType::UserFeedback, "Compatibility", |
| 57 | Common::Telemetry::FieldType::UserFeedback, "Compatibility", | 56 | compatibility->checkedId()); |
| 58 | compatibility->checkedId()); | ||
| 59 | 57 | ||
| 60 | button(NextButton)->setEnabled(false); | 58 | button(NextButton)->setEnabled(false); |
| 61 | button(NextButton)->setText(tr("Submitting")); | 59 | button(NextButton)->setText(tr("Submitting")); |
| 62 | button(CancelButton)->setVisible(false); | 60 | button(CancelButton)->setVisible(false); |
| 63 | 61 | ||
| 64 | testcase_watcher.setFuture(QtConcurrent::run( | 62 | testcase_watcher.setFuture( |
| 65 | [] { return Core::System::GetInstance().TelemetrySession().SubmitTestcase(); })); | 63 | QtConcurrent::run([this] { return telemetry_session.SubmitTestcase(); })); |
| 66 | break; | 64 | break; |
| 67 | default: | 65 | default: |
| 68 | LOG_ERROR(Frontend, "Unexpected page: {}", currentId()); | 66 | LOG_ERROR(Frontend, "Unexpected page: {}", currentId()); |
diff --git a/src/yuzu/compatdb.h b/src/yuzu/compatdb.h index 5381f67f7..e2b2522bd 100644 --- a/src/yuzu/compatdb.h +++ b/src/yuzu/compatdb.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <QFutureWatcher> | 8 | #include <QFutureWatcher> |
| 9 | #include <QWizard> | 9 | #include <QWizard> |
| 10 | #include "core/telemetry_session.h" | ||
| 10 | 11 | ||
| 11 | namespace Ui { | 12 | namespace Ui { |
| 12 | class CompatDB; | 13 | class CompatDB; |
| @@ -16,7 +17,7 @@ class CompatDB : public QWizard { | |||
| 16 | Q_OBJECT | 17 | Q_OBJECT |
| 17 | 18 | ||
| 18 | public: | 19 | public: |
| 19 | explicit CompatDB(QWidget* parent = nullptr); | 20 | explicit CompatDB(Core::TelemetrySession& telemetry_session_, QWidget* parent = nullptr); |
| 20 | ~CompatDB(); | 21 | ~CompatDB(); |
| 21 | 22 | ||
| 22 | private: | 23 | private: |
| @@ -27,4 +28,6 @@ private: | |||
| 27 | void Submit(); | 28 | void Submit(); |
| 28 | void OnTestcaseSubmitted(); | 29 | void OnTestcaseSubmitted(); |
| 29 | void EnableNext(); | 30 | void EnableNext(); |
| 31 | |||
| 32 | Core::TelemetrySession& telemetry_session; | ||
| 30 | }; | 33 | }; |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index eb941ce02..30a864135 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -16,7 +16,8 @@ | |||
| 16 | 16 | ||
| 17 | namespace FS = Common::FS; | 17 | namespace FS = Common::FS; |
| 18 | 18 | ||
| 19 | Config::Config(const std::string& config_name, ConfigType config_type) : type(config_type) { | 19 | Config::Config(Core::System& system_, const std::string& config_name, ConfigType config_type) |
| 20 | : type(config_type), system{system_} { | ||
| 20 | global = config_type == ConfigType::GlobalConfig; | 21 | global = config_type == ConfigType::GlobalConfig; |
| 21 | 22 | ||
| 22 | Initialize(config_name); | 23 | Initialize(config_name); |
| @@ -1593,7 +1594,7 @@ void Config::Reload() { | |||
| 1593 | ReadValues(); | 1594 | ReadValues(); |
| 1594 | // To apply default value changes | 1595 | // To apply default value changes |
| 1595 | SaveValues(); | 1596 | SaveValues(); |
| 1596 | Core::System::GetInstance().ApplySettings(); | 1597 | system.ApplySettings(); |
| 1597 | } | 1598 | } |
| 1598 | 1599 | ||
| 1599 | void Config::Save() { | 1600 | void Config::Save() { |
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index 3ee694e7c..a7f4a6720 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h | |||
| @@ -14,6 +14,10 @@ | |||
| 14 | 14 | ||
| 15 | class QSettings; | 15 | class QSettings; |
| 16 | 16 | ||
| 17 | namespace Core { | ||
| 18 | class System; | ||
| 19 | } | ||
| 20 | |||
| 17 | class Config { | 21 | class Config { |
| 18 | public: | 22 | public: |
| 19 | enum class ConfigType { | 23 | enum class ConfigType { |
| @@ -22,7 +26,7 @@ public: | |||
| 22 | InputProfile, | 26 | InputProfile, |
| 23 | }; | 27 | }; |
| 24 | 28 | ||
| 25 | explicit Config(const std::string& config_name = "qt-config", | 29 | explicit Config(Core::System& system_, const std::string& config_name = "qt-config", |
| 26 | ConfigType config_type = ConfigType::GlobalConfig); | 30 | ConfigType config_type = ConfigType::GlobalConfig); |
| 27 | ~Config(); | 31 | ~Config(); |
| 28 | 32 | ||
| @@ -176,6 +180,8 @@ private: | |||
| 176 | std::unique_ptr<QSettings> qt_config; | 180 | std::unique_ptr<QSettings> qt_config; |
| 177 | std::string qt_config_loc; | 181 | std::string qt_config_loc; |
| 178 | bool global; | 182 | bool global; |
| 183 | |||
| 184 | Core::System& system; | ||
| 179 | }; | 185 | }; |
| 180 | 186 | ||
| 181 | // These metatype declarations cannot be in common/settings.h because core is devoid of QT | 187 | // These metatype declarations cannot be in common/settings.h because core is devoid of QT |
diff --git a/src/yuzu/configuration/configure.ui b/src/yuzu/configuration/configure.ui index 6258dcf20..eb8078467 100644 --- a/src/yuzu/configuration/configure.ui +++ b/src/yuzu/configuration/configure.ui | |||
| @@ -41,120 +41,8 @@ | |||
| 41 | <item> | 41 | <item> |
| 42 | <widget class="QTabWidget" name="tabWidget"> | 42 | <widget class="QTabWidget" name="tabWidget"> |
| 43 | <property name="currentIndex"> | 43 | <property name="currentIndex"> |
| 44 | <number>11</number> | 44 | <number>-1</number> |
| 45 | </property> | 45 | </property> |
| 46 | <widget class="ConfigureGeneral" name="generalTab"> | ||
| 47 | <property name="accessibleName"> | ||
| 48 | <string>General</string> | ||
| 49 | </property> | ||
| 50 | <attribute name="title"> | ||
| 51 | <string>General</string> | ||
| 52 | </attribute> | ||
| 53 | </widget> | ||
| 54 | <widget class="ConfigureUi" name="uiTab"> | ||
| 55 | <property name="accessibleName"> | ||
| 56 | <string>UI</string> | ||
| 57 | </property> | ||
| 58 | <attribute name="title"> | ||
| 59 | <string>Game List</string> | ||
| 60 | </attribute> | ||
| 61 | </widget> | ||
| 62 | <widget class="ConfigureSystem" name="systemTab"> | ||
| 63 | <property name="accessibleName"> | ||
| 64 | <string>System</string> | ||
| 65 | </property> | ||
| 66 | <attribute name="title"> | ||
| 67 | <string>System</string> | ||
| 68 | </attribute> | ||
| 69 | </widget> | ||
| 70 | <widget class="ConfigureProfileManager" name="profileManagerTab"> | ||
| 71 | <property name="accessibleName"> | ||
| 72 | <string>Profiles</string> | ||
| 73 | </property> | ||
| 74 | <attribute name="title"> | ||
| 75 | <string>Profiles</string> | ||
| 76 | </attribute> | ||
| 77 | </widget> | ||
| 78 | <widget class="ConfigureFilesystem" name="filesystemTab"> | ||
| 79 | <property name="accessibleName"> | ||
| 80 | <string>Filesystem</string> | ||
| 81 | </property> | ||
| 82 | <attribute name="title"> | ||
| 83 | <string>Filesystem</string> | ||
| 84 | </attribute> | ||
| 85 | </widget> | ||
| 86 | <widget class="ConfigureInput" name="inputTab"> | ||
| 87 | <property name="accessibleName"> | ||
| 88 | <string>Controls</string> | ||
| 89 | </property> | ||
| 90 | <attribute name="title"> | ||
| 91 | <string>Controls</string> | ||
| 92 | </attribute> | ||
| 93 | </widget> | ||
| 94 | <widget class="ConfigureHotkeys" name="hotkeysTab"> | ||
| 95 | <property name="accessibleName"> | ||
| 96 | <string>Hotkeys</string> | ||
| 97 | </property> | ||
| 98 | <attribute name="title"> | ||
| 99 | <string>Hotkeys</string> | ||
| 100 | </attribute> | ||
| 101 | </widget> | ||
| 102 | <widget class="ConfigureCpu" name="cpuTab"> | ||
| 103 | <property name="accessibleName"> | ||
| 104 | <string>CPU</string> | ||
| 105 | </property> | ||
| 106 | <attribute name="title"> | ||
| 107 | <string>CPU</string> | ||
| 108 | </attribute> | ||
| 109 | </widget> | ||
| 110 | <widget class="ConfigureGraphics" name="graphicsTab"> | ||
| 111 | <property name="accessibleName"> | ||
| 112 | <string>Graphics</string> | ||
| 113 | </property> | ||
| 114 | <attribute name="title"> | ||
| 115 | <string>Graphics</string> | ||
| 116 | </attribute> | ||
| 117 | </widget> | ||
| 118 | <widget class="ConfigureGraphicsAdvanced" name="graphicsAdvancedTab"> | ||
| 119 | <property name="accessibleName"> | ||
| 120 | <string>Advanced</string> | ||
| 121 | </property> | ||
| 122 | <attribute name="title"> | ||
| 123 | <string>GraphicsAdvanced</string> | ||
| 124 | </attribute> | ||
| 125 | </widget> | ||
| 126 | <widget class="ConfigureAudio" name="audioTab"> | ||
| 127 | <property name="accessibleName"> | ||
| 128 | <string>Audio</string> | ||
| 129 | </property> | ||
| 130 | <attribute name="title"> | ||
| 131 | <string>Audio</string> | ||
| 132 | </attribute> | ||
| 133 | </widget> | ||
| 134 | <widget class="ConfigureDebugTab" name="debugTab"> | ||
| 135 | <property name="accessibleName"> | ||
| 136 | <string>Debug</string> | ||
| 137 | </property> | ||
| 138 | <attribute name="title"> | ||
| 139 | <string>Debug</string> | ||
| 140 | </attribute> | ||
| 141 | </widget> | ||
| 142 | <widget class="ConfigureWeb" name="webTab"> | ||
| 143 | <property name="accessibleName"> | ||
| 144 | <string>Web</string> | ||
| 145 | </property> | ||
| 146 | <attribute name="title"> | ||
| 147 | <string>Web</string> | ||
| 148 | </attribute> | ||
| 149 | </widget> | ||
| 150 | <widget class="ConfigureNetwork" name="networkTab"> | ||
| 151 | <property name="accessibleName"> | ||
| 152 | <string>Network</string> | ||
| 153 | </property> | ||
| 154 | <attribute name="title"> | ||
| 155 | <string>Network</string> | ||
| 156 | </attribute> | ||
| 157 | </widget> | ||
| 158 | </widget> | 46 | </widget> |
| 159 | </item> | 47 | </item> |
| 160 | </layout> | 48 | </layout> |
| @@ -168,92 +56,6 @@ | |||
| 168 | </item> | 56 | </item> |
| 169 | </layout> | 57 | </layout> |
| 170 | </widget> | 58 | </widget> |
| 171 | <customwidgets> | ||
| 172 | <customwidget> | ||
| 173 | <class>ConfigureGeneral</class> | ||
| 174 | <extends>QWidget</extends> | ||
| 175 | <header>configuration/configure_general.h</header> | ||
| 176 | <container>1</container> | ||
| 177 | </customwidget> | ||
| 178 | <customwidget> | ||
| 179 | <class>ConfigureSystem</class> | ||
| 180 | <extends>QWidget</extends> | ||
| 181 | <header>configuration/configure_system.h</header> | ||
| 182 | <container>1</container> | ||
| 183 | </customwidget> | ||
| 184 | <customwidget> | ||
| 185 | <class>ConfigureProfileManager</class> | ||
| 186 | <extends>QWidget</extends> | ||
| 187 | <header>configuration/configure_profile_manager.h</header> | ||
| 188 | <container>1</container> | ||
| 189 | </customwidget> | ||
| 190 | <customwidget> | ||
| 191 | <class>ConfigureFilesystem</class> | ||
| 192 | <extends>QWidget</extends> | ||
| 193 | <header>configuration/configure_filesystem.h</header> | ||
| 194 | <container>1</container> | ||
| 195 | </customwidget> | ||
| 196 | <customwidget> | ||
| 197 | <class>ConfigureAudio</class> | ||
| 198 | <extends>QWidget</extends> | ||
| 199 | <header>configuration/configure_audio.h</header> | ||
| 200 | <container>1</container> | ||
| 201 | </customwidget> | ||
| 202 | <customwidget> | ||
| 203 | <class>ConfigureCpu</class> | ||
| 204 | <extends>QWidget</extends> | ||
| 205 | <header>configuration/configure_cpu.h</header> | ||
| 206 | <container>1</container> | ||
| 207 | </customwidget> | ||
| 208 | <customwidget> | ||
| 209 | <class>ConfigureGraphics</class> | ||
| 210 | <extends>QWidget</extends> | ||
| 211 | <header>configuration/configure_graphics.h</header> | ||
| 212 | <container>1</container> | ||
| 213 | </customwidget> | ||
| 214 | <customwidget> | ||
| 215 | <class>ConfigureGraphicsAdvanced</class> | ||
| 216 | <extends>QWidget</extends> | ||
| 217 | <header>configuration/configure_graphics_advanced.h</header> | ||
| 218 | <container>1</container> | ||
| 219 | </customwidget> | ||
| 220 | <customwidget> | ||
| 221 | <class>ConfigureWeb</class> | ||
| 222 | <extends>QWidget</extends> | ||
| 223 | <header>configuration/configure_web.h</header> | ||
| 224 | <container>1</container> | ||
| 225 | </customwidget> | ||
| 226 | <customwidget> | ||
| 227 | <class>ConfigureUi</class> | ||
| 228 | <extends>QWidget</extends> | ||
| 229 | <header>configuration/configure_ui.h</header> | ||
| 230 | <container>1</container> | ||
| 231 | </customwidget> | ||
| 232 | <customwidget> | ||
| 233 | <class>ConfigureInput</class> | ||
| 234 | <extends>QWidget</extends> | ||
| 235 | <header>configuration/configure_input.h</header> | ||
| 236 | <container>1</container> | ||
| 237 | </customwidget> | ||
| 238 | <customwidget> | ||
| 239 | <class>ConfigureHotkeys</class> | ||
| 240 | <extends>QWidget</extends> | ||
| 241 | <header>configuration/configure_hotkeys.h</header> | ||
| 242 | <container>1</container> | ||
| 243 | </customwidget> | ||
| 244 | <customwidget> | ||
| 245 | <class>ConfigureNetwork</class> | ||
| 246 | <extends>QWidget</extends> | ||
| 247 | <header>configuration/configure_network.h</header> | ||
| 248 | <container>1</container> | ||
| 249 | </customwidget> | ||
| 250 | <customwidget> | ||
| 251 | <class>ConfigureDebugTab</class> | ||
| 252 | <extends>QWidget</extends> | ||
| 253 | <header>configuration/configure_debug_tab.h</header> | ||
| 254 | <container>1</container> | ||
| 255 | </customwidget> | ||
| 256 | </customwidgets> | ||
| 257 | <resources/> | 59 | <resources/> |
| 258 | <connections> | 60 | <connections> |
| 259 | <connection> | 61 | <connection> |
diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp index f437cb53d..c33488718 100644 --- a/src/yuzu/configuration/configure_audio.cpp +++ b/src/yuzu/configuration/configure_audio.cpp | |||
| @@ -14,8 +14,8 @@ | |||
| 14 | #include "yuzu/configuration/configuration_shared.h" | 14 | #include "yuzu/configuration/configuration_shared.h" |
| 15 | #include "yuzu/configuration/configure_audio.h" | 15 | #include "yuzu/configuration/configure_audio.h" |
| 16 | 16 | ||
| 17 | ConfigureAudio::ConfigureAudio(QWidget* parent) | 17 | ConfigureAudio::ConfigureAudio(const Core::System& system_, QWidget* parent) |
| 18 | : QWidget(parent), ui(std::make_unique<Ui::ConfigureAudio>()) { | 18 | : QWidget(parent), ui(std::make_unique<Ui::ConfigureAudio>()), system{system_} { |
| 19 | ui->setupUi(this); | 19 | ui->setupUi(this); |
| 20 | 20 | ||
| 21 | InitializeAudioOutputSinkComboBox(); | 21 | InitializeAudioOutputSinkComboBox(); |
| @@ -32,7 +32,7 @@ ConfigureAudio::ConfigureAudio(QWidget* parent) | |||
| 32 | 32 | ||
| 33 | SetConfiguration(); | 33 | SetConfiguration(); |
| 34 | 34 | ||
| 35 | const bool is_powered_on = Core::System::GetInstance().IsPoweredOn(); | 35 | const bool is_powered_on = system_.IsPoweredOn(); |
| 36 | ui->output_sink_combo_box->setEnabled(!is_powered_on); | 36 | ui->output_sink_combo_box->setEnabled(!is_powered_on); |
| 37 | ui->audio_device_combo_box->setEnabled(!is_powered_on); | 37 | ui->audio_device_combo_box->setEnabled(!is_powered_on); |
| 38 | } | 38 | } |
diff --git a/src/yuzu/configuration/configure_audio.h b/src/yuzu/configuration/configure_audio.h index 5a01c8de7..5d2d05e47 100644 --- a/src/yuzu/configuration/configure_audio.h +++ b/src/yuzu/configuration/configure_audio.h | |||
| @@ -7,6 +7,10 @@ | |||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <QWidget> | 8 | #include <QWidget> |
| 9 | 9 | ||
| 10 | namespace Core { | ||
| 11 | class System; | ||
| 12 | } | ||
| 13 | |||
| 10 | namespace ConfigurationShared { | 14 | namespace ConfigurationShared { |
| 11 | enum class CheckState; | 15 | enum class CheckState; |
| 12 | } | 16 | } |
| @@ -19,10 +23,11 @@ class ConfigureAudio : public QWidget { | |||
| 19 | Q_OBJECT | 23 | Q_OBJECT |
| 20 | 24 | ||
| 21 | public: | 25 | public: |
| 22 | explicit ConfigureAudio(QWidget* parent = nullptr); | 26 | explicit ConfigureAudio(const Core::System& system_, QWidget* parent = nullptr); |
| 23 | ~ConfigureAudio() override; | 27 | ~ConfigureAudio() override; |
| 24 | 28 | ||
| 25 | void ApplyConfiguration(); | 29 | void ApplyConfiguration(); |
| 30 | void SetConfiguration(); | ||
| 26 | 31 | ||
| 27 | private: | 32 | private: |
| 28 | void changeEvent(QEvent* event) override; | 33 | void changeEvent(QEvent* event) override; |
| @@ -33,7 +38,6 @@ private: | |||
| 33 | 38 | ||
| 34 | void UpdateAudioDevices(int sink_index); | 39 | void UpdateAudioDevices(int sink_index); |
| 35 | 40 | ||
| 36 | void SetConfiguration(); | ||
| 37 | void SetOutputSinkFromSinkID(); | 41 | void SetOutputSinkFromSinkID(); |
| 38 | void SetAudioDeviceFromDeviceID(); | 42 | void SetAudioDeviceFromDeviceID(); |
| 39 | void SetVolumeIndicatorText(int percentage); | 43 | void SetVolumeIndicatorText(int percentage); |
| @@ -41,4 +45,6 @@ private: | |||
| 41 | void SetupPerGameUI(); | 45 | void SetupPerGameUI(); |
| 42 | 46 | ||
| 43 | std::unique_ptr<Ui::ConfigureAudio> ui; | 47 | std::unique_ptr<Ui::ConfigureAudio> ui; |
| 48 | |||
| 49 | const Core::System& system; | ||
| 44 | }; | 50 | }; |
diff --git a/src/yuzu/configuration/configure_audio.ui b/src/yuzu/configuration/configure_audio.ui index bf736fc2c..d1ac8ad02 100644 --- a/src/yuzu/configuration/configure_audio.ui +++ b/src/yuzu/configuration/configure_audio.ui | |||
| @@ -10,6 +10,9 @@ | |||
| 10 | <height>368</height> | 10 | <height>368</height> |
| 11 | </rect> | 11 | </rect> |
| 12 | </property> | 12 | </property> |
| 13 | <property name="accessibleName"> | ||
| 14 | <string>Audio</string> | ||
| 15 | </property> | ||
| 13 | <layout class="QVBoxLayout"> | 16 | <layout class="QVBoxLayout"> |
| 14 | <item> | 17 | <item> |
| 15 | <widget class="QGroupBox" name="groupBox"> | 18 | <widget class="QGroupBox" name="groupBox"> |
diff --git a/src/yuzu/configuration/configure_cpu.cpp b/src/yuzu/configuration/configure_cpu.cpp index 784b6484e..27fabef38 100644 --- a/src/yuzu/configuration/configure_cpu.cpp +++ b/src/yuzu/configuration/configure_cpu.cpp | |||
| @@ -13,7 +13,8 @@ | |||
| 13 | #include "yuzu/configuration/configuration_shared.h" | 13 | #include "yuzu/configuration/configuration_shared.h" |
| 14 | #include "yuzu/configuration/configure_cpu.h" | 14 | #include "yuzu/configuration/configure_cpu.h" |
| 15 | 15 | ||
| 16 | ConfigureCpu::ConfigureCpu(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureCpu) { | 16 | ConfigureCpu::ConfigureCpu(const Core::System& system_, QWidget* parent) |
| 17 | : QWidget(parent), ui(new Ui::ConfigureCpu), system{system_} { | ||
| 17 | ui->setupUi(this); | 18 | ui->setupUi(this); |
| 18 | 19 | ||
| 19 | SetupPerGameUI(); | 20 | SetupPerGameUI(); |
| @@ -27,7 +28,7 @@ ConfigureCpu::ConfigureCpu(QWidget* parent) : QWidget(parent), ui(new Ui::Config | |||
| 27 | ConfigureCpu::~ConfigureCpu() = default; | 28 | ConfigureCpu::~ConfigureCpu() = default; |
| 28 | 29 | ||
| 29 | void ConfigureCpu::SetConfiguration() { | 30 | void ConfigureCpu::SetConfiguration() { |
| 30 | const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); | 31 | const bool runtime_lock = !system.IsPoweredOn(); |
| 31 | 32 | ||
| 32 | ui->accuracy->setEnabled(runtime_lock); | 33 | ui->accuracy->setEnabled(runtime_lock); |
| 33 | ui->cpuopt_unsafe_unfuse_fma->setEnabled(runtime_lock); | 34 | ui->cpuopt_unsafe_unfuse_fma->setEnabled(runtime_lock); |
diff --git a/src/yuzu/configuration/configure_cpu.h b/src/yuzu/configuration/configure_cpu.h index 154931482..ed9af0e9f 100644 --- a/src/yuzu/configuration/configure_cpu.h +++ b/src/yuzu/configuration/configure_cpu.h | |||
| @@ -8,6 +8,10 @@ | |||
| 8 | #include <QWidget> | 8 | #include <QWidget> |
| 9 | #include "common/settings.h" | 9 | #include "common/settings.h" |
| 10 | 10 | ||
| 11 | namespace Core { | ||
| 12 | class System; | ||
| 13 | } | ||
| 14 | |||
| 11 | namespace ConfigurationShared { | 15 | namespace ConfigurationShared { |
| 12 | enum class CheckState; | 16 | enum class CheckState; |
| 13 | } | 17 | } |
| @@ -20,10 +24,11 @@ class ConfigureCpu : public QWidget { | |||
| 20 | Q_OBJECT | 24 | Q_OBJECT |
| 21 | 25 | ||
| 22 | public: | 26 | public: |
| 23 | explicit ConfigureCpu(QWidget* parent = nullptr); | 27 | explicit ConfigureCpu(const Core::System& system_, QWidget* parent = nullptr); |
| 24 | ~ConfigureCpu() override; | 28 | ~ConfigureCpu() override; |
| 25 | 29 | ||
| 26 | void ApplyConfiguration(); | 30 | void ApplyConfiguration(); |
| 31 | void SetConfiguration(); | ||
| 27 | 32 | ||
| 28 | private: | 33 | private: |
| 29 | void changeEvent(QEvent* event) override; | 34 | void changeEvent(QEvent* event) override; |
| @@ -31,8 +36,6 @@ private: | |||
| 31 | 36 | ||
| 32 | void UpdateGroup(int index); | 37 | void UpdateGroup(int index); |
| 33 | 38 | ||
| 34 | void SetConfiguration(); | ||
| 35 | |||
| 36 | void SetupPerGameUI(); | 39 | void SetupPerGameUI(); |
| 37 | 40 | ||
| 38 | std::unique_ptr<Ui::ConfigureCpu> ui; | 41 | std::unique_ptr<Ui::ConfigureCpu> ui; |
| @@ -42,4 +45,6 @@ private: | |||
| 42 | ConfigurationShared::CheckState cpuopt_unsafe_ignore_standard_fpcr; | 45 | ConfigurationShared::CheckState cpuopt_unsafe_ignore_standard_fpcr; |
| 43 | ConfigurationShared::CheckState cpuopt_unsafe_inaccurate_nan; | 46 | ConfigurationShared::CheckState cpuopt_unsafe_inaccurate_nan; |
| 44 | ConfigurationShared::CheckState cpuopt_unsafe_fastmem_check; | 47 | ConfigurationShared::CheckState cpuopt_unsafe_fastmem_check; |
| 48 | |||
| 49 | const Core::System& system; | ||
| 45 | }; | 50 | }; |
diff --git a/src/yuzu/configuration/configure_cpu.ui b/src/yuzu/configuration/configure_cpu.ui index 5b9457faf..d8064db24 100644 --- a/src/yuzu/configuration/configure_cpu.ui +++ b/src/yuzu/configuration/configure_cpu.ui | |||
| @@ -7,12 +7,15 @@ | |||
| 7 | <x>0</x> | 7 | <x>0</x> |
| 8 | <y>0</y> | 8 | <y>0</y> |
| 9 | <width>448</width> | 9 | <width>448</width> |
| 10 | <height>433</height> | 10 | <height>439</height> |
| 11 | </rect> | 11 | </rect> |
| 12 | </property> | 12 | </property> |
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| 14 | <string>Form</string> | 14 | <string>Form</string> |
| 15 | </property> | 15 | </property> |
| 16 | <property name="accessibleName"> | ||
| 17 | <string>CPU</string> | ||
| 18 | </property> | ||
| 16 | <layout class="QVBoxLayout"> | 19 | <layout class="QVBoxLayout"> |
| 17 | <item> | 20 | <item> |
| 18 | <layout class="QVBoxLayout"> | 21 | <layout class="QVBoxLayout"> |
diff --git a/src/yuzu/configuration/configure_cpu_debug.cpp b/src/yuzu/configuration/configure_cpu_debug.cpp index 98e2d2be5..6e910e33e 100644 --- a/src/yuzu/configuration/configure_cpu_debug.cpp +++ b/src/yuzu/configuration/configure_cpu_debug.cpp | |||
| @@ -11,8 +11,8 @@ | |||
| 11 | #include "ui_configure_cpu_debug.h" | 11 | #include "ui_configure_cpu_debug.h" |
| 12 | #include "yuzu/configuration/configure_cpu_debug.h" | 12 | #include "yuzu/configuration/configure_cpu_debug.h" |
| 13 | 13 | ||
| 14 | ConfigureCpuDebug::ConfigureCpuDebug(QWidget* parent) | 14 | ConfigureCpuDebug::ConfigureCpuDebug(const Core::System& system_, QWidget* parent) |
| 15 | : QWidget(parent), ui(new Ui::ConfigureCpuDebug) { | 15 | : QWidget(parent), ui(new Ui::ConfigureCpuDebug), system{system_} { |
| 16 | ui->setupUi(this); | 16 | ui->setupUi(this); |
| 17 | 17 | ||
| 18 | SetConfiguration(); | 18 | SetConfiguration(); |
| @@ -21,7 +21,7 @@ ConfigureCpuDebug::ConfigureCpuDebug(QWidget* parent) | |||
| 21 | ConfigureCpuDebug::~ConfigureCpuDebug() = default; | 21 | ConfigureCpuDebug::~ConfigureCpuDebug() = default; |
| 22 | 22 | ||
| 23 | void ConfigureCpuDebug::SetConfiguration() { | 23 | void ConfigureCpuDebug::SetConfiguration() { |
| 24 | const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); | 24 | const bool runtime_lock = !system.IsPoweredOn(); |
| 25 | 25 | ||
| 26 | ui->cpuopt_page_tables->setEnabled(runtime_lock); | 26 | ui->cpuopt_page_tables->setEnabled(runtime_lock); |
| 27 | ui->cpuopt_page_tables->setChecked(Settings::values.cpuopt_page_tables.GetValue()); | 27 | ui->cpuopt_page_tables->setChecked(Settings::values.cpuopt_page_tables.GetValue()); |
diff --git a/src/yuzu/configuration/configure_cpu_debug.h b/src/yuzu/configuration/configure_cpu_debug.h index 1b0d8050c..d06c4c63f 100644 --- a/src/yuzu/configuration/configure_cpu_debug.h +++ b/src/yuzu/configuration/configure_cpu_debug.h | |||
| @@ -7,6 +7,10 @@ | |||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <QWidget> | 8 | #include <QWidget> |
| 9 | 9 | ||
| 10 | namespace Core { | ||
| 11 | class System; | ||
| 12 | } | ||
| 13 | |||
| 10 | namespace Ui { | 14 | namespace Ui { |
| 11 | class ConfigureCpuDebug; | 15 | class ConfigureCpuDebug; |
| 12 | } | 16 | } |
| @@ -15,7 +19,7 @@ class ConfigureCpuDebug : public QWidget { | |||
| 15 | Q_OBJECT | 19 | Q_OBJECT |
| 16 | 20 | ||
| 17 | public: | 21 | public: |
| 18 | explicit ConfigureCpuDebug(QWidget* parent = nullptr); | 22 | explicit ConfigureCpuDebug(const Core::System& system_, QWidget* parent = nullptr); |
| 19 | ~ConfigureCpuDebug() override; | 23 | ~ConfigureCpuDebug() override; |
| 20 | 24 | ||
| 21 | void ApplyConfiguration(); | 25 | void ApplyConfiguration(); |
| @@ -27,4 +31,6 @@ private: | |||
| 27 | void SetConfiguration(); | 31 | void SetConfiguration(); |
| 28 | 32 | ||
| 29 | std::unique_ptr<Ui::ConfigureCpuDebug> ui; | 33 | std::unique_ptr<Ui::ConfigureCpuDebug> ui; |
| 34 | |||
| 35 | const Core::System& system; | ||
| 30 | }; | 36 | }; |
diff --git a/src/yuzu/configuration/configure_cpu_debug.ui b/src/yuzu/configuration/configure_cpu_debug.ui index abf469b55..6e635bb2f 100644 --- a/src/yuzu/configuration/configure_cpu_debug.ui +++ b/src/yuzu/configuration/configure_cpu_debug.ui | |||
| @@ -13,6 +13,9 @@ | |||
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| 14 | <string>Form</string> | 14 | <string>Form</string> |
| 15 | </property> | 15 | </property> |
| 16 | <property name="accessibleName"> | ||
| 17 | <string>CPU</string> | ||
| 18 | </property> | ||
| 16 | <layout class="QVBoxLayout"> | 19 | <layout class="QVBoxLayout"> |
| 17 | <item> | 20 | <item> |
| 18 | <layout class="QVBoxLayout"> | 21 | <layout class="QVBoxLayout"> |
diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp index c0b240c1e..40447093e 100644 --- a/src/yuzu/configuration/configure_debug.cpp +++ b/src/yuzu/configuration/configure_debug.cpp | |||
| @@ -14,7 +14,8 @@ | |||
| 14 | #include "yuzu/debugger/console.h" | 14 | #include "yuzu/debugger/console.h" |
| 15 | #include "yuzu/uisettings.h" | 15 | #include "yuzu/uisettings.h" |
| 16 | 16 | ||
| 17 | ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureDebug) { | 17 | ConfigureDebug::ConfigureDebug(const Core::System& system_, QWidget* parent) |
| 18 | : QWidget(parent), ui(new Ui::ConfigureDebug), system{system_} { | ||
| 18 | ui->setupUi(this); | 19 | ui->setupUi(this); |
| 19 | SetConfiguration(); | 20 | SetConfiguration(); |
| 20 | 21 | ||
| @@ -28,7 +29,7 @@ ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::Co | |||
| 28 | ConfigureDebug::~ConfigureDebug() = default; | 29 | ConfigureDebug::~ConfigureDebug() = default; |
| 29 | 30 | ||
| 30 | void ConfigureDebug::SetConfiguration() { | 31 | void ConfigureDebug::SetConfiguration() { |
| 31 | const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); | 32 | const bool runtime_lock = !system.IsPoweredOn(); |
| 32 | 33 | ||
| 33 | ui->toggle_console->setEnabled(runtime_lock); | 34 | ui->toggle_console->setEnabled(runtime_lock); |
| 34 | ui->toggle_console->setChecked(UISettings::values.show_console.GetValue()); | 35 | ui->toggle_console->setChecked(UISettings::values.show_console.GetValue()); |
diff --git a/src/yuzu/configuration/configure_debug.h b/src/yuzu/configuration/configure_debug.h index f4805a1d8..73f71c9e3 100644 --- a/src/yuzu/configuration/configure_debug.h +++ b/src/yuzu/configuration/configure_debug.h | |||
| @@ -7,6 +7,10 @@ | |||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <QWidget> | 8 | #include <QWidget> |
| 9 | 9 | ||
| 10 | namespace Core { | ||
| 11 | class System; | ||
| 12 | } | ||
| 13 | |||
| 10 | namespace Ui { | 14 | namespace Ui { |
| 11 | class ConfigureDebug; | 15 | class ConfigureDebug; |
| 12 | } | 16 | } |
| @@ -15,7 +19,7 @@ class ConfigureDebug : public QWidget { | |||
| 15 | Q_OBJECT | 19 | Q_OBJECT |
| 16 | 20 | ||
| 17 | public: | 21 | public: |
| 18 | explicit ConfigureDebug(QWidget* parent = nullptr); | 22 | explicit ConfigureDebug(const Core::System& system_, QWidget* parent = nullptr); |
| 19 | ~ConfigureDebug() override; | 23 | ~ConfigureDebug() override; |
| 20 | 24 | ||
| 21 | void ApplyConfiguration(); | 25 | void ApplyConfiguration(); |
| @@ -27,4 +31,6 @@ private: | |||
| 27 | void SetConfiguration(); | 31 | void SetConfiguration(); |
| 28 | 32 | ||
| 29 | std::unique_ptr<Ui::ConfigureDebug> ui; | 33 | std::unique_ptr<Ui::ConfigureDebug> ui; |
| 34 | |||
| 35 | const Core::System& system; | ||
| 30 | }; | 36 | }; |
diff --git a/src/yuzu/configuration/configure_debug_controller.cpp b/src/yuzu/configuration/configure_debug_controller.cpp index a878ef9c6..31ec48384 100644 --- a/src/yuzu/configuration/configure_debug_controller.cpp +++ b/src/yuzu/configuration/configure_debug_controller.cpp | |||
| @@ -2,16 +2,17 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "core/core.h" | ||
| 5 | #include "ui_configure_debug_controller.h" | 6 | #include "ui_configure_debug_controller.h" |
| 6 | #include "yuzu/configuration/configure_debug_controller.h" | 7 | #include "yuzu/configuration/configure_debug_controller.h" |
| 7 | #include "yuzu/configuration/configure_input_player.h" | 8 | #include "yuzu/configuration/configure_input_player.h" |
| 8 | 9 | ||
| 9 | ConfigureDebugController::ConfigureDebugController(QWidget* parent, | 10 | ConfigureDebugController::ConfigureDebugController(QWidget* parent, |
| 10 | InputCommon::InputSubsystem* input_subsystem, | 11 | InputCommon::InputSubsystem* input_subsystem, |
| 11 | InputProfiles* profiles) | 12 | InputProfiles* profiles, Core::System& system) |
| 12 | : QDialog(parent), ui(std::make_unique<Ui::ConfigureDebugController>()), | 13 | : QDialog(parent), ui(std::make_unique<Ui::ConfigureDebugController>()), |
| 13 | debug_controller( | 14 | debug_controller( |
| 14 | new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles, true)) { | 15 | new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles, system, true)) { |
| 15 | ui->setupUi(this); | 16 | ui->setupUi(this); |
| 16 | 17 | ||
| 17 | ui->controllerLayout->addWidget(debug_controller); | 18 | ui->controllerLayout->addWidget(debug_controller); |
diff --git a/src/yuzu/configuration/configure_debug_controller.h b/src/yuzu/configuration/configure_debug_controller.h index b4f53fad5..6e17c5aa0 100644 --- a/src/yuzu/configuration/configure_debug_controller.h +++ b/src/yuzu/configuration/configure_debug_controller.h | |||
| @@ -13,6 +13,10 @@ class ConfigureInputPlayer; | |||
| 13 | 13 | ||
| 14 | class InputProfiles; | 14 | class InputProfiles; |
| 15 | 15 | ||
| 16 | namespace Core { | ||
| 17 | class System; | ||
| 18 | } | ||
| 19 | |||
| 16 | namespace InputCommon { | 20 | namespace InputCommon { |
| 17 | class InputSubsystem; | 21 | class InputSubsystem; |
| 18 | } | 22 | } |
| @@ -26,7 +30,7 @@ class ConfigureDebugController : public QDialog { | |||
| 26 | 30 | ||
| 27 | public: | 31 | public: |
| 28 | explicit ConfigureDebugController(QWidget* parent, InputCommon::InputSubsystem* input_subsystem, | 32 | explicit ConfigureDebugController(QWidget* parent, InputCommon::InputSubsystem* input_subsystem, |
| 29 | InputProfiles* profiles); | 33 | InputProfiles* profiles, Core::System& system); |
| 30 | ~ConfigureDebugController() override; | 34 | ~ConfigureDebugController() override; |
| 31 | 35 | ||
| 32 | void ApplyConfiguration(); | 36 | void ApplyConfiguration(); |
diff --git a/src/yuzu/configuration/configure_debug_tab.cpp b/src/yuzu/configuration/configure_debug_tab.cpp index 67d369249..e126eeea9 100644 --- a/src/yuzu/configuration/configure_debug_tab.cpp +++ b/src/yuzu/configuration/configure_debug_tab.cpp | |||
| @@ -2,21 +2,29 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <memory> | ||
| 5 | #include "ui_configure_debug_tab.h" | 6 | #include "ui_configure_debug_tab.h" |
| 7 | #include "yuzu/configuration/configure_cpu_debug.h" | ||
| 8 | #include "yuzu/configuration/configure_debug.h" | ||
| 6 | #include "yuzu/configuration/configure_debug_tab.h" | 9 | #include "yuzu/configuration/configure_debug_tab.h" |
| 7 | 10 | ||
| 8 | ConfigureDebugTab::ConfigureDebugTab(QWidget* parent) | 11 | ConfigureDebugTab::ConfigureDebugTab(const Core::System& system_, QWidget* parent) |
| 9 | : QWidget(parent), ui(new Ui::ConfigureDebugTab) { | 12 | : QWidget(parent), |
| 13 | ui(new Ui::ConfigureDebugTab), debug_tab{std::make_unique<ConfigureDebug>(system_, this)}, | ||
| 14 | cpu_debug_tab{std::make_unique<ConfigureCpuDebug>(system_, this)} { | ||
| 10 | ui->setupUi(this); | 15 | ui->setupUi(this); |
| 11 | 16 | ||
| 17 | ui->tabWidget->addTab(debug_tab.get(), tr("Debug")); | ||
| 18 | ui->tabWidget->addTab(cpu_debug_tab.get(), tr("CPU")); | ||
| 19 | |||
| 12 | SetConfiguration(); | 20 | SetConfiguration(); |
| 13 | } | 21 | } |
| 14 | 22 | ||
| 15 | ConfigureDebugTab::~ConfigureDebugTab() = default; | 23 | ConfigureDebugTab::~ConfigureDebugTab() = default; |
| 16 | 24 | ||
| 17 | void ConfigureDebugTab::ApplyConfiguration() { | 25 | void ConfigureDebugTab::ApplyConfiguration() { |
| 18 | ui->debugTab->ApplyConfiguration(); | 26 | debug_tab->ApplyConfiguration(); |
| 19 | ui->cpuDebugTab->ApplyConfiguration(); | 27 | cpu_debug_tab->ApplyConfiguration(); |
| 20 | } | 28 | } |
| 21 | 29 | ||
| 22 | void ConfigureDebugTab::SetCurrentIndex(int index) { | 30 | void ConfigureDebugTab::SetCurrentIndex(int index) { |
diff --git a/src/yuzu/configuration/configure_debug_tab.h b/src/yuzu/configuration/configure_debug_tab.h index 0a96d43d0..4f68260aa 100644 --- a/src/yuzu/configuration/configure_debug_tab.h +++ b/src/yuzu/configuration/configure_debug_tab.h | |||
| @@ -7,6 +7,13 @@ | |||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <QWidget> | 8 | #include <QWidget> |
| 9 | 9 | ||
| 10 | class ConfigureDebug; | ||
| 11 | class ConfigureCpuDebug; | ||
| 12 | |||
| 13 | namespace Core { | ||
| 14 | class System; | ||
| 15 | } | ||
| 16 | |||
| 10 | namespace Ui { | 17 | namespace Ui { |
| 11 | class ConfigureDebugTab; | 18 | class ConfigureDebugTab; |
| 12 | } | 19 | } |
| @@ -15,7 +22,7 @@ class ConfigureDebugTab : public QWidget { | |||
| 15 | Q_OBJECT | 22 | Q_OBJECT |
| 16 | 23 | ||
| 17 | public: | 24 | public: |
| 18 | explicit ConfigureDebugTab(QWidget* parent = nullptr); | 25 | explicit ConfigureDebugTab(const Core::System& system_, QWidget* parent = nullptr); |
| 19 | ~ConfigureDebugTab() override; | 26 | ~ConfigureDebugTab() override; |
| 20 | 27 | ||
| 21 | void ApplyConfiguration(); | 28 | void ApplyConfiguration(); |
| @@ -29,4 +36,7 @@ private: | |||
| 29 | void SetConfiguration(); | 36 | void SetConfiguration(); |
| 30 | 37 | ||
| 31 | std::unique_ptr<Ui::ConfigureDebugTab> ui; | 38 | std::unique_ptr<Ui::ConfigureDebugTab> ui; |
| 39 | |||
| 40 | std::unique_ptr<ConfigureDebug> debug_tab; | ||
| 41 | std::unique_ptr<ConfigureCpuDebug> cpu_debug_tab; | ||
| 32 | }; | 42 | }; |
diff --git a/src/yuzu/configuration/configure_debug_tab.ui b/src/yuzu/configuration/configure_debug_tab.ui index 7dc6dd704..15ec74727 100644 --- a/src/yuzu/configuration/configure_debug_tab.ui +++ b/src/yuzu/configuration/configure_debug_tab.ui | |||
| @@ -13,40 +13,19 @@ | |||
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| 14 | <string>Form</string> | 14 | <string>Form</string> |
| 15 | </property> | 15 | </property> |
| 16 | <property name="accessibleName"> | ||
| 17 | <string>Debug</string> | ||
| 18 | </property> | ||
| 16 | <layout class="QVBoxLayout" name="verticalLayout"> | 19 | <layout class="QVBoxLayout" name="verticalLayout"> |
| 17 | <item> | 20 | <item> |
| 18 | <widget class="QTabWidget" name="tabWidget"> | 21 | <widget class="QTabWidget" name="tabWidget"> |
| 19 | <property name="currentIndex"> | 22 | <property name="currentIndex"> |
| 20 | <number>1</number> | 23 | <number>-1</number> |
| 21 | </property> | 24 | </property> |
| 22 | <widget class="ConfigureDebug" name="debugTab"> | ||
| 23 | <attribute name="title"> | ||
| 24 | <string>General</string> | ||
| 25 | </attribute> | ||
| 26 | </widget> | ||
| 27 | <widget class="ConfigureCpuDebug" name="cpuDebugTab"> | ||
| 28 | <attribute name="title"> | ||
| 29 | <string>CPU</string> | ||
| 30 | </attribute> | ||
| 31 | </widget> | ||
| 32 | </widget> | 25 | </widget> |
| 33 | </item> | 26 | </item> |
| 34 | </layout> | 27 | </layout> |
| 35 | </widget> | 28 | </widget> |
| 36 | <customwidgets> | ||
| 37 | <customwidget> | ||
| 38 | <class>ConfigureDebug</class> | ||
| 39 | <extends>QWidget</extends> | ||
| 40 | <header>configuration/configure_debug.h</header> | ||
| 41 | <container>1</container> | ||
| 42 | </customwidget> | ||
| 43 | <customwidget> | ||
| 44 | <class>ConfigureCpuDebug</class> | ||
| 45 | <extends>QWidget</extends> | ||
| 46 | <header>configuration/configure_cpu_debug.h</header> | ||
| 47 | <container>1</container> | ||
| 48 | </customwidget> | ||
| 49 | </customwidgets> | ||
| 50 | <resources/> | 29 | <resources/> |
| 51 | <connections/> | 30 | <connections/> |
| 52 | </ui> | 31 | </ui> |
diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp index fe4186157..759625ef7 100644 --- a/src/yuzu/configuration/configure_dialog.cpp +++ b/src/yuzu/configuration/configure_dialog.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <memory> | ||
| 5 | #include <QAbstractButton> | 6 | #include <QAbstractButton> |
| 6 | #include <QDialogButtonBox> | 7 | #include <QDialogButtonBox> |
| 7 | #include <QHash> | 8 | #include <QHash> |
| @@ -9,37 +10,84 @@ | |||
| 9 | #include <QPushButton> | 10 | #include <QPushButton> |
| 10 | #include <QSignalBlocker> | 11 | #include <QSignalBlocker> |
| 11 | #include <QTabWidget> | 12 | #include <QTabWidget> |
| 13 | #include "common/logging/log.h" | ||
| 12 | #include "common/settings.h" | 14 | #include "common/settings.h" |
| 13 | #include "core/core.h" | 15 | #include "core/core.h" |
| 14 | #include "ui_configure.h" | 16 | #include "ui_configure.h" |
| 15 | #include "yuzu/configuration/config.h" | 17 | #include "yuzu/configuration/config.h" |
| 18 | #include "yuzu/configuration/configure_audio.h" | ||
| 19 | #include "yuzu/configuration/configure_cpu.h" | ||
| 20 | #include "yuzu/configuration/configure_debug_tab.h" | ||
| 16 | #include "yuzu/configuration/configure_dialog.h" | 21 | #include "yuzu/configuration/configure_dialog.h" |
| 22 | #include "yuzu/configuration/configure_filesystem.h" | ||
| 23 | #include "yuzu/configuration/configure_general.h" | ||
| 24 | #include "yuzu/configuration/configure_graphics.h" | ||
| 25 | #include "yuzu/configuration/configure_graphics_advanced.h" | ||
| 26 | #include "yuzu/configuration/configure_hotkeys.h" | ||
| 27 | #include "yuzu/configuration/configure_input.h" | ||
| 17 | #include "yuzu/configuration/configure_input_player.h" | 28 | #include "yuzu/configuration/configure_input_player.h" |
| 29 | #include "yuzu/configuration/configure_network.h" | ||
| 30 | #include "yuzu/configuration/configure_profile_manager.h" | ||
| 31 | #include "yuzu/configuration/configure_system.h" | ||
| 32 | #include "yuzu/configuration/configure_ui.h" | ||
| 33 | #include "yuzu/configuration/configure_web.h" | ||
| 18 | #include "yuzu/hotkeys.h" | 34 | #include "yuzu/hotkeys.h" |
| 19 | 35 | ||
| 20 | ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, | 36 | ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, |
| 21 | InputCommon::InputSubsystem* input_subsystem) | 37 | InputCommon::InputSubsystem* input_subsystem, |
| 22 | : QDialog(parent), ui(new Ui::ConfigureDialog), registry(registry) { | 38 | Core::System& system_) |
| 39 | : QDialog(parent), ui(new Ui::ConfigureDialog), | ||
| 40 | registry(registry), system{system_}, audio_tab{std::make_unique<ConfigureAudio>(system_, | ||
| 41 | this)}, | ||
| 42 | cpu_tab{std::make_unique<ConfigureCpu>(system_, this)}, | ||
| 43 | debug_tab_tab{std::make_unique<ConfigureDebugTab>(system_, this)}, | ||
| 44 | filesystem_tab{std::make_unique<ConfigureFilesystem>(this)}, | ||
| 45 | general_tab{std::make_unique<ConfigureGeneral>(system_, this)}, | ||
| 46 | graphics_tab{std::make_unique<ConfigureGraphics>(system_, this)}, | ||
| 47 | graphics_advanced_tab{std::make_unique<ConfigureGraphicsAdvanced>(system_, this)}, | ||
| 48 | hotkeys_tab{std::make_unique<ConfigureHotkeys>(this)}, | ||
| 49 | input_tab{std::make_unique<ConfigureInput>(system_, this)}, | ||
| 50 | network_tab{std::make_unique<ConfigureNetwork>(system_, this)}, | ||
| 51 | profile_tab{std::make_unique<ConfigureProfileManager>(system_, this)}, | ||
| 52 | system_tab{std::make_unique<ConfigureSystem>(system_, this)}, | ||
| 53 | ui_tab{std::make_unique<ConfigureUi>(system_, this)}, web_tab{std::make_unique<ConfigureWeb>( | ||
| 54 | this)} { | ||
| 23 | Settings::SetConfiguringGlobal(true); | 55 | Settings::SetConfiguringGlobal(true); |
| 24 | 56 | ||
| 25 | ui->setupUi(this); | 57 | ui->setupUi(this); |
| 26 | ui->hotkeysTab->Populate(registry); | 58 | |
| 59 | ui->tabWidget->addTab(audio_tab.get(), tr("Audio")); | ||
| 60 | ui->tabWidget->addTab(cpu_tab.get(), tr("CPU")); | ||
| 61 | ui->tabWidget->addTab(debug_tab_tab.get(), tr("Debug")); | ||
| 62 | ui->tabWidget->addTab(filesystem_tab.get(), tr("Filesystem")); | ||
| 63 | ui->tabWidget->addTab(general_tab.get(), tr("General")); | ||
| 64 | ui->tabWidget->addTab(graphics_tab.get(), tr("Graphics")); | ||
| 65 | ui->tabWidget->addTab(graphics_advanced_tab.get(), tr("GraphicsAdvanced")); | ||
| 66 | ui->tabWidget->addTab(hotkeys_tab.get(), tr("Hotkeys")); | ||
| 67 | ui->tabWidget->addTab(input_tab.get(), tr("Controls")); | ||
| 68 | ui->tabWidget->addTab(profile_tab.get(), tr("Profiles")); | ||
| 69 | ui->tabWidget->addTab(network_tab.get(), tr("Network")); | ||
| 70 | ui->tabWidget->addTab(system_tab.get(), tr("System")); | ||
| 71 | ui->tabWidget->addTab(ui_tab.get(), tr("Game List")); | ||
| 72 | ui->tabWidget->addTab(web_tab.get(), tr("Web")); | ||
| 73 | |||
| 74 | hotkeys_tab->Populate(registry); | ||
| 27 | setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); | 75 | setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); |
| 28 | 76 | ||
| 29 | ui->inputTab->Initialize(input_subsystem); | 77 | input_tab->Initialize(input_subsystem); |
| 30 | 78 | ||
| 31 | ui->generalTab->SetResetCallback([&] { this->close(); }); | 79 | general_tab->SetResetCallback([&] { this->close(); }); |
| 32 | 80 | ||
| 33 | SetConfiguration(); | 81 | SetConfiguration(); |
| 34 | PopulateSelectionList(); | 82 | PopulateSelectionList(); |
| 35 | 83 | ||
| 36 | connect(ui->tabWidget, &QTabWidget::currentChanged, this, | 84 | connect(ui->tabWidget, &QTabWidget::currentChanged, this, |
| 37 | [this]() { ui->debugTab->SetCurrentIndex(0); }); | 85 | [this]() { debug_tab_tab->SetCurrentIndex(0); }); |
| 38 | connect(ui->uiTab, &ConfigureUi::LanguageChanged, this, &ConfigureDialog::OnLanguageChanged); | 86 | connect(ui_tab.get(), &ConfigureUi::LanguageChanged, this, &ConfigureDialog::OnLanguageChanged); |
| 39 | connect(ui->selectorList, &QListWidget::itemSelectionChanged, this, | 87 | connect(ui->selectorList, &QListWidget::itemSelectionChanged, this, |
| 40 | &ConfigureDialog::UpdateVisibleTabs); | 88 | &ConfigureDialog::UpdateVisibleTabs); |
| 41 | 89 | ||
| 42 | if (Core::System::GetInstance().IsPoweredOn()) { | 90 | if (system.IsPoweredOn()) { |
| 43 | QPushButton* apply_button = ui->buttonBox->addButton(QDialogButtonBox::Apply); | 91 | QPushButton* apply_button = ui->buttonBox->addButton(QDialogButtonBox::Apply); |
| 44 | connect(apply_button, &QAbstractButton::clicked, this, | 92 | connect(apply_button, &QAbstractButton::clicked, this, |
| 45 | &ConfigureDialog::HandleApplyButtonClicked); | 93 | &ConfigureDialog::HandleApplyButtonClicked); |
| @@ -54,21 +102,21 @@ ConfigureDialog::~ConfigureDialog() = default; | |||
| 54 | void ConfigureDialog::SetConfiguration() {} | 102 | void ConfigureDialog::SetConfiguration() {} |
| 55 | 103 | ||
| 56 | void ConfigureDialog::ApplyConfiguration() { | 104 | void ConfigureDialog::ApplyConfiguration() { |
| 57 | ui->generalTab->ApplyConfiguration(); | 105 | general_tab->ApplyConfiguration(); |
| 58 | ui->uiTab->ApplyConfiguration(); | 106 | ui_tab->ApplyConfiguration(); |
| 59 | ui->systemTab->ApplyConfiguration(); | 107 | system_tab->ApplyConfiguration(); |
| 60 | ui->profileManagerTab->ApplyConfiguration(); | 108 | profile_tab->ApplyConfiguration(); |
| 61 | ui->filesystemTab->applyConfiguration(); | 109 | filesystem_tab->applyConfiguration(); |
| 62 | ui->inputTab->ApplyConfiguration(); | 110 | input_tab->ApplyConfiguration(); |
| 63 | ui->hotkeysTab->ApplyConfiguration(registry); | 111 | hotkeys_tab->ApplyConfiguration(registry); |
| 64 | ui->cpuTab->ApplyConfiguration(); | 112 | cpu_tab->ApplyConfiguration(); |
| 65 | ui->graphicsTab->ApplyConfiguration(); | 113 | graphics_tab->ApplyConfiguration(); |
| 66 | ui->graphicsAdvancedTab->ApplyConfiguration(); | 114 | graphics_advanced_tab->ApplyConfiguration(); |
| 67 | ui->audioTab->ApplyConfiguration(); | 115 | audio_tab->ApplyConfiguration(); |
| 68 | ui->debugTab->ApplyConfiguration(); | 116 | debug_tab_tab->ApplyConfiguration(); |
| 69 | ui->webTab->ApplyConfiguration(); | 117 | web_tab->ApplyConfiguration(); |
| 70 | ui->networkTab->ApplyConfiguration(); | 118 | network_tab->ApplyConfiguration(); |
| 71 | Core::System::GetInstance().ApplySettings(); | 119 | system.ApplySettings(); |
| 72 | Settings::LogSettings(); | 120 | Settings::LogSettings(); |
| 73 | } | 121 | } |
| 74 | 122 | ||
| @@ -102,12 +150,14 @@ Q_DECLARE_METATYPE(QList<QWidget*>); | |||
| 102 | 150 | ||
| 103 | void ConfigureDialog::PopulateSelectionList() { | 151 | void ConfigureDialog::PopulateSelectionList() { |
| 104 | const std::array<std::pair<QString, QList<QWidget*>>, 6> items{ | 152 | const std::array<std::pair<QString, QList<QWidget*>>, 6> items{ |
| 105 | {{tr("General"), {ui->generalTab, ui->hotkeysTab, ui->uiTab, ui->webTab, ui->debugTab}}, | 153 | {{tr("General"), |
| 106 | {tr("System"), {ui->systemTab, ui->profileManagerTab, ui->networkTab, ui->filesystemTab}}, | 154 | {general_tab.get(), hotkeys_tab.get(), ui_tab.get(), web_tab.get(), debug_tab_tab.get()}}, |
| 107 | {tr("CPU"), {ui->cpuTab}}, | 155 | {tr("System"), |
| 108 | {tr("Graphics"), {ui->graphicsTab, ui->graphicsAdvancedTab}}, | 156 | {system_tab.get(), profile_tab.get(), network_tab.get(), filesystem_tab.get()}}, |
| 109 | {tr("Audio"), {ui->audioTab}}, | 157 | {tr("CPU"), {cpu_tab.get()}}, |
| 110 | {tr("Controls"), ui->inputTab->GetSubTabs()}}, | 158 | {tr("Graphics"), {graphics_tab.get(), graphics_advanced_tab.get()}}, |
| 159 | {tr("Audio"), {audio_tab.get()}}, | ||
| 160 | {tr("Controls"), input_tab->GetSubTabs()}}, | ||
| 111 | }; | 161 | }; |
| 112 | 162 | ||
| 113 | [[maybe_unused]] const QSignalBlocker blocker(ui->selectorList); | 163 | [[maybe_unused]] const QSignalBlocker blocker(ui->selectorList); |
| @@ -142,6 +192,7 @@ void ConfigureDialog::UpdateVisibleTabs() { | |||
| 142 | const auto tabs = qvariant_cast<QList<QWidget*>>(items[0]->data(Qt::UserRole)); | 192 | const auto tabs = qvariant_cast<QList<QWidget*>>(items[0]->data(Qt::UserRole)); |
| 143 | 193 | ||
| 144 | for (auto* const tab : tabs) { | 194 | for (auto* const tab : tabs) { |
| 195 | LOG_DEBUG(Frontend, "{}", tab->accessibleName().toStdString()); | ||
| 145 | ui->tabWidget->addTab(tab, tab->accessibleName()); | 196 | ui->tabWidget->addTab(tab, tab->accessibleName()); |
| 146 | } | 197 | } |
| 147 | } | 198 | } |
diff --git a/src/yuzu/configuration/configure_dialog.h b/src/yuzu/configuration/configure_dialog.h index abe019635..32ddfd4e0 100644 --- a/src/yuzu/configuration/configure_dialog.h +++ b/src/yuzu/configuration/configure_dialog.h | |||
| @@ -7,6 +7,25 @@ | |||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <QDialog> | 8 | #include <QDialog> |
| 9 | 9 | ||
| 10 | namespace Core { | ||
| 11 | class System; | ||
| 12 | } | ||
| 13 | |||
| 14 | class ConfigureAudio; | ||
| 15 | class ConfigureCpu; | ||
| 16 | class ConfigureDebugTab; | ||
| 17 | class ConfigureFilesystem; | ||
| 18 | class ConfigureGeneral; | ||
| 19 | class ConfigureGraphics; | ||
| 20 | class ConfigureGraphicsAdvanced; | ||
| 21 | class ConfigureHotkeys; | ||
| 22 | class ConfigureInput; | ||
| 23 | class ConfigureProfileManager; | ||
| 24 | class ConfigureSystem; | ||
| 25 | class ConfigureNetwork; | ||
| 26 | class ConfigureUi; | ||
| 27 | class ConfigureWeb; | ||
| 28 | |||
| 10 | class HotkeyRegistry; | 29 | class HotkeyRegistry; |
| 11 | 30 | ||
| 12 | namespace InputCommon { | 31 | namespace InputCommon { |
| @@ -22,7 +41,7 @@ class ConfigureDialog : public QDialog { | |||
| 22 | 41 | ||
| 23 | public: | 42 | public: |
| 24 | explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, | 43 | explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, |
| 25 | InputCommon::InputSubsystem* input_subsystem); | 44 | InputCommon::InputSubsystem* input_subsystem, Core::System& system_); |
| 26 | ~ConfigureDialog() override; | 45 | ~ConfigureDialog() override; |
| 27 | 46 | ||
| 28 | void ApplyConfiguration(); | 47 | void ApplyConfiguration(); |
| @@ -45,4 +64,21 @@ private: | |||
| 45 | 64 | ||
| 46 | std::unique_ptr<Ui::ConfigureDialog> ui; | 65 | std::unique_ptr<Ui::ConfigureDialog> ui; |
| 47 | HotkeyRegistry& registry; | 66 | HotkeyRegistry& registry; |
| 67 | |||
| 68 | Core::System& system; | ||
| 69 | |||
| 70 | std::unique_ptr<ConfigureAudio> audio_tab; | ||
| 71 | std::unique_ptr<ConfigureCpu> cpu_tab; | ||
| 72 | std::unique_ptr<ConfigureDebugTab> debug_tab_tab; | ||
| 73 | std::unique_ptr<ConfigureFilesystem> filesystem_tab; | ||
| 74 | std::unique_ptr<ConfigureGeneral> general_tab; | ||
| 75 | std::unique_ptr<ConfigureGraphics> graphics_tab; | ||
| 76 | std::unique_ptr<ConfigureGraphicsAdvanced> graphics_advanced_tab; | ||
| 77 | std::unique_ptr<ConfigureHotkeys> hotkeys_tab; | ||
| 78 | std::unique_ptr<ConfigureInput> input_tab; | ||
| 79 | std::unique_ptr<ConfigureNetwork> network_tab; | ||
| 80 | std::unique_ptr<ConfigureProfileManager> profile_tab; | ||
| 81 | std::unique_ptr<ConfigureSystem> system_tab; | ||
| 82 | std::unique_ptr<ConfigureUi> ui_tab; | ||
| 83 | std::unique_ptr<ConfigureWeb> web_tab; | ||
| 48 | }; | 84 | }; |
diff --git a/src/yuzu/configuration/configure_filesystem.ui b/src/yuzu/configuration/configure_filesystem.ui index 62b9abc7a..2f6030b5c 100644 --- a/src/yuzu/configuration/configure_filesystem.ui +++ b/src/yuzu/configuration/configure_filesystem.ui | |||
| @@ -13,6 +13,9 @@ | |||
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| 14 | <string>Form</string> | 14 | <string>Form</string> |
| 15 | </property> | 15 | </property> |
| 16 | <property name="accessibleName"> | ||
| 17 | <string>Filesystem</string> | ||
| 18 | </property> | ||
| 16 | <layout class="QVBoxLayout" name="verticalLayout"> | 19 | <layout class="QVBoxLayout" name="verticalLayout"> |
| 17 | <item> | 20 | <item> |
| 18 | <layout class="QVBoxLayout" name="verticalLayout_3"> | 21 | <layout class="QVBoxLayout" name="verticalLayout_3"> |
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 1f647a0d1..e562e89e5 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp | |||
| @@ -15,8 +15,8 @@ | |||
| 15 | #include "yuzu/configuration/configure_general.h" | 15 | #include "yuzu/configuration/configure_general.h" |
| 16 | #include "yuzu/uisettings.h" | 16 | #include "yuzu/uisettings.h" |
| 17 | 17 | ||
| 18 | ConfigureGeneral::ConfigureGeneral(QWidget* parent) | 18 | ConfigureGeneral::ConfigureGeneral(const Core::System& system_, QWidget* parent) |
| 19 | : QWidget(parent), ui(new Ui::ConfigureGeneral) { | 19 | : QWidget(parent), ui(new Ui::ConfigureGeneral), system{system_} { |
| 20 | ui->setupUi(this); | 20 | ui->setupUi(this); |
| 21 | 21 | ||
| 22 | SetupPerGameUI(); | 22 | SetupPerGameUI(); |
| @@ -35,7 +35,7 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent) | |||
| 35 | ConfigureGeneral::~ConfigureGeneral() = default; | 35 | ConfigureGeneral::~ConfigureGeneral() = default; |
| 36 | 36 | ||
| 37 | void ConfigureGeneral::SetConfiguration() { | 37 | void ConfigureGeneral::SetConfiguration() { |
| 38 | const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); | 38 | const bool runtime_lock = !system.IsPoweredOn(); |
| 39 | 39 | ||
| 40 | ui->use_multi_core->setEnabled(runtime_lock); | 40 | ui->use_multi_core->setEnabled(runtime_lock); |
| 41 | ui->use_multi_core->setChecked(Settings::values.use_multi_core.GetValue()); | 41 | ui->use_multi_core->setChecked(Settings::values.use_multi_core.GetValue()); |
diff --git a/src/yuzu/configuration/configure_general.h b/src/yuzu/configuration/configure_general.h index c9df37d73..85c1dd4a8 100644 --- a/src/yuzu/configuration/configure_general.h +++ b/src/yuzu/configuration/configure_general.h | |||
| @@ -8,6 +8,10 @@ | |||
| 8 | #include <memory> | 8 | #include <memory> |
| 9 | #include <QWidget> | 9 | #include <QWidget> |
| 10 | 10 | ||
| 11 | namespace Core { | ||
| 12 | class System; | ||
| 13 | } | ||
| 14 | |||
| 11 | class ConfigureDialog; | 15 | class ConfigureDialog; |
| 12 | 16 | ||
| 13 | namespace ConfigurationShared { | 17 | namespace ConfigurationShared { |
| @@ -24,19 +28,18 @@ class ConfigureGeneral : public QWidget { | |||
| 24 | Q_OBJECT | 28 | Q_OBJECT |
| 25 | 29 | ||
| 26 | public: | 30 | public: |
| 27 | explicit ConfigureGeneral(QWidget* parent = nullptr); | 31 | explicit ConfigureGeneral(const Core::System& system_, QWidget* parent = nullptr); |
| 28 | ~ConfigureGeneral() override; | 32 | ~ConfigureGeneral() override; |
| 29 | 33 | ||
| 30 | void SetResetCallback(std::function<void()> callback); | 34 | void SetResetCallback(std::function<void()> callback); |
| 31 | void ResetDefaults(); | 35 | void ResetDefaults(); |
| 32 | void ApplyConfiguration(); | 36 | void ApplyConfiguration(); |
| 37 | void SetConfiguration(); | ||
| 33 | 38 | ||
| 34 | private: | 39 | private: |
| 35 | void changeEvent(QEvent* event) override; | 40 | void changeEvent(QEvent* event) override; |
| 36 | void RetranslateUI(); | 41 | void RetranslateUI(); |
| 37 | 42 | ||
| 38 | void SetConfiguration(); | ||
| 39 | |||
| 40 | void SetupPerGameUI(); | 43 | void SetupPerGameUI(); |
| 41 | 44 | ||
| 42 | std::function<void()> reset_callback; | 45 | std::function<void()> reset_callback; |
| @@ -45,4 +48,6 @@ private: | |||
| 45 | 48 | ||
| 46 | ConfigurationShared::CheckState use_speed_limit; | 49 | ConfigurationShared::CheckState use_speed_limit; |
| 47 | ConfigurationShared::CheckState use_multi_core; | 50 | ConfigurationShared::CheckState use_multi_core; |
| 51 | |||
| 52 | const Core::System& system; | ||
| 48 | }; | 53 | }; |
diff --git a/src/yuzu/configuration/configure_general.ui b/src/yuzu/configuration/configure_general.ui index 69b6c2d66..f9f0e3ebf 100644 --- a/src/yuzu/configuration/configure_general.ui +++ b/src/yuzu/configuration/configure_general.ui | |||
| @@ -13,6 +13,9 @@ | |||
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| 14 | <string>Form</string> | 14 | <string>Form</string> |
| 15 | </property> | 15 | </property> |
| 16 | <property name="accessibleName"> | ||
| 17 | <string>General</string> | ||
| 18 | </property> | ||
| 16 | <layout class="QHBoxLayout" name="HorizontalLayout"> | 19 | <layout class="QHBoxLayout" name="HorizontalLayout"> |
| 17 | <item> | 20 | <item> |
| 18 | <layout class="QVBoxLayout" name="VerticalLayout"> | 21 | <layout class="QVBoxLayout" name="VerticalLayout"> |
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index c594164be..be4e7997b 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp | |||
| @@ -19,8 +19,8 @@ | |||
| 19 | #include "yuzu/configuration/configuration_shared.h" | 19 | #include "yuzu/configuration/configuration_shared.h" |
| 20 | #include "yuzu/configuration/configure_graphics.h" | 20 | #include "yuzu/configuration/configure_graphics.h" |
| 21 | 21 | ||
| 22 | ConfigureGraphics::ConfigureGraphics(QWidget* parent) | 22 | ConfigureGraphics::ConfigureGraphics(const Core::System& system_, QWidget* parent) |
| 23 | : QWidget(parent), ui(new Ui::ConfigureGraphics) { | 23 | : QWidget(parent), ui(new Ui::ConfigureGraphics), system{system_} { |
| 24 | vulkan_device = Settings::values.vulkan_device.GetValue(); | 24 | vulkan_device = Settings::values.vulkan_device.GetValue(); |
| 25 | RetrieveVulkanDevices(); | 25 | RetrieveVulkanDevices(); |
| 26 | 26 | ||
| @@ -83,7 +83,7 @@ void ConfigureGraphics::UpdateShaderBackendSelection(int backend) { | |||
| 83 | ConfigureGraphics::~ConfigureGraphics() = default; | 83 | ConfigureGraphics::~ConfigureGraphics() = default; |
| 84 | 84 | ||
| 85 | void ConfigureGraphics::SetConfiguration() { | 85 | void ConfigureGraphics::SetConfiguration() { |
| 86 | const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); | 86 | const bool runtime_lock = !system.IsPoweredOn(); |
| 87 | 87 | ||
| 88 | ui->api_widget->setEnabled(runtime_lock); | 88 | ui->api_widget->setEnabled(runtime_lock); |
| 89 | ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock); | 89 | ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock); |
diff --git a/src/yuzu/configuration/configure_graphics.h b/src/yuzu/configuration/configure_graphics.h index 7d7ac329d..1b101c940 100644 --- a/src/yuzu/configuration/configure_graphics.h +++ b/src/yuzu/configuration/configure_graphics.h | |||
| @@ -10,6 +10,10 @@ | |||
| 10 | #include <QWidget> | 10 | #include <QWidget> |
| 11 | #include "common/settings.h" | 11 | #include "common/settings.h" |
| 12 | 12 | ||
| 13 | namespace Core { | ||
| 14 | class System; | ||
| 15 | } | ||
| 16 | |||
| 13 | namespace ConfigurationShared { | 17 | namespace ConfigurationShared { |
| 14 | enum class CheckState; | 18 | enum class CheckState; |
| 15 | } | 19 | } |
| @@ -22,17 +26,16 @@ class ConfigureGraphics : public QWidget { | |||
| 22 | Q_OBJECT | 26 | Q_OBJECT |
| 23 | 27 | ||
| 24 | public: | 28 | public: |
| 25 | explicit ConfigureGraphics(QWidget* parent = nullptr); | 29 | explicit ConfigureGraphics(const Core::System& system_, QWidget* parent = nullptr); |
| 26 | ~ConfigureGraphics() override; | 30 | ~ConfigureGraphics() override; |
| 27 | 31 | ||
| 28 | void ApplyConfiguration(); | 32 | void ApplyConfiguration(); |
| 33 | void SetConfiguration(); | ||
| 29 | 34 | ||
| 30 | private: | 35 | private: |
| 31 | void changeEvent(QEvent* event) override; | 36 | void changeEvent(QEvent* event) override; |
| 32 | void RetranslateUI(); | 37 | void RetranslateUI(); |
| 33 | 38 | ||
| 34 | void SetConfiguration(); | ||
| 35 | |||
| 36 | void UpdateBackgroundColorButton(QColor color); | 39 | void UpdateBackgroundColorButton(QColor color); |
| 37 | void UpdateAPILayout(); | 40 | void UpdateAPILayout(); |
| 38 | void UpdateDeviceSelection(int device); | 41 | void UpdateDeviceSelection(int device); |
| @@ -56,4 +59,6 @@ private: | |||
| 56 | std::vector<QString> vulkan_devices; | 59 | std::vector<QString> vulkan_devices; |
| 57 | u32 vulkan_device{}; | 60 | u32 vulkan_device{}; |
| 58 | Settings::ShaderBackend shader_backend{}; | 61 | Settings::ShaderBackend shader_backend{}; |
| 62 | |||
| 63 | const Core::System& system; | ||
| 59 | }; | 64 | }; |
diff --git a/src/yuzu/configuration/configure_graphics.ui b/src/yuzu/configuration/configure_graphics.ui index 1a12cfa4d..451d86859 100644 --- a/src/yuzu/configuration/configure_graphics.ui +++ b/src/yuzu/configuration/configure_graphics.ui | |||
| @@ -7,12 +7,15 @@ | |||
| 7 | <x>0</x> | 7 | <x>0</x> |
| 8 | <y>0</y> | 8 | <y>0</y> |
| 9 | <width>437</width> | 9 | <width>437</width> |
| 10 | <height>321</height> | 10 | <height>482</height> |
| 11 | </rect> | 11 | </rect> |
| 12 | </property> | 12 | </property> |
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| 14 | <string>Form</string> | 14 | <string>Form</string> |
| 15 | </property> | 15 | </property> |
| 16 | <property name="accessibleName"> | ||
| 17 | <string>Graphics</string> | ||
| 18 | </property> | ||
| 16 | <layout class="QVBoxLayout" name="verticalLayout_1"> | 19 | <layout class="QVBoxLayout" name="verticalLayout_1"> |
| 17 | <item> | 20 | <item> |
| 18 | <layout class="QVBoxLayout" name="verticalLayout_2"> | 21 | <layout class="QVBoxLayout" name="verticalLayout_2"> |
diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index bfd464061..4407e65d3 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp | |||
| @@ -8,8 +8,8 @@ | |||
| 8 | #include "yuzu/configuration/configuration_shared.h" | 8 | #include "yuzu/configuration/configuration_shared.h" |
| 9 | #include "yuzu/configuration/configure_graphics_advanced.h" | 9 | #include "yuzu/configuration/configure_graphics_advanced.h" |
| 10 | 10 | ||
| 11 | ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(QWidget* parent) | 11 | ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(const Core::System& system_, QWidget* parent) |
| 12 | : QWidget(parent), ui(new Ui::ConfigureGraphicsAdvanced) { | 12 | : QWidget(parent), ui(new Ui::ConfigureGraphicsAdvanced), system{system_} { |
| 13 | 13 | ||
| 14 | ui->setupUi(this); | 14 | ui->setupUi(this); |
| 15 | 15 | ||
| @@ -21,7 +21,7 @@ ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(QWidget* parent) | |||
| 21 | ConfigureGraphicsAdvanced::~ConfigureGraphicsAdvanced() = default; | 21 | ConfigureGraphicsAdvanced::~ConfigureGraphicsAdvanced() = default; |
| 22 | 22 | ||
| 23 | void ConfigureGraphicsAdvanced::SetConfiguration() { | 23 | void ConfigureGraphicsAdvanced::SetConfiguration() { |
| 24 | const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); | 24 | const bool runtime_lock = !system.IsPoweredOn(); |
| 25 | ui->use_vsync->setEnabled(runtime_lock); | 25 | ui->use_vsync->setEnabled(runtime_lock); |
| 26 | ui->use_asynchronous_shaders->setEnabled(runtime_lock); | 26 | ui->use_asynchronous_shaders->setEnabled(runtime_lock); |
| 27 | ui->anisotropic_filtering_combobox->setEnabled(runtime_lock); | 27 | ui->anisotropic_filtering_combobox->setEnabled(runtime_lock); |
diff --git a/src/yuzu/configuration/configure_graphics_advanced.h b/src/yuzu/configuration/configure_graphics_advanced.h index 13ba4ff6b..0a1724ce4 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.h +++ b/src/yuzu/configuration/configure_graphics_advanced.h | |||
| @@ -7,6 +7,10 @@ | |||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <QWidget> | 8 | #include <QWidget> |
| 9 | 9 | ||
| 10 | namespace Core { | ||
| 11 | class System; | ||
| 12 | } | ||
| 13 | |||
| 10 | namespace ConfigurationShared { | 14 | namespace ConfigurationShared { |
| 11 | enum class CheckState; | 15 | enum class CheckState; |
| 12 | } | 16 | } |
| @@ -19,17 +23,16 @@ class ConfigureGraphicsAdvanced : public QWidget { | |||
| 19 | Q_OBJECT | 23 | Q_OBJECT |
| 20 | 24 | ||
| 21 | public: | 25 | public: |
| 22 | explicit ConfigureGraphicsAdvanced(QWidget* parent = nullptr); | 26 | explicit ConfigureGraphicsAdvanced(const Core::System& system_, QWidget* parent = nullptr); |
| 23 | ~ConfigureGraphicsAdvanced() override; | 27 | ~ConfigureGraphicsAdvanced() override; |
| 24 | 28 | ||
| 25 | void ApplyConfiguration(); | 29 | void ApplyConfiguration(); |
| 30 | void SetConfiguration(); | ||
| 26 | 31 | ||
| 27 | private: | 32 | private: |
| 28 | void changeEvent(QEvent* event) override; | 33 | void changeEvent(QEvent* event) override; |
| 29 | void RetranslateUI(); | 34 | void RetranslateUI(); |
| 30 | 35 | ||
| 31 | void SetConfiguration(); | ||
| 32 | |||
| 33 | void SetupPerGameUI(); | 36 | void SetupPerGameUI(); |
| 34 | 37 | ||
| 35 | std::unique_ptr<Ui::ConfigureGraphicsAdvanced> ui; | 38 | std::unique_ptr<Ui::ConfigureGraphicsAdvanced> ui; |
| @@ -37,4 +40,6 @@ private: | |||
| 37 | ConfigurationShared::CheckState use_vsync; | 40 | ConfigurationShared::CheckState use_vsync; |
| 38 | ConfigurationShared::CheckState use_asynchronous_shaders; | 41 | ConfigurationShared::CheckState use_asynchronous_shaders; |
| 39 | ConfigurationShared::CheckState use_fast_gpu_time; | 42 | ConfigurationShared::CheckState use_fast_gpu_time; |
| 43 | |||
| 44 | const Core::System& system; | ||
| 40 | }; | 45 | }; |
diff --git a/src/yuzu/configuration/configure_graphics_advanced.ui b/src/yuzu/configuration/configure_graphics_advanced.ui index b91abc2f0..d06b45f17 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.ui +++ b/src/yuzu/configuration/configure_graphics_advanced.ui | |||
| @@ -13,6 +13,9 @@ | |||
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| 14 | <string>Form</string> | 14 | <string>Form</string> |
| 15 | </property> | 15 | </property> |
| 16 | <property name="accessibleName"> | ||
| 17 | <string>Advanced</string> | ||
| 18 | </property> | ||
| 16 | <layout class="QVBoxLayout" name="verticalLayout_1"> | 19 | <layout class="QVBoxLayout" name="verticalLayout_1"> |
| 17 | <item> | 20 | <item> |
| 18 | <layout class="QVBoxLayout" name="verticalLayout_2"> | 21 | <layout class="QVBoxLayout" name="verticalLayout_2"> |
diff --git a/src/yuzu/configuration/configure_hotkeys.ui b/src/yuzu/configuration/configure_hotkeys.ui index 6d9f861e3..a6902a5d8 100644 --- a/src/yuzu/configuration/configure_hotkeys.ui +++ b/src/yuzu/configuration/configure_hotkeys.ui | |||
| @@ -13,6 +13,9 @@ | |||
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| 14 | <string>Hotkey Settings</string> | 14 | <string>Hotkey Settings</string> |
| 15 | </property> | 15 | </property> |
| 16 | <property name="accessibleName"> | ||
| 17 | <string>Hotkeys</string> | ||
| 18 | </property> | ||
| 16 | <layout class="QVBoxLayout" name="verticalLayout"> | 19 | <layout class="QVBoxLayout" name="verticalLayout"> |
| 17 | <item> | 20 | <item> |
| 18 | <layout class="QHBoxLayout" name="horizontalLayout"> | 21 | <layout class="QHBoxLayout" name="horizontalLayout"> |
diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp index 422022d02..1599299db 100644 --- a/src/yuzu/configuration/configure_input.cpp +++ b/src/yuzu/configuration/configure_input.cpp | |||
| @@ -39,12 +39,11 @@ void CallConfigureDialog(ConfigureInput& parent, Args&&... args) { | |||
| 39 | } | 39 | } |
| 40 | } // Anonymous namespace | 40 | } // Anonymous namespace |
| 41 | 41 | ||
| 42 | void OnDockedModeChanged(bool last_state, bool new_state) { | 42 | void OnDockedModeChanged(bool last_state, bool new_state, Core::System& system) { |
| 43 | if (last_state == new_state) { | 43 | if (last_state == new_state) { |
| 44 | return; | 44 | return; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | Core::System& system{Core::System::GetInstance()}; | ||
| 48 | if (!system.IsPoweredOn()) { | 47 | if (!system.IsPoweredOn()) { |
| 49 | return; | 48 | return; |
| 50 | } | 49 | } |
| @@ -66,9 +65,9 @@ void OnDockedModeChanged(bool last_state, bool new_state) { | |||
| 66 | } | 65 | } |
| 67 | } | 66 | } |
| 68 | 67 | ||
| 69 | ConfigureInput::ConfigureInput(QWidget* parent) | 68 | ConfigureInput::ConfigureInput(Core::System& system_, QWidget* parent) |
| 70 | : QWidget(parent), ui(std::make_unique<Ui::ConfigureInput>()), | 69 | : QWidget(parent), ui(std::make_unique<Ui::ConfigureInput>()), |
| 71 | profiles(std::make_unique<InputProfiles>()) { | 70 | profiles(std::make_unique<InputProfiles>(system_)), system{system_} { |
| 72 | ui->setupUi(this); | 71 | ui->setupUi(this); |
| 73 | } | 72 | } |
| 74 | 73 | ||
| @@ -77,22 +76,22 @@ ConfigureInput::~ConfigureInput() = default; | |||
| 77 | void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem, | 76 | void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem, |
| 78 | std::size_t max_players) { | 77 | std::size_t max_players) { |
| 79 | player_controllers = { | 78 | player_controllers = { |
| 80 | new ConfigureInputPlayer(this, 0, ui->consoleInputSettings, input_subsystem, | 79 | new ConfigureInputPlayer(this, 0, ui->consoleInputSettings, input_subsystem, profiles.get(), |
| 81 | profiles.get()), | 80 | system), |
| 82 | new ConfigureInputPlayer(this, 1, ui->consoleInputSettings, input_subsystem, | 81 | new ConfigureInputPlayer(this, 1, ui->consoleInputSettings, input_subsystem, profiles.get(), |
| 83 | profiles.get()), | 82 | system), |
| 84 | new ConfigureInputPlayer(this, 2, ui->consoleInputSettings, input_subsystem, | 83 | new ConfigureInputPlayer(this, 2, ui->consoleInputSettings, input_subsystem, profiles.get(), |
| 85 | profiles.get()), | 84 | system), |
| 86 | new ConfigureInputPlayer(this, 3, ui->consoleInputSettings, input_subsystem, | 85 | new ConfigureInputPlayer(this, 3, ui->consoleInputSettings, input_subsystem, profiles.get(), |
| 87 | profiles.get()), | 86 | system), |
| 88 | new ConfigureInputPlayer(this, 4, ui->consoleInputSettings, input_subsystem, | 87 | new ConfigureInputPlayer(this, 4, ui->consoleInputSettings, input_subsystem, profiles.get(), |
| 89 | profiles.get()), | 88 | system), |
| 90 | new ConfigureInputPlayer(this, 5, ui->consoleInputSettings, input_subsystem, | 89 | new ConfigureInputPlayer(this, 5, ui->consoleInputSettings, input_subsystem, profiles.get(), |
| 91 | profiles.get()), | 90 | system), |
| 92 | new ConfigureInputPlayer(this, 6, ui->consoleInputSettings, input_subsystem, | 91 | new ConfigureInputPlayer(this, 6, ui->consoleInputSettings, input_subsystem, profiles.get(), |
| 93 | profiles.get()), | 92 | system), |
| 94 | new ConfigureInputPlayer(this, 7, ui->consoleInputSettings, input_subsystem, | 93 | new ConfigureInputPlayer(this, 7, ui->consoleInputSettings, input_subsystem, profiles.get(), |
| 95 | profiles.get()), | 94 | system), |
| 96 | }; | 95 | }; |
| 97 | 96 | ||
| 98 | player_tabs = { | 97 | player_tabs = { |
| @@ -148,7 +147,8 @@ void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem, | |||
| 148 | ui->tabAdvanced->setLayout(new QHBoxLayout(ui->tabAdvanced)); | 147 | ui->tabAdvanced->setLayout(new QHBoxLayout(ui->tabAdvanced)); |
| 149 | ui->tabAdvanced->layout()->addWidget(advanced); | 148 | ui->tabAdvanced->layout()->addWidget(advanced); |
| 150 | connect(advanced, &ConfigureInputAdvanced::CallDebugControllerDialog, [this, input_subsystem] { | 149 | connect(advanced, &ConfigureInputAdvanced::CallDebugControllerDialog, [this, input_subsystem] { |
| 151 | CallConfigureDialog<ConfigureDebugController>(*this, input_subsystem, profiles.get()); | 150 | CallConfigureDialog<ConfigureDebugController>(*this, input_subsystem, profiles.get(), |
| 151 | system); | ||
| 152 | }); | 152 | }); |
| 153 | connect(advanced, &ConfigureInputAdvanced::CallMouseConfigDialog, [this, input_subsystem] { | 153 | connect(advanced, &ConfigureInputAdvanced::CallMouseConfigDialog, [this, input_subsystem] { |
| 154 | CallConfigureDialog<ConfigureMouseAdvanced>(*this, input_subsystem); | 154 | CallConfigureDialog<ConfigureMouseAdvanced>(*this, input_subsystem); |
| @@ -204,7 +204,7 @@ void ConfigureInput::ApplyConfiguration() { | |||
| 204 | 204 | ||
| 205 | const bool pre_docked_mode = Settings::values.use_docked_mode.GetValue(); | 205 | const bool pre_docked_mode = Settings::values.use_docked_mode.GetValue(); |
| 206 | Settings::values.use_docked_mode.SetValue(ui->radioDocked->isChecked()); | 206 | Settings::values.use_docked_mode.SetValue(ui->radioDocked->isChecked()); |
| 207 | OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue()); | 207 | OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue(), system); |
| 208 | 208 | ||
| 209 | Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); | 209 | Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); |
| 210 | Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); | 210 | Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); |
diff --git a/src/yuzu/configuration/configure_input.h b/src/yuzu/configuration/configure_input.h index f4eb0d78b..4cafa3dab 100644 --- a/src/yuzu/configuration/configure_input.h +++ b/src/yuzu/configuration/configure_input.h | |||
| @@ -11,6 +11,10 @@ | |||
| 11 | #include <QList> | 11 | #include <QList> |
| 12 | #include <QWidget> | 12 | #include <QWidget> |
| 13 | 13 | ||
| 14 | namespace Core { | ||
| 15 | class System; | ||
| 16 | } | ||
| 17 | |||
| 14 | class QCheckBox; | 18 | class QCheckBox; |
| 15 | class QString; | 19 | class QString; |
| 16 | class QTimer; | 20 | class QTimer; |
| @@ -28,13 +32,13 @@ namespace Ui { | |||
| 28 | class ConfigureInput; | 32 | class ConfigureInput; |
| 29 | } | 33 | } |
| 30 | 34 | ||
| 31 | void OnDockedModeChanged(bool last_state, bool new_state); | 35 | void OnDockedModeChanged(bool last_state, bool new_state, Core::System& system); |
| 32 | 36 | ||
| 33 | class ConfigureInput : public QWidget { | 37 | class ConfigureInput : public QWidget { |
| 34 | Q_OBJECT | 38 | Q_OBJECT |
| 35 | 39 | ||
| 36 | public: | 40 | public: |
| 37 | explicit ConfigureInput(QWidget* parent = nullptr); | 41 | explicit ConfigureInput(Core::System& system_, QWidget* parent = nullptr); |
| 38 | ~ConfigureInput() override; | 42 | ~ConfigureInput() override; |
| 39 | 43 | ||
| 40 | /// Initializes the input dialog with the given input subsystem. | 44 | /// Initializes the input dialog with the given input subsystem. |
| @@ -69,4 +73,6 @@ private: | |||
| 69 | std::array<QWidget*, 8> player_tabs; | 73 | std::array<QWidget*, 8> player_tabs; |
| 70 | std::array<QCheckBox*, 8> player_connected; | 74 | std::array<QCheckBox*, 8> player_connected; |
| 71 | ConfigureInputAdvanced* advanced; | 75 | ConfigureInputAdvanced* advanced; |
| 76 | |||
| 77 | Core::System& system; | ||
| 72 | }; | 78 | }; |
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 88f4bf388..3aab5d5f8 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp | |||
| @@ -44,8 +44,7 @@ namespace { | |||
| 44 | constexpr std::size_t HANDHELD_INDEX = 8; | 44 | constexpr std::size_t HANDHELD_INDEX = 8; |
| 45 | 45 | ||
| 46 | void UpdateController(Settings::ControllerType controller_type, std::size_t npad_index, | 46 | void UpdateController(Settings::ControllerType controller_type, std::size_t npad_index, |
| 47 | bool connected) { | 47 | bool connected, Core::System& system) { |
| 48 | Core::System& system{Core::System::GetInstance()}; | ||
| 49 | if (!system.IsPoweredOn()) { | 48 | if (!system.IsPoweredOn()) { |
| 50 | return; | 49 | return; |
| 51 | } | 50 | } |
| @@ -232,11 +231,12 @@ QString AnalogToText(const Common::ParamPackage& param, const std::string& dir) | |||
| 232 | ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_index, | 231 | ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_index, |
| 233 | QWidget* bottom_row, | 232 | QWidget* bottom_row, |
| 234 | InputCommon::InputSubsystem* input_subsystem_, | 233 | InputCommon::InputSubsystem* input_subsystem_, |
| 235 | InputProfiles* profiles_, bool debug) | 234 | InputProfiles* profiles_, Core::System& system_, |
| 235 | bool debug) | ||
| 236 | : QWidget(parent), ui(std::make_unique<Ui::ConfigureInputPlayer>()), player_index(player_index), | 236 | : QWidget(parent), ui(std::make_unique<Ui::ConfigureInputPlayer>()), player_index(player_index), |
| 237 | debug(debug), input_subsystem{input_subsystem_}, profiles(profiles_), | 237 | debug(debug), input_subsystem{input_subsystem_}, profiles(profiles_), |
| 238 | timeout_timer(std::make_unique<QTimer>()), poll_timer(std::make_unique<QTimer>()), | 238 | timeout_timer(std::make_unique<QTimer>()), poll_timer(std::make_unique<QTimer>()), |
| 239 | bottom_row(bottom_row) { | 239 | bottom_row(bottom_row), system{system_} { |
| 240 | ui->setupUi(this); | 240 | ui->setupUi(this); |
| 241 | 241 | ||
| 242 | setFocusPolicy(Qt::ClickFocus); | 242 | setFocusPolicy(Qt::ClickFocus); |
| @@ -683,7 +683,7 @@ void ConfigureInputPlayer::TryConnectSelectedController() { | |||
| 683 | controller_type == Settings::ControllerType::Handheld; | 683 | controller_type == Settings::ControllerType::Handheld; |
| 684 | // Connect only if handheld is going from disconnected to connected | 684 | // Connect only if handheld is going from disconnected to connected |
| 685 | if (!handheld.connected && handheld_connected) { | 685 | if (!handheld.connected && handheld_connected) { |
| 686 | UpdateController(controller_type, HANDHELD_INDEX, true); | 686 | UpdateController(controller_type, HANDHELD_INDEX, true, system); |
| 687 | } | 687 | } |
| 688 | handheld.connected = handheld_connected; | 688 | handheld.connected = handheld_connected; |
| 689 | } | 689 | } |
| @@ -703,7 +703,7 @@ void ConfigureInputPlayer::TryConnectSelectedController() { | |||
| 703 | return; | 703 | return; |
| 704 | } | 704 | } |
| 705 | 705 | ||
| 706 | UpdateController(controller_type, player_index, true); | 706 | UpdateController(controller_type, player_index, true, system); |
| 707 | } | 707 | } |
| 708 | 708 | ||
| 709 | void ConfigureInputPlayer::TryDisconnectSelectedController() { | 709 | void ConfigureInputPlayer::TryDisconnectSelectedController() { |
| @@ -721,7 +721,7 @@ void ConfigureInputPlayer::TryDisconnectSelectedController() { | |||
| 721 | controller_type == Settings::ControllerType::Handheld; | 721 | controller_type == Settings::ControllerType::Handheld; |
| 722 | // Disconnect only if handheld is going from connected to disconnected | 722 | // Disconnect only if handheld is going from connected to disconnected |
| 723 | if (handheld.connected && !handheld_connected) { | 723 | if (handheld.connected && !handheld_connected) { |
| 724 | UpdateController(controller_type, HANDHELD_INDEX, false); | 724 | UpdateController(controller_type, HANDHELD_INDEX, false, system); |
| 725 | } | 725 | } |
| 726 | return; | 726 | return; |
| 727 | } | 727 | } |
| @@ -737,7 +737,7 @@ void ConfigureInputPlayer::TryDisconnectSelectedController() { | |||
| 737 | } | 737 | } |
| 738 | 738 | ||
| 739 | // Disconnect the controller first. | 739 | // Disconnect the controller first. |
| 740 | UpdateController(controller_type, player_index, false); | 740 | UpdateController(controller_type, player_index, false, system); |
| 741 | } | 741 | } |
| 742 | 742 | ||
| 743 | void ConfigureInputPlayer::showEvent(QShowEvent* event) { | 743 | void ConfigureInputPlayer::showEvent(QShowEvent* event) { |
| @@ -1017,8 +1017,6 @@ void ConfigureInputPlayer::SetConnectableControllers() { | |||
| 1017 | } | 1017 | } |
| 1018 | }; | 1018 | }; |
| 1019 | 1019 | ||
| 1020 | Core::System& system{Core::System::GetInstance()}; | ||
| 1021 | |||
| 1022 | if (!system.IsPoweredOn()) { | 1020 | if (!system.IsPoweredOn()) { |
| 1023 | add_controllers(true); | 1021 | add_controllers(true); |
| 1024 | return; | 1022 | return; |
diff --git a/src/yuzu/configuration/configure_input_player.h b/src/yuzu/configuration/configure_input_player.h index c7d101682..39b44b8a5 100644 --- a/src/yuzu/configuration/configure_input_player.h +++ b/src/yuzu/configuration/configure_input_player.h | |||
| @@ -29,6 +29,10 @@ class QWidget; | |||
| 29 | 29 | ||
| 30 | class InputProfiles; | 30 | class InputProfiles; |
| 31 | 31 | ||
| 32 | namespace Core { | ||
| 33 | class System; | ||
| 34 | } | ||
| 35 | |||
| 32 | namespace InputCommon { | 36 | namespace InputCommon { |
| 33 | class InputSubsystem; | 37 | class InputSubsystem; |
| 34 | } | 38 | } |
| @@ -48,7 +52,8 @@ class ConfigureInputPlayer : public QWidget { | |||
| 48 | public: | 52 | public: |
| 49 | explicit ConfigureInputPlayer(QWidget* parent, std::size_t player_index, QWidget* bottom_row, | 53 | explicit ConfigureInputPlayer(QWidget* parent, std::size_t player_index, QWidget* bottom_row, |
| 50 | InputCommon::InputSubsystem* input_subsystem_, | 54 | InputCommon::InputSubsystem* input_subsystem_, |
| 51 | InputProfiles* profiles_, bool debug = false); | 55 | InputProfiles* profiles_, Core::System& system_, |
| 56 | bool debug = false); | ||
| 52 | ~ConfigureInputPlayer() override; | 57 | ~ConfigureInputPlayer() override; |
| 53 | 58 | ||
| 54 | /// Save all button configurations to settings file. | 59 | /// Save all button configurations to settings file. |
| @@ -233,4 +238,6 @@ private: | |||
| 233 | /// ConfigureInput widget. On show, add this widget to the main layout. This will change the | 238 | /// ConfigureInput widget. On show, add this widget to the main layout. This will change the |
| 234 | /// parent of the widget to this widget (but thats fine). | 239 | /// parent of the widget to this widget (but thats fine). |
| 235 | QWidget* bottom_row; | 240 | QWidget* bottom_row; |
| 241 | |||
| 242 | Core::System& system; | ||
| 236 | }; | 243 | }; |
diff --git a/src/yuzu/configuration/configure_input_profile_dialog.cpp b/src/yuzu/configuration/configure_input_profile_dialog.cpp index 1f5cfa75b..cd5a88cea 100644 --- a/src/yuzu/configuration/configure_input_profile_dialog.cpp +++ b/src/yuzu/configuration/configure_input_profile_dialog.cpp | |||
| @@ -2,14 +2,17 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "core/core.h" | ||
| 5 | #include "ui_configure_input_profile_dialog.h" | 6 | #include "ui_configure_input_profile_dialog.h" |
| 6 | #include "yuzu/configuration/configure_input_player.h" | 7 | #include "yuzu/configuration/configure_input_player.h" |
| 7 | #include "yuzu/configuration/configure_input_profile_dialog.h" | 8 | #include "yuzu/configuration/configure_input_profile_dialog.h" |
| 8 | 9 | ||
| 9 | ConfigureInputProfileDialog::ConfigureInputProfileDialog( | 10 | ConfigureInputProfileDialog::ConfigureInputProfileDialog( |
| 10 | QWidget* parent, InputCommon::InputSubsystem* input_subsystem, InputProfiles* profiles) | 11 | QWidget* parent, InputCommon::InputSubsystem* input_subsystem, InputProfiles* profiles, |
| 12 | Core::System& system) | ||
| 11 | : QDialog(parent), ui(std::make_unique<Ui::ConfigureInputProfileDialog>()), | 13 | : QDialog(parent), ui(std::make_unique<Ui::ConfigureInputProfileDialog>()), |
| 12 | profile_widget(new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles, false)) { | 14 | profile_widget( |
| 15 | new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles, system, false)) { | ||
| 13 | ui->setupUi(this); | 16 | ui->setupUi(this); |
| 14 | 17 | ||
| 15 | ui->controllerLayout->addWidget(profile_widget); | 18 | ui->controllerLayout->addWidget(profile_widget); |
diff --git a/src/yuzu/configuration/configure_input_profile_dialog.h b/src/yuzu/configuration/configure_input_profile_dialog.h index e6386bdbb..84b1f6d1a 100644 --- a/src/yuzu/configuration/configure_input_profile_dialog.h +++ b/src/yuzu/configuration/configure_input_profile_dialog.h | |||
| @@ -13,6 +13,10 @@ class ConfigureInputPlayer; | |||
| 13 | 13 | ||
| 14 | class InputProfiles; | 14 | class InputProfiles; |
| 15 | 15 | ||
| 16 | namespace Core { | ||
| 17 | class System; | ||
| 18 | } | ||
| 19 | |||
| 16 | namespace InputCommon { | 20 | namespace InputCommon { |
| 17 | class InputSubsystem; | 21 | class InputSubsystem; |
| 18 | } | 22 | } |
| @@ -27,7 +31,7 @@ class ConfigureInputProfileDialog : public QDialog { | |||
| 27 | public: | 31 | public: |
| 28 | explicit ConfigureInputProfileDialog(QWidget* parent, | 32 | explicit ConfigureInputProfileDialog(QWidget* parent, |
| 29 | InputCommon::InputSubsystem* input_subsystem, | 33 | InputCommon::InputSubsystem* input_subsystem, |
| 30 | InputProfiles* profiles); | 34 | InputProfiles* profiles, Core::System& system); |
| 31 | ~ConfigureInputProfileDialog() override; | 35 | ~ConfigureInputProfileDialog() override; |
| 32 | 36 | ||
| 33 | private: | 37 | private: |
diff --git a/src/yuzu/configuration/configure_network.cpp b/src/yuzu/configuration/configure_network.cpp index cc15d36c2..7020d2964 100644 --- a/src/yuzu/configuration/configure_network.cpp +++ b/src/yuzu/configuration/configure_network.cpp | |||
| @@ -10,8 +10,8 @@ | |||
| 10 | #include "ui_configure_network.h" | 10 | #include "ui_configure_network.h" |
| 11 | #include "yuzu/configuration/configure_network.h" | 11 | #include "yuzu/configuration/configure_network.h" |
| 12 | 12 | ||
| 13 | ConfigureNetwork::ConfigureNetwork(QWidget* parent) | 13 | ConfigureNetwork::ConfigureNetwork(const Core::System& system_, QWidget* parent) |
| 14 | : QWidget(parent), ui(std::make_unique<Ui::ConfigureNetwork>()) { | 14 | : QWidget(parent), ui(std::make_unique<Ui::ConfigureNetwork>()), system{system_} { |
| 15 | ui->setupUi(this); | 15 | ui->setupUi(this); |
| 16 | 16 | ||
| 17 | ui->network_interface->addItem(tr("None")); | 17 | ui->network_interface->addItem(tr("None")); |
| @@ -33,7 +33,7 @@ void ConfigureNetwork::RetranslateUi() { | |||
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | void ConfigureNetwork::SetConfiguration() { | 35 | void ConfigureNetwork::SetConfiguration() { |
| 36 | const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn(); | 36 | const bool runtime_lock = !system.IsPoweredOn(); |
| 37 | 37 | ||
| 38 | const std::string& network_interface = Settings::values.network_interface.GetValue(); | 38 | const std::string& network_interface = Settings::values.network_interface.GetValue(); |
| 39 | 39 | ||
diff --git a/src/yuzu/configuration/configure_network.h b/src/yuzu/configuration/configure_network.h index 028fd4acc..8507c62eb 100644 --- a/src/yuzu/configuration/configure_network.h +++ b/src/yuzu/configuration/configure_network.h | |||
| @@ -16,7 +16,7 @@ class ConfigureNetwork : public QWidget { | |||
| 16 | Q_OBJECT | 16 | Q_OBJECT |
| 17 | 17 | ||
| 18 | public: | 18 | public: |
| 19 | explicit ConfigureNetwork(QWidget* parent = nullptr); | 19 | explicit ConfigureNetwork(const Core::System& system_, QWidget* parent = nullptr); |
| 20 | ~ConfigureNetwork() override; | 20 | ~ConfigureNetwork() override; |
| 21 | 21 | ||
| 22 | void ApplyConfiguration(); | 22 | void ApplyConfiguration(); |
| @@ -26,4 +26,6 @@ private: | |||
| 26 | void SetConfiguration(); | 26 | void SetConfiguration(); |
| 27 | 27 | ||
| 28 | std::unique_ptr<Ui::ConfigureNetwork> ui; | 28 | std::unique_ptr<Ui::ConfigureNetwork> ui; |
| 29 | |||
| 30 | const Core::System& system; | ||
| 29 | }; | 31 | }; |
diff --git a/src/yuzu/configuration/configure_network.ui b/src/yuzu/configuration/configure_network.ui index 9a79262f0..f10e973b1 100644 --- a/src/yuzu/configuration/configure_network.ui +++ b/src/yuzu/configuration/configure_network.ui | |||
| @@ -13,6 +13,9 @@ | |||
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| 14 | <string>Form</string> | 14 | <string>Form</string> |
| 15 | </property> | 15 | </property> |
| 16 | <property name="accessibleName"> | ||
| 17 | <string>Network</string> | ||
| 18 | </property> | ||
| 16 | <layout class="QVBoxLayout" name="verticalLayout"> | 19 | <layout class="QVBoxLayout" name="verticalLayout"> |
| 17 | <item> | 20 | <item> |
| 18 | <layout class="QVBoxLayout" name="verticalLayout_3"> | 21 | <layout class="QVBoxLayout" name="verticalLayout_3"> |
diff --git a/src/yuzu/configuration/configure_per_game.cpp b/src/yuzu/configuration/configure_per_game.cpp index 8c00eec59..1031399e1 100644 --- a/src/yuzu/configuration/configure_per_game.cpp +++ b/src/yuzu/configuration/configure_per_game.cpp | |||
| @@ -30,32 +30,56 @@ | |||
| 30 | #include "core/loader/loader.h" | 30 | #include "core/loader/loader.h" |
| 31 | #include "ui_configure_per_game.h" | 31 | #include "ui_configure_per_game.h" |
| 32 | #include "yuzu/configuration/config.h" | 32 | #include "yuzu/configuration/config.h" |
| 33 | #include "yuzu/configuration/configure_audio.h" | ||
| 34 | #include "yuzu/configuration/configure_cpu.h" | ||
| 35 | #include "yuzu/configuration/configure_general.h" | ||
| 36 | #include "yuzu/configuration/configure_graphics.h" | ||
| 37 | #include "yuzu/configuration/configure_graphics_advanced.h" | ||
| 33 | #include "yuzu/configuration/configure_input.h" | 38 | #include "yuzu/configuration/configure_input.h" |
| 34 | #include "yuzu/configuration/configure_per_game.h" | 39 | #include "yuzu/configuration/configure_per_game.h" |
| 40 | #include "yuzu/configuration/configure_per_game_addons.h" | ||
| 41 | #include "yuzu/configuration/configure_system.h" | ||
| 35 | #include "yuzu/uisettings.h" | 42 | #include "yuzu/uisettings.h" |
| 36 | #include "yuzu/util/util.h" | 43 | #include "yuzu/util/util.h" |
| 37 | 44 | ||
| 38 | ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id, const std::string& file_name) | 45 | ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id, const std::string& file_name, |
| 39 | : QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()), title_id(title_id) { | 46 | Core::System& system_) |
| 47 | : QDialog(parent), ui(std::make_unique<Ui::ConfigurePerGame>()), | ||
| 48 | title_id(title_id), system{system_}, addons_tab{std::make_unique<ConfigurePerGameAddons>( | ||
| 49 | system_, this)}, | ||
| 50 | audio_tab{std::make_unique<ConfigureAudio>(system_, this)}, | ||
| 51 | cpu_tab{std::make_unique<ConfigureCpu>(system_, this)}, | ||
| 52 | general_tab{std::make_unique<ConfigureGeneral>(system_, this)}, | ||
| 53 | graphics_tab{std::make_unique<ConfigureGraphics>(system_, this)}, | ||
| 54 | graphics_advanced_tab{std::make_unique<ConfigureGraphicsAdvanced>(system_, this)}, | ||
| 55 | system_tab{std::make_unique<ConfigureSystem>(system_, this)} { | ||
| 40 | const auto file_path = std::filesystem::path(Common::FS::ToU8String(file_name)); | 56 | const auto file_path = std::filesystem::path(Common::FS::ToU8String(file_name)); |
| 41 | const auto config_file_name = title_id == 0 ? Common::FS::PathToUTF8String(file_path.filename()) | 57 | const auto config_file_name = title_id == 0 ? Common::FS::PathToUTF8String(file_path.filename()) |
| 42 | : fmt::format("{:016X}", title_id); | 58 | : fmt::format("{:016X}", title_id); |
| 43 | game_config = std::make_unique<Config>(config_file_name, Config::ConfigType::PerGameConfig); | 59 | game_config = |
| 44 | 60 | std::make_unique<Config>(system, config_file_name, Config::ConfigType::PerGameConfig); | |
| 45 | Settings::SetConfiguringGlobal(false); | ||
| 46 | 61 | ||
| 47 | ui->setupUi(this); | 62 | ui->setupUi(this); |
| 63 | |||
| 64 | ui->tabWidget->addTab(addons_tab.get(), tr("Add-Ons")); | ||
| 65 | ui->tabWidget->addTab(general_tab.get(), tr("General")); | ||
| 66 | ui->tabWidget->addTab(system_tab.get(), tr("System")); | ||
| 67 | ui->tabWidget->addTab(cpu_tab.get(), tr("CPU")); | ||
| 68 | ui->tabWidget->addTab(graphics_tab.get(), tr("Graphics")); | ||
| 69 | ui->tabWidget->addTab(graphics_advanced_tab.get(), tr("GraphicsAdvanced")); | ||
| 70 | ui->tabWidget->addTab(audio_tab.get(), tr("Audio")); | ||
| 71 | |||
| 48 | setFocusPolicy(Qt::ClickFocus); | 72 | setFocusPolicy(Qt::ClickFocus); |
| 49 | setWindowTitle(tr("Properties")); | 73 | setWindowTitle(tr("Properties")); |
| 50 | // remove Help question mark button from the title bar | 74 | // remove Help question mark button from the title bar |
| 51 | setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); | 75 | setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); |
| 52 | 76 | ||
| 53 | ui->addonsTab->SetTitleId(title_id); | 77 | addons_tab->SetTitleId(title_id); |
| 54 | 78 | ||
| 55 | scene = new QGraphicsScene; | 79 | scene = new QGraphicsScene; |
| 56 | ui->icon_view->setScene(scene); | 80 | ui->icon_view->setScene(scene); |
| 57 | 81 | ||
| 58 | if (Core::System::GetInstance().IsPoweredOn()) { | 82 | if (system.IsPoweredOn()) { |
| 59 | QPushButton* apply_button = ui->buttonBox->addButton(QDialogButtonBox::Apply); | 83 | QPushButton* apply_button = ui->buttonBox->addButton(QDialogButtonBox::Apply); |
| 60 | connect(apply_button, &QAbstractButton::clicked, this, | 84 | connect(apply_button, &QAbstractButton::clicked, this, |
| 61 | &ConfigurePerGame::HandleApplyButtonClicked); | 85 | &ConfigurePerGame::HandleApplyButtonClicked); |
| @@ -67,15 +91,15 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id, const std::str | |||
| 67 | ConfigurePerGame::~ConfigurePerGame() = default; | 91 | ConfigurePerGame::~ConfigurePerGame() = default; |
| 68 | 92 | ||
| 69 | void ConfigurePerGame::ApplyConfiguration() { | 93 | void ConfigurePerGame::ApplyConfiguration() { |
| 70 | ui->addonsTab->ApplyConfiguration(); | 94 | addons_tab->ApplyConfiguration(); |
| 71 | ui->generalTab->ApplyConfiguration(); | 95 | general_tab->ApplyConfiguration(); |
| 72 | ui->cpuTab->ApplyConfiguration(); | 96 | cpu_tab->ApplyConfiguration(); |
| 73 | ui->systemTab->ApplyConfiguration(); | 97 | system_tab->ApplyConfiguration(); |
| 74 | ui->graphicsTab->ApplyConfiguration(); | 98 | graphics_tab->ApplyConfiguration(); |
| 75 | ui->graphicsAdvancedTab->ApplyConfiguration(); | 99 | graphics_advanced_tab->ApplyConfiguration(); |
| 76 | ui->audioTab->ApplyConfiguration(); | 100 | audio_tab->ApplyConfiguration(); |
| 77 | 101 | ||
| 78 | Core::System::GetInstance().ApplySettings(); | 102 | system.ApplySettings(); |
| 79 | Settings::LogSettings(); | 103 | Settings::LogSettings(); |
| 80 | 104 | ||
| 81 | game_config->Save(); | 105 | game_config->Save(); |
| @@ -108,12 +132,11 @@ void ConfigurePerGame::LoadConfiguration() { | |||
| 108 | return; | 132 | return; |
| 109 | } | 133 | } |
| 110 | 134 | ||
| 111 | ui->addonsTab->LoadFromFile(file); | 135 | addons_tab->LoadFromFile(file); |
| 112 | 136 | ||
| 113 | ui->display_title_id->setText( | 137 | ui->display_title_id->setText( |
| 114 | QStringLiteral("%1").arg(title_id, 16, 16, QLatin1Char{'0'}).toUpper()); | 138 | QStringLiteral("%1").arg(title_id, 16, 16, QLatin1Char{'0'}).toUpper()); |
| 115 | 139 | ||
| 116 | auto& system = Core::System::GetInstance(); | ||
| 117 | const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), | 140 | const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), |
| 118 | system.GetContentProvider()}; | 141 | system.GetContentProvider()}; |
| 119 | const auto control = pm.GetControlMetadata(); | 142 | const auto control = pm.GetControlMetadata(); |
| @@ -164,4 +187,11 @@ void ConfigurePerGame::LoadConfiguration() { | |||
| 164 | 187 | ||
| 165 | const auto valueText = ReadableByteSize(file->GetSize()); | 188 | const auto valueText = ReadableByteSize(file->GetSize()); |
| 166 | ui->display_size->setText(valueText); | 189 | ui->display_size->setText(valueText); |
| 190 | |||
| 191 | general_tab->SetConfiguration(); | ||
| 192 | cpu_tab->SetConfiguration(); | ||
| 193 | system_tab->SetConfiguration(); | ||
| 194 | graphics_tab->SetConfiguration(); | ||
| 195 | graphics_advanced_tab->SetConfiguration(); | ||
| 196 | audio_tab->SetConfiguration(); | ||
| 167 | } | 197 | } |
diff --git a/src/yuzu/configuration/configure_per_game.h b/src/yuzu/configuration/configure_per_game.h index a2d0211a3..c1a57d87b 100644 --- a/src/yuzu/configuration/configure_per_game.h +++ b/src/yuzu/configuration/configure_per_game.h | |||
| @@ -14,6 +14,18 @@ | |||
| 14 | #include "core/file_sys/vfs_types.h" | 14 | #include "core/file_sys/vfs_types.h" |
| 15 | #include "yuzu/configuration/config.h" | 15 | #include "yuzu/configuration/config.h" |
| 16 | 16 | ||
| 17 | namespace Core { | ||
| 18 | class System; | ||
| 19 | } | ||
| 20 | |||
| 21 | class ConfigurePerGameAddons; | ||
| 22 | class ConfigureAudio; | ||
| 23 | class ConfigureCpu; | ||
| 24 | class ConfigureGeneral; | ||
| 25 | class ConfigureGraphics; | ||
| 26 | class ConfigureGraphicsAdvanced; | ||
| 27 | class ConfigureSystem; | ||
| 28 | |||
| 17 | class QGraphicsScene; | 29 | class QGraphicsScene; |
| 18 | class QStandardItem; | 30 | class QStandardItem; |
| 19 | class QStandardItemModel; | 31 | class QStandardItemModel; |
| @@ -29,7 +41,8 @@ class ConfigurePerGame : public QDialog { | |||
| 29 | 41 | ||
| 30 | public: | 42 | public: |
| 31 | // Cannot use std::filesystem::path due to https://bugreports.qt.io/browse/QTBUG-73263 | 43 | // Cannot use std::filesystem::path due to https://bugreports.qt.io/browse/QTBUG-73263 |
| 32 | explicit ConfigurePerGame(QWidget* parent, u64 title_id, const std::string& file_name); | 44 | explicit ConfigurePerGame(QWidget* parent, u64 title_id, const std::string& file_name, |
| 45 | Core::System& system_); | ||
| 33 | ~ConfigurePerGame() override; | 46 | ~ConfigurePerGame() override; |
| 34 | 47 | ||
| 35 | /// Save all button configurations to settings file | 48 | /// Save all button configurations to settings file |
| @@ -52,4 +65,14 @@ private: | |||
| 52 | QGraphicsScene* scene; | 65 | QGraphicsScene* scene; |
| 53 | 66 | ||
| 54 | std::unique_ptr<Config> game_config; | 67 | std::unique_ptr<Config> game_config; |
| 68 | |||
| 69 | Core::System& system; | ||
| 70 | |||
| 71 | std::unique_ptr<ConfigurePerGameAddons> addons_tab; | ||
| 72 | std::unique_ptr<ConfigureAudio> audio_tab; | ||
| 73 | std::unique_ptr<ConfigureCpu> cpu_tab; | ||
| 74 | std::unique_ptr<ConfigureGeneral> general_tab; | ||
| 75 | std::unique_ptr<ConfigureGraphics> graphics_tab; | ||
| 76 | std::unique_ptr<ConfigureGraphicsAdvanced> graphics_advanced_tab; | ||
| 77 | std::unique_ptr<ConfigureSystem> system_tab; | ||
| 55 | }; | 78 | }; |
diff --git a/src/yuzu/configuration/configure_per_game.ui b/src/yuzu/configuration/configure_per_game.ui index 7da14146b..60efdbf21 100644 --- a/src/yuzu/configuration/configure_per_game.ui +++ b/src/yuzu/configuration/configure_per_game.ui | |||
| @@ -7,12 +7,13 @@ | |||
| 7 | <x>0</x> | 7 | <x>0</x> |
| 8 | <y>0</y> | 8 | <y>0</y> |
| 9 | <width>900</width> | 9 | <width>900</width> |
| 10 | <height>600</height> | 10 | <height>630</height> |
| 11 | </rect> | 11 | </rect> |
| 12 | </property> | 12 | </property> |
| 13 | <property name="minimumSize"> | 13 | <property name="minimumSize"> |
| 14 | <size> | 14 | <size> |
| 15 | <width>900</width> | 15 | <width>900</width> |
| 16 | <height>0</height> | ||
| 16 | </size> | 17 | </size> |
| 17 | </property> | 18 | </property> |
| 18 | <property name="windowTitle"> | 19 | <property name="windowTitle"> |
| @@ -214,7 +215,7 @@ | |||
| 214 | <bool>true</bool> | 215 | <bool>true</bool> |
| 215 | </property> | 216 | </property> |
| 216 | <property name="currentIndex"> | 217 | <property name="currentIndex"> |
| 217 | <number>0</number> | 218 | <number>-1</number> |
| 218 | </property> | 219 | </property> |
| 219 | <property name="usesScrollButtons"> | 220 | <property name="usesScrollButtons"> |
| 220 | <bool>true</bool> | 221 | <bool>true</bool> |
| @@ -225,41 +226,6 @@ | |||
| 225 | <property name="tabsClosable"> | 226 | <property name="tabsClosable"> |
| 226 | <bool>false</bool> | 227 | <bool>false</bool> |
| 227 | </property> | 228 | </property> |
| 228 | <widget class="ConfigurePerGameAddons" name="addonsTab"> | ||
| 229 | <attribute name="title"> | ||
| 230 | <string>Add-Ons</string> | ||
| 231 | </attribute> | ||
| 232 | </widget> | ||
| 233 | <widget class="ConfigureGeneral" name="generalTab"> | ||
| 234 | <attribute name="title"> | ||
| 235 | <string>General</string> | ||
| 236 | </attribute> | ||
| 237 | </widget> | ||
| 238 | <widget class="ConfigureSystem" name="systemTab"> | ||
| 239 | <attribute name="title"> | ||
| 240 | <string>System</string> | ||
| 241 | </attribute> | ||
| 242 | </widget> | ||
| 243 | <widget class="ConfigureCpu" name="cpuTab"> | ||
| 244 | <attribute name="title"> | ||
| 245 | <string>CPU</string> | ||
| 246 | </attribute> | ||
| 247 | </widget> | ||
| 248 | <widget class="ConfigureGraphics" name="graphicsTab"> | ||
| 249 | <attribute name="title"> | ||
| 250 | <string>Graphics</string> | ||
| 251 | </attribute> | ||
| 252 | </widget> | ||
| 253 | <widget class="ConfigureGraphicsAdvanced" name="graphicsAdvancedTab"> | ||
| 254 | <attribute name="title"> | ||
| 255 | <string>Adv. Graphics</string> | ||
| 256 | </attribute> | ||
| 257 | </widget> | ||
| 258 | <widget class="ConfigureAudio" name="audioTab"> | ||
| 259 | <attribute name="title"> | ||
| 260 | <string>Audio</string> | ||
| 261 | </attribute> | ||
| 262 | </widget> | ||
| 263 | </widget> | 229 | </widget> |
| 264 | </item> | 230 | </item> |
| 265 | </layout> | 231 | </layout> |
| @@ -284,50 +250,6 @@ | |||
| 284 | </item> | 250 | </item> |
| 285 | </layout> | 251 | </layout> |
| 286 | </widget> | 252 | </widget> |
| 287 | <customwidgets> | ||
| 288 | <customwidget> | ||
| 289 | <class>ConfigureGeneral</class> | ||
| 290 | <extends>QWidget</extends> | ||
| 291 | <header>configuration/configure_general.h</header> | ||
| 292 | <container>1</container> | ||
| 293 | </customwidget> | ||
| 294 | <customwidget> | ||
| 295 | <class>ConfigureSystem</class> | ||
| 296 | <extends>QWidget</extends> | ||
| 297 | <header>configuration/configure_system.h</header> | ||
| 298 | <container>1</container> | ||
| 299 | </customwidget> | ||
| 300 | <customwidget> | ||
| 301 | <class>ConfigureAudio</class> | ||
| 302 | <extends>QWidget</extends> | ||
| 303 | <header>configuration/configure_audio.h</header> | ||
| 304 | <container>1</container> | ||
| 305 | </customwidget> | ||
| 306 | <customwidget> | ||
| 307 | <class>ConfigureGraphics</class> | ||
| 308 | <extends>QWidget</extends> | ||
| 309 | <header>configuration/configure_graphics.h</header> | ||
| 310 | <container>1</container> | ||
| 311 | </customwidget> | ||
| 312 | <customwidget> | ||
| 313 | <class>ConfigureGraphicsAdvanced</class> | ||
| 314 | <extends>QWidget</extends> | ||
| 315 | <header>configuration/configure_graphics_advanced.h</header> | ||
| 316 | <container>1</container> | ||
| 317 | </customwidget> | ||
| 318 | <customwidget> | ||
| 319 | <class>ConfigurePerGameAddons</class> | ||
| 320 | <extends>QWidget</extends> | ||
| 321 | <header>configuration/configure_per_game_addons.h</header> | ||
| 322 | <container>1</container> | ||
| 323 | </customwidget> | ||
| 324 | <customwidget> | ||
| 325 | <class>ConfigureCpu</class> | ||
| 326 | <extends>QWidget</extends> | ||
| 327 | <header>configuration/configure_cpu.h</header> | ||
| 328 | <container>1</container> | ||
| 329 | </customwidget> | ||
| 330 | </customwidgets> | ||
| 331 | <resources/> | 253 | <resources/> |
| 332 | <connections> | 254 | <connections> |
| 333 | <connection> | 255 | <connection> |
| @@ -335,12 +257,32 @@ | |||
| 335 | <signal>accepted()</signal> | 257 | <signal>accepted()</signal> |
| 336 | <receiver>ConfigurePerGame</receiver> | 258 | <receiver>ConfigurePerGame</receiver> |
| 337 | <slot>accept()</slot> | 259 | <slot>accept()</slot> |
| 260 | <hints> | ||
| 261 | <hint type="sourcelabel"> | ||
| 262 | <x>20</x> | ||
| 263 | <y>20</y> | ||
| 264 | </hint> | ||
| 265 | <hint type="destinationlabel"> | ||
| 266 | <x>20</x> | ||
| 267 | <y>20</y> | ||
| 268 | </hint> | ||
| 269 | </hints> | ||
| 338 | </connection> | 270 | </connection> |
| 339 | <connection> | 271 | <connection> |
| 340 | <sender>buttonBox</sender> | 272 | <sender>buttonBox</sender> |
| 341 | <signal>rejected()</signal> | 273 | <signal>rejected()</signal> |
| 342 | <receiver>ConfigurePerGame</receiver> | 274 | <receiver>ConfigurePerGame</receiver> |
| 343 | <slot>reject()</slot> | 275 | <slot>reject()</slot> |
| 276 | <hints> | ||
| 277 | <hint type="sourcelabel"> | ||
| 278 | <x>20</x> | ||
| 279 | <y>20</y> | ||
| 280 | </hint> | ||
| 281 | <hint type="destinationlabel"> | ||
| 282 | <x>20</x> | ||
| 283 | <y>20</y> | ||
| 284 | </hint> | ||
| 285 | </hints> | ||
| 344 | </connection> | 286 | </connection> |
| 345 | </connections> | 287 | </connections> |
| 346 | </ui> | 288 | </ui> |
diff --git a/src/yuzu/configuration/configure_per_game_addons.cpp b/src/yuzu/configuration/configure_per_game_addons.cpp index ebb0f411c..c8de8e2ff 100644 --- a/src/yuzu/configuration/configure_per_game_addons.cpp +++ b/src/yuzu/configuration/configure_per_game_addons.cpp | |||
| @@ -26,8 +26,8 @@ | |||
| 26 | #include "yuzu/uisettings.h" | 26 | #include "yuzu/uisettings.h" |
| 27 | #include "yuzu/util/util.h" | 27 | #include "yuzu/util/util.h" |
| 28 | 28 | ||
| 29 | ConfigurePerGameAddons::ConfigurePerGameAddons(QWidget* parent) | 29 | ConfigurePerGameAddons::ConfigurePerGameAddons(Core::System& system_, QWidget* parent) |
| 30 | : QWidget(parent), ui(new Ui::ConfigurePerGameAddons) { | 30 | : QWidget(parent), ui(new Ui::ConfigurePerGameAddons), system{system_} { |
| 31 | ui->setupUi(this); | 31 | ui->setupUi(this); |
| 32 | 32 | ||
| 33 | layout = new QVBoxLayout; | 33 | layout = new QVBoxLayout; |
| @@ -58,7 +58,7 @@ ConfigurePerGameAddons::ConfigurePerGameAddons(QWidget* parent) | |||
| 58 | 58 | ||
| 59 | ui->scrollArea->setLayout(layout); | 59 | ui->scrollArea->setLayout(layout); |
| 60 | 60 | ||
| 61 | ui->scrollArea->setEnabled(!Core::System::GetInstance().IsPoweredOn()); | 61 | ui->scrollArea->setEnabled(!system.IsPoweredOn()); |
| 62 | 62 | ||
| 63 | connect(item_model, &QStandardItemModel::itemChanged, | 63 | connect(item_model, &QStandardItemModel::itemChanged, |
| 64 | [] { UISettings::values.is_game_list_reload_pending.exchange(true); }); | 64 | [] { UISettings::values.is_game_list_reload_pending.exchange(true); }); |
| @@ -112,7 +112,6 @@ void ConfigurePerGameAddons::LoadConfiguration() { | |||
| 112 | return; | 112 | return; |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | auto& system = Core::System::GetInstance(); | ||
| 116 | const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), | 115 | const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), |
| 117 | system.GetContentProvider()}; | 116 | system.GetContentProvider()}; |
| 118 | const auto loader = Loader::GetLoader(system, file); | 117 | const auto loader = Loader::GetLoader(system, file); |
diff --git a/src/yuzu/configuration/configure_per_game_addons.h b/src/yuzu/configuration/configure_per_game_addons.h index a00ec3539..24b017494 100644 --- a/src/yuzu/configuration/configure_per_game_addons.h +++ b/src/yuzu/configuration/configure_per_game_addons.h | |||
| @@ -11,6 +11,10 @@ | |||
| 11 | 11 | ||
| 12 | #include "core/file_sys/vfs_types.h" | 12 | #include "core/file_sys/vfs_types.h" |
| 13 | 13 | ||
| 14 | namespace Core { | ||
| 15 | class System; | ||
| 16 | } | ||
| 17 | |||
| 14 | class QGraphicsScene; | 18 | class QGraphicsScene; |
| 15 | class QStandardItem; | 19 | class QStandardItem; |
| 16 | class QStandardItemModel; | 20 | class QStandardItemModel; |
| @@ -25,7 +29,7 @@ class ConfigurePerGameAddons : public QWidget { | |||
| 25 | Q_OBJECT | 29 | Q_OBJECT |
| 26 | 30 | ||
| 27 | public: | 31 | public: |
| 28 | explicit ConfigurePerGameAddons(QWidget* parent = nullptr); | 32 | explicit ConfigurePerGameAddons(Core::System& system_, QWidget* parent = nullptr); |
| 29 | ~ConfigurePerGameAddons() override; | 33 | ~ConfigurePerGameAddons() override; |
| 30 | 34 | ||
| 31 | /// Save all button configurations to settings file | 35 | /// Save all button configurations to settings file |
| @@ -50,4 +54,6 @@ private: | |||
| 50 | QStandardItemModel* item_model; | 54 | QStandardItemModel* item_model; |
| 51 | 55 | ||
| 52 | std::vector<QList<QStandardItem*>> list_items; | 56 | std::vector<QList<QStandardItem*>> list_items; |
| 57 | |||
| 58 | Core::System& system; | ||
| 53 | }; | 59 | }; |
diff --git a/src/yuzu/configuration/configure_per_game_addons.ui b/src/yuzu/configuration/configure_per_game_addons.ui index aefdebfcd..f9cf6f2c3 100644 --- a/src/yuzu/configuration/configure_per_game_addons.ui +++ b/src/yuzu/configuration/configure_per_game_addons.ui | |||
| @@ -13,6 +13,9 @@ | |||
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| 14 | <string>Form</string> | 14 | <string>Form</string> |
| 15 | </property> | 15 | </property> |
| 16 | <property name="accessibleDescription"> | ||
| 17 | <string>Add-Ons</string> | ||
| 18 | </property> | ||
| 16 | <layout class="QGridLayout" name="gridLayout"> | 19 | <layout class="QGridLayout" name="gridLayout"> |
| 17 | <item row="0" column="0"> | 20 | <item row="0" column="0"> |
| 18 | <widget class="QScrollArea" name="scrollArea"> | 21 | <widget class="QScrollArea" name="scrollArea"> |
diff --git a/src/yuzu/configuration/configure_profile_manager.cpp b/src/yuzu/configuration/configure_profile_manager.cpp index 136614bf8..9feec37ff 100644 --- a/src/yuzu/configuration/configure_profile_manager.cpp +++ b/src/yuzu/configuration/configure_profile_manager.cpp | |||
| @@ -76,9 +76,9 @@ QString GetProfileUsernameFromUser(QWidget* parent, const QString& description_t | |||
| 76 | } | 76 | } |
| 77 | } // Anonymous namespace | 77 | } // Anonymous namespace |
| 78 | 78 | ||
| 79 | ConfigureProfileManager::ConfigureProfileManager(QWidget* parent) | 79 | ConfigureProfileManager::ConfigureProfileManager(const Core::System& system_, QWidget* parent) |
| 80 | : QWidget(parent), ui(new Ui::ConfigureProfileManager), | 80 | : QWidget(parent), ui(new Ui::ConfigureProfileManager), |
| 81 | profile_manager(std::make_unique<Service::Account::ProfileManager>()) { | 81 | profile_manager(std::make_unique<Service::Account::ProfileManager>()), system{system_} { |
| 82 | ui->setupUi(this); | 82 | ui->setupUi(this); |
| 83 | 83 | ||
| 84 | tree_view = new QTreeView; | 84 | tree_view = new QTreeView; |
| @@ -137,7 +137,7 @@ void ConfigureProfileManager::RetranslateUI() { | |||
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | void ConfigureProfileManager::SetConfiguration() { | 139 | void ConfigureProfileManager::SetConfiguration() { |
| 140 | enabled = !Core::System::GetInstance().IsPoweredOn(); | 140 | enabled = !system.IsPoweredOn(); |
| 141 | item_model->removeRows(0, item_model->rowCount()); | 141 | item_model->removeRows(0, item_model->rowCount()); |
| 142 | list_items.clear(); | 142 | list_items.clear(); |
| 143 | 143 | ||
| @@ -180,8 +180,6 @@ void ConfigureProfileManager::ApplyConfiguration() { | |||
| 180 | if (!enabled) { | 180 | if (!enabled) { |
| 181 | return; | 181 | return; |
| 182 | } | 182 | } |
| 183 | |||
| 184 | Core::System::GetInstance().ApplySettings(); | ||
| 185 | } | 183 | } |
| 186 | 184 | ||
| 187 | void ConfigureProfileManager::SelectUser(const QModelIndex& index) { | 185 | void ConfigureProfileManager::SelectUser(const QModelIndex& index) { |
diff --git a/src/yuzu/configuration/configure_profile_manager.h b/src/yuzu/configuration/configure_profile_manager.h index 0a9bca2a6..575cb89d5 100644 --- a/src/yuzu/configuration/configure_profile_manager.h +++ b/src/yuzu/configuration/configure_profile_manager.h | |||
| @@ -9,6 +9,10 @@ | |||
| 9 | #include <QList> | 9 | #include <QList> |
| 10 | #include <QWidget> | 10 | #include <QWidget> |
| 11 | 11 | ||
| 12 | namespace Core { | ||
| 13 | class System; | ||
| 14 | } | ||
| 15 | |||
| 12 | class QGraphicsScene; | 16 | class QGraphicsScene; |
| 13 | class QStandardItem; | 17 | class QStandardItem; |
| 14 | class QStandardItemModel; | 18 | class QStandardItemModel; |
| @@ -27,7 +31,7 @@ class ConfigureProfileManager : public QWidget { | |||
| 27 | Q_OBJECT | 31 | Q_OBJECT |
| 28 | 32 | ||
| 29 | public: | 33 | public: |
| 30 | explicit ConfigureProfileManager(QWidget* parent = nullptr); | 34 | explicit ConfigureProfileManager(const Core::System& system_, QWidget* parent = nullptr); |
| 31 | ~ConfigureProfileManager() override; | 35 | ~ConfigureProfileManager() override; |
| 32 | 36 | ||
| 33 | void ApplyConfiguration(); | 37 | void ApplyConfiguration(); |
| @@ -58,4 +62,6 @@ private: | |||
| 58 | bool enabled = false; | 62 | bool enabled = false; |
| 59 | 63 | ||
| 60 | std::unique_ptr<Service::Account::ProfileManager> profile_manager; | 64 | std::unique_ptr<Service::Account::ProfileManager> profile_manager; |
| 65 | |||
| 66 | const Core::System& system; | ||
| 61 | }; | 67 | }; |
diff --git a/src/yuzu/configuration/configure_profile_manager.ui b/src/yuzu/configuration/configure_profile_manager.ui index dedba4998..cfe7478c8 100644 --- a/src/yuzu/configuration/configure_profile_manager.ui +++ b/src/yuzu/configuration/configure_profile_manager.ui | |||
| @@ -6,13 +6,16 @@ | |||
| 6 | <rect> | 6 | <rect> |
| 7 | <x>0</x> | 7 | <x>0</x> |
| 8 | <y>0</y> | 8 | <y>0</y> |
| 9 | <width>366</width> | 9 | <width>390</width> |
| 10 | <height>483</height> | 10 | <height>483</height> |
| 11 | </rect> | 11 | </rect> |
| 12 | </property> | 12 | </property> |
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| 14 | <string>Form</string> | 14 | <string>Form</string> |
| 15 | </property> | 15 | </property> |
| 16 | <property name="accessibleName"> | ||
| 17 | <string>Profiles</string> | ||
| 18 | </property> | ||
| 16 | <layout class="QHBoxLayout" name="horizontalLayout"> | 19 | <layout class="QHBoxLayout" name="horizontalLayout"> |
| 17 | <item> | 20 | <item> |
| 18 | <layout class="QVBoxLayout" name="verticalLayout"> | 21 | <layout class="QVBoxLayout" name="verticalLayout"> |
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 24a67ad46..33eb059a3 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp | |||
| @@ -17,7 +17,8 @@ | |||
| 17 | #include "yuzu/configuration/configuration_shared.h" | 17 | #include "yuzu/configuration/configuration_shared.h" |
| 18 | #include "yuzu/configuration/configure_system.h" | 18 | #include "yuzu/configuration/configure_system.h" |
| 19 | 19 | ||
| 20 | ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureSystem) { | 20 | ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent) |
| 21 | : QWidget(parent), ui(new Ui::ConfigureSystem), system{system_} { | ||
| 21 | ui->setupUi(this); | 22 | ui->setupUi(this); |
| 22 | connect(ui->button_regenerate_console_id, &QPushButton::clicked, this, | 23 | connect(ui->button_regenerate_console_id, &QPushButton::clicked, this, |
| 23 | &ConfigureSystem::RefreshConsoleID); | 24 | &ConfigureSystem::RefreshConsoleID); |
| @@ -59,7 +60,7 @@ void ConfigureSystem::RetranslateUI() { | |||
| 59 | } | 60 | } |
| 60 | 61 | ||
| 61 | void ConfigureSystem::SetConfiguration() { | 62 | void ConfigureSystem::SetConfiguration() { |
| 62 | enabled = !Core::System::GetInstance().IsPoweredOn(); | 63 | enabled = !system.IsPoweredOn(); |
| 63 | const auto rng_seed = | 64 | const auto rng_seed = |
| 64 | QStringLiteral("%1") | 65 | QStringLiteral("%1") |
| 65 | .arg(Settings::values.rng_seed.GetValue().value_or(0), 8, 16, QLatin1Char{'0'}) | 66 | .arg(Settings::values.rng_seed.GetValue().value_or(0), 8, 16, QLatin1Char{'0'}) |
| @@ -103,8 +104,6 @@ void ConfigureSystem::SetConfiguration() { | |||
| 103 | void ConfigureSystem::ReadSystemSettings() {} | 104 | void ConfigureSystem::ReadSystemSettings() {} |
| 104 | 105 | ||
| 105 | void ConfigureSystem::ApplyConfiguration() { | 106 | void ConfigureSystem::ApplyConfiguration() { |
| 106 | auto& system = Core::System::GetInstance(); | ||
| 107 | |||
| 108 | // Allow setting custom RTC even if system is powered on, | 107 | // Allow setting custom RTC even if system is powered on, |
| 109 | // to allow in-game time to be fast forwarded | 108 | // to allow in-game time to be fast forwarded |
| 110 | if (Settings::IsConfiguringGlobal()) { | 109 | if (Settings::IsConfiguringGlobal()) { |
| @@ -162,8 +161,6 @@ void ConfigureSystem::ApplyConfiguration() { | |||
| 162 | break; | 161 | break; |
| 163 | } | 162 | } |
| 164 | } | 163 | } |
| 165 | |||
| 166 | system.ApplySettings(); | ||
| 167 | } | 164 | } |
| 168 | 165 | ||
| 169 | void ConfigureSystem::RefreshConsoleID() { | 166 | void ConfigureSystem::RefreshConsoleID() { |
diff --git a/src/yuzu/configuration/configure_system.h b/src/yuzu/configuration/configure_system.h index fc5cd2945..bb24c9ae7 100644 --- a/src/yuzu/configuration/configure_system.h +++ b/src/yuzu/configuration/configure_system.h | |||
| @@ -9,6 +9,10 @@ | |||
| 9 | #include <QList> | 9 | #include <QList> |
| 10 | #include <QWidget> | 10 | #include <QWidget> |
| 11 | 11 | ||
| 12 | namespace Core { | ||
| 13 | class System; | ||
| 14 | } | ||
| 15 | |||
| 12 | namespace ConfigurationShared { | 16 | namespace ConfigurationShared { |
| 13 | enum class CheckState; | 17 | enum class CheckState; |
| 14 | } | 18 | } |
| @@ -21,17 +25,16 @@ class ConfigureSystem : public QWidget { | |||
| 21 | Q_OBJECT | 25 | Q_OBJECT |
| 22 | 26 | ||
| 23 | public: | 27 | public: |
| 24 | explicit ConfigureSystem(QWidget* parent = nullptr); | 28 | explicit ConfigureSystem(Core::System& system_, QWidget* parent = nullptr); |
| 25 | ~ConfigureSystem() override; | 29 | ~ConfigureSystem() override; |
| 26 | 30 | ||
| 27 | void ApplyConfiguration(); | 31 | void ApplyConfiguration(); |
| 32 | void SetConfiguration(); | ||
| 28 | 33 | ||
| 29 | private: | 34 | private: |
| 30 | void changeEvent(QEvent* event) override; | 35 | void changeEvent(QEvent* event) override; |
| 31 | void RetranslateUI(); | 36 | void RetranslateUI(); |
| 32 | 37 | ||
| 33 | void SetConfiguration(); | ||
| 34 | |||
| 35 | void ReadSystemSettings(); | 38 | void ReadSystemSettings(); |
| 36 | 39 | ||
| 37 | void RefreshConsoleID(); | 40 | void RefreshConsoleID(); |
| @@ -48,4 +51,6 @@ private: | |||
| 48 | 51 | ||
| 49 | ConfigurationShared::CheckState use_rng_seed; | 52 | ConfigurationShared::CheckState use_rng_seed; |
| 50 | ConfigurationShared::CheckState use_custom_rtc; | 53 | ConfigurationShared::CheckState use_custom_rtc; |
| 54 | |||
| 55 | Core::System& system; | ||
| 51 | }; | 56 | }; |
diff --git a/src/yuzu/configuration/configure_system.ui b/src/yuzu/configuration/configure_system.ui index 27f552f59..5b68dcb29 100644 --- a/src/yuzu/configuration/configure_system.ui +++ b/src/yuzu/configuration/configure_system.ui | |||
| @@ -13,6 +13,9 @@ | |||
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| 14 | <string>Form</string> | 14 | <string>Form</string> |
| 15 | </property> | 15 | </property> |
| 16 | <property name="accessibleName"> | ||
| 17 | <string>System</string> | ||
| 18 | </property> | ||
| 16 | <layout class="QHBoxLayout" name="horizontalLayout"> | 19 | <layout class="QHBoxLayout" name="horizontalLayout"> |
| 17 | <item> | 20 | <item> |
| 18 | <layout class="QVBoxLayout" name="verticalLayout"> | 21 | <layout class="QVBoxLayout" name="verticalLayout"> |
diff --git a/src/yuzu/configuration/configure_ui.cpp b/src/yuzu/configuration/configure_ui.cpp index 9d7d51126..d01895bf2 100644 --- a/src/yuzu/configuration/configure_ui.cpp +++ b/src/yuzu/configuration/configure_ui.cpp | |||
| @@ -54,7 +54,8 @@ QString GetTranslatedRowTextName(size_t index) { | |||
| 54 | } | 54 | } |
| 55 | } // Anonymous namespace | 55 | } // Anonymous namespace |
| 56 | 56 | ||
| 57 | ConfigureUi::ConfigureUi(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureUi) { | 57 | ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent) |
| 58 | : QWidget(parent), ui(new Ui::ConfigureUi), system{system_} { | ||
| 58 | ui->setupUi(this); | 59 | ui->setupUi(this); |
| 59 | 60 | ||
| 60 | InitializeLanguageComboBox(); | 61 | InitializeLanguageComboBox(); |
| @@ -116,7 +117,7 @@ void ConfigureUi::ApplyConfiguration() { | |||
| 116 | UISettings::values.enable_screenshot_save_as = ui->enable_screenshot_save_as->isChecked(); | 117 | UISettings::values.enable_screenshot_save_as = ui->enable_screenshot_save_as->isChecked(); |
| 117 | Common::FS::SetYuzuPath(Common::FS::YuzuPath::ScreenshotsDir, | 118 | Common::FS::SetYuzuPath(Common::FS::YuzuPath::ScreenshotsDir, |
| 118 | ui->screenshot_path_edit->text().toStdString()); | 119 | ui->screenshot_path_edit->text().toStdString()); |
| 119 | Core::System::GetInstance().ApplySettings(); | 120 | system.ApplySettings(); |
| 120 | } | 121 | } |
| 121 | 122 | ||
| 122 | void ConfigureUi::RequestGameListUpdate() { | 123 | void ConfigureUi::RequestGameListUpdate() { |
diff --git a/src/yuzu/configuration/configure_ui.h b/src/yuzu/configuration/configure_ui.h index c30bcf6ff..48b6e6d82 100644 --- a/src/yuzu/configuration/configure_ui.h +++ b/src/yuzu/configuration/configure_ui.h | |||
| @@ -7,6 +7,10 @@ | |||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <QWidget> | 8 | #include <QWidget> |
| 9 | 9 | ||
| 10 | namespace Core { | ||
| 11 | class System; | ||
| 12 | } | ||
| 13 | |||
| 10 | namespace Ui { | 14 | namespace Ui { |
| 11 | class ConfigureUi; | 15 | class ConfigureUi; |
| 12 | } | 16 | } |
| @@ -15,7 +19,7 @@ class ConfigureUi : public QWidget { | |||
| 15 | Q_OBJECT | 19 | Q_OBJECT |
| 16 | 20 | ||
| 17 | public: | 21 | public: |
| 18 | explicit ConfigureUi(QWidget* parent = nullptr); | 22 | explicit ConfigureUi(Core::System& system_, QWidget* parent = nullptr); |
| 19 | ~ConfigureUi() override; | 23 | ~ConfigureUi() override; |
| 20 | 24 | ||
| 21 | void ApplyConfiguration(); | 25 | void ApplyConfiguration(); |
| @@ -42,4 +46,6 @@ private: | |||
| 42 | void UpdateSecondRowComboBox(bool init = false); | 46 | void UpdateSecondRowComboBox(bool init = false); |
| 43 | 47 | ||
| 44 | std::unique_ptr<Ui::ConfigureUi> ui; | 48 | std::unique_ptr<Ui::ConfigureUi> ui; |
| 49 | |||
| 50 | Core::System& system; | ||
| 45 | }; | 51 | }; |
diff --git a/src/yuzu/configuration/configure_ui.ui b/src/yuzu/configuration/configure_ui.ui index 394f9fe04..a50df7f6f 100644 --- a/src/yuzu/configuration/configure_ui.ui +++ b/src/yuzu/configuration/configure_ui.ui | |||
| @@ -7,12 +7,15 @@ | |||
| 7 | <x>0</x> | 7 | <x>0</x> |
| 8 | <y>0</y> | 8 | <y>0</y> |
| 9 | <width>363</width> | 9 | <width>363</width> |
| 10 | <height>391</height> | 10 | <height>507</height> |
| 11 | </rect> | 11 | </rect> |
| 12 | </property> | 12 | </property> |
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| 14 | <string>Form</string> | 14 | <string>Form</string> |
| 15 | </property> | 15 | </property> |
| 16 | <property name="accessibleName"> | ||
| 17 | <string>UI</string> | ||
| 18 | </property> | ||
| 16 | <layout class="QVBoxLayout" name="verticalLayout"> | 19 | <layout class="QVBoxLayout" name="verticalLayout"> |
| 17 | <item> | 20 | <item> |
| 18 | <widget class="QGroupBox" name="general_groupBox"> | 21 | <widget class="QGroupBox" name="general_groupBox"> |
diff --git a/src/yuzu/configuration/configure_web.ui b/src/yuzu/configuration/configure_web.ui index 8c07d1165..35b4274b0 100644 --- a/src/yuzu/configuration/configure_web.ui +++ b/src/yuzu/configuration/configure_web.ui | |||
| @@ -13,6 +13,9 @@ | |||
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| 14 | <string>Form</string> | 14 | <string>Form</string> |
| 15 | </property> | 15 | </property> |
| 16 | <property name="accessibleName"> | ||
| 17 | <string>Web</string> | ||
| 18 | </property> | ||
| 16 | <layout class="QVBoxLayout" name="verticalLayout"> | 19 | <layout class="QVBoxLayout" name="verticalLayout"> |
| 17 | <item> | 20 | <item> |
| 18 | <layout class="QVBoxLayout" name="verticalLayout_3"> | 21 | <layout class="QVBoxLayout" name="verticalLayout_3"> |
| @@ -55,7 +58,7 @@ | |||
| 55 | </widget> | 58 | </widget> |
| 56 | </item> | 59 | </item> |
| 57 | <item row="0" column="1" colspan="3"> | 60 | <item row="0" column="1" colspan="3"> |
| 58 | <widget class="QLabel" name="username" /> | 61 | <widget class="QLabel" name="username"/> |
| 59 | </item> | 62 | </item> |
| 60 | <item row="1" column="0"> | 63 | <item row="1" column="0"> |
| 61 | <widget class="QLabel" name="label_token"> | 64 | <widget class="QLabel" name="label_token"> |
| @@ -65,8 +68,7 @@ | |||
| 65 | </widget> | 68 | </widget> |
| 66 | </item> | 69 | </item> |
| 67 | <item row="1" column="4"> | 70 | <item row="1" column="4"> |
| 68 | <widget class="QLabel" name="label_token_verified"> | 71 | <widget class="QLabel" name="label_token_verified"/> |
| 69 | </widget> | ||
| 70 | </item> | 72 | </item> |
| 71 | <item row="0" column="0"> | 73 | <item row="0" column="0"> |
| 72 | <widget class="QLabel" name="label_username"> | 74 | <widget class="QLabel" name="label_username"> |
| @@ -163,20 +165,20 @@ | |||
| 163 | </layout> | 165 | </layout> |
| 164 | </item> | 166 | </item> |
| 165 | <item> | 167 | <item> |
| 166 | <widget class="QGroupBox" name="discord_group"> | 168 | <widget class="QGroupBox" name="discord_group"> |
| 167 | <property name="title"> | 169 | <property name="title"> |
| 168 | <string>Discord Presence</string> | 170 | <string>Discord Presence</string> |
| 169 | </property> | 171 | </property> |
| 170 | <layout class="QVBoxLayout" name="verticalLayout_21"> | 172 | <layout class="QVBoxLayout" name="verticalLayout_21"> |
| 171 | <item> | 173 | <item> |
| 172 | <widget class="QCheckBox" name="toggle_discordrpc"> | 174 | <widget class="QCheckBox" name="toggle_discordrpc"> |
| 173 | <property name="text"> | 175 | <property name="text"> |
| 174 | <string>Show Current Game in your Discord Status</string> | 176 | <string>Show Current Game in your Discord Status</string> |
| 175 | </property> | 177 | </property> |
| 176 | </widget> | 178 | </widget> |
| 177 | </item> | 179 | </item> |
| 178 | </layout> | 180 | </layout> |
| 179 | </widget> | 181 | </widget> |
| 180 | </item> | 182 | </item> |
| 181 | <item> | 183 | <item> |
| 182 | <spacer name="verticalSpacer"> | 184 | <spacer name="verticalSpacer"> |
diff --git a/src/yuzu/configuration/input_profiles.cpp b/src/yuzu/configuration/input_profiles.cpp index 333eeb84e..38ea6c772 100644 --- a/src/yuzu/configuration/input_profiles.cpp +++ b/src/yuzu/configuration/input_profiles.cpp | |||
| @@ -28,7 +28,7 @@ std::filesystem::path GetNameWithoutExtension(std::filesystem::path filename) { | |||
| 28 | 28 | ||
| 29 | } // namespace | 29 | } // namespace |
| 30 | 30 | ||
| 31 | InputProfiles::InputProfiles() { | 31 | InputProfiles::InputProfiles(Core::System& system_) : system{system_} { |
| 32 | const auto input_profile_loc = FS::GetYuzuPath(FS::YuzuPath::ConfigDir) / "input"; | 32 | const auto input_profile_loc = FS::GetYuzuPath(FS::YuzuPath::ConfigDir) / "input"; |
| 33 | 33 | ||
| 34 | if (!FS::IsDir(input_profile_loc)) { | 34 | if (!FS::IsDir(input_profile_loc)) { |
| @@ -44,8 +44,8 @@ InputProfiles::InputProfiles() { | |||
| 44 | 44 | ||
| 45 | if (IsINI(filename) && IsProfileNameValid(name_without_ext)) { | 45 | if (IsINI(filename) && IsProfileNameValid(name_without_ext)) { |
| 46 | map_profiles.insert_or_assign( | 46 | map_profiles.insert_or_assign( |
| 47 | name_without_ext, | 47 | name_without_ext, std::make_unique<Config>(system, name_without_ext, |
| 48 | std::make_unique<Config>(name_without_ext, Config::ConfigType::InputProfile)); | 48 | Config::ConfigType::InputProfile)); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | return true; | 51 | return true; |
| @@ -81,7 +81,8 @@ bool InputProfiles::CreateProfile(const std::string& profile_name, std::size_t p | |||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | map_profiles.insert_or_assign( | 83 | map_profiles.insert_or_assign( |
| 84 | profile_name, std::make_unique<Config>(profile_name, Config::ConfigType::InputProfile)); | 84 | profile_name, |
| 85 | std::make_unique<Config>(system, profile_name, Config::ConfigType::InputProfile)); | ||
| 85 | 86 | ||
| 86 | return SaveProfile(profile_name, player_index); | 87 | return SaveProfile(profile_name, player_index); |
| 87 | } | 88 | } |
diff --git a/src/yuzu/configuration/input_profiles.h b/src/yuzu/configuration/input_profiles.h index cb41fd9be..a567bd5a9 100644 --- a/src/yuzu/configuration/input_profiles.h +++ b/src/yuzu/configuration/input_profiles.h | |||
| @@ -8,12 +8,16 @@ | |||
| 8 | #include <string_view> | 8 | #include <string_view> |
| 9 | #include <unordered_map> | 9 | #include <unordered_map> |
| 10 | 10 | ||
| 11 | namespace Core { | ||
| 12 | class System; | ||
| 13 | } | ||
| 14 | |||
| 11 | class Config; | 15 | class Config; |
| 12 | 16 | ||
| 13 | class InputProfiles { | 17 | class InputProfiles { |
| 14 | 18 | ||
| 15 | public: | 19 | public: |
| 16 | explicit InputProfiles(); | 20 | explicit InputProfiles(Core::System& system_); |
| 17 | virtual ~InputProfiles(); | 21 | virtual ~InputProfiles(); |
| 18 | 22 | ||
| 19 | std::vector<std::string> GetInputProfileNames(); | 23 | std::vector<std::string> GetInputProfileNames(); |
| @@ -29,4 +33,6 @@ private: | |||
| 29 | bool ProfileExistsInMap(const std::string& profile_name) const; | 33 | bool ProfileExistsInMap(const std::string& profile_name) const; |
| 30 | 34 | ||
| 31 | std::unordered_map<std::string, std::unique_ptr<Config>> map_profiles; | 35 | std::unordered_map<std::string, std::unique_ptr<Config>> map_profiles; |
| 36 | |||
| 37 | Core::System& system; | ||
| 32 | }; | 38 | }; |
diff --git a/src/yuzu/debugger/wait_tree.cpp b/src/yuzu/debugger/wait_tree.cpp index bdfda6c54..1f41c46c4 100644 --- a/src/yuzu/debugger/wait_tree.cpp +++ b/src/yuzu/debugger/wait_tree.cpp | |||
| @@ -89,20 +89,20 @@ std::size_t WaitTreeItem::Row() const { | |||
| 89 | return row; | 89 | return row; |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | std::vector<std::unique_ptr<WaitTreeThread>> WaitTreeItem::MakeThreadItemList() { | 92 | std::vector<std::unique_ptr<WaitTreeThread>> WaitTreeItem::MakeThreadItemList( |
| 93 | Core::System& system) { | ||
| 93 | std::vector<std::unique_ptr<WaitTreeThread>> item_list; | 94 | std::vector<std::unique_ptr<WaitTreeThread>> item_list; |
| 94 | std::size_t row = 0; | 95 | std::size_t row = 0; |
| 95 | auto add_threads = [&](const std::vector<Kernel::KThread*>& threads) { | 96 | auto add_threads = [&](const std::vector<Kernel::KThread*>& threads) { |
| 96 | for (std::size_t i = 0; i < threads.size(); ++i) { | 97 | for (std::size_t i = 0; i < threads.size(); ++i) { |
| 97 | if (threads[i]->GetThreadTypeForDebugging() == Kernel::ThreadType::User) { | 98 | if (threads[i]->GetThreadTypeForDebugging() == Kernel::ThreadType::User) { |
| 98 | item_list.push_back(std::make_unique<WaitTreeThread>(*threads[i])); | 99 | item_list.push_back(std::make_unique<WaitTreeThread>(*threads[i], system)); |
| 99 | item_list.back()->row = row; | 100 | item_list.back()->row = row; |
| 100 | } | 101 | } |
| 101 | ++row; | 102 | ++row; |
| 102 | } | 103 | } |
| 103 | }; | 104 | }; |
| 104 | 105 | ||
| 105 | const auto& system = Core::System::GetInstance(); | ||
| 106 | add_threads(system.GlobalSchedulerContext().GetThreadList()); | 106 | add_threads(system.GlobalSchedulerContext().GetThreadList()); |
| 107 | 107 | ||
| 108 | return item_list; | 108 | return item_list; |
| @@ -115,9 +115,10 @@ QString WaitTreeText::GetText() const { | |||
| 115 | return text; | 115 | return text; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | WaitTreeMutexInfo::WaitTreeMutexInfo(VAddr mutex_address, const Kernel::KHandleTable& handle_table) | 118 | WaitTreeMutexInfo::WaitTreeMutexInfo(VAddr mutex_address, const Kernel::KHandleTable& handle_table, |
| 119 | : mutex_address(mutex_address) { | 119 | Core::System& system_) |
| 120 | mutex_value = Core::System::GetInstance().Memory().Read32(mutex_address); | 120 | : mutex_address(mutex_address), system{system_} { |
| 121 | mutex_value = system.Memory().Read32(mutex_address); | ||
| 121 | owner_handle = static_cast<Kernel::Handle>(mutex_value & Kernel::Svc::HandleWaitMask); | 122 | owner_handle = static_cast<Kernel::Handle>(mutex_value & Kernel::Svc::HandleWaitMask); |
| 122 | owner = handle_table.GetObject<Kernel::KThread>(owner_handle).GetPointerUnsafe(); | 123 | owner = handle_table.GetObject<Kernel::KThread>(owner_handle).GetPointerUnsafe(); |
| 123 | } | 124 | } |
| @@ -136,12 +137,13 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeMutexInfo::GetChildren() cons | |||
| 136 | list.push_back(std::make_unique<WaitTreeText>( | 137 | list.push_back(std::make_unique<WaitTreeText>( |
| 137 | tr("owner handle: 0x%1").arg(owner_handle, 8, 16, QLatin1Char{'0'}))); | 138 | tr("owner handle: 0x%1").arg(owner_handle, 8, 16, QLatin1Char{'0'}))); |
| 138 | if (owner != nullptr) { | 139 | if (owner != nullptr) { |
| 139 | list.push_back(std::make_unique<WaitTreeThread>(*owner)); | 140 | list.push_back(std::make_unique<WaitTreeThread>(*owner, system)); |
| 140 | } | 141 | } |
| 141 | return list; | 142 | return list; |
| 142 | } | 143 | } |
| 143 | 144 | ||
| 144 | WaitTreeCallstack::WaitTreeCallstack(const Kernel::KThread& thread) : thread(thread) {} | 145 | WaitTreeCallstack::WaitTreeCallstack(const Kernel::KThread& thread, Core::System& system_) |
| 146 | : thread(thread), system{system_} {} | ||
| 145 | WaitTreeCallstack::~WaitTreeCallstack() = default; | 147 | WaitTreeCallstack::~WaitTreeCallstack() = default; |
| 146 | 148 | ||
| 147 | QString WaitTreeCallstack::GetText() const { | 149 | QString WaitTreeCallstack::GetText() const { |
| @@ -159,8 +161,7 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeCallstack::GetChildren() cons | |||
| 159 | return list; | 161 | return list; |
| 160 | } | 162 | } |
| 161 | 163 | ||
| 162 | auto backtrace = Core::ARM_Interface::GetBacktraceFromContext(Core::System::GetInstance(), | 164 | auto backtrace = Core::ARM_Interface::GetBacktraceFromContext(system, thread.GetContext64()); |
| 163 | thread.GetContext64()); | ||
| 164 | 165 | ||
| 165 | for (auto& entry : backtrace) { | 166 | for (auto& entry : backtrace) { |
| 166 | std::string s = fmt::format("{:20}{:016X} {:016X} {:016X} {}", entry.module, entry.address, | 167 | std::string s = fmt::format("{:20}{:016X} {:016X} {:016X} {}", entry.module, entry.address, |
| @@ -172,8 +173,8 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeCallstack::GetChildren() cons | |||
| 172 | } | 173 | } |
| 173 | 174 | ||
| 174 | WaitTreeSynchronizationObject::WaitTreeSynchronizationObject( | 175 | WaitTreeSynchronizationObject::WaitTreeSynchronizationObject( |
| 175 | const Kernel::KSynchronizationObject& o) | 176 | const Kernel::KSynchronizationObject& o, Core::System& system_) |
| 176 | : object(o) {} | 177 | : object(o), system{system_} {} |
| 177 | WaitTreeSynchronizationObject::~WaitTreeSynchronizationObject() = default; | 178 | WaitTreeSynchronizationObject::~WaitTreeSynchronizationObject() = default; |
| 178 | 179 | ||
| 179 | WaitTreeExpandableItem::WaitTreeExpandableItem() = default; | 180 | WaitTreeExpandableItem::WaitTreeExpandableItem() = default; |
| @@ -191,16 +192,18 @@ QString WaitTreeSynchronizationObject::GetText() const { | |||
| 191 | } | 192 | } |
| 192 | 193 | ||
| 193 | std::unique_ptr<WaitTreeSynchronizationObject> WaitTreeSynchronizationObject::make( | 194 | std::unique_ptr<WaitTreeSynchronizationObject> WaitTreeSynchronizationObject::make( |
| 194 | const Kernel::KSynchronizationObject& object) { | 195 | const Kernel::KSynchronizationObject& object, Core::System& system) { |
| 195 | const auto type = | 196 | const auto type = |
| 196 | static_cast<Kernel::KClassTokenGenerator::ObjectType>(object.GetTypeObj().GetClassToken()); | 197 | static_cast<Kernel::KClassTokenGenerator::ObjectType>(object.GetTypeObj().GetClassToken()); |
| 197 | switch (type) { | 198 | switch (type) { |
| 198 | case Kernel::KClassTokenGenerator::ObjectType::KReadableEvent: | 199 | case Kernel::KClassTokenGenerator::ObjectType::KReadableEvent: |
| 199 | return std::make_unique<WaitTreeEvent>(static_cast<const Kernel::KReadableEvent&>(object)); | 200 | return std::make_unique<WaitTreeEvent>(static_cast<const Kernel::KReadableEvent&>(object), |
| 201 | system); | ||
| 200 | case Kernel::KClassTokenGenerator::ObjectType::KThread: | 202 | case Kernel::KClassTokenGenerator::ObjectType::KThread: |
| 201 | return std::make_unique<WaitTreeThread>(static_cast<const Kernel::KThread&>(object)); | 203 | return std::make_unique<WaitTreeThread>(static_cast<const Kernel::KThread&>(object), |
| 204 | system); | ||
| 202 | default: | 205 | default: |
| 203 | return std::make_unique<WaitTreeSynchronizationObject>(object); | 206 | return std::make_unique<WaitTreeSynchronizationObject>(object, system); |
| 204 | } | 207 | } |
| 205 | } | 208 | } |
| 206 | 209 | ||
| @@ -211,15 +214,15 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeSynchronizationObject::GetChi | |||
| 211 | if (threads.empty()) { | 214 | if (threads.empty()) { |
| 212 | list.push_back(std::make_unique<WaitTreeText>(tr("waited by no thread"))); | 215 | list.push_back(std::make_unique<WaitTreeText>(tr("waited by no thread"))); |
| 213 | } else { | 216 | } else { |
| 214 | list.push_back(std::make_unique<WaitTreeThreadList>(std::move(threads))); | 217 | list.push_back(std::make_unique<WaitTreeThreadList>(std::move(threads), system)); |
| 215 | } | 218 | } |
| 216 | 219 | ||
| 217 | return list; | 220 | return list; |
| 218 | } | 221 | } |
| 219 | 222 | ||
| 220 | WaitTreeObjectList::WaitTreeObjectList(const std::vector<Kernel::KSynchronizationObject*>& list, | 223 | WaitTreeObjectList::WaitTreeObjectList(const std::vector<Kernel::KSynchronizationObject*>& list, |
| 221 | bool w_all) | 224 | bool w_all, Core::System& system_) |
| 222 | : object_list(list), wait_all(w_all) {} | 225 | : object_list(list), wait_all(w_all), system{system_} {} |
| 223 | 226 | ||
| 224 | WaitTreeObjectList::~WaitTreeObjectList() = default; | 227 | WaitTreeObjectList::~WaitTreeObjectList() = default; |
| 225 | 228 | ||
| @@ -231,13 +234,14 @@ QString WaitTreeObjectList::GetText() const { | |||
| 231 | 234 | ||
| 232 | std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeObjectList::GetChildren() const { | 235 | std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeObjectList::GetChildren() const { |
| 233 | std::vector<std::unique_ptr<WaitTreeItem>> list(object_list.size()); | 236 | std::vector<std::unique_ptr<WaitTreeItem>> list(object_list.size()); |
| 234 | std::transform(object_list.begin(), object_list.end(), list.begin(), | 237 | std::transform(object_list.begin(), object_list.end(), list.begin(), [this](const auto& t) { |
| 235 | [](const auto& t) { return WaitTreeSynchronizationObject::make(*t); }); | 238 | return WaitTreeSynchronizationObject::make(*t, system); |
| 239 | }); | ||
| 236 | return list; | 240 | return list; |
| 237 | } | 241 | } |
| 238 | 242 | ||
| 239 | WaitTreeThread::WaitTreeThread(const Kernel::KThread& thread) | 243 | WaitTreeThread::WaitTreeThread(const Kernel::KThread& thread, Core::System& system_) |
| 240 | : WaitTreeSynchronizationObject(thread) {} | 244 | : WaitTreeSynchronizationObject(thread, system_), system{system_} {} |
| 241 | WaitTreeThread::~WaitTreeThread() = default; | 245 | WaitTreeThread::~WaitTreeThread() = default; |
| 242 | 246 | ||
| 243 | QString WaitTreeThread::GetText() const { | 247 | QString WaitTreeThread::GetText() const { |
| @@ -360,7 +364,8 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const { | |||
| 360 | const VAddr mutex_wait_address = thread.GetMutexWaitAddressForDebugging(); | 364 | const VAddr mutex_wait_address = thread.GetMutexWaitAddressForDebugging(); |
| 361 | if (mutex_wait_address != 0) { | 365 | if (mutex_wait_address != 0) { |
| 362 | const auto& handle_table = thread.GetOwnerProcess()->GetHandleTable(); | 366 | const auto& handle_table = thread.GetOwnerProcess()->GetHandleTable(); |
| 363 | list.push_back(std::make_unique<WaitTreeMutexInfo>(mutex_wait_address, handle_table)); | 367 | list.push_back( |
| 368 | std::make_unique<WaitTreeMutexInfo>(mutex_wait_address, handle_table, system)); | ||
| 364 | } else { | 369 | } else { |
| 365 | list.push_back(std::make_unique<WaitTreeText>(tr("not waiting for mutex"))); | 370 | list.push_back(std::make_unique<WaitTreeText>(tr("not waiting for mutex"))); |
| 366 | } | 371 | } |
| @@ -369,20 +374,20 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const { | |||
| 369 | thread.GetWaitReasonForDebugging() == | 374 | thread.GetWaitReasonForDebugging() == |
| 370 | Kernel::ThreadWaitReasonForDebugging::Synchronization) { | 375 | Kernel::ThreadWaitReasonForDebugging::Synchronization) { |
| 371 | list.push_back(std::make_unique<WaitTreeObjectList>(thread.GetWaitObjectsForDebugging(), | 376 | list.push_back(std::make_unique<WaitTreeObjectList>(thread.GetWaitObjectsForDebugging(), |
| 372 | thread.IsCancellable())); | 377 | thread.IsCancellable(), system)); |
| 373 | } | 378 | } |
| 374 | 379 | ||
| 375 | list.push_back(std::make_unique<WaitTreeCallstack>(thread)); | 380 | list.push_back(std::make_unique<WaitTreeCallstack>(thread, system)); |
| 376 | 381 | ||
| 377 | return list; | 382 | return list; |
| 378 | } | 383 | } |
| 379 | 384 | ||
| 380 | WaitTreeEvent::WaitTreeEvent(const Kernel::KReadableEvent& object) | 385 | WaitTreeEvent::WaitTreeEvent(const Kernel::KReadableEvent& object, Core::System& system_) |
| 381 | : WaitTreeSynchronizationObject(object) {} | 386 | : WaitTreeSynchronizationObject(object, system_) {} |
| 382 | WaitTreeEvent::~WaitTreeEvent() = default; | 387 | WaitTreeEvent::~WaitTreeEvent() = default; |
| 383 | 388 | ||
| 384 | WaitTreeThreadList::WaitTreeThreadList(std::vector<Kernel::KThread*>&& list) | 389 | WaitTreeThreadList::WaitTreeThreadList(std::vector<Kernel::KThread*>&& list, Core::System& system_) |
| 385 | : thread_list(std::move(list)) {} | 390 | : thread_list(std::move(list)), system{system_} {} |
| 386 | WaitTreeThreadList::~WaitTreeThreadList() = default; | 391 | WaitTreeThreadList::~WaitTreeThreadList() = default; |
| 387 | 392 | ||
| 388 | QString WaitTreeThreadList::GetText() const { | 393 | QString WaitTreeThreadList::GetText() const { |
| @@ -392,11 +397,12 @@ QString WaitTreeThreadList::GetText() const { | |||
| 392 | std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThreadList::GetChildren() const { | 397 | std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThreadList::GetChildren() const { |
| 393 | std::vector<std::unique_ptr<WaitTreeItem>> list(thread_list.size()); | 398 | std::vector<std::unique_ptr<WaitTreeItem>> list(thread_list.size()); |
| 394 | std::transform(thread_list.begin(), thread_list.end(), list.begin(), | 399 | std::transform(thread_list.begin(), thread_list.end(), list.begin(), |
| 395 | [](const auto& t) { return std::make_unique<WaitTreeThread>(*t); }); | 400 | [this](const auto& t) { return std::make_unique<WaitTreeThread>(*t, system); }); |
| 396 | return list; | 401 | return list; |
| 397 | } | 402 | } |
| 398 | 403 | ||
| 399 | WaitTreeModel::WaitTreeModel(QObject* parent) : QAbstractItemModel(parent) {} | 404 | WaitTreeModel::WaitTreeModel(Core::System& system_, QObject* parent) |
| 405 | : QAbstractItemModel(parent), system{system_} {} | ||
| 400 | WaitTreeModel::~WaitTreeModel() = default; | 406 | WaitTreeModel::~WaitTreeModel() = default; |
| 401 | 407 | ||
| 402 | QModelIndex WaitTreeModel::index(int row, int column, const QModelIndex& parent) const { | 408 | QModelIndex WaitTreeModel::index(int row, int column, const QModelIndex& parent) const { |
| @@ -455,10 +461,11 @@ void WaitTreeModel::ClearItems() { | |||
| 455 | } | 461 | } |
| 456 | 462 | ||
| 457 | void WaitTreeModel::InitItems() { | 463 | void WaitTreeModel::InitItems() { |
| 458 | thread_items = WaitTreeItem::MakeThreadItemList(); | 464 | thread_items = WaitTreeItem::MakeThreadItemList(system); |
| 459 | } | 465 | } |
| 460 | 466 | ||
| 461 | WaitTreeWidget::WaitTreeWidget(QWidget* parent) : QDockWidget(tr("&Wait Tree"), parent) { | 467 | WaitTreeWidget::WaitTreeWidget(Core::System& system_, QWidget* parent) |
| 468 | : QDockWidget(tr("&Wait Tree"), parent), system{system_} { | ||
| 462 | setObjectName(QStringLiteral("WaitTreeWidget")); | 469 | setObjectName(QStringLiteral("WaitTreeWidget")); |
| 463 | view = new QTreeView(this); | 470 | view = new QTreeView(this); |
| 464 | view->setHeaderHidden(true); | 471 | view->setHeaderHidden(true); |
| @@ -469,7 +476,7 @@ WaitTreeWidget::WaitTreeWidget(QWidget* parent) : QDockWidget(tr("&Wait Tree"), | |||
| 469 | WaitTreeWidget::~WaitTreeWidget() = default; | 476 | WaitTreeWidget::~WaitTreeWidget() = default; |
| 470 | 477 | ||
| 471 | void WaitTreeWidget::OnDebugModeEntered() { | 478 | void WaitTreeWidget::OnDebugModeEntered() { |
| 472 | if (!Core::System::GetInstance().IsPoweredOn()) | 479 | if (!system.IsPoweredOn()) |
| 473 | return; | 480 | return; |
| 474 | model->InitItems(); | 481 | model->InitItems(); |
| 475 | view->setModel(model); | 482 | view->setModel(model); |
| @@ -483,7 +490,7 @@ void WaitTreeWidget::OnDebugModeLeft() { | |||
| 483 | } | 490 | } |
| 484 | 491 | ||
| 485 | void WaitTreeWidget::OnEmulationStarting(EmuThread* emu_thread) { | 492 | void WaitTreeWidget::OnEmulationStarting(EmuThread* emu_thread) { |
| 486 | model = new WaitTreeModel(this); | 493 | model = new WaitTreeModel(system, this); |
| 487 | view->setModel(model); | 494 | view->setModel(model); |
| 488 | setEnabled(false); | 495 | setEnabled(false); |
| 489 | } | 496 | } |
diff --git a/src/yuzu/debugger/wait_tree.h b/src/yuzu/debugger/wait_tree.h index d450345df..ea4d2e299 100644 --- a/src/yuzu/debugger/wait_tree.h +++ b/src/yuzu/debugger/wait_tree.h | |||
| @@ -18,6 +18,10 @@ | |||
| 18 | 18 | ||
| 19 | class EmuThread; | 19 | class EmuThread; |
| 20 | 20 | ||
| 21 | namespace Core { | ||
| 22 | class System; | ||
| 23 | } | ||
| 24 | |||
| 21 | namespace Kernel { | 25 | namespace Kernel { |
| 22 | class KHandleTable; | 26 | class KHandleTable; |
| 23 | class KReadableEvent; | 27 | class KReadableEvent; |
| @@ -42,7 +46,7 @@ public: | |||
| 42 | WaitTreeItem* Parent() const; | 46 | WaitTreeItem* Parent() const; |
| 43 | const std::vector<std::unique_ptr<WaitTreeItem>>& Children() const; | 47 | const std::vector<std::unique_ptr<WaitTreeItem>>& Children() const; |
| 44 | std::size_t Row() const; | 48 | std::size_t Row() const; |
| 45 | static std::vector<std::unique_ptr<WaitTreeThread>> MakeThreadItemList(); | 49 | static std::vector<std::unique_ptr<WaitTreeThread>> MakeThreadItemList(Core::System& system); |
| 46 | 50 | ||
| 47 | private: | 51 | private: |
| 48 | std::size_t row; | 52 | std::size_t row; |
| @@ -75,7 +79,8 @@ public: | |||
| 75 | class WaitTreeMutexInfo : public WaitTreeExpandableItem { | 79 | class WaitTreeMutexInfo : public WaitTreeExpandableItem { |
| 76 | Q_OBJECT | 80 | Q_OBJECT |
| 77 | public: | 81 | public: |
| 78 | explicit WaitTreeMutexInfo(VAddr mutex_address, const Kernel::KHandleTable& handle_table); | 82 | explicit WaitTreeMutexInfo(VAddr mutex_address, const Kernel::KHandleTable& handle_table, |
| 83 | Core::System& system_); | ||
| 79 | ~WaitTreeMutexInfo() override; | 84 | ~WaitTreeMutexInfo() override; |
| 80 | 85 | ||
| 81 | QString GetText() const override; | 86 | QString GetText() const override; |
| @@ -86,12 +91,14 @@ private: | |||
| 86 | u32 mutex_value{}; | 91 | u32 mutex_value{}; |
| 87 | Kernel::Handle owner_handle{}; | 92 | Kernel::Handle owner_handle{}; |
| 88 | Kernel::KThread* owner{}; | 93 | Kernel::KThread* owner{}; |
| 94 | |||
| 95 | Core::System& system; | ||
| 89 | }; | 96 | }; |
| 90 | 97 | ||
| 91 | class WaitTreeCallstack : public WaitTreeExpandableItem { | 98 | class WaitTreeCallstack : public WaitTreeExpandableItem { |
| 92 | Q_OBJECT | 99 | Q_OBJECT |
| 93 | public: | 100 | public: |
| 94 | explicit WaitTreeCallstack(const Kernel::KThread& thread); | 101 | explicit WaitTreeCallstack(const Kernel::KThread& thread, Core::System& system_); |
| 95 | ~WaitTreeCallstack() override; | 102 | ~WaitTreeCallstack() override; |
| 96 | 103 | ||
| 97 | QString GetText() const override; | 104 | QString GetText() const override; |
| @@ -99,27 +106,34 @@ public: | |||
| 99 | 106 | ||
| 100 | private: | 107 | private: |
| 101 | const Kernel::KThread& thread; | 108 | const Kernel::KThread& thread; |
| 109 | |||
| 110 | Core::System& system; | ||
| 102 | }; | 111 | }; |
| 103 | 112 | ||
| 104 | class WaitTreeSynchronizationObject : public WaitTreeExpandableItem { | 113 | class WaitTreeSynchronizationObject : public WaitTreeExpandableItem { |
| 105 | Q_OBJECT | 114 | Q_OBJECT |
| 106 | public: | 115 | public: |
| 107 | explicit WaitTreeSynchronizationObject(const Kernel::KSynchronizationObject& object); | 116 | explicit WaitTreeSynchronizationObject(const Kernel::KSynchronizationObject& object, |
| 117 | Core::System& system_); | ||
| 108 | ~WaitTreeSynchronizationObject() override; | 118 | ~WaitTreeSynchronizationObject() override; |
| 109 | 119 | ||
| 110 | static std::unique_ptr<WaitTreeSynchronizationObject> make( | 120 | static std::unique_ptr<WaitTreeSynchronizationObject> make( |
| 111 | const Kernel::KSynchronizationObject& object); | 121 | const Kernel::KSynchronizationObject& object, Core::System& system); |
| 112 | QString GetText() const override; | 122 | QString GetText() const override; |
| 113 | std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; | 123 | std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; |
| 114 | 124 | ||
| 115 | protected: | 125 | protected: |
| 116 | const Kernel::KSynchronizationObject& object; | 126 | const Kernel::KSynchronizationObject& object; |
| 127 | |||
| 128 | private: | ||
| 129 | Core::System& system; | ||
| 117 | }; | 130 | }; |
| 118 | 131 | ||
| 119 | class WaitTreeObjectList : public WaitTreeExpandableItem { | 132 | class WaitTreeObjectList : public WaitTreeExpandableItem { |
| 120 | Q_OBJECT | 133 | Q_OBJECT |
| 121 | public: | 134 | public: |
| 122 | WaitTreeObjectList(const std::vector<Kernel::KSynchronizationObject*>& list, bool wait_all); | 135 | WaitTreeObjectList(const std::vector<Kernel::KSynchronizationObject*>& list, bool wait_all, |
| 136 | Core::System& system_); | ||
| 123 | ~WaitTreeObjectList() override; | 137 | ~WaitTreeObjectList() override; |
| 124 | 138 | ||
| 125 | QString GetText() const override; | 139 | QString GetText() const override; |
| @@ -128,30 +142,35 @@ public: | |||
| 128 | private: | 142 | private: |
| 129 | const std::vector<Kernel::KSynchronizationObject*>& object_list; | 143 | const std::vector<Kernel::KSynchronizationObject*>& object_list; |
| 130 | bool wait_all; | 144 | bool wait_all; |
| 145 | |||
| 146 | Core::System& system; | ||
| 131 | }; | 147 | }; |
| 132 | 148 | ||
| 133 | class WaitTreeThread : public WaitTreeSynchronizationObject { | 149 | class WaitTreeThread : public WaitTreeSynchronizationObject { |
| 134 | Q_OBJECT | 150 | Q_OBJECT |
| 135 | public: | 151 | public: |
| 136 | explicit WaitTreeThread(const Kernel::KThread& thread); | 152 | explicit WaitTreeThread(const Kernel::KThread& thread, Core::System& system_); |
| 137 | ~WaitTreeThread() override; | 153 | ~WaitTreeThread() override; |
| 138 | 154 | ||
| 139 | QString GetText() const override; | 155 | QString GetText() const override; |
| 140 | QColor GetColor() const override; | 156 | QColor GetColor() const override; |
| 141 | std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; | 157 | std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; |
| 158 | |||
| 159 | private: | ||
| 160 | Core::System& system; | ||
| 142 | }; | 161 | }; |
| 143 | 162 | ||
| 144 | class WaitTreeEvent : public WaitTreeSynchronizationObject { | 163 | class WaitTreeEvent : public WaitTreeSynchronizationObject { |
| 145 | Q_OBJECT | 164 | Q_OBJECT |
| 146 | public: | 165 | public: |
| 147 | explicit WaitTreeEvent(const Kernel::KReadableEvent& object); | 166 | explicit WaitTreeEvent(const Kernel::KReadableEvent& object, Core::System& system_); |
| 148 | ~WaitTreeEvent() override; | 167 | ~WaitTreeEvent() override; |
| 149 | }; | 168 | }; |
| 150 | 169 | ||
| 151 | class WaitTreeThreadList : public WaitTreeExpandableItem { | 170 | class WaitTreeThreadList : public WaitTreeExpandableItem { |
| 152 | Q_OBJECT | 171 | Q_OBJECT |
| 153 | public: | 172 | public: |
| 154 | explicit WaitTreeThreadList(std::vector<Kernel::KThread*>&& list); | 173 | explicit WaitTreeThreadList(std::vector<Kernel::KThread*>&& list, Core::System& system_); |
| 155 | ~WaitTreeThreadList() override; | 174 | ~WaitTreeThreadList() override; |
| 156 | 175 | ||
| 157 | QString GetText() const override; | 176 | QString GetText() const override; |
| @@ -159,13 +178,15 @@ public: | |||
| 159 | 178 | ||
| 160 | private: | 179 | private: |
| 161 | std::vector<Kernel::KThread*> thread_list; | 180 | std::vector<Kernel::KThread*> thread_list; |
| 181 | |||
| 182 | Core::System& system; | ||
| 162 | }; | 183 | }; |
| 163 | 184 | ||
| 164 | class WaitTreeModel : public QAbstractItemModel { | 185 | class WaitTreeModel : public QAbstractItemModel { |
| 165 | Q_OBJECT | 186 | Q_OBJECT |
| 166 | 187 | ||
| 167 | public: | 188 | public: |
| 168 | explicit WaitTreeModel(QObject* parent = nullptr); | 189 | explicit WaitTreeModel(Core::System& system_, QObject* parent = nullptr); |
| 169 | ~WaitTreeModel() override; | 190 | ~WaitTreeModel() override; |
| 170 | 191 | ||
| 171 | QVariant data(const QModelIndex& index, int role) const override; | 192 | QVariant data(const QModelIndex& index, int role) const override; |
| @@ -179,13 +200,15 @@ public: | |||
| 179 | 200 | ||
| 180 | private: | 201 | private: |
| 181 | std::vector<std::unique_ptr<WaitTreeThread>> thread_items; | 202 | std::vector<std::unique_ptr<WaitTreeThread>> thread_items; |
| 203 | |||
| 204 | Core::System& system; | ||
| 182 | }; | 205 | }; |
| 183 | 206 | ||
| 184 | class WaitTreeWidget : public QDockWidget { | 207 | class WaitTreeWidget : public QDockWidget { |
| 185 | Q_OBJECT | 208 | Q_OBJECT |
| 186 | 209 | ||
| 187 | public: | 210 | public: |
| 188 | explicit WaitTreeWidget(QWidget* parent = nullptr); | 211 | explicit WaitTreeWidget(Core::System& system_, QWidget* parent = nullptr); |
| 189 | ~WaitTreeWidget() override; | 212 | ~WaitTreeWidget() override; |
| 190 | 213 | ||
| 191 | public slots: | 214 | public slots: |
| @@ -198,4 +221,6 @@ public slots: | |||
| 198 | private: | 221 | private: |
| 199 | QTreeView* view; | 222 | QTreeView* view; |
| 200 | WaitTreeModel* model; | 223 | WaitTreeModel* model; |
| 224 | |||
| 225 | Core::System& system; | ||
| 201 | }; | 226 | }; |
diff --git a/src/yuzu/discord_impl.cpp b/src/yuzu/discord_impl.cpp index a93733b26..66f928af6 100644 --- a/src/yuzu/discord_impl.cpp +++ b/src/yuzu/discord_impl.cpp | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | namespace DiscordRPC { | 14 | namespace DiscordRPC { |
| 15 | 15 | ||
| 16 | DiscordImpl::DiscordImpl() { | 16 | DiscordImpl::DiscordImpl(Core::System& system_) : system{system_} { |
| 17 | DiscordEventHandlers handlers{}; | 17 | DiscordEventHandlers handlers{}; |
| 18 | 18 | ||
| 19 | // The number is the client ID for yuzu, it's used for images and the | 19 | // The number is the client ID for yuzu, it's used for images and the |
| @@ -35,12 +35,13 @@ void DiscordImpl::Update() { | |||
| 35 | std::chrono::system_clock::now().time_since_epoch()) | 35 | std::chrono::system_clock::now().time_since_epoch()) |
| 36 | .count(); | 36 | .count(); |
| 37 | std::string title; | 37 | std::string title; |
| 38 | if (Core::System::GetInstance().IsPoweredOn()) | 38 | if (system.IsPoweredOn()) { |
| 39 | Core::System::GetInstance().GetAppLoader().ReadTitle(title); | 39 | system.GetAppLoader().ReadTitle(title); |
| 40 | } | ||
| 40 | DiscordRichPresence presence{}; | 41 | DiscordRichPresence presence{}; |
| 41 | presence.largeImageKey = "yuzu_logo"; | 42 | presence.largeImageKey = "yuzu_logo"; |
| 42 | presence.largeImageText = "yuzu is an emulator for the Nintendo Switch"; | 43 | presence.largeImageText = "yuzu is an emulator for the Nintendo Switch"; |
| 43 | if (Core::System::GetInstance().IsPoweredOn()) { | 44 | if (system.IsPoweredOn()) { |
| 44 | presence.state = title.c_str(); | 45 | presence.state = title.c_str(); |
| 45 | presence.details = "Currently in game"; | 46 | presence.details = "Currently in game"; |
| 46 | } else { | 47 | } else { |
diff --git a/src/yuzu/discord_impl.h b/src/yuzu/discord_impl.h index 4bfda8cdf..03ad42681 100644 --- a/src/yuzu/discord_impl.h +++ b/src/yuzu/discord_impl.h | |||
| @@ -6,15 +6,21 @@ | |||
| 6 | 6 | ||
| 7 | #include "yuzu/discord.h" | 7 | #include "yuzu/discord.h" |
| 8 | 8 | ||
| 9 | namespace Core { | ||
| 10 | class System; | ||
| 11 | } | ||
| 12 | |||
| 9 | namespace DiscordRPC { | 13 | namespace DiscordRPC { |
| 10 | 14 | ||
| 11 | class DiscordImpl : public DiscordInterface { | 15 | class DiscordImpl : public DiscordInterface { |
| 12 | public: | 16 | public: |
| 13 | DiscordImpl(); | 17 | DiscordImpl(Core::System& system_); |
| 14 | ~DiscordImpl() override; | 18 | ~DiscordImpl() override; |
| 15 | 19 | ||
| 16 | void Pause() override; | 20 | void Pause() override; |
| 17 | void Update() override; | 21 | void Update() override; |
| 22 | |||
| 23 | Core::System& system; | ||
| 18 | }; | 24 | }; |
| 19 | 25 | ||
| 20 | } // namespace DiscordRPC | 26 | } // namespace DiscordRPC |
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index ba54423ff..6bd0f9ee9 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -304,8 +304,8 @@ void GameList::OnFilterCloseClicked() { | |||
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvider* provider, | 306 | GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvider* provider, |
| 307 | GMainWindow* parent) | 307 | Core::System& system_, GMainWindow* parent) |
| 308 | : QWidget{parent}, vfs(std::move(vfs)), provider(provider) { | 308 | : QWidget{parent}, vfs(std::move(vfs)), provider(provider), system{system_} { |
| 309 | watcher = new QFileSystemWatcher(this); | 309 | watcher = new QFileSystemWatcher(this); |
| 310 | connect(watcher, &QFileSystemWatcher::directoryChanged, this, &GameList::RefreshGameDirectory); | 310 | connect(watcher, &QFileSystemWatcher::directoryChanged, this, &GameList::RefreshGameDirectory); |
| 311 | 311 | ||
| @@ -737,7 +737,8 @@ void GameList::PopulateAsync(QVector<UISettings::GameDir>& game_dirs) { | |||
| 737 | 737 | ||
| 738 | emit ShouldCancelWorker(); | 738 | emit ShouldCancelWorker(); |
| 739 | 739 | ||
| 740 | GameListWorker* worker = new GameListWorker(vfs, provider, game_dirs, compatibility_list); | 740 | GameListWorker* worker = |
| 741 | new GameListWorker(vfs, provider, game_dirs, compatibility_list, system); | ||
| 741 | 742 | ||
| 742 | connect(worker, &GameListWorker::EntryReady, this, &GameList::AddEntry, Qt::QueuedConnection); | 743 | connect(worker, &GameListWorker::EntryReady, this, &GameList::AddEntry, Qt::QueuedConnection); |
| 743 | connect(worker, &GameListWorker::DirEntryReady, this, &GameList::AddDirEntry, | 744 | connect(worker, &GameListWorker::DirEntryReady, this, &GameList::AddDirEntry, |
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h index 10339dcca..675469e66 100644 --- a/src/yuzu/game_list.h +++ b/src/yuzu/game_list.h | |||
| @@ -72,7 +72,8 @@ public: | |||
| 72 | }; | 72 | }; |
| 73 | 73 | ||
| 74 | explicit GameList(std::shared_ptr<FileSys::VfsFilesystem> vfs, | 74 | explicit GameList(std::shared_ptr<FileSys::VfsFilesystem> vfs, |
| 75 | FileSys::ManualContentProvider* provider, GMainWindow* parent = nullptr); | 75 | FileSys::ManualContentProvider* provider, Core::System& system_, |
| 76 | GMainWindow* parent = nullptr); | ||
| 76 | ~GameList() override; | 77 | ~GameList() override; |
| 77 | 78 | ||
| 78 | QString GetLastFilterResultItem() const; | 79 | QString GetLastFilterResultItem() const; |
| @@ -145,6 +146,8 @@ private: | |||
| 145 | CompatibilityList compatibility_list; | 146 | CompatibilityList compatibility_list; |
| 146 | 147 | ||
| 147 | friend class GameListSearchField; | 148 | friend class GameListSearchField; |
| 149 | |||
| 150 | Core::System& system; | ||
| 148 | }; | 151 | }; |
| 149 | 152 | ||
| 150 | class GameListPlaceholder : public QWidget { | 153 | class GameListPlaceholder : public QWidget { |
diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp index 2d5492157..fd92b36df 100644 --- a/src/yuzu/game_list_worker.cpp +++ b/src/yuzu/game_list_worker.cpp | |||
| @@ -228,16 +228,15 @@ QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::stri | |||
| 228 | GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs, | 228 | GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs, |
| 229 | FileSys::ManualContentProvider* provider, | 229 | FileSys::ManualContentProvider* provider, |
| 230 | QVector<UISettings::GameDir>& game_dirs, | 230 | QVector<UISettings::GameDir>& game_dirs, |
| 231 | const CompatibilityList& compatibility_list) | 231 | const CompatibilityList& compatibility_list, Core::System& system_) |
| 232 | : vfs(std::move(vfs)), provider(provider), game_dirs(game_dirs), | 232 | : vfs(std::move(vfs)), provider(provider), game_dirs(game_dirs), |
| 233 | compatibility_list(compatibility_list) {} | 233 | compatibility_list(compatibility_list), system{system_} {} |
| 234 | 234 | ||
| 235 | GameListWorker::~GameListWorker() = default; | 235 | GameListWorker::~GameListWorker() = default; |
| 236 | 236 | ||
| 237 | void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) { | 237 | void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) { |
| 238 | using namespace FileSys; | 238 | using namespace FileSys; |
| 239 | 239 | ||
| 240 | auto& system = Core::System::GetInstance(); | ||
| 241 | const auto& cache = dynamic_cast<ContentProviderUnion&>(system.GetContentProvider()); | 240 | const auto& cache = dynamic_cast<ContentProviderUnion&>(system.GetContentProvider()); |
| 242 | 241 | ||
| 243 | auto installed_games = cache.ListEntriesFilterOrigin(std::nullopt, TitleType::Application, | 242 | auto installed_games = cache.ListEntriesFilterOrigin(std::nullopt, TitleType::Application, |
| @@ -285,10 +284,7 @@ void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) { | |||
| 285 | 284 | ||
| 286 | void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_path, bool deep_scan, | 285 | void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_path, bool deep_scan, |
| 287 | GameListDir* parent_dir) { | 286 | GameListDir* parent_dir) { |
| 288 | auto& system = Core::System::GetInstance(); | 287 | const auto callback = [this, target, parent_dir](const std::filesystem::path& path) -> bool { |
| 289 | |||
| 290 | const auto callback = [this, target, parent_dir, | ||
| 291 | &system](const std::filesystem::path& path) -> bool { | ||
| 292 | if (stop_processing) { | 288 | if (stop_processing) { |
| 293 | // Breaks the callback loop. | 289 | // Breaks the callback loop. |
| 294 | return false; | 290 | return false; |
diff --git a/src/yuzu/game_list_worker.h b/src/yuzu/game_list_worker.h index 396bb2623..1383e9fbc 100644 --- a/src/yuzu/game_list_worker.h +++ b/src/yuzu/game_list_worker.h | |||
| @@ -19,6 +19,10 @@ | |||
| 19 | #include "common/common_types.h" | 19 | #include "common/common_types.h" |
| 20 | #include "yuzu/compatibility_list.h" | 20 | #include "yuzu/compatibility_list.h" |
| 21 | 21 | ||
| 22 | namespace Core { | ||
| 23 | class System; | ||
| 24 | } | ||
| 25 | |||
| 22 | class QStandardItem; | 26 | class QStandardItem; |
| 23 | 27 | ||
| 24 | namespace FileSys { | 28 | namespace FileSys { |
| @@ -37,7 +41,7 @@ public: | |||
| 37 | explicit GameListWorker(std::shared_ptr<FileSys::VfsFilesystem> vfs, | 41 | explicit GameListWorker(std::shared_ptr<FileSys::VfsFilesystem> vfs, |
| 38 | FileSys::ManualContentProvider* provider, | 42 | FileSys::ManualContentProvider* provider, |
| 39 | QVector<UISettings::GameDir>& game_dirs, | 43 | QVector<UISettings::GameDir>& game_dirs, |
| 40 | const CompatibilityList& compatibility_list); | 44 | const CompatibilityList& compatibility_list, Core::System& system_); |
| 41 | ~GameListWorker() override; | 45 | ~GameListWorker() override; |
| 42 | 46 | ||
| 43 | /// Starts the processing of directory tree information. | 47 | /// Starts the processing of directory tree information. |
| @@ -80,4 +84,6 @@ private: | |||
| 80 | 84 | ||
| 81 | QStringList watch_list; | 85 | QStringList watch_list; |
| 82 | std::atomic_bool stop_processing; | 86 | std::atomic_bool stop_processing; |
| 87 | |||
| 88 | Core::System& system; | ||
| 83 | }; | 89 | }; |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 3eea61354..9f80a245c 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -171,7 +171,7 @@ void GMainWindow::ShowTelemetryCallout() { | |||
| 171 | "<br/><br/>Would you like to share your usage data with us?"); | 171 | "<br/><br/>Would you like to share your usage data with us?"); |
| 172 | if (QMessageBox::question(this, tr("Telemetry"), telemetry_message) != QMessageBox::Yes) { | 172 | if (QMessageBox::question(this, tr("Telemetry"), telemetry_message) != QMessageBox::Yes) { |
| 173 | Settings::values.enable_telemetry = false; | 173 | Settings::values.enable_telemetry = false; |
| 174 | Core::System::GetInstance().ApplySettings(); | 174 | system.ApplySettings(); |
| 175 | } | 175 | } |
| 176 | } | 176 | } |
| 177 | 177 | ||
| @@ -190,9 +190,10 @@ static void RemoveCachedContents() { | |||
| 190 | Common::FS::RemoveDirRecursively(offline_system_data); | 190 | Common::FS::RemoveDirRecursively(offline_system_data); |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | GMainWindow::GMainWindow() | 193 | GMainWindow::GMainWindow(Core::System& system_) |
| 194 | : input_subsystem{std::make_shared<InputCommon::InputSubsystem>()}, | 194 | : input_subsystem{std::make_shared<InputCommon::InputSubsystem>()}, system{system_}, |
| 195 | config{std::make_unique<Config>()}, vfs{std::make_shared<FileSys::RealVfsFilesystem>()}, | 195 | config{std::make_unique<Config>(system_)}, |
| 196 | vfs{std::make_shared<FileSys::RealVfsFilesystem>()}, | ||
| 196 | provider{std::make_unique<FileSys::ManualContentProvider>()} { | 197 | provider{std::make_unique<FileSys::ManualContentProvider>()} { |
| 197 | Common::Log::Initialize(); | 198 | Common::Log::Initialize(); |
| 198 | LoadTranslation(); | 199 | LoadTranslation(); |
| @@ -255,11 +256,10 @@ GMainWindow::GMainWindow() | |||
| 255 | 256 | ||
| 256 | show(); | 257 | show(); |
| 257 | 258 | ||
| 258 | Core::System::GetInstance().SetContentProvider( | 259 | system.SetContentProvider(std::make_unique<FileSys::ContentProviderUnion>()); |
| 259 | std::make_unique<FileSys::ContentProviderUnion>()); | 260 | system.RegisterContentProvider(FileSys::ContentProviderUnionSlot::FrontendManual, |
| 260 | Core::System::GetInstance().RegisterContentProvider( | 261 | provider.get()); |
| 261 | FileSys::ContentProviderUnionSlot::FrontendManual, provider.get()); | 262 | system.GetFileSystemController().CreateFactories(*vfs); |
| 262 | Core::System::GetInstance().GetFileSystemController().CreateFactories(*vfs); | ||
| 263 | 263 | ||
| 264 | // Remove cached contents generated during the previous session | 264 | // Remove cached contents generated during the previous session |
| 265 | RemoveCachedContents(); | 265 | RemoveCachedContents(); |
| @@ -410,7 +410,7 @@ void GMainWindow::RegisterMetaTypes() { | |||
| 410 | 410 | ||
| 411 | void GMainWindow::ControllerSelectorReconfigureControllers( | 411 | void GMainWindow::ControllerSelectorReconfigureControllers( |
| 412 | const Core::Frontend::ControllerParameters& parameters) { | 412 | const Core::Frontend::ControllerParameters& parameters) { |
| 413 | QtControllerSelectorDialog dialog(this, parameters, input_subsystem.get()); | 413 | QtControllerSelectorDialog dialog(this, parameters, input_subsystem.get(), system); |
| 414 | 414 | ||
| 415 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | | 415 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | |
| 416 | Qt::WindowTitleHint | Qt::WindowSystemMenuHint); | 416 | Qt::WindowTitleHint | Qt::WindowSystemMenuHint); |
| @@ -420,7 +420,7 @@ void GMainWindow::ControllerSelectorReconfigureControllers( | |||
| 420 | emit ControllerSelectorReconfigureFinished(); | 420 | emit ControllerSelectorReconfigureFinished(); |
| 421 | 421 | ||
| 422 | // Don't forget to apply settings. | 422 | // Don't forget to apply settings. |
| 423 | Core::System::GetInstance().ApplySettings(); | 423 | system.ApplySettings(); |
| 424 | config->Save(); | 424 | config->Save(); |
| 425 | 425 | ||
| 426 | UpdateStatusButtons(); | 426 | UpdateStatusButtons(); |
| @@ -454,8 +454,8 @@ void GMainWindow::SoftwareKeyboardInitialize( | |||
| 454 | return; | 454 | return; |
| 455 | } | 455 | } |
| 456 | 456 | ||
| 457 | software_keyboard = new QtSoftwareKeyboardDialog(render_window, Core::System::GetInstance(), | 457 | software_keyboard = new QtSoftwareKeyboardDialog(render_window, system, is_inline, |
| 458 | is_inline, std::move(initialize_parameters)); | 458 | std::move(initialize_parameters)); |
| 459 | 459 | ||
| 460 | if (is_inline) { | 460 | if (is_inline) { |
| 461 | connect( | 461 | connect( |
| @@ -566,7 +566,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url, | |||
| 566 | return; | 566 | return; |
| 567 | } | 567 | } |
| 568 | 568 | ||
| 569 | QtNXWebEngineView web_browser_view(this, Core::System::GetInstance(), input_subsystem.get()); | 569 | QtNXWebEngineView web_browser_view(this, system, input_subsystem.get()); |
| 570 | 570 | ||
| 571 | ui.action_Pause->setEnabled(false); | 571 | ui.action_Pause->setEnabled(false); |
| 572 | ui.action_Restart->setEnabled(false); | 572 | ui.action_Restart->setEnabled(false); |
| @@ -698,10 +698,10 @@ void GMainWindow::InitializeWidgets() { | |||
| 698 | #ifdef YUZU_ENABLE_COMPATIBILITY_REPORTING | 698 | #ifdef YUZU_ENABLE_COMPATIBILITY_REPORTING |
| 699 | ui.action_Report_Compatibility->setVisible(true); | 699 | ui.action_Report_Compatibility->setVisible(true); |
| 700 | #endif | 700 | #endif |
| 701 | render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem); | 701 | render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem, system); |
| 702 | render_window->hide(); | 702 | render_window->hide(); |
| 703 | 703 | ||
| 704 | game_list = new GameList(vfs, provider.get(), this); | 704 | game_list = new GameList(vfs, provider.get(), system, this); |
| 705 | ui.horizontalLayout->addWidget(game_list); | 705 | ui.horizontalLayout->addWidget(game_list); |
| 706 | 706 | ||
| 707 | game_list_placeholder = new GameListPlaceholder(this); | 707 | game_list_placeholder = new GameListPlaceholder(this); |
| @@ -767,14 +767,14 @@ void GMainWindow::InitializeWidgets() { | |||
| 767 | tr("Handheld controller can't be used on docked mode. Pro " | 767 | tr("Handheld controller can't be used on docked mode. Pro " |
| 768 | "controller will be selected.")); | 768 | "controller will be selected.")); |
| 769 | controller_type = Settings::ControllerType::ProController; | 769 | controller_type = Settings::ControllerType::ProController; |
| 770 | ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get()); | 770 | ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(), system); |
| 771 | configure_dialog.ApplyConfiguration(); | 771 | configure_dialog.ApplyConfiguration(); |
| 772 | controller_dialog->refreshConfiguration(); | 772 | controller_dialog->refreshConfiguration(); |
| 773 | } | 773 | } |
| 774 | 774 | ||
| 775 | Settings::values.use_docked_mode.SetValue(!is_docked); | 775 | Settings::values.use_docked_mode.SetValue(!is_docked); |
| 776 | dock_status_button->setChecked(!is_docked); | 776 | dock_status_button->setChecked(!is_docked); |
| 777 | OnDockedModeChanged(is_docked, !is_docked); | 777 | OnDockedModeChanged(is_docked, !is_docked, system); |
| 778 | }); | 778 | }); |
| 779 | dock_status_button->setText(tr("DOCK")); | 779 | dock_status_button->setText(tr("DOCK")); |
| 780 | dock_status_button->setCheckable(true); | 780 | dock_status_button->setCheckable(true); |
| @@ -798,7 +798,7 @@ void GMainWindow::InitializeWidgets() { | |||
| 798 | } | 798 | } |
| 799 | } | 799 | } |
| 800 | 800 | ||
| 801 | Core::System::GetInstance().ApplySettings(); | 801 | system.ApplySettings(); |
| 802 | UpdateGPUAccuracyButton(); | 802 | UpdateGPUAccuracyButton(); |
| 803 | }); | 803 | }); |
| 804 | UpdateGPUAccuracyButton(); | 804 | UpdateGPUAccuracyButton(); |
| @@ -826,7 +826,7 @@ void GMainWindow::InitializeWidgets() { | |||
| 826 | Settings::values.renderer_backend.SetValue(Settings::RendererBackend::OpenGL); | 826 | Settings::values.renderer_backend.SetValue(Settings::RendererBackend::OpenGL); |
| 827 | } | 827 | } |
| 828 | 828 | ||
| 829 | Core::System::GetInstance().ApplySettings(); | 829 | system.ApplySettings(); |
| 830 | }); | 830 | }); |
| 831 | statusBar()->insertPermanentWidget(0, renderer_status_button); | 831 | statusBar()->insertPermanentWidget(0, renderer_status_button); |
| 832 | 832 | ||
| @@ -843,7 +843,7 @@ void GMainWindow::InitializeDebugWidgets() { | |||
| 843 | debug_menu->addAction(microProfileDialog->toggleViewAction()); | 843 | debug_menu->addAction(microProfileDialog->toggleViewAction()); |
| 844 | #endif | 844 | #endif |
| 845 | 845 | ||
| 846 | waitTreeWidget = new WaitTreeWidget(this); | 846 | waitTreeWidget = new WaitTreeWidget(system, this); |
| 847 | addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget); | 847 | addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget); |
| 848 | waitTreeWidget->hide(); | 848 | waitTreeWidget->hide(); |
| 849 | debug_menu->addAction(waitTreeWidget->toggleViewAction()); | 849 | debug_menu->addAction(waitTreeWidget->toggleViewAction()); |
| @@ -946,7 +946,7 @@ void GMainWindow::InitializeHotkeys() { | |||
| 946 | }); | 946 | }); |
| 947 | connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Restart Emulation"), this), | 947 | connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Restart Emulation"), this), |
| 948 | &QShortcut::activated, this, [this] { | 948 | &QShortcut::activated, this, [this] { |
| 949 | if (!Core::System::GetInstance().IsPoweredOn()) { | 949 | if (!system.IsPoweredOn()) { |
| 950 | return; | 950 | return; |
| 951 | } | 951 | } |
| 952 | BootGame(game_path); | 952 | BootGame(game_path); |
| @@ -1002,7 +1002,7 @@ void GMainWindow::InitializeHotkeys() { | |||
| 1002 | Settings::values.use_docked_mode.SetValue( | 1002 | Settings::values.use_docked_mode.SetValue( |
| 1003 | !Settings::values.use_docked_mode.GetValue()); | 1003 | !Settings::values.use_docked_mode.GetValue()); |
| 1004 | OnDockedModeChanged(!Settings::values.use_docked_mode.GetValue(), | 1004 | OnDockedModeChanged(!Settings::values.use_docked_mode.GetValue(), |
| 1005 | Settings::values.use_docked_mode.GetValue()); | 1005 | Settings::values.use_docked_mode.GetValue(), system); |
| 1006 | dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue()); | 1006 | dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue()); |
| 1007 | }); | 1007 | }); |
| 1008 | connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Mute Audio"), this), | 1008 | connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Mute Audio"), this), |
| @@ -1238,7 +1238,6 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p | |||
| 1238 | return false; | 1238 | return false; |
| 1239 | } | 1239 | } |
| 1240 | 1240 | ||
| 1241 | Core::System& system{Core::System::GetInstance()}; | ||
| 1242 | system.SetFilesystem(vfs); | 1241 | system.SetFilesystem(vfs); |
| 1243 | 1242 | ||
| 1244 | system.SetAppletFrontendSet({ | 1243 | system.SetAppletFrontendSet({ |
| @@ -1348,7 +1347,6 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t | |||
| 1348 | 1347 | ||
| 1349 | last_filename_booted = filename; | 1348 | last_filename_booted = filename; |
| 1350 | 1349 | ||
| 1351 | auto& system = Core::System::GetInstance(); | ||
| 1352 | const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData()); | 1350 | const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData()); |
| 1353 | const auto loader = Loader::GetLoader(system, v_file, program_id, program_index); | 1351 | const auto loader = Loader::GetLoader(system, v_file, program_id, program_index); |
| 1354 | 1352 | ||
| @@ -1359,7 +1357,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t | |||
| 1359 | const auto config_file_name = title_id == 0 | 1357 | const auto config_file_name = title_id == 0 |
| 1360 | ? Common::FS::PathToUTF8String(file_path.filename()) | 1358 | ? Common::FS::PathToUTF8String(file_path.filename()) |
| 1361 | : fmt::format("{:016X}", title_id); | 1359 | : fmt::format("{:016X}", title_id); |
| 1362 | Config per_game_config(config_file_name, Config::ConfigType::PerGameConfig); | 1360 | Config per_game_config(system, config_file_name, Config::ConfigType::PerGameConfig); |
| 1363 | } | 1361 | } |
| 1364 | 1362 | ||
| 1365 | ConfigureVibration::SetAllVibrationDevices(); | 1363 | ConfigureVibration::SetAllVibrationDevices(); |
| @@ -1382,7 +1380,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t | |||
| 1382 | return; | 1380 | return; |
| 1383 | 1381 | ||
| 1384 | // Create and start the emulation thread | 1382 | // Create and start the emulation thread |
| 1385 | emu_thread = std::make_unique<EmuThread>(); | 1383 | emu_thread = std::make_unique<EmuThread>(system); |
| 1386 | emit EmulationStarting(emu_thread.get()); | 1384 | emit EmulationStarting(emu_thread.get()); |
| 1387 | emu_thread->start(); | 1385 | emu_thread->start(); |
| 1388 | 1386 | ||
| @@ -1427,7 +1425,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t | |||
| 1427 | std::string title_version; | 1425 | std::string title_version; |
| 1428 | const auto res = system.GetGameName(title_name); | 1426 | const auto res = system.GetGameName(title_name); |
| 1429 | 1427 | ||
| 1430 | const auto metadata = [&system, title_id] { | 1428 | const auto metadata = [this, title_id] { |
| 1431 | const FileSys::PatchManager pm(title_id, system.GetFileSystemController(), | 1429 | const FileSys::PatchManager pm(title_id, system.GetFileSystemController(), |
| 1432 | system.GetContentProvider()); | 1430 | system.GetContentProvider()); |
| 1433 | return pm.GetControlMetadata(); | 1431 | return pm.GetControlMetadata(); |
| @@ -1566,9 +1564,8 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target | |||
| 1566 | const std::string& game_path) { | 1564 | const std::string& game_path) { |
| 1567 | std::filesystem::path path; | 1565 | std::filesystem::path path; |
| 1568 | QString open_target; | 1566 | QString open_target; |
| 1569 | auto& system = Core::System::GetInstance(); | ||
| 1570 | 1567 | ||
| 1571 | const auto [user_save_size, device_save_size] = [this, &game_path, &program_id, &system] { | 1568 | const auto [user_save_size, device_save_size] = [this, &game_path, &program_id] { |
| 1572 | const FileSys::PatchManager pm{program_id, system.GetFileSystemController(), | 1569 | const FileSys::PatchManager pm{program_id, system.GetFileSystemController(), |
| 1573 | system.GetContentProvider()}; | 1570 | system.GetContentProvider()}; |
| 1574 | const auto control = pm.GetControlMetadata().first; | 1571 | const auto control = pm.GetControlMetadata().first; |
| @@ -1754,7 +1751,7 @@ void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryT | |||
| 1754 | } | 1751 | } |
| 1755 | 1752 | ||
| 1756 | void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) { | 1753 | void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) { |
| 1757 | const auto& fs_controller = Core::System::GetInstance().GetFileSystemController(); | 1754 | const auto& fs_controller = system.GetFileSystemController(); |
| 1758 | const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) || | 1755 | const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) || |
| 1759 | fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id); | 1756 | fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id); |
| 1760 | 1757 | ||
| @@ -1770,7 +1767,7 @@ void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) { | |||
| 1770 | 1767 | ||
| 1771 | void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) { | 1768 | void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) { |
| 1772 | const auto update_id = program_id | 0x800; | 1769 | const auto update_id = program_id | 0x800; |
| 1773 | const auto& fs_controller = Core::System::GetInstance().GetFileSystemController(); | 1770 | const auto& fs_controller = system.GetFileSystemController(); |
| 1774 | const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) || | 1771 | const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) || |
| 1775 | fs_controller.GetSDMCContents()->RemoveExistingEntry(update_id); | 1772 | fs_controller.GetSDMCContents()->RemoveExistingEntry(update_id); |
| 1776 | 1773 | ||
| @@ -1785,8 +1782,8 @@ void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) | |||
| 1785 | 1782 | ||
| 1786 | void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) { | 1783 | void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) { |
| 1787 | u32 count{}; | 1784 | u32 count{}; |
| 1788 | const auto& fs_controller = Core::System::GetInstance().GetFileSystemController(); | 1785 | const auto& fs_controller = system.GetFileSystemController(); |
| 1789 | const auto dlc_entries = Core::System::GetInstance().GetContentProvider().ListEntriesFilter( | 1786 | const auto dlc_entries = system.GetContentProvider().ListEntriesFilter( |
| 1790 | FileSys::TitleType::AOC, FileSys::ContentRecordType::Data); | 1787 | FileSys::TitleType::AOC, FileSys::ContentRecordType::Data); |
| 1791 | 1788 | ||
| 1792 | for (const auto& entry : dlc_entries) { | 1789 | for (const auto& entry : dlc_entries) { |
| @@ -1924,7 +1921,6 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa | |||
| 1924 | "cancelled the operation.")); | 1921 | "cancelled the operation.")); |
| 1925 | }; | 1922 | }; |
| 1926 | 1923 | ||
| 1927 | auto& system = Core::System::GetInstance(); | ||
| 1928 | const auto loader = Loader::GetLoader(system, vfs->OpenFile(game_path, FileSys::Mode::Read)); | 1924 | const auto loader = Loader::GetLoader(system, vfs->OpenFile(game_path, FileSys::Mode::Read)); |
| 1929 | if (loader == nullptr) { | 1925 | if (loader == nullptr) { |
| 1930 | failed(); | 1926 | failed(); |
| @@ -2092,7 +2088,7 @@ void GMainWindow::OnGameListShowList(bool show) { | |||
| 2092 | void GMainWindow::OnGameListOpenPerGameProperties(const std::string& file) { | 2088 | void GMainWindow::OnGameListOpenPerGameProperties(const std::string& file) { |
| 2093 | u64 title_id{}; | 2089 | u64 title_id{}; |
| 2094 | const auto v_file = Core::GetGameFileFromPath(vfs, file); | 2090 | const auto v_file = Core::GetGameFileFromPath(vfs, file); |
| 2095 | const auto loader = Loader::GetLoader(Core::System::GetInstance(), v_file); | 2091 | const auto loader = Loader::GetLoader(system, v_file); |
| 2096 | 2092 | ||
| 2097 | if (loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) { | 2093 | if (loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) { |
| 2098 | QMessageBox::information(this, tr("Properties"), | 2094 | QMessageBox::information(this, tr("Properties"), |
| @@ -2306,9 +2302,8 @@ InstallResult GMainWindow::InstallNSPXCI(const QString& filename) { | |||
| 2306 | if (nsp->GetStatus() != Loader::ResultStatus::Success) { | 2302 | if (nsp->GetStatus() != Loader::ResultStatus::Success) { |
| 2307 | return InstallResult::Failure; | 2303 | return InstallResult::Failure; |
| 2308 | } | 2304 | } |
| 2309 | const auto res = | 2305 | const auto res = system.GetFileSystemController().GetUserNANDContents()->InstallEntry( |
| 2310 | Core::System::GetInstance().GetFileSystemController().GetUserNANDContents()->InstallEntry( | 2306 | *nsp, true, qt_raw_copy); |
| 2311 | *nsp, true, qt_raw_copy); | ||
| 2312 | switch (res) { | 2307 | switch (res) { |
| 2313 | case FileSys::InstallResult::Success: | 2308 | case FileSys::InstallResult::Success: |
| 2314 | return InstallResult::Success; | 2309 | return InstallResult::Success; |
| @@ -2388,15 +2383,11 @@ InstallResult GMainWindow::InstallNCA(const QString& filename) { | |||
| 2388 | 2383 | ||
| 2389 | FileSys::InstallResult res; | 2384 | FileSys::InstallResult res; |
| 2390 | if (index >= static_cast<s32>(FileSys::TitleType::Application)) { | 2385 | if (index >= static_cast<s32>(FileSys::TitleType::Application)) { |
| 2391 | res = Core::System::GetInstance() | 2386 | res = system.GetFileSystemController().GetUserNANDContents()->InstallEntry( |
| 2392 | .GetFileSystemController() | 2387 | *nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy); |
| 2393 | .GetUserNANDContents() | ||
| 2394 | ->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy); | ||
| 2395 | } else { | 2388 | } else { |
| 2396 | res = Core::System::GetInstance() | 2389 | res = system.GetFileSystemController().GetSystemNANDContents()->InstallEntry( |
| 2397 | .GetFileSystemController() | 2390 | *nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy); |
| 2398 | .GetSystemNANDContents() | ||
| 2399 | ->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy); | ||
| 2400 | } | 2391 | } |
| 2401 | 2392 | ||
| 2402 | if (res == FileSys::InstallResult::Success) { | 2393 | if (res == FileSys::InstallResult::Success) { |
| @@ -2458,7 +2449,6 @@ void GMainWindow::OnPauseGame() { | |||
| 2458 | } | 2449 | } |
| 2459 | 2450 | ||
| 2460 | void GMainWindow::OnStopGame() { | 2451 | void GMainWindow::OnStopGame() { |
| 2461 | auto& system{Core::System::GetInstance()}; | ||
| 2462 | if (system.GetExitLock() && !ConfirmForceLockedExit()) { | 2452 | if (system.GetExitLock() && !ConfirmForceLockedExit()) { |
| 2463 | return; | 2453 | return; |
| 2464 | } | 2454 | } |
| @@ -2483,8 +2473,8 @@ void GMainWindow::OnExit() { | |||
| 2483 | } | 2473 | } |
| 2484 | 2474 | ||
| 2485 | void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_text) { | 2475 | void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_text) { |
| 2486 | OverlayDialog dialog(render_window, Core::System::GetInstance(), error_code, error_text, | 2476 | OverlayDialog dialog(render_window, system, error_code, error_text, QString{}, tr("OK"), |
| 2487 | QString{}, tr("OK"), Qt::AlignLeft | Qt::AlignVCenter); | 2477 | Qt::AlignLeft | Qt::AlignVCenter); |
| 2488 | dialog.exec(); | 2478 | dialog.exec(); |
| 2489 | 2479 | ||
| 2490 | emit ErrorDisplayFinished(); | 2480 | emit ErrorDisplayFinished(); |
| @@ -2493,7 +2483,7 @@ void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_tex | |||
| 2493 | void GMainWindow::OnMenuReportCompatibility() { | 2483 | void GMainWindow::OnMenuReportCompatibility() { |
| 2494 | if (!Settings::values.yuzu_token.GetValue().empty() && | 2484 | if (!Settings::values.yuzu_token.GetValue().empty() && |
| 2495 | !Settings::values.yuzu_username.GetValue().empty()) { | 2485 | !Settings::values.yuzu_username.GetValue().empty()) { |
| 2496 | CompatDB compatdb{this}; | 2486 | CompatDB compatdb{system.TelemetrySession(), this}; |
| 2497 | compatdb.exec(); | 2487 | compatdb.exec(); |
| 2498 | } else { | 2488 | } else { |
| 2499 | QMessageBox::critical( | 2489 | QMessageBox::critical( |
| @@ -2656,7 +2646,8 @@ void GMainWindow::OnConfigure() { | |||
| 2656 | const auto old_theme = UISettings::values.theme; | 2646 | const auto old_theme = UISettings::values.theme; |
| 2657 | const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue(); | 2647 | const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue(); |
| 2658 | 2648 | ||
| 2659 | ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get()); | 2649 | Settings::SetConfiguringGlobal(true); |
| 2650 | ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(), system); | ||
| 2660 | connect(&configure_dialog, &ConfigureDialog::LanguageChanged, this, | 2651 | connect(&configure_dialog, &ConfigureDialog::LanguageChanged, this, |
| 2661 | &GMainWindow::OnLanguageChanged); | 2652 | &GMainWindow::OnLanguageChanged); |
| 2662 | 2653 | ||
| @@ -2692,7 +2683,7 @@ void GMainWindow::OnConfigure() { | |||
| 2692 | 2683 | ||
| 2693 | Settings::values.disabled_addons.clear(); | 2684 | Settings::values.disabled_addons.clear(); |
| 2694 | 2685 | ||
| 2695 | config = std::make_unique<Config>(); | 2686 | config = std::make_unique<Config>(system); |
| 2696 | UISettings::values.reset_to_defaults = false; | 2687 | UISettings::values.reset_to_defaults = false; |
| 2697 | 2688 | ||
| 2698 | UISettings::values.game_dirs = std::move(old_game_dirs); | 2689 | UISettings::values.game_dirs = std::move(old_game_dirs); |
| @@ -2754,15 +2745,15 @@ void GMainWindow::OnConfigureTas() { | |||
| 2754 | } | 2745 | } |
| 2755 | 2746 | ||
| 2756 | void GMainWindow::OnConfigurePerGame() { | 2747 | void GMainWindow::OnConfigurePerGame() { |
| 2757 | const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); | 2748 | const u64 title_id = system.CurrentProcess()->GetTitleID(); |
| 2758 | OpenPerGameConfiguration(title_id, game_path.toStdString()); | 2749 | OpenPerGameConfiguration(title_id, game_path.toStdString()); |
| 2759 | } | 2750 | } |
| 2760 | 2751 | ||
| 2761 | void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file_name) { | 2752 | void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file_name) { |
| 2762 | const auto v_file = Core::GetGameFileFromPath(vfs, file_name); | 2753 | const auto v_file = Core::GetGameFileFromPath(vfs, file_name); |
| 2763 | const auto& system = Core::System::GetInstance(); | ||
| 2764 | 2754 | ||
| 2765 | ConfigurePerGame dialog(this, title_id, file_name); | 2755 | Settings::SetConfiguringGlobal(false); |
| 2756 | ConfigurePerGame dialog(this, title_id, file_name, system); | ||
| 2766 | dialog.LoadFromFile(v_file); | 2757 | dialog.LoadFromFile(v_file); |
| 2767 | const auto result = dialog.exec(); | 2758 | const auto result = dialog.exec(); |
| 2768 | 2759 | ||
| @@ -2802,7 +2793,6 @@ void GMainWindow::OnLoadAmiibo() { | |||
| 2802 | } | 2793 | } |
| 2803 | 2794 | ||
| 2804 | void GMainWindow::LoadAmiibo(const QString& filename) { | 2795 | void GMainWindow::LoadAmiibo(const QString& filename) { |
| 2805 | Core::System& system{Core::System::GetInstance()}; | ||
| 2806 | Service::SM::ServiceManager& sm = system.ServiceManager(); | 2796 | Service::SM::ServiceManager& sm = system.ServiceManager(); |
| 2807 | auto nfc = sm.GetService<Service::NFP::Module::Interface>("nfp:user"); | 2797 | auto nfc = sm.GetService<Service::NFP::Module::Interface>("nfp:user"); |
| 2808 | if (nfc == nullptr) { | 2798 | if (nfc == nullptr) { |
| @@ -2854,7 +2844,7 @@ void GMainWindow::OnToggleFilterBar() { | |||
| 2854 | } | 2844 | } |
| 2855 | 2845 | ||
| 2856 | void GMainWindow::OnCaptureScreenshot() { | 2846 | void GMainWindow::OnCaptureScreenshot() { |
| 2857 | const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); | 2847 | const u64 title_id = system.CurrentProcess()->GetTitleID(); |
| 2858 | const auto screenshot_path = | 2848 | const auto screenshot_path = |
| 2859 | QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir)); | 2849 | QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir)); |
| 2860 | const auto date = | 2850 | const auto date = |
| @@ -2960,7 +2950,6 @@ void GMainWindow::UpdateStatusBar() { | |||
| 2960 | tas_label->clear(); | 2950 | tas_label->clear(); |
| 2961 | } | 2951 | } |
| 2962 | 2952 | ||
| 2963 | auto& system = Core::System::GetInstance(); | ||
| 2964 | auto results = system.GetAndResetPerfStats(); | 2953 | auto results = system.GetAndResetPerfStats(); |
| 2965 | auto& shader_notify = system.GPU().ShaderNotify(); | 2954 | auto& shader_notify = system.GPU().ShaderNotify(); |
| 2966 | const int shaders_building = shader_notify.ShadersBuilding(); | 2955 | const int shaders_building = shader_notify.ShadersBuilding(); |
| @@ -3123,7 +3112,7 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det | |||
| 3123 | if (emu_thread) { | 3112 | if (emu_thread) { |
| 3124 | ShutdownGame(); | 3113 | ShutdownGame(); |
| 3125 | 3114 | ||
| 3126 | Settings::RestoreGlobalState(Core::System::GetInstance().IsPoweredOn()); | 3115 | Settings::RestoreGlobalState(system.IsPoweredOn()); |
| 3127 | UpdateStatusButtons(); | 3116 | UpdateStatusButtons(); |
| 3128 | } | 3117 | } |
| 3129 | } else { | 3118 | } else { |
| @@ -3165,7 +3154,6 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) { | |||
| 3165 | const auto function = [this, &keys, &pdm] { | 3154 | const auto function = [this, &keys, &pdm] { |
| 3166 | keys.PopulateFromPartitionData(pdm); | 3155 | keys.PopulateFromPartitionData(pdm); |
| 3167 | 3156 | ||
| 3168 | auto& system = Core::System::GetInstance(); | ||
| 3169 | system.GetFileSystemController().CreateFactories(*vfs); | 3157 | system.GetFileSystemController().CreateFactories(*vfs); |
| 3170 | keys.DeriveETicket(pdm, system.GetContentProvider()); | 3158 | keys.DeriveETicket(pdm, system.GetContentProvider()); |
| 3171 | }; | 3159 | }; |
| @@ -3209,7 +3197,7 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) { | |||
| 3209 | prog.close(); | 3197 | prog.close(); |
| 3210 | } | 3198 | } |
| 3211 | 3199 | ||
| 3212 | Core::System::GetInstance().GetFileSystemController().CreateFactories(*vfs); | 3200 | system.GetFileSystemController().CreateFactories(*vfs); |
| 3213 | 3201 | ||
| 3214 | if (behavior == ReinitializeKeyBehavior::Warning) { | 3202 | if (behavior == ReinitializeKeyBehavior::Warning) { |
| 3215 | game_list->PopulateAsync(UISettings::values.game_dirs); | 3203 | game_list->PopulateAsync(UISettings::values.game_dirs); |
| @@ -3277,7 +3265,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) { | |||
| 3277 | if (emu_thread != nullptr) { | 3265 | if (emu_thread != nullptr) { |
| 3278 | ShutdownGame(); | 3266 | ShutdownGame(); |
| 3279 | 3267 | ||
| 3280 | Settings::RestoreGlobalState(Core::System::GetInstance().IsPoweredOn()); | 3268 | Settings::RestoreGlobalState(system.IsPoweredOn()); |
| 3281 | UpdateStatusButtons(); | 3269 | UpdateStatusButtons(); |
| 3282 | } | 3270 | } |
| 3283 | 3271 | ||
| @@ -3352,7 +3340,7 @@ bool GMainWindow::ConfirmForceLockedExit() { | |||
| 3352 | } | 3340 | } |
| 3353 | 3341 | ||
| 3354 | void GMainWindow::RequestGameExit() { | 3342 | void GMainWindow::RequestGameExit() { |
| 3355 | auto& sm{Core::System::GetInstance().ServiceManager()}; | 3343 | auto& sm{system.ServiceManager()}; |
| 3356 | auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE"); | 3344 | auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE"); |
| 3357 | auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE"); | 3345 | auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE"); |
| 3358 | bool has_signalled = false; | 3346 | bool has_signalled = false; |
| @@ -3446,7 +3434,7 @@ void GMainWindow::OnLanguageChanged(const QString& locale) { | |||
| 3446 | void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) { | 3434 | void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) { |
| 3447 | #ifdef USE_DISCORD_PRESENCE | 3435 | #ifdef USE_DISCORD_PRESENCE |
| 3448 | if (state) { | 3436 | if (state) { |
| 3449 | discord_rpc = std::make_unique<DiscordRPC::DiscordImpl>(); | 3437 | discord_rpc = std::make_unique<DiscordRPC::DiscordImpl>(system); |
| 3450 | } else { | 3438 | } else { |
| 3451 | discord_rpc = std::make_unique<DiscordRPC::NullImpl>(); | 3439 | discord_rpc = std::make_unique<DiscordRPC::NullImpl>(); |
| 3452 | } | 3440 | } |
| @@ -3501,7 +3489,7 @@ int main(int argc, char* argv[]) { | |||
| 3501 | setlocale(LC_ALL, "C"); | 3489 | setlocale(LC_ALL, "C"); |
| 3502 | 3490 | ||
| 3503 | Core::System::InitializeGlobalInstance(); | 3491 | Core::System::InitializeGlobalInstance(); |
| 3504 | GMainWindow main_window; | 3492 | GMainWindow main_window{Core::System::GetInstance()}; |
| 3505 | // After settings have been loaded by GMainWindow, apply the filter | 3493 | // After settings have been loaded by GMainWindow, apply the filter |
| 3506 | main_window.show(); | 3494 | main_window.show(); |
| 3507 | 3495 | ||
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 5df2c9422..e31b3d06b 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -107,7 +107,7 @@ class GMainWindow : public QMainWindow { | |||
| 107 | public: | 107 | public: |
| 108 | void filterBarSetChecked(bool state); | 108 | void filterBarSetChecked(bool state); |
| 109 | void UpdateUITheme(); | 109 | void UpdateUITheme(); |
| 110 | GMainWindow(); | 110 | GMainWindow(Core::System& system_); |
| 111 | ~GMainWindow() override; | 111 | ~GMainWindow() override; |
| 112 | 112 | ||
| 113 | bool DropAction(QDropEvent* event); | 113 | bool DropAction(QDropEvent* event); |
| @@ -311,6 +311,8 @@ private: | |||
| 311 | std::unique_ptr<DiscordRPC::DiscordInterface> discord_rpc; | 311 | std::unique_ptr<DiscordRPC::DiscordInterface> discord_rpc; |
| 312 | std::shared_ptr<InputCommon::InputSubsystem> input_subsystem; | 312 | std::shared_ptr<InputCommon::InputSubsystem> input_subsystem; |
| 313 | 313 | ||
| 314 | Core::System& system; | ||
| 315 | |||
| 314 | GRenderWindow* render_window; | 316 | GRenderWindow* render_window; |
| 315 | GameList* game_list; | 317 | GameList* game_list; |
| 316 | LoadingScreen* loading_screen; | 318 | LoadingScreen* loading_screen; |