summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/yuzu/applets/qt_controller.cpp26
-rw-r--r--src/yuzu/applets/qt_controller.h6
-rw-r--r--src/yuzu/bootmanager.cpp12
-rw-r--r--src/yuzu/bootmanager.h11
-rw-r--r--src/yuzu/compatdb.cpp14
-rw-r--r--src/yuzu/compatdb.h5
-rw-r--r--src/yuzu/configuration/config.cpp5
-rw-r--r--src/yuzu/configuration/config.h8
-rw-r--r--src/yuzu/configuration/configure.ui200
-rw-r--r--src/yuzu/configuration/configure_audio.cpp6
-rw-r--r--src/yuzu/configuration/configure_audio.h10
-rw-r--r--src/yuzu/configuration/configure_audio.ui3
-rw-r--r--src/yuzu/configuration/configure_cpu.cpp5
-rw-r--r--src/yuzu/configuration/configure_cpu.h11
-rw-r--r--src/yuzu/configuration/configure_cpu.ui5
-rw-r--r--src/yuzu/configuration/configure_cpu_debug.cpp6
-rw-r--r--src/yuzu/configuration/configure_cpu_debug.h8
-rw-r--r--src/yuzu/configuration/configure_cpu_debug.ui3
-rw-r--r--src/yuzu/configuration/configure_debug.cpp5
-rw-r--r--src/yuzu/configuration/configure_debug.h8
-rw-r--r--src/yuzu/configuration/configure_debug_controller.cpp5
-rw-r--r--src/yuzu/configuration/configure_debug_controller.h6
-rw-r--r--src/yuzu/configuration/configure_debug_tab.cpp17
-rw-r--r--src/yuzu/configuration/configure_debug_tab.h14
-rw-r--r--src/yuzu/configuration/configure_debug_tab.ui29
-rw-r--r--src/yuzu/configuration/configure_dialog.cpp109
-rw-r--r--src/yuzu/configuration/configure_dialog.h38
-rw-r--r--src/yuzu/configuration/configure_filesystem.ui3
-rw-r--r--src/yuzu/configuration/configure_general.cpp6
-rw-r--r--src/yuzu/configuration/configure_general.h11
-rw-r--r--src/yuzu/configuration/configure_general.ui3
-rw-r--r--src/yuzu/configuration/configure_graphics.cpp6
-rw-r--r--src/yuzu/configuration/configure_graphics.h11
-rw-r--r--src/yuzu/configuration/configure_graphics.ui5
-rw-r--r--src/yuzu/configuration/configure_graphics_advanced.cpp6
-rw-r--r--src/yuzu/configuration/configure_graphics_advanced.h11
-rw-r--r--src/yuzu/configuration/configure_graphics_advanced.ui3
-rw-r--r--src/yuzu/configuration/configure_hotkeys.ui3
-rw-r--r--src/yuzu/configuration/configure_input.cpp44
-rw-r--r--src/yuzu/configuration/configure_input.h10
-rw-r--r--src/yuzu/configuration/configure_input_player.cpp18
-rw-r--r--src/yuzu/configuration/configure_input_player.h9
-rw-r--r--src/yuzu/configuration/configure_input_profile_dialog.cpp7
-rw-r--r--src/yuzu/configuration/configure_input_profile_dialog.h6
-rw-r--r--src/yuzu/configuration/configure_network.cpp6
-rw-r--r--src/yuzu/configuration/configure_network.h4
-rw-r--r--src/yuzu/configuration/configure_network.ui3
-rw-r--r--src/yuzu/configuration/configure_per_game.cpp66
-rw-r--r--src/yuzu/configuration/configure_per_game.h25
-rw-r--r--src/yuzu/configuration/configure_per_game.ui104
-rw-r--r--src/yuzu/configuration/configure_per_game_addons.cpp7
-rw-r--r--src/yuzu/configuration/configure_per_game_addons.h8
-rw-r--r--src/yuzu/configuration/configure_per_game_addons.ui3
-rw-r--r--src/yuzu/configuration/configure_profile_manager.cpp8
-rw-r--r--src/yuzu/configuration/configure_profile_manager.h8
-rw-r--r--src/yuzu/configuration/configure_profile_manager.ui5
-rw-r--r--src/yuzu/configuration/configure_system.cpp9
-rw-r--r--src/yuzu/configuration/configure_system.h11
-rw-r--r--src/yuzu/configuration/configure_system.ui3
-rw-r--r--src/yuzu/configuration/configure_ui.cpp5
-rw-r--r--src/yuzu/configuration/configure_ui.h8
-rw-r--r--src/yuzu/configuration/configure_ui.ui5
-rw-r--r--src/yuzu/configuration/configure_web.ui36
-rw-r--r--src/yuzu/configuration/input_profiles.cpp9
-rw-r--r--src/yuzu/configuration/input_profiles.h8
-rw-r--r--src/yuzu/debugger/wait_tree.cpp79
-rw-r--r--src/yuzu/debugger/wait_tree.h47
-rw-r--r--src/yuzu/main.cpp116
-rw-r--r--src/yuzu/main.h4
69 files changed, 688 insertions, 636 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
39void UpdateController(Settings::ControllerType controller_type, std::size_t npad_index, 39void 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
80QtControllerSelectorDialog::QtControllerSelectorDialog( 77QtControllerSelectorDialog::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() {
245void QtControllerSelectorDialog::ApplyConfiguration() { 242void 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
295void QtControllerSelectorDialog::CallConfigureInputProfileDialog() { 292void 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
566void QtControllerSelectorDialog::UpdateLEDPattern(std::size_t player_index) { 563void 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
12class GMainWindow; 13class GMainWindow;
@@ -36,7 +37,8 @@ class QtControllerSelectorDialog final : public QDialog {
36public: 37public:
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
45EmuThread::EmuThread() = default; 45EmuThread::EmuThread(Core::System& system_) : system{system_} {}
46 46
47EmuThread::~EmuThread() = default; 47EmuThread::~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
287GRenderWindow::GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_, 286GRenderWindow::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
631void GRenderWindow::CaptureScreenshot(u32 res_scale, const QString& screenshot_path) { 632void 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
35namespace VideoCore { 35namespace VideoCore {
36enum class LoadCallbackStage; 36enum class LoadCallbackStage;
37} 37class RendererBase;
38} // namespace VideoCore
38 39
39class EmuThread final : public QThread { 40class EmuThread final : public QThread {
40 Q_OBJECT 41 Q_OBJECT
41 42
42public: 43public:
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
105signals: 107signals:
106 /** 108 /**
@@ -131,7 +133,8 @@ class GRenderWindow : public QWidget, public Core::Frontend::EmuWindow {
131 133
132public: 134public:
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
235protected: 240protected:
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
16CompatDB::CompatDB(QWidget* parent) 15CompatDB::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
11namespace Ui { 12namespace Ui {
12class CompatDB; 13class CompatDB;
@@ -16,7 +17,7 @@ class CompatDB : public QWizard {
16 Q_OBJECT 17 Q_OBJECT
17 18
18public: 19public:
19 explicit CompatDB(QWidget* parent = nullptr); 20 explicit CompatDB(Core::TelemetrySession& telemetry_session_, QWidget* parent = nullptr);
20 ~CompatDB(); 21 ~CompatDB();
21 22
22private: 23private:
@@ -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
17namespace FS = Common::FS; 17namespace FS = Common::FS;
18 18
19Config::Config(const std::string& config_name, ConfigType config_type) : type(config_type) { 19Config::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
1599void Config::Save() { 1600void 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
15class QSettings; 15class QSettings;
16 16
17namespace Core {
18class System;
19}
20
17class Config { 21class Config {
18public: 22public:
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..7ddfd822b 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
17ConfigureAudio::ConfigureAudio(QWidget* parent) 17ConfigureAudio::ConfigureAudio(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..7b503ff48 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
10namespace Core {
11class System;
12}
13
10namespace ConfigurationShared { 14namespace ConfigurationShared {
11enum class CheckState; 15enum class CheckState;
12} 16}
@@ -19,10 +23,11 @@ class ConfigureAudio : public QWidget {
19 Q_OBJECT 23 Q_OBJECT
20 24
21public: 25public:
22 explicit ConfigureAudio(QWidget* parent = nullptr); 26 explicit ConfigureAudio(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
27private: 32private:
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 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..a232e8970 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
16ConfigureCpu::ConfigureCpu(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureCpu) { 16ConfigureCpu::ConfigureCpu(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
27ConfigureCpu::~ConfigureCpu() = default; 28ConfigureCpu::~ConfigureCpu() = default;
28 29
29void ConfigureCpu::SetConfiguration() { 30void 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..ae4e389f6 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
11namespace Core {
12class System;
13}
14
11namespace ConfigurationShared { 15namespace ConfigurationShared {
12enum class CheckState; 16enum class CheckState;
13} 17}
@@ -20,10 +24,11 @@ class ConfigureCpu : public QWidget {
20 Q_OBJECT 24 Q_OBJECT
21 25
22public: 26public:
23 explicit ConfigureCpu(QWidget* parent = nullptr); 27 explicit ConfigureCpu(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
28private: 33private:
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 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..e22f6166c 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
14ConfigureCpuDebug::ConfigureCpuDebug(QWidget* parent) 14ConfigureCpuDebug::ConfigureCpuDebug(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)
21ConfigureCpuDebug::~ConfigureCpuDebug() = default; 21ConfigureCpuDebug::~ConfigureCpuDebug() = default;
22 22
23void ConfigureCpuDebug::SetConfiguration() { 23void 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..3811fd602 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
10namespace Core {
11class System;
12}
13
10namespace Ui { 14namespace Ui {
11class ConfigureCpuDebug; 15class ConfigureCpuDebug;
12} 16}
@@ -15,7 +19,7 @@ class ConfigureCpuDebug : public QWidget {
15 Q_OBJECT 19 Q_OBJECT
16 20
17public: 21public:
18 explicit ConfigureCpuDebug(QWidget* parent = nullptr); 22 explicit ConfigureCpuDebug(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 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..f67a3d723 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
17ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureDebug) { 17ConfigureDebug::ConfigureDebug(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
28ConfigureDebug::~ConfigureDebug() = default; 29ConfigureDebug::~ConfigureDebug() = default;
29 30
30void ConfigureDebug::SetConfiguration() { 31void 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..89eb9d76c 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
10namespace Core {
11class System;
12}
13
10namespace Ui { 14namespace Ui {
11class ConfigureDebug; 15class ConfigureDebug;
12} 16}
@@ -15,7 +19,7 @@ class ConfigureDebug : public QWidget {
15 Q_OBJECT 19 Q_OBJECT
16 20
17public: 21public:
18 explicit ConfigureDebug(QWidget* parent = nullptr); 22 explicit ConfigureDebug(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 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
9ConfigureDebugController::ConfigureDebugController(QWidget* parent, 10ConfigureDebugController::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
14class InputProfiles; 14class InputProfiles;
15 15
16namespace Core {
17class System;
18}
19
16namespace InputCommon { 20namespace InputCommon {
17class InputSubsystem; 21class InputSubsystem;
18} 22}
@@ -26,7 +30,7 @@ class ConfigureDebugController : public QDialog {
26 30
27public: 31public:
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..03f266adf 100644
--- a/src/yuzu/configuration/configure_debug_tab.cpp
+++ b/src/yuzu/configuration/configure_debug_tab.cpp
@@ -2,21 +2,30 @@
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
8ConfigureDebugTab::ConfigureDebugTab(QWidget* parent) 11ConfigureDebugTab::ConfigureDebugTab(Core::System& system_, QWidget* parent)
9 : QWidget(parent), ui(new Ui::ConfigureDebugTab) { 12 : QWidget(parent),
13 ui(new Ui::ConfigureDebugTab), system{system_}, debug_tab{std::make_unique<ConfigureDebug>(
14 system_, this)},
15 cpu_debug_tab{std::make_unique<ConfigureCpuDebug>(system_, this)} {
10 ui->setupUi(this); 16 ui->setupUi(this);
11 17
18 ui->tabWidget->addTab(debug_tab.get(), tr("Debug"));
19 ui->tabWidget->addTab(cpu_debug_tab.get(), tr("CPU"));
20
12 SetConfiguration(); 21 SetConfiguration();
13} 22}
14 23
15ConfigureDebugTab::~ConfigureDebugTab() = default; 24ConfigureDebugTab::~ConfigureDebugTab() = default;
16 25
17void ConfigureDebugTab::ApplyConfiguration() { 26void ConfigureDebugTab::ApplyConfiguration() {
18 ui->debugTab->ApplyConfiguration(); 27 debug_tab->ApplyConfiguration();
19 ui->cpuDebugTab->ApplyConfiguration(); 28 cpu_debug_tab->ApplyConfiguration();
20} 29}
21 30
22void ConfigureDebugTab::SetCurrentIndex(int index) { 31void ConfigureDebugTab::SetCurrentIndex(int index) {
diff --git a/src/yuzu/configuration/configure_debug_tab.h b/src/yuzu/configuration/configure_debug_tab.h
index 0a96d43d0..9cf309a83 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
10class ConfigureDebug;
11class ConfigureCpuDebug;
12
13namespace Core {
14class System;
15}
16
10namespace Ui { 17namespace Ui {
11class ConfigureDebugTab; 18class ConfigureDebugTab;
12} 19}
@@ -15,7 +22,7 @@ class ConfigureDebugTab : public QWidget {
15 Q_OBJECT 22 Q_OBJECT
16 23
17public: 24public:
18 explicit ConfigureDebugTab(QWidget* parent = nullptr); 25 explicit ConfigureDebugTab(Core::System& system_, QWidget* parent = nullptr);
19 ~ConfigureDebugTab() override; 26 ~ConfigureDebugTab() override;
20 27
21 void ApplyConfiguration(); 28 void ApplyConfiguration();
@@ -29,4 +36,9 @@ 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 Core::System& system;
41
42 std::unique_ptr<ConfigureDebug> debug_tab;
43 std::unique_ptr<ConfigureCpuDebug> cpu_debug_tab;
32}; 44};
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
20ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, 36ConfigureDialog::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;
54void ConfigureDialog::SetConfiguration() {} 102void ConfigureDialog::SetConfiguration() {}
55 103
56void ConfigureDialog::ApplyConfiguration() { 104void 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
103void ConfigureDialog::PopulateSelectionList() { 151void 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
10namespace Core {
11class System;
12}
13
14class ConfigureAudio;
15class ConfigureCpu;
16class ConfigureDebugTab;
17class ConfigureFilesystem;
18class ConfigureGeneral;
19class ConfigureGraphics;
20class ConfigureGraphicsAdvanced;
21class ConfigureHotkeys;
22class ConfigureInput;
23class ConfigureProfileManager;
24class ConfigureSystem;
25class ConfigureNetwork;
26class ConfigureUi;
27class ConfigureWeb;
28
10class HotkeyRegistry; 29class HotkeyRegistry;
11 30
12namespace InputCommon { 31namespace InputCommon {
@@ -22,7 +41,7 @@ class ConfigureDialog : public QDialog {
22 41
23public: 42public:
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..70f067ea7 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
18ConfigureGeneral::ConfigureGeneral(QWidget* parent) 18ConfigureGeneral::ConfigureGeneral(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)
35ConfigureGeneral::~ConfigureGeneral() = default; 35ConfigureGeneral::~ConfigureGeneral() = default;
36 36
37void ConfigureGeneral::SetConfiguration() { 37void 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..6f8957280 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
11namespace Core {
12class System;
13}
14
11class ConfigureDialog; 15class ConfigureDialog;
12 16
13namespace ConfigurationShared { 17namespace ConfigurationShared {
@@ -24,19 +28,18 @@ class ConfigureGeneral : public QWidget {
24 Q_OBJECT 28 Q_OBJECT
25 29
26public: 30public:
27 explicit ConfigureGeneral(QWidget* parent = nullptr); 31 explicit ConfigureGeneral(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
34private: 39private:
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 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..cb4df429c 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
22ConfigureGraphics::ConfigureGraphics(QWidget* parent) 22ConfigureGraphics::ConfigureGraphics(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) {
83ConfigureGraphics::~ConfigureGraphics() = default; 83ConfigureGraphics::~ConfigureGraphics() = default;
84 84
85void ConfigureGraphics::SetConfiguration() { 85void 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..d0dddf864 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
13namespace Core {
14class System;
15}
16
13namespace ConfigurationShared { 17namespace ConfigurationShared {
14enum class CheckState; 18enum class CheckState;
15} 19}
@@ -22,17 +26,16 @@ class ConfigureGraphics : public QWidget {
22 Q_OBJECT 26 Q_OBJECT
23 27
24public: 28public:
25 explicit ConfigureGraphics(QWidget* parent = nullptr); 29 explicit ConfigureGraphics(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
30private: 35private:
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 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..de2d669b4 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
11ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(QWidget* parent) 11ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(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)
21ConfigureGraphicsAdvanced::~ConfigureGraphicsAdvanced() = default; 21ConfigureGraphicsAdvanced::~ConfigureGraphicsAdvanced() = default;
22 22
23void ConfigureGraphicsAdvanced::SetConfiguration() { 23void 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..eee5343fb 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
10namespace Core {
11class System;
12}
13
10namespace ConfigurationShared { 14namespace ConfigurationShared {
11enum class CheckState; 15enum class CheckState;
12} 16}
@@ -19,17 +23,16 @@ class ConfigureGraphicsAdvanced : public QWidget {
19 Q_OBJECT 23 Q_OBJECT
20 24
21public: 25public:
22 explicit ConfigureGraphicsAdvanced(QWidget* parent = nullptr); 26 explicit ConfigureGraphicsAdvanced(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
27private: 32private:
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 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
42void OnDockedModeChanged(bool last_state, bool new_state) { 42void 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
69ConfigureInput::ConfigureInput(QWidget* parent) 68ConfigureInput::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;
77void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem, 76void 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
14namespace Core {
15class System;
16}
17
14class QCheckBox; 18class QCheckBox;
15class QString; 19class QString;
16class QTimer; 20class QTimer;
@@ -28,13 +32,13 @@ namespace Ui {
28class ConfigureInput; 32class ConfigureInput;
29} 33}
30 34
31void OnDockedModeChanged(bool last_state, bool new_state); 35void OnDockedModeChanged(bool last_state, bool new_state, Core::System& system);
32 36
33class ConfigureInput : public QWidget { 37class ConfigureInput : public QWidget {
34 Q_OBJECT 38 Q_OBJECT
35 39
36public: 40public:
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 {
44constexpr std::size_t HANDHELD_INDEX = 8; 44constexpr std::size_t HANDHELD_INDEX = 8;
45 45
46void UpdateController(Settings::ControllerType controller_type, std::size_t npad_index, 46void 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)
232ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_index, 231ConfigureInputPlayer::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
709void ConfigureInputPlayer::TryDisconnectSelectedController() { 709void 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
743void ConfigureInputPlayer::showEvent(QShowEvent* event) { 743void 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
30class InputProfiles; 30class InputProfiles;
31 31
32namespace Core {
33class System;
34}
35
32namespace InputCommon { 36namespace InputCommon {
33class InputSubsystem; 37class InputSubsystem;
34} 38}
@@ -48,7 +52,8 @@ class ConfigureInputPlayer : public QWidget {
48public: 52public:
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
9ConfigureInputProfileDialog::ConfigureInputProfileDialog( 10ConfigureInputProfileDialog::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
14class InputProfiles; 14class InputProfiles;
15 15
16namespace Core {
17class System;
18}
19
16namespace InputCommon { 20namespace InputCommon {
17class InputSubsystem; 21class InputSubsystem;
18} 22}
@@ -27,7 +31,7 @@ class ConfigureInputProfileDialog : public QDialog {
27public: 31public:
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
33private: 37private:
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
13ConfigureNetwork::ConfigureNetwork(QWidget* parent) 13ConfigureNetwork::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
35void ConfigureNetwork::SetConfiguration() { 35void 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
18public: 18public:
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
38ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id, const std::string& file_name) 45ConfigurePerGame::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
67ConfigurePerGame::~ConfigurePerGame() = default; 91ConfigurePerGame::~ConfigurePerGame() = default;
68 92
69void ConfigurePerGame::ApplyConfiguration() { 93void 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
17namespace Core {
18class System;
19}
20
21class ConfigurePerGameAddons;
22class ConfigureAudio;
23class ConfigureCpu;
24class ConfigureGeneral;
25class ConfigureGraphics;
26class ConfigureGraphicsAdvanced;
27class ConfigureSystem;
28
17class QGraphicsScene; 29class QGraphicsScene;
18class QStandardItem; 30class QStandardItem;
19class QStandardItemModel; 31class QStandardItemModel;
@@ -29,7 +41,8 @@ class ConfigurePerGame : public QDialog {
29 41
30public: 42public:
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
29ConfigurePerGameAddons::ConfigurePerGameAddons(QWidget* parent) 29ConfigurePerGameAddons::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
14namespace Core {
15class System;
16}
17
14class QGraphicsScene; 18class QGraphicsScene;
15class QStandardItem; 19class QStandardItem;
16class QStandardItemModel; 20class QStandardItemModel;
@@ -25,7 +29,7 @@ class ConfigurePerGameAddons : public QWidget {
25 Q_OBJECT 29 Q_OBJECT
26 30
27public: 31public:
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..2ba65c638 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
79ConfigureProfileManager::ConfigureProfileManager(QWidget* parent) 79ConfigureProfileManager::ConfigureProfileManager(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
139void ConfigureProfileManager::SetConfiguration() { 139void 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
187void ConfigureProfileManager::SelectUser(const QModelIndex& index) { 185void 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..afd9b3679 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
12namespace Core {
13class System;
14}
15
12class QGraphicsScene; 16class QGraphicsScene;
13class QStandardItem; 17class QStandardItem;
14class QStandardItemModel; 18class QStandardItemModel;
@@ -27,7 +31,7 @@ class ConfigureProfileManager : public QWidget {
27 Q_OBJECT 31 Q_OBJECT
28 32
29public: 33public:
30 explicit ConfigureProfileManager(QWidget* parent = nullptr); 34 explicit ConfigureProfileManager(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 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 99a5df241..a405e05ca 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
20ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureSystem) { 20ConfigureSystem::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
61void ConfigureSystem::SetConfiguration() { 62void 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() {
103void ConfigureSystem::ReadSystemSettings() {} 104void ConfigureSystem::ReadSystemSettings() {}
104 105
105void ConfigureSystem::ApplyConfiguration() { 106void 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
169void ConfigureSystem::RefreshConsoleID() { 166void 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
12namespace Core {
13class System;
14}
15
12namespace ConfigurationShared { 16namespace ConfigurationShared {
13enum class CheckState; 17enum class CheckState;
14} 18}
@@ -21,17 +25,16 @@ class ConfigureSystem : public QWidget {
21 Q_OBJECT 25 Q_OBJECT
22 26
23public: 27public:
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
29private: 34private:
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
57ConfigureUi::ConfigureUi(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureUi) { 57ConfigureUi::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
122void ConfigureUi::RequestGameListUpdate() { 123void 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
10namespace Core {
11class System;
12}
13
10namespace Ui { 14namespace Ui {
11class ConfigureUi; 15class ConfigureUi;
12} 16}
@@ -15,7 +19,7 @@ class ConfigureUi : public QWidget {
15 Q_OBJECT 19 Q_OBJECT
16 20
17public: 21public:
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
31InputProfiles::InputProfiles() { 31InputProfiles::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
11namespace Core {
12class System;
13}
14
11class Config; 15class Config;
12 16
13class InputProfiles { 17class InputProfiles {
14 18
15public: 19public:
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
92std::vector<std::unique_ptr<WaitTreeThread>> WaitTreeItem::MakeThreadItemList() { 92std::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
118WaitTreeMutexInfo::WaitTreeMutexInfo(VAddr mutex_address, const Kernel::KHandleTable& handle_table) 118WaitTreeMutexInfo::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
144WaitTreeCallstack::WaitTreeCallstack(const Kernel::KThread& thread) : thread(thread) {} 145WaitTreeCallstack::WaitTreeCallstack(const Kernel::KThread& thread, Core::System& system_)
146 : thread(thread), system{system_} {}
145WaitTreeCallstack::~WaitTreeCallstack() = default; 147WaitTreeCallstack::~WaitTreeCallstack() = default;
146 148
147QString WaitTreeCallstack::GetText() const { 149QString 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
174WaitTreeSynchronizationObject::WaitTreeSynchronizationObject( 175WaitTreeSynchronizationObject::WaitTreeSynchronizationObject(
175 const Kernel::KSynchronizationObject& o) 176 const Kernel::KSynchronizationObject& o, Core::System& system_)
176 : object(o) {} 177 : object(o), system{system_} {}
177WaitTreeSynchronizationObject::~WaitTreeSynchronizationObject() = default; 178WaitTreeSynchronizationObject::~WaitTreeSynchronizationObject() = default;
178 179
179WaitTreeExpandableItem::WaitTreeExpandableItem() = default; 180WaitTreeExpandableItem::WaitTreeExpandableItem() = default;
@@ -191,16 +192,18 @@ QString WaitTreeSynchronizationObject::GetText() const {
191} 192}
192 193
193std::unique_ptr<WaitTreeSynchronizationObject> WaitTreeSynchronizationObject::make( 194std::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
220WaitTreeObjectList::WaitTreeObjectList(const std::vector<Kernel::KSynchronizationObject*>& list, 223WaitTreeObjectList::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
224WaitTreeObjectList::~WaitTreeObjectList() = default; 227WaitTreeObjectList::~WaitTreeObjectList() = default;
225 228
@@ -231,13 +234,14 @@ QString WaitTreeObjectList::GetText() const {
231 234
232std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeObjectList::GetChildren() const { 235std::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
239WaitTreeThread::WaitTreeThread(const Kernel::KThread& thread) 243WaitTreeThread::WaitTreeThread(const Kernel::KThread& thread, Core::System& system_)
240 : WaitTreeSynchronizationObject(thread) {} 244 : WaitTreeSynchronizationObject(thread, system_), system{system_} {}
241WaitTreeThread::~WaitTreeThread() = default; 245WaitTreeThread::~WaitTreeThread() = default;
242 246
243QString WaitTreeThread::GetText() const { 247QString 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
380WaitTreeEvent::WaitTreeEvent(const Kernel::KReadableEvent& object) 385WaitTreeEvent::WaitTreeEvent(const Kernel::KReadableEvent& object, Core::System& system_)
381 : WaitTreeSynchronizationObject(object) {} 386 : WaitTreeSynchronizationObject(object, system_) {}
382WaitTreeEvent::~WaitTreeEvent() = default; 387WaitTreeEvent::~WaitTreeEvent() = default;
383 388
384WaitTreeThreadList::WaitTreeThreadList(std::vector<Kernel::KThread*>&& list) 389WaitTreeThreadList::WaitTreeThreadList(std::vector<Kernel::KThread*>&& list, Core::System& system_)
385 : thread_list(std::move(list)) {} 390 : thread_list(std::move(list)), system{system_} {}
386WaitTreeThreadList::~WaitTreeThreadList() = default; 391WaitTreeThreadList::~WaitTreeThreadList() = default;
387 392
388QString WaitTreeThreadList::GetText() const { 393QString WaitTreeThreadList::GetText() const {
@@ -392,11 +397,12 @@ QString WaitTreeThreadList::GetText() const {
392std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThreadList::GetChildren() const { 397std::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
399WaitTreeModel::WaitTreeModel(QObject* parent) : QAbstractItemModel(parent) {} 404WaitTreeModel::WaitTreeModel(Core::System& system_, QObject* parent)
405 : QAbstractItemModel(parent), system{system_} {}
400WaitTreeModel::~WaitTreeModel() = default; 406WaitTreeModel::~WaitTreeModel() = default;
401 407
402QModelIndex WaitTreeModel::index(int row, int column, const QModelIndex& parent) const { 408QModelIndex WaitTreeModel::index(int row, int column, const QModelIndex& parent) const {
@@ -455,10 +461,11 @@ void WaitTreeModel::ClearItems() {
455} 461}
456 462
457void WaitTreeModel::InitItems() { 463void WaitTreeModel::InitItems() {
458 thread_items = WaitTreeItem::MakeThreadItemList(); 464 thread_items = WaitTreeItem::MakeThreadItemList(system);
459} 465}
460 466
461WaitTreeWidget::WaitTreeWidget(QWidget* parent) : QDockWidget(tr("&Wait Tree"), parent) { 467WaitTreeWidget::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"),
469WaitTreeWidget::~WaitTreeWidget() = default; 476WaitTreeWidget::~WaitTreeWidget() = default;
470 477
471void WaitTreeWidget::OnDebugModeEntered() { 478void 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
485void WaitTreeWidget::OnEmulationStarting(EmuThread* emu_thread) { 492void 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
19class EmuThread; 19class EmuThread;
20 20
21namespace Core {
22class System;
23}
24
21namespace Kernel { 25namespace Kernel {
22class KHandleTable; 26class KHandleTable;
23class KReadableEvent; 27class 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
47private: 51private:
48 std::size_t row; 52 std::size_t row;
@@ -75,7 +79,8 @@ public:
75class WaitTreeMutexInfo : public WaitTreeExpandableItem { 79class WaitTreeMutexInfo : public WaitTreeExpandableItem {
76 Q_OBJECT 80 Q_OBJECT
77public: 81public:
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
91class WaitTreeCallstack : public WaitTreeExpandableItem { 98class WaitTreeCallstack : public WaitTreeExpandableItem {
92 Q_OBJECT 99 Q_OBJECT
93public: 100public:
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
100private: 107private:
101 const Kernel::KThread& thread; 108 const Kernel::KThread& thread;
109
110 Core::System& system;
102}; 111};
103 112
104class WaitTreeSynchronizationObject : public WaitTreeExpandableItem { 113class WaitTreeSynchronizationObject : public WaitTreeExpandableItem {
105 Q_OBJECT 114 Q_OBJECT
106public: 115public:
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
115protected: 125protected:
116 const Kernel::KSynchronizationObject& object; 126 const Kernel::KSynchronizationObject& object;
127
128private:
129 Core::System& system;
117}; 130};
118 131
119class WaitTreeObjectList : public WaitTreeExpandableItem { 132class WaitTreeObjectList : public WaitTreeExpandableItem {
120 Q_OBJECT 133 Q_OBJECT
121public: 134public:
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:
128private: 142private:
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
133class WaitTreeThread : public WaitTreeSynchronizationObject { 149class WaitTreeThread : public WaitTreeSynchronizationObject {
134 Q_OBJECT 150 Q_OBJECT
135public: 151public:
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
159private:
160 Core::System& system;
142}; 161};
143 162
144class WaitTreeEvent : public WaitTreeSynchronizationObject { 163class WaitTreeEvent : public WaitTreeSynchronizationObject {
145 Q_OBJECT 164 Q_OBJECT
146public: 165public:
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
151class WaitTreeThreadList : public WaitTreeExpandableItem { 170class WaitTreeThreadList : public WaitTreeExpandableItem {
152 Q_OBJECT 171 Q_OBJECT
153public: 172public:
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
160private: 179private:
161 std::vector<Kernel::KThread*> thread_list; 180 std::vector<Kernel::KThread*> thread_list;
181
182 Core::System& system;
162}; 183};
163 184
164class WaitTreeModel : public QAbstractItemModel { 185class WaitTreeModel : public QAbstractItemModel {
165 Q_OBJECT 186 Q_OBJECT
166 187
167public: 188public:
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
180private: 201private:
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
184class WaitTreeWidget : public QDockWidget { 207class WaitTreeWidget : public QDockWidget {
185 Q_OBJECT 208 Q_OBJECT
186 209
187public: 210public:
188 explicit WaitTreeWidget(QWidget* parent = nullptr); 211 explicit WaitTreeWidget(Core::System& system_, QWidget* parent = nullptr);
189 ~WaitTreeWidget() override; 212 ~WaitTreeWidget() override;
190 213
191public slots: 214public slots:
@@ -198,4 +221,6 @@ public slots:
198private: 221private:
199 QTreeView* view; 222 QTreeView* view;
200 WaitTreeModel* model; 223 WaitTreeModel* model;
224
225 Core::System& system;
201}; 226};
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 552c2cc63..056f7da36 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
193GMainWindow::GMainWindow() 193GMainWindow::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
411void GMainWindow::ControllerSelectorReconfigureControllers( 411void 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,7 +698,7 @@ 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(), 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),
@@ -1232,7 +1232,6 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
1232 return false; 1232 return false;
1233 } 1233 }
1234 1234
1235 Core::System& system{Core::System::GetInstance()};
1236 system.SetFilesystem(vfs); 1235 system.SetFilesystem(vfs);
1237 1236
1238 system.SetAppletFrontendSet({ 1237 system.SetAppletFrontendSet({
@@ -1342,7 +1341,6 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
1342 1341
1343 last_filename_booted = filename; 1342 last_filename_booted = filename;
1344 1343
1345 auto& system = Core::System::GetInstance();
1346 const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData()); 1344 const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData());
1347 const auto loader = Loader::GetLoader(system, v_file, program_id, program_index); 1345 const auto loader = Loader::GetLoader(system, v_file, program_id, program_index);
1348 1346
@@ -1353,7 +1351,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
1353 const auto config_file_name = title_id == 0 1351 const auto config_file_name = title_id == 0
1354 ? Common::FS::PathToUTF8String(file_path.filename()) 1352 ? Common::FS::PathToUTF8String(file_path.filename())
1355 : fmt::format("{:016X}", title_id); 1353 : fmt::format("{:016X}", title_id);
1356 Config per_game_config(config_file_name, Config::ConfigType::PerGameConfig); 1354 Config per_game_config(system, config_file_name, Config::ConfigType::PerGameConfig);
1357 } 1355 }
1358 1356
1359 ConfigureVibration::SetAllVibrationDevices(); 1357 ConfigureVibration::SetAllVibrationDevices();
@@ -1376,7 +1374,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
1376 return; 1374 return;
1377 1375
1378 // Create and start the emulation thread 1376 // Create and start the emulation thread
1379 emu_thread = std::make_unique<EmuThread>(); 1377 emu_thread = std::make_unique<EmuThread>(system);
1380 emit EmulationStarting(emu_thread.get()); 1378 emit EmulationStarting(emu_thread.get());
1381 emu_thread->start(); 1379 emu_thread->start();
1382 1380
@@ -1421,7 +1419,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
1421 std::string title_version; 1419 std::string title_version;
1422 const auto res = system.GetGameName(title_name); 1420 const auto res = system.GetGameName(title_name);
1423 1421
1424 const auto metadata = [&system, title_id] { 1422 const auto metadata = [this, title_id] {
1425 const FileSys::PatchManager pm(title_id, system.GetFileSystemController(), 1423 const FileSys::PatchManager pm(title_id, system.GetFileSystemController(),
1426 system.GetContentProvider()); 1424 system.GetContentProvider());
1427 return pm.GetControlMetadata(); 1425 return pm.GetControlMetadata();
@@ -1560,9 +1558,8 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
1560 const std::string& game_path) { 1558 const std::string& game_path) {
1561 std::filesystem::path path; 1559 std::filesystem::path path;
1562 QString open_target; 1560 QString open_target;
1563 auto& system = Core::System::GetInstance();
1564 1561
1565 const auto [user_save_size, device_save_size] = [this, &game_path, &program_id, &system] { 1562 const auto [user_save_size, device_save_size] = [this, &game_path, &program_id] {
1566 const FileSys::PatchManager pm{program_id, system.GetFileSystemController(), 1563 const FileSys::PatchManager pm{program_id, system.GetFileSystemController(),
1567 system.GetContentProvider()}; 1564 system.GetContentProvider()};
1568 const auto control = pm.GetControlMetadata().first; 1565 const auto control = pm.GetControlMetadata().first;
@@ -1748,7 +1745,7 @@ void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryT
1748} 1745}
1749 1746
1750void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) { 1747void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) {
1751 const auto& fs_controller = Core::System::GetInstance().GetFileSystemController(); 1748 const auto& fs_controller = system.GetFileSystemController();
1752 const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) || 1749 const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) ||
1753 fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id); 1750 fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id);
1754 1751
@@ -1764,7 +1761,7 @@ void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) {
1764 1761
1765void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) { 1762void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) {
1766 const auto update_id = program_id | 0x800; 1763 const auto update_id = program_id | 0x800;
1767 const auto& fs_controller = Core::System::GetInstance().GetFileSystemController(); 1764 const auto& fs_controller = system.GetFileSystemController();
1768 const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) || 1765 const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) ||
1769 fs_controller.GetSDMCContents()->RemoveExistingEntry(update_id); 1766 fs_controller.GetSDMCContents()->RemoveExistingEntry(update_id);
1770 1767
@@ -1779,8 +1776,8 @@ void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type)
1779 1776
1780void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) { 1777void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) {
1781 u32 count{}; 1778 u32 count{};
1782 const auto& fs_controller = Core::System::GetInstance().GetFileSystemController(); 1779 const auto& fs_controller = system.GetFileSystemController();
1783 const auto dlc_entries = Core::System::GetInstance().GetContentProvider().ListEntriesFilter( 1780 const auto dlc_entries = system.GetContentProvider().ListEntriesFilter(
1784 FileSys::TitleType::AOC, FileSys::ContentRecordType::Data); 1781 FileSys::TitleType::AOC, FileSys::ContentRecordType::Data);
1785 1782
1786 for (const auto& entry : dlc_entries) { 1783 for (const auto& entry : dlc_entries) {
@@ -1918,7 +1915,6 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
1918 "cancelled the operation.")); 1915 "cancelled the operation."));
1919 }; 1916 };
1920 1917
1921 auto& system = Core::System::GetInstance();
1922 const auto loader = Loader::GetLoader(system, vfs->OpenFile(game_path, FileSys::Mode::Read)); 1918 const auto loader = Loader::GetLoader(system, vfs->OpenFile(game_path, FileSys::Mode::Read));
1923 if (loader == nullptr) { 1919 if (loader == nullptr) {
1924 failed(); 1920 failed();
@@ -2086,7 +2082,7 @@ void GMainWindow::OnGameListShowList(bool show) {
2086void GMainWindow::OnGameListOpenPerGameProperties(const std::string& file) { 2082void GMainWindow::OnGameListOpenPerGameProperties(const std::string& file) {
2087 u64 title_id{}; 2083 u64 title_id{};
2088 const auto v_file = Core::GetGameFileFromPath(vfs, file); 2084 const auto v_file = Core::GetGameFileFromPath(vfs, file);
2089 const auto loader = Loader::GetLoader(Core::System::GetInstance(), v_file); 2085 const auto loader = Loader::GetLoader(system, v_file);
2090 2086
2091 if (loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) { 2087 if (loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) {
2092 QMessageBox::information(this, tr("Properties"), 2088 QMessageBox::information(this, tr("Properties"),
@@ -2300,9 +2296,8 @@ InstallResult GMainWindow::InstallNSPXCI(const QString& filename) {
2300 if (nsp->GetStatus() != Loader::ResultStatus::Success) { 2296 if (nsp->GetStatus() != Loader::ResultStatus::Success) {
2301 return InstallResult::Failure; 2297 return InstallResult::Failure;
2302 } 2298 }
2303 const auto res = 2299 const auto res = system.GetFileSystemController().GetUserNANDContents()->InstallEntry(
2304 Core::System::GetInstance().GetFileSystemController().GetUserNANDContents()->InstallEntry( 2300 *nsp, true, qt_raw_copy);
2305 *nsp, true, qt_raw_copy);
2306 switch (res) { 2301 switch (res) {
2307 case FileSys::InstallResult::Success: 2302 case FileSys::InstallResult::Success:
2308 return InstallResult::Success; 2303 return InstallResult::Success;
@@ -2382,15 +2377,11 @@ InstallResult GMainWindow::InstallNCA(const QString& filename) {
2382 2377
2383 FileSys::InstallResult res; 2378 FileSys::InstallResult res;
2384 if (index >= static_cast<s32>(FileSys::TitleType::Application)) { 2379 if (index >= static_cast<s32>(FileSys::TitleType::Application)) {
2385 res = Core::System::GetInstance() 2380 res = system.GetFileSystemController().GetUserNANDContents()->InstallEntry(
2386 .GetFileSystemController() 2381 *nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy);
2387 .GetUserNANDContents()
2388 ->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy);
2389 } else { 2382 } else {
2390 res = Core::System::GetInstance() 2383 res = system.GetFileSystemController().GetSystemNANDContents()->InstallEntry(
2391 .GetFileSystemController() 2384 *nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy);
2392 .GetSystemNANDContents()
2393 ->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy);
2394 } 2385 }
2395 2386
2396 if (res == FileSys::InstallResult::Success) { 2387 if (res == FileSys::InstallResult::Success) {
@@ -2452,7 +2443,6 @@ void GMainWindow::OnPauseGame() {
2452} 2443}
2453 2444
2454void GMainWindow::OnStopGame() { 2445void GMainWindow::OnStopGame() {
2455 auto& system{Core::System::GetInstance()};
2456 if (system.GetExitLock() && !ConfirmForceLockedExit()) { 2446 if (system.GetExitLock() && !ConfirmForceLockedExit()) {
2457 return; 2447 return;
2458 } 2448 }
@@ -2477,8 +2467,8 @@ void GMainWindow::OnExit() {
2477} 2467}
2478 2468
2479void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_text) { 2469void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_text) {
2480 OverlayDialog dialog(render_window, Core::System::GetInstance(), error_code, error_text, 2470 OverlayDialog dialog(render_window, system, error_code, error_text, QString{}, tr("OK"),
2481 QString{}, tr("OK"), Qt::AlignLeft | Qt::AlignVCenter); 2471 Qt::AlignLeft | Qt::AlignVCenter);
2482 dialog.exec(); 2472 dialog.exec();
2483 2473
2484 emit ErrorDisplayFinished(); 2474 emit ErrorDisplayFinished();
@@ -2487,7 +2477,7 @@ void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_tex
2487void GMainWindow::OnMenuReportCompatibility() { 2477void GMainWindow::OnMenuReportCompatibility() {
2488 if (!Settings::values.yuzu_token.GetValue().empty() && 2478 if (!Settings::values.yuzu_token.GetValue().empty() &&
2489 !Settings::values.yuzu_username.GetValue().empty()) { 2479 !Settings::values.yuzu_username.GetValue().empty()) {
2490 CompatDB compatdb{this}; 2480 CompatDB compatdb{system.TelemetrySession(), this};
2491 compatdb.exec(); 2481 compatdb.exec();
2492 } else { 2482 } else {
2493 QMessageBox::critical( 2483 QMessageBox::critical(
@@ -2653,7 +2643,8 @@ void GMainWindow::OnConfigure() {
2653 const auto old_theme = UISettings::values.theme; 2643 const auto old_theme = UISettings::values.theme;
2654 const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue(); 2644 const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue();
2655 2645
2656 ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get()); 2646 Settings::SetConfiguringGlobal(true);
2647 ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(), system);
2657 connect(&configure_dialog, &ConfigureDialog::LanguageChanged, this, 2648 connect(&configure_dialog, &ConfigureDialog::LanguageChanged, this,
2658 &GMainWindow::OnLanguageChanged); 2649 &GMainWindow::OnLanguageChanged);
2659 2650
@@ -2689,7 +2680,7 @@ void GMainWindow::OnConfigure() {
2689 2680
2690 Settings::values.disabled_addons.clear(); 2681 Settings::values.disabled_addons.clear();
2691 2682
2692 config = std::make_unique<Config>(); 2683 config = std::make_unique<Config>(system);
2693 UISettings::values.reset_to_defaults = false; 2684 UISettings::values.reset_to_defaults = false;
2694 2685
2695 UISettings::values.game_dirs = std::move(old_game_dirs); 2686 UISettings::values.game_dirs = std::move(old_game_dirs);
@@ -2751,15 +2742,15 @@ void GMainWindow::OnConfigureTas() {
2751} 2742}
2752 2743
2753void GMainWindow::OnConfigurePerGame() { 2744void GMainWindow::OnConfigurePerGame() {
2754 const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); 2745 const u64 title_id = system.CurrentProcess()->GetTitleID();
2755 OpenPerGameConfiguration(title_id, game_path.toStdString()); 2746 OpenPerGameConfiguration(title_id, game_path.toStdString());
2756} 2747}
2757 2748
2758void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file_name) { 2749void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file_name) {
2759 const auto v_file = Core::GetGameFileFromPath(vfs, file_name); 2750 const auto v_file = Core::GetGameFileFromPath(vfs, file_name);
2760 const auto& system = Core::System::GetInstance();
2761 2751
2762 ConfigurePerGame dialog(this, title_id, file_name); 2752 Settings::SetConfiguringGlobal(false);
2753 ConfigurePerGame dialog(this, title_id, file_name, system);
2763 dialog.LoadFromFile(v_file); 2754 dialog.LoadFromFile(v_file);
2764 const auto result = dialog.exec(); 2755 const auto result = dialog.exec();
2765 2756
@@ -2799,7 +2790,6 @@ void GMainWindow::OnLoadAmiibo() {
2799} 2790}
2800 2791
2801void GMainWindow::LoadAmiibo(const QString& filename) { 2792void GMainWindow::LoadAmiibo(const QString& filename) {
2802 Core::System& system{Core::System::GetInstance()};
2803 Service::SM::ServiceManager& sm = system.ServiceManager(); 2793 Service::SM::ServiceManager& sm = system.ServiceManager();
2804 auto nfc = sm.GetService<Service::NFP::Module::Interface>("nfp:user"); 2794 auto nfc = sm.GetService<Service::NFP::Module::Interface>("nfp:user");
2805 if (nfc == nullptr) { 2795 if (nfc == nullptr) {
@@ -2851,7 +2841,7 @@ void GMainWindow::OnToggleFilterBar() {
2851} 2841}
2852 2842
2853void GMainWindow::OnCaptureScreenshot() { 2843void GMainWindow::OnCaptureScreenshot() {
2854 const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); 2844 const u64 title_id = system.CurrentProcess()->GetTitleID();
2855 const auto screenshot_path = 2845 const auto screenshot_path =
2856 QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir)); 2846 QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir));
2857 const auto date = 2847 const auto date =
@@ -2957,7 +2947,6 @@ void GMainWindow::UpdateStatusBar() {
2957 tas_label->clear(); 2947 tas_label->clear();
2958 } 2948 }
2959 2949
2960 auto& system = Core::System::GetInstance();
2961 auto results = system.GetAndResetPerfStats(); 2950 auto results = system.GetAndResetPerfStats();
2962 auto& shader_notify = system.GPU().ShaderNotify(); 2951 auto& shader_notify = system.GPU().ShaderNotify();
2963 const int shaders_building = shader_notify.ShadersBuilding(); 2952 const int shaders_building = shader_notify.ShadersBuilding();
@@ -3120,7 +3109,7 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
3120 if (emu_thread) { 3109 if (emu_thread) {
3121 ShutdownGame(); 3110 ShutdownGame();
3122 3111
3123 Settings::RestoreGlobalState(Core::System::GetInstance().IsPoweredOn()); 3112 Settings::RestoreGlobalState(system.IsPoweredOn());
3124 UpdateStatusButtons(); 3113 UpdateStatusButtons();
3125 } 3114 }
3126 } else { 3115 } else {
@@ -3162,7 +3151,6 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
3162 const auto function = [this, &keys, &pdm] { 3151 const auto function = [this, &keys, &pdm] {
3163 keys.PopulateFromPartitionData(pdm); 3152 keys.PopulateFromPartitionData(pdm);
3164 3153
3165 auto& system = Core::System::GetInstance();
3166 system.GetFileSystemController().CreateFactories(*vfs); 3154 system.GetFileSystemController().CreateFactories(*vfs);
3167 keys.DeriveETicket(pdm, system.GetContentProvider()); 3155 keys.DeriveETicket(pdm, system.GetContentProvider());
3168 }; 3156 };
@@ -3206,7 +3194,7 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
3206 prog.close(); 3194 prog.close();
3207 } 3195 }
3208 3196
3209 Core::System::GetInstance().GetFileSystemController().CreateFactories(*vfs); 3197 system.GetFileSystemController().CreateFactories(*vfs);
3210 3198
3211 if (behavior == ReinitializeKeyBehavior::Warning) { 3199 if (behavior == ReinitializeKeyBehavior::Warning) {
3212 game_list->PopulateAsync(UISettings::values.game_dirs); 3200 game_list->PopulateAsync(UISettings::values.game_dirs);
@@ -3274,7 +3262,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
3274 if (emu_thread != nullptr) { 3262 if (emu_thread != nullptr) {
3275 ShutdownGame(); 3263 ShutdownGame();
3276 3264
3277 Settings::RestoreGlobalState(Core::System::GetInstance().IsPoweredOn()); 3265 Settings::RestoreGlobalState(system.IsPoweredOn());
3278 UpdateStatusButtons(); 3266 UpdateStatusButtons();
3279 } 3267 }
3280 3268
@@ -3349,7 +3337,7 @@ bool GMainWindow::ConfirmForceLockedExit() {
3349} 3337}
3350 3338
3351void GMainWindow::RequestGameExit() { 3339void GMainWindow::RequestGameExit() {
3352 auto& sm{Core::System::GetInstance().ServiceManager()}; 3340 auto& sm{system.ServiceManager()};
3353 auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE"); 3341 auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE");
3354 auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE"); 3342 auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE");
3355 bool has_signalled = false; 3343 bool has_signalled = false;
@@ -3498,7 +3486,7 @@ int main(int argc, char* argv[]) {
3498 setlocale(LC_ALL, "C"); 3486 setlocale(LC_ALL, "C");
3499 3487
3500 Core::System::InitializeGlobalInstance(); 3488 Core::System::InitializeGlobalInstance();
3501 GMainWindow main_window; 3489 GMainWindow main_window{Core::System::GetInstance()};
3502 // After settings have been loaded by GMainWindow, apply the filter 3490 // After settings have been loaded by GMainWindow, apply the filter
3503 main_window.show(); 3491 main_window.show();
3504 3492
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 60ce01471..6ef4e4d4e 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -107,7 +107,7 @@ class GMainWindow : public QMainWindow {
107public: 107public:
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);
@@ -309,6 +309,8 @@ private:
309 std::unique_ptr<DiscordRPC::DiscordInterface> discord_rpc; 309 std::unique_ptr<DiscordRPC::DiscordInterface> discord_rpc;
310 std::shared_ptr<InputCommon::InputSubsystem> input_subsystem; 310 std::shared_ptr<InputCommon::InputSubsystem> input_subsystem;
311 311
312 Core::System& system;
313
312 GRenderWindow* render_window; 314 GRenderWindow* render_window;
313 GameList* game_list; 315 GameList* game_list;
314 LoadingScreen* loading_screen; 316 LoadingScreen* loading_screen;