summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/string_util.cpp12
-rw-r--r--src/common/string_util.h2
-rw-r--r--src/core/core.cpp95
-rw-r--r--src/core/core.h61
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp14
-rw-r--r--src/core/hle/service/nvdrv/nvdrv.h2
-rw-r--r--src/core/hle/service/vi/vi.cpp12
-rw-r--r--src/input_common/sdl/sdl_impl.cpp7
-rw-r--r--src/shader_recompiler/ir_opt/texture_pass.cpp3
-rw-r--r--src/video_core/command_classes/vic.cpp31
-rw-r--r--src/video_core/query_cache.h8
-rw-r--r--src/video_core/rasterizer_accelerated.h2
-rw-r--r--src/video_core/renderer_vulkan/vk_master_semaphore.h17
-rw-r--r--src/video_core/renderer_vulkan/vk_query_cache.cpp3
-rw-r--r--src/yuzu/about_dialog.cpp3
-rw-r--r--src/yuzu/applets/qt_controller.cpp26
-rw-r--r--src/yuzu/applets/qt_controller.h6
-rw-r--r--src/yuzu/applets/qt_web_browser.cpp1
-rw-r--r--src/yuzu/bootmanager.cpp18
-rw-r--r--src/yuzu/bootmanager.h19
-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.cpp16
-rw-r--r--src/yuzu/configuration/configure_debug_tab.h12
-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.ui11
-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.cpp10
-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/discord_impl.cpp9
-rw-r--r--src/yuzu/discord_impl.h8
-rw-r--r--src/yuzu/game_list.cpp7
-rw-r--r--src/yuzu/game_list.h5
-rw-r--r--src/yuzu/game_list_worker.cpp10
-rw-r--r--src/yuzu/game_list_worker.h8
-rw-r--r--src/yuzu/main.cpp516
-rw-r--r--src/yuzu/main.h20
-rw-r--r--src/yuzu/main.ui48
-rw-r--r--src/yuzu/uisettings.h2
-rw-r--r--src/yuzu_cmd/config.cpp3
-rw-r--r--src/yuzu_cmd/default_ini.h6
-rw-r--r--src/yuzu_cmd/yuzu.cpp21
96 files changed, 1154 insertions, 1005 deletions
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index e6344fd41..662171138 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -180,20 +180,20 @@ std::wstring UTF8ToUTF16W(const std::string& input) {
180 180
181#endif 181#endif
182 182
183std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, std::size_t max_len) { 183std::string StringFromFixedZeroTerminatedBuffer(std::string_view buffer, std::size_t max_len) {
184 std::size_t len = 0; 184 std::size_t len = 0;
185 while (len < max_len && buffer[len] != '\0') 185 while (len < buffer.length() && len < max_len && buffer[len] != '\0') {
186 ++len; 186 ++len;
187 187 }
188 return std::string(buffer, len); 188 return std::string(buffer.begin(), buffer.begin() + len);
189} 189}
190 190
191std::u16string UTF16StringFromFixedZeroTerminatedBuffer(std::u16string_view buffer, 191std::u16string UTF16StringFromFixedZeroTerminatedBuffer(std::u16string_view buffer,
192 std::size_t max_len) { 192 std::size_t max_len) {
193 std::size_t len = 0; 193 std::size_t len = 0;
194 while (len < max_len && buffer[len] != '\0') 194 while (len < buffer.length() && len < max_len && buffer[len] != '\0') {
195 ++len; 195 ++len;
196 196 }
197 return std::u16string(buffer.begin(), buffer.begin() + len); 197 return std::u16string(buffer.begin(), buffer.begin() + len);
198} 198}
199 199
diff --git a/src/common/string_util.h b/src/common/string_util.h
index 7e90a9ca5..f0dd632ee 100644
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -63,7 +63,7 @@ template <typename InIt>
63 * Creates a std::string from a fixed-size NUL-terminated char buffer. If the buffer isn't 63 * Creates a std::string from a fixed-size NUL-terminated char buffer. If the buffer isn't
64 * NUL-terminated then the string ends at max_len characters. 64 * NUL-terminated then the string ends at max_len characters.
65 */ 65 */
66[[nodiscard]] std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, 66[[nodiscard]] std::string StringFromFixedZeroTerminatedBuffer(std::string_view buffer,
67 std::size_t max_len); 67 std::size_t max_len);
68 68
69/** 69/**
diff --git a/src/core/core.cpp b/src/core/core.cpp
index bb268a319..3042d611b 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -139,27 +139,47 @@ struct System::Impl {
139 : kernel{system}, fs_controller{system}, memory{system}, 139 : kernel{system}, fs_controller{system}, memory{system},
140 cpu_manager{system}, reporter{system}, applet_manager{system}, time_manager{system} {} 140 cpu_manager{system}, reporter{system}, applet_manager{system}, time_manager{system} {}
141 141
142 ResultStatus Run() { 142 SystemResultStatus Run() {
143 status = ResultStatus::Success; 143 std::unique_lock<std::mutex> lk(suspend_guard);
144 status = SystemResultStatus::Success;
144 145
145 kernel.Suspend(false); 146 kernel.Suspend(false);
146 core_timing.SyncPause(false); 147 core_timing.SyncPause(false);
147 cpu_manager.Pause(false); 148 cpu_manager.Pause(false);
149 is_paused = false;
148 150
149 return status; 151 return status;
150 } 152 }
151 153
152 ResultStatus Pause() { 154 SystemResultStatus Pause() {
153 status = ResultStatus::Success; 155 std::unique_lock<std::mutex> lk(suspend_guard);
156 status = SystemResultStatus::Success;
154 157
155 core_timing.SyncPause(true); 158 core_timing.SyncPause(true);
156 kernel.Suspend(true); 159 kernel.Suspend(true);
157 cpu_manager.Pause(true); 160 cpu_manager.Pause(true);
161 is_paused = true;
158 162
159 return status; 163 return status;
160 } 164 }
161 165
162 ResultStatus Init(System& system, Frontend::EmuWindow& emu_window) { 166 std::unique_lock<std::mutex> StallCPU() {
167 std::unique_lock<std::mutex> lk(suspend_guard);
168 kernel.Suspend(true);
169 core_timing.SyncPause(true);
170 cpu_manager.Pause(true);
171 return lk;
172 }
173
174 void UnstallCPU() {
175 if (!is_paused) {
176 core_timing.SyncPause(false);
177 kernel.Suspend(false);
178 cpu_manager.Pause(false);
179 }
180 }
181
182 SystemResultStatus Init(System& system, Frontend::EmuWindow& emu_window) {
163 LOG_DEBUG(Core, "initialized OK"); 183 LOG_DEBUG(Core, "initialized OK");
164 184
165 device_memory = std::make_unique<Core::DeviceMemory>(); 185 device_memory = std::make_unique<Core::DeviceMemory>();
@@ -197,7 +217,7 @@ struct System::Impl {
197 217
198 gpu_core = VideoCore::CreateGPU(emu_window, system); 218 gpu_core = VideoCore::CreateGPU(emu_window, system);
199 if (!gpu_core) { 219 if (!gpu_core) {
200 return ResultStatus::ErrorVideoCore; 220 return SystemResultStatus::ErrorVideoCore;
201 } 221 }
202 222
203 service_manager = std::make_shared<Service::SM::ServiceManager>(kernel); 223 service_manager = std::make_shared<Service::SM::ServiceManager>(kernel);
@@ -217,21 +237,22 @@ struct System::Impl {
217 237
218 LOG_DEBUG(Core, "Initialized OK"); 238 LOG_DEBUG(Core, "Initialized OK");
219 239
220 return ResultStatus::Success; 240 return SystemResultStatus::Success;
221 } 241 }
222 242
223 ResultStatus Load(System& system, Frontend::EmuWindow& emu_window, const std::string& filepath, 243 SystemResultStatus Load(System& system, Frontend::EmuWindow& emu_window,
224 u64 program_id, std::size_t program_index) { 244 const std::string& filepath, u64 program_id,
245 std::size_t program_index) {
225 app_loader = Loader::GetLoader(system, GetGameFileFromPath(virtual_filesystem, filepath), 246 app_loader = Loader::GetLoader(system, GetGameFileFromPath(virtual_filesystem, filepath),
226 program_id, program_index); 247 program_id, program_index);
227 248
228 if (!app_loader) { 249 if (!app_loader) {
229 LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath); 250 LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath);
230 return ResultStatus::ErrorGetLoader; 251 return SystemResultStatus::ErrorGetLoader;
231 } 252 }
232 253
233 ResultStatus init_result{Init(system, emu_window)}; 254 SystemResultStatus init_result{Init(system, emu_window)};
234 if (init_result != ResultStatus::Success) { 255 if (init_result != SystemResultStatus::Success) {
235 LOG_CRITICAL(Core, "Failed to initialize system (Error {})!", 256 LOG_CRITICAL(Core, "Failed to initialize system (Error {})!",
236 static_cast<int>(init_result)); 257 static_cast<int>(init_result));
237 Shutdown(); 258 Shutdown();
@@ -249,8 +270,8 @@ struct System::Impl {
249 LOG_CRITICAL(Core, "Failed to load ROM (Error {})!", load_result); 270 LOG_CRITICAL(Core, "Failed to load ROM (Error {})!", load_result);
250 Shutdown(); 271 Shutdown();
251 272
252 return static_cast<ResultStatus>(static_cast<u32>(ResultStatus::ErrorLoader) + 273 return static_cast<SystemResultStatus>(
253 static_cast<u32>(load_result)); 274 static_cast<u32>(SystemResultStatus::ErrorLoader) + static_cast<u32>(load_result));
254 } 275 }
255 AddGlueRegistrationForProcess(*app_loader, *main_process); 276 AddGlueRegistrationForProcess(*app_loader, *main_process);
256 kernel.MakeCurrentProcess(main_process.get()); 277 kernel.MakeCurrentProcess(main_process.get());
@@ -282,7 +303,7 @@ struct System::Impl {
282 GetAndResetPerfStats(); 303 GetAndResetPerfStats();
283 perf_stats->BeginSystemFrame(); 304 perf_stats->BeginSystemFrame();
284 305
285 status = ResultStatus::Success; 306 status = SystemResultStatus::Success;
286 return status; 307 return status;
287 } 308 }
288 309
@@ -355,7 +376,7 @@ struct System::Impl {
355 arp_manager.Register(launch.title_id, launch, std::move(nacp_data)); 376 arp_manager.Register(launch.title_id, launch, std::move(nacp_data));
356 } 377 }
357 378
358 void SetStatus(ResultStatus new_status, const char* details = nullptr) { 379 void SetStatus(SystemResultStatus new_status, const char* details = nullptr) {
359 status = new_status; 380 status = new_status;
360 if (details) { 381 if (details) {
361 status_details = details; 382 status_details = details;
@@ -366,6 +387,9 @@ struct System::Impl {
366 return perf_stats->GetAndResetStats(core_timing.GetGlobalTimeUs()); 387 return perf_stats->GetAndResetStats(core_timing.GetGlobalTimeUs());
367 } 388 }
368 389
390 std::mutex suspend_guard;
391 bool is_paused{};
392
369 Timing::CoreTiming core_timing; 393 Timing::CoreTiming core_timing;
370 Kernel::KernelCore kernel; 394 Kernel::KernelCore kernel;
371 /// RealVfsFilesystem instance 395 /// RealVfsFilesystem instance
@@ -411,7 +435,7 @@ struct System::Impl {
411 /// Network instance 435 /// Network instance
412 Network::NetworkInstance network_instance; 436 Network::NetworkInstance network_instance;
413 437
414 ResultStatus status = ResultStatus::Success; 438 SystemResultStatus status = SystemResultStatus::Success;
415 std::string status_details = ""; 439 std::string status_details = "";
416 440
417 std::unique_ptr<Core::PerfStats> perf_stats; 441 std::unique_ptr<Core::PerfStats> perf_stats;
@@ -428,21 +452,8 @@ struct System::Impl {
428}; 452};
429 453
430System::System() : impl{std::make_unique<Impl>(*this)} {} 454System::System() : impl{std::make_unique<Impl>(*this)} {}
431System::~System() = default;
432 455
433System& System::GetInstance() { 456System::~System() = default;
434 if (!s_instance) {
435 throw std::runtime_error("Using System instance before its initialization");
436 }
437 return *s_instance;
438}
439
440void System::InitializeGlobalInstance() {
441 if (s_instance) {
442 throw std::runtime_error("Reinitializing Global System instance.");
443 }
444 s_instance = std::unique_ptr<System>(new System);
445}
446 457
447CpuManager& System::GetCpuManager() { 458CpuManager& System::GetCpuManager() {
448 return impl->cpu_manager; 459 return impl->cpu_manager;
@@ -452,16 +463,16 @@ const CpuManager& System::GetCpuManager() const {
452 return impl->cpu_manager; 463 return impl->cpu_manager;
453} 464}
454 465
455System::ResultStatus System::Run() { 466SystemResultStatus System::Run() {
456 return impl->Run(); 467 return impl->Run();
457} 468}
458 469
459System::ResultStatus System::Pause() { 470SystemResultStatus System::Pause() {
460 return impl->Pause(); 471 return impl->Pause();
461} 472}
462 473
463System::ResultStatus System::SingleStep() { 474SystemResultStatus System::SingleStep() {
464 return ResultStatus::Success; 475 return SystemResultStatus::Success;
465} 476}
466 477
467void System::InvalidateCpuInstructionCaches() { 478void System::InvalidateCpuInstructionCaches() {
@@ -476,8 +487,16 @@ void System::Shutdown() {
476 impl->Shutdown(); 487 impl->Shutdown();
477} 488}
478 489
479System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath, 490std::unique_lock<std::mutex> System::StallCPU() {
480 u64 program_id, std::size_t program_index) { 491 return impl->StallCPU();
492}
493
494void System::UnstallCPU() {
495 impl->UnstallCPU();
496}
497
498SystemResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath,
499 u64 program_id, std::size_t program_index) {
481 return impl->Load(*this, emu_window, filepath, program_id, program_index); 500 return impl->Load(*this, emu_window, filepath, program_id, program_index);
482} 501}
483 502
@@ -637,7 +656,7 @@ Loader::ResultStatus System::GetGameName(std::string& out) const {
637 return impl->GetGameName(out); 656 return impl->GetGameName(out);
638} 657}
639 658
640void System::SetStatus(ResultStatus new_status, const char* details) { 659void System::SetStatus(SystemResultStatus new_status, const char* details) {
641 impl->SetStatus(new_status, details); 660 impl->SetStatus(new_status, details);
642} 661}
643 662
diff --git a/src/core/core.h b/src/core/core.h
index a796472b2..1cfe1bba6 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -7,6 +7,7 @@
7#include <cstddef> 7#include <cstddef>
8#include <functional> 8#include <functional>
9#include <memory> 9#include <memory>
10#include <mutex>
10#include <string> 11#include <string>
11#include <vector> 12#include <vector>
12 13
@@ -104,55 +105,49 @@ struct PerfStatsResults;
104FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs, 105FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs,
105 const std::string& path); 106 const std::string& path);
106 107
108/// Enumeration representing the return values of the System Initialize and Load process.
109enum class SystemResultStatus : u32 {
110 Success, ///< Succeeded
111 ErrorNotInitialized, ///< Error trying to use core prior to initialization
112 ErrorGetLoader, ///< Error finding the correct application loader
113 ErrorSystemFiles, ///< Error in finding system files
114 ErrorSharedFont, ///< Error in finding shared font
115 ErrorVideoCore, ///< Error in the video core
116 ErrorUnknown, ///< Any other error
117 ErrorLoader, ///< The base for loader errors (too many to repeat)
118};
119
107class System { 120class System {
108public: 121public:
109 using CurrentBuildProcessID = std::array<u8, 0x20>; 122 using CurrentBuildProcessID = std::array<u8, 0x20>;
110 123
124 explicit System();
125
126 ~System();
127
111 System(const System&) = delete; 128 System(const System&) = delete;
112 System& operator=(const System&) = delete; 129 System& operator=(const System&) = delete;
113 130
114 System(System&&) = delete; 131 System(System&&) = delete;
115 System& operator=(System&&) = delete; 132 System& operator=(System&&) = delete;
116 133
117 ~System();
118
119 /**
120 * Gets the instance of the System singleton class.
121 * @returns Reference to the instance of the System singleton class.
122 */
123 [[deprecated("Use of the global system instance is deprecated")]] static System& GetInstance();
124
125 static void InitializeGlobalInstance();
126
127 /// Enumeration representing the return values of the System Initialize and Load process.
128 enum class ResultStatus : u32 {
129 Success, ///< Succeeded
130 ErrorNotInitialized, ///< Error trying to use core prior to initialization
131 ErrorGetLoader, ///< Error finding the correct application loader
132 ErrorSystemFiles, ///< Error in finding system files
133 ErrorSharedFont, ///< Error in finding shared font
134 ErrorVideoCore, ///< Error in the video core
135 ErrorUnknown, ///< Any other error
136 ErrorLoader, ///< The base for loader errors (too many to repeat)
137 };
138
139 /** 134 /**
140 * Run the OS and Application 135 * Run the OS and Application
141 * This function will start emulation and run the relevant devices 136 * This function will start emulation and run the relevant devices
142 */ 137 */
143 [[nodiscard]] ResultStatus Run(); 138 [[nodiscard]] SystemResultStatus Run();
144 139
145 /** 140 /**
146 * Pause the OS and Application 141 * Pause the OS and Application
147 * This function will pause emulation and stop the relevant devices 142 * This function will pause emulation and stop the relevant devices
148 */ 143 */
149 [[nodiscard]] ResultStatus Pause(); 144 [[nodiscard]] SystemResultStatus Pause();
150 145
151 /** 146 /**
152 * Step the CPU one instruction 147 * Step the CPU one instruction
153 * @return Result status, indicating whether or not the operation succeeded. 148 * @return Result status, indicating whether or not the operation succeeded.
154 */ 149 */
155 [[nodiscard]] ResultStatus SingleStep(); 150 [[nodiscard]] SystemResultStatus SingleStep();
156 151
157 /** 152 /**
158 * Invalidate the CPU instruction caches 153 * Invalidate the CPU instruction caches
@@ -166,16 +161,20 @@ public:
166 /// Shutdown the emulated system. 161 /// Shutdown the emulated system.
167 void Shutdown(); 162 void Shutdown();
168 163
164 std::unique_lock<std::mutex> StallCPU();
165 void UnstallCPU();
166
169 /** 167 /**
170 * Load an executable application. 168 * Load an executable application.
171 * @param emu_window Reference to the host-system window used for video output and keyboard 169 * @param emu_window Reference to the host-system window used for video output and keyboard
172 * input. 170 * input.
173 * @param filepath String path to the executable application to load on the host file system. 171 * @param filepath String path to the executable application to load on the host file system.
174 * @param program_index Specifies the index within the container of the program to launch. 172 * @param program_index Specifies the index within the container of the program to launch.
175 * @returns ResultStatus code, indicating if the operation succeeded. 173 * @returns SystemResultStatus code, indicating if the operation succeeded.
176 */ 174 */
177 [[nodiscard]] ResultStatus Load(Frontend::EmuWindow& emu_window, const std::string& filepath, 175 [[nodiscard]] SystemResultStatus Load(Frontend::EmuWindow& emu_window,
178 u64 program_id = 0, std::size_t program_index = 0); 176 const std::string& filepath, u64 program_id = 0,
177 std::size_t program_index = 0);
179 178
180 /** 179 /**
181 * Indicates if the emulated system is powered on (all subsystems initialized and able to run an 180 * Indicates if the emulated system is powered on (all subsystems initialized and able to run an
@@ -301,7 +300,7 @@ public:
301 /// Gets the name of the current game 300 /// Gets the name of the current game
302 [[nodiscard]] Loader::ResultStatus GetGameName(std::string& out) const; 301 [[nodiscard]] Loader::ResultStatus GetGameName(std::string& out) const;
303 302
304 void SetStatus(ResultStatus new_status, const char* details); 303 void SetStatus(SystemResultStatus new_status, const char* details);
305 304
306 [[nodiscard]] const std::string& GetStatusDetails() const; 305 [[nodiscard]] const std::string& GetStatusDetails() const;
307 306
@@ -403,12 +402,8 @@ public:
403 void ApplySettings(); 402 void ApplySettings();
404 403
405private: 404private:
406 System();
407
408 struct Impl; 405 struct Impl;
409 std::unique_ptr<Impl> impl; 406 std::unique_ptr<Impl> impl;
410
411 inline static std::unique_ptr<System> s_instance{};
412}; 407};
413 408
414} // namespace Core 409} // namespace Core
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
index 8b4867ca7..f9b82b504 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp
@@ -92,6 +92,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
92 if (syncpoint_manager.IsSyncpointExpired(params.syncpt_id, params.threshold)) { 92 if (syncpoint_manager.IsSyncpointExpired(params.syncpt_id, params.threshold)) {
93 params.value = syncpoint_manager.GetSyncpointMin(params.syncpt_id); 93 params.value = syncpoint_manager.GetSyncpointMin(params.syncpt_id);
94 std::memcpy(output.data(), &params, sizeof(params)); 94 std::memcpy(output.data(), &params, sizeof(params));
95 events_interface.failed[event_id] = false;
95 return NvResult::Success; 96 return NvResult::Success;
96 } 97 }
97 98
@@ -99,6 +100,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
99 syncpoint_manager.IsSyncpointExpired(params.syncpt_id, params.threshold)) { 100 syncpoint_manager.IsSyncpointExpired(params.syncpt_id, params.threshold)) {
100 params.value = new_value; 101 params.value = new_value;
101 std::memcpy(output.data(), &params, sizeof(params)); 102 std::memcpy(output.data(), &params, sizeof(params));
103 events_interface.failed[event_id] = false;
102 return NvResult::Success; 104 return NvResult::Success;
103 } 105 }
104 106
@@ -117,6 +119,7 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
117 event.event->GetWritableEvent().Signal(); 119 event.event->GetWritableEvent().Signal();
118 params.value = current_syncpoint_value; 120 params.value = current_syncpoint_value;
119 std::memcpy(output.data(), &params, sizeof(params)); 121 std::memcpy(output.data(), &params, sizeof(params));
122 events_interface.failed[event_id] = false;
120 return NvResult::Success; 123 return NvResult::Success;
121 } 124 }
122 const u32 target_value = current_syncpoint_value - diff; 125 const u32 target_value = current_syncpoint_value - diff;
@@ -146,6 +149,16 @@ NvResult nvhost_ctrl::IocCtrlEventWait(const std::vector<u8>& input, std::vector
146 } 149 }
147 params.value |= event_id; 150 params.value |= event_id;
148 event.event->GetWritableEvent().Clear(); 151 event.event->GetWritableEvent().Clear();
152 if (events_interface.failed[event_id]) {
153 {
154 auto lk = system.StallCPU();
155 gpu.WaitFence(params.syncpt_id, target_value);
156 system.UnstallCPU();
157 }
158 std::memcpy(output.data(), &params, sizeof(params));
159 events_interface.failed[event_id] = false;
160 return NvResult::Success;
161 }
149 gpu.RegisterSyncptInterrupt(params.syncpt_id, target_value); 162 gpu.RegisterSyncptInterrupt(params.syncpt_id, target_value);
150 std::memcpy(output.data(), &params, sizeof(params)); 163 std::memcpy(output.data(), &params, sizeof(params));
151 return NvResult::Timeout; 164 return NvResult::Timeout;
@@ -201,6 +214,7 @@ NvResult nvhost_ctrl::IocCtrlClearEventWait(const std::vector<u8>& input, std::v
201 if (events_interface.status[event_id] == EventState::Waiting) { 214 if (events_interface.status[event_id] == EventState::Waiting) {
202 events_interface.LiberateEvent(event_id); 215 events_interface.LiberateEvent(event_id);
203 } 216 }
217 events_interface.failed[event_id] = true;
204 218
205 syncpoint_manager.RefreshSyncpoint(events_interface.events[event_id].fence.id); 219 syncpoint_manager.RefreshSyncpoint(events_interface.events[event_id].fence.id);
206 220
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h
index e2a1dde5b..a5af5b785 100644
--- a/src/core/hle/service/nvdrv/nvdrv.h
+++ b/src/core/hle/service/nvdrv/nvdrv.h
@@ -49,6 +49,8 @@ struct EventInterface {
49 std::array<EventState, MaxNvEvents> status{}; 49 std::array<EventState, MaxNvEvents> status{};
50 // Tells if an NVEvent is registered or not 50 // Tells if an NVEvent is registered or not
51 std::array<bool, MaxNvEvents> registered{}; 51 std::array<bool, MaxNvEvents> registered{};
52 // Tells the NVEvent that it has failed.
53 std::array<bool, MaxNvEvents> failed{};
52 // When an NVEvent is waiting on GPU interrupt, this is the sync_point 54 // When an NVEvent is waiting on GPU interrupt, this is the sync_point
53 // associated with it. 55 // associated with it.
54 std::array<u32, MaxNvEvents> assigned_syncpt{}; 56 std::array<u32, MaxNvEvents> assigned_syncpt{};
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index be3d52d54..439e7e472 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -524,7 +524,9 @@ private:
524 Disconnect = 11, 524 Disconnect = 11,
525 525
526 AllocateBuffers = 13, 526 AllocateBuffers = 13,
527 SetPreallocatedBuffer = 14 527 SetPreallocatedBuffer = 14,
528
529 GetBufferHistory = 17
528 }; 530 };
529 531
530 void TransactParcel(Kernel::HLERequestContext& ctx) { 532 void TransactParcel(Kernel::HLERequestContext& ctx) {
@@ -641,6 +643,14 @@ private:
641 ctx.WriteBuffer(response.Serialize()); 643 ctx.WriteBuffer(response.Serialize());
642 break; 644 break;
643 } 645 }
646 case TransactionId::GetBufferHistory: {
647 LOG_WARNING(Service_VI, "(STUBBED) called, transaction=GetBufferHistory");
648 [[maybe_unused]] const auto buffer = ctx.ReadBuffer();
649
650 IGBPEmptyResponseParcel response{};
651 ctx.WriteBuffer(response.Serialize());
652 break;
653 }
644 default: 654 default:
645 ASSERT_MSG(false, "Unimplemented"); 655 ASSERT_MSG(false, "Unimplemented");
646 } 656 }
diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp
index ab6211b29..ecb00d428 100644
--- a/src/input_common/sdl/sdl_impl.cpp
+++ b/src/input_common/sdl/sdl_impl.cpp
@@ -170,7 +170,8 @@ public:
170 float GetAxis(int axis, float range, float offset) const { 170 float GetAxis(int axis, float range, float offset) const {
171 std::lock_guard lock{mutex}; 171 std::lock_guard lock{mutex};
172 const float value = static_cast<float>(state.axes.at(axis)) / 32767.0f; 172 const float value = static_cast<float>(state.axes.at(axis)) / 32767.0f;
173 return (value + offset) / range; 173 const float offset_scale = (value + offset) > 0.0f ? 1.0f + offset : 1.0f - offset;
174 return (value + offset) / range / offset_scale;
174 } 175 }
175 176
176 bool RumblePlay(u16 amp_low, u16 amp_high) { 177 bool RumblePlay(u16 amp_low, u16 amp_high) {
@@ -789,8 +790,8 @@ public:
789 const std::string invert_y_value = params.Get("invert_y", "+"); 790 const std::string invert_y_value = params.Get("invert_y", "+");
790 const bool invert_x = invert_x_value == "-"; 791 const bool invert_x = invert_x_value == "-";
791 const bool invert_y = invert_y_value == "-"; 792 const bool invert_y = invert_y_value == "-";
792 const float offset_x = params.Get("offset_x", 0.0f); 793 const float offset_x = std::clamp(params.Get("offset_x", 0.0f), -0.99f, 0.99f);
793 const float offset_y = params.Get("offset_y", 0.0f); 794 const float offset_y = std::clamp(params.Get("offset_y", 0.0f), -0.99f, 0.99f);
794 auto joystick = state.GetSDLJoystickByGUID(guid, port); 795 auto joystick = state.GetSDLJoystickByGUID(guid, port);
795 796
796 // This is necessary so accessing GetAxis with axis_x and axis_y won't crash 797 // This is necessary so accessing GetAxis with axis_x and axis_y won't crash
diff --git a/src/shader_recompiler/ir_opt/texture_pass.cpp b/src/shader_recompiler/ir_opt/texture_pass.cpp
index 44ad10d43..225c238fb 100644
--- a/src/shader_recompiler/ir_opt/texture_pass.cpp
+++ b/src/shader_recompiler/ir_opt/texture_pass.cpp
@@ -492,7 +492,8 @@ void TexturePass(Environment& env, IR::Program& program) {
492 const auto insert_point{IR::Block::InstructionList::s_iterator_to(*inst)}; 492 const auto insert_point{IR::Block::InstructionList::s_iterator_to(*inst)};
493 IR::IREmitter ir{*texture_inst.block, insert_point}; 493 IR::IREmitter ir{*texture_inst.block, insert_point};
494 const IR::U32 shift{ir.Imm32(std::countr_zero(DESCRIPTOR_SIZE))}; 494 const IR::U32 shift{ir.Imm32(std::countr_zero(DESCRIPTOR_SIZE))};
495 inst->SetArg(0, ir.ShiftRightArithmetic(cbuf.dynamic_offset, shift)); 495 inst->SetArg(0, ir.SMin(ir.ShiftRightArithmetic(cbuf.dynamic_offset, shift),
496 ir.Imm32(DESCRIPTOR_SIZE - 1)));
496 } else { 497 } else {
497 inst->SetArg(0, IR::Value{}); 498 inst->SetArg(0, IR::Value{});
498 } 499 }
diff --git a/src/video_core/command_classes/vic.cpp b/src/video_core/command_classes/vic.cpp
index dc768b952..051616124 100644
--- a/src/video_core/command_classes/vic.cpp
+++ b/src/video_core/command_classes/vic.cpp
@@ -32,7 +32,7 @@ enum class VideoPixelFormat : u64_le {
32 RGBA8 = 0x1f, 32 RGBA8 = 0x1f,
33 BGRA8 = 0x20, 33 BGRA8 = 0x20,
34 RGBX8 = 0x23, 34 RGBX8 = 0x23,
35 Yuv420 = 0x44, 35 YUV420 = 0x44,
36}; 36};
37} // Anonymous namespace 37} // Anonymous namespace
38 38
@@ -88,12 +88,10 @@ void Vic::Execute() {
88 const u64 surface_width = config.surface_width_minus1 + 1; 88 const u64 surface_width = config.surface_width_minus1 + 1;
89 const u64 surface_height = config.surface_height_minus1 + 1; 89 const u64 surface_height = config.surface_height_minus1 + 1;
90 if (static_cast<u64>(frame->width) != surface_width || 90 if (static_cast<u64>(frame->width) != surface_width ||
91 static_cast<u64>(frame->height) > surface_height) { 91 static_cast<u64>(frame->height) != surface_height) {
92 // TODO: Properly support multiple video streams with differing frame dimensions 92 // TODO: Properly support multiple video streams with differing frame dimensions
93 LOG_WARNING(Debug, 93 LOG_WARNING(Service_NVDRV, "Frame dimensions {}x{} don't match surface dimensions {}x{}",
94 "Frame dimensions {}x{} can't be safely decoded into surface dimensions {}x{}",
95 frame->width, frame->height, surface_width, surface_height); 94 frame->width, frame->height, surface_width, surface_height);
96 return;
97 } 95 }
98 switch (config.pixel_format) { 96 switch (config.pixel_format) {
99 case VideoPixelFormat::RGBA8: 97 case VideoPixelFormat::RGBA8:
@@ -101,7 +99,7 @@ void Vic::Execute() {
101 case VideoPixelFormat::RGBX8: 99 case VideoPixelFormat::RGBX8:
102 WriteRGBFrame(frame, config); 100 WriteRGBFrame(frame, config);
103 break; 101 break;
104 case VideoPixelFormat::Yuv420: 102 case VideoPixelFormat::YUV420:
105 WriteYUVFrame(frame, config); 103 WriteYUVFrame(frame, config);
106 break; 104 break;
107 default: 105 default:
@@ -136,21 +134,20 @@ void Vic::WriteRGBFrame(const AVFrame* frame, const VicConfig& config) {
136 scaler_height = frame->height; 134 scaler_height = frame->height;
137 converted_frame_buffer.reset(); 135 converted_frame_buffer.reset();
138 } 136 }
139 // Get Converted frame
140 const u32 width = static_cast<u32>(frame->width);
141 const u32 height = static_cast<u32>(frame->height);
142 const std::size_t linear_size = width * height * 4;
143
144 // Only allocate frame_buffer once per stream, as the size is not expected to change
145 if (!converted_frame_buffer) { 137 if (!converted_frame_buffer) {
146 converted_frame_buffer = AVMallocPtr{static_cast<u8*>(av_malloc(linear_size)), av_free}; 138 const size_t frame_size = frame->width * frame->height * 4;
139 converted_frame_buffer = AVMallocPtr{static_cast<u8*>(av_malloc(frame_size)), av_free};
147 } 140 }
148 const std::array<int, 4> converted_stride{frame->width * 4, frame->height * 4, 0, 0}; 141 const std::array<int, 4> converted_stride{frame->width * 4, frame->height * 4, 0, 0};
149 u8* const converted_frame_buf_addr{converted_frame_buffer.get()}; 142 u8* const converted_frame_buf_addr{converted_frame_buffer.get()};
150
151 sws_scale(scaler_ctx, frame->data, frame->linesize, 0, frame->height, &converted_frame_buf_addr, 143 sws_scale(scaler_ctx, frame->data, frame->linesize, 0, frame->height, &converted_frame_buf_addr,
152 converted_stride.data()); 144 converted_stride.data());
153 145
146 // Use the minimum of surface/frame dimensions to avoid buffer overflow.
147 const u32 surface_width = static_cast<u32>(config.surface_width_minus1) + 1;
148 const u32 surface_height = static_cast<u32>(config.surface_height_minus1) + 1;
149 const u32 width = std::min(surface_width, static_cast<u32>(frame->width));
150 const u32 height = std::min(surface_height, static_cast<u32>(frame->height));
154 const u32 blk_kind = static_cast<u32>(config.block_linear_kind); 151 const u32 blk_kind = static_cast<u32>(config.block_linear_kind);
155 if (blk_kind != 0) { 152 if (blk_kind != 0) {
156 // swizzle pitch linear to block linear 153 // swizzle pitch linear to block linear
@@ -158,11 +155,12 @@ void Vic::WriteRGBFrame(const AVFrame* frame, const VicConfig& config) {
158 const auto size = Texture::CalculateSize(true, 4, width, height, 1, block_height, 0); 155 const auto size = Texture::CalculateSize(true, 4, width, height, 1, block_height, 0);
159 luma_buffer.resize(size); 156 luma_buffer.resize(size);
160 Texture::SwizzleSubrect(width, height, width * 4, width, 4, luma_buffer.data(), 157 Texture::SwizzleSubrect(width, height, width * 4, width, 4, luma_buffer.data(),
161 converted_frame_buffer.get(), block_height, 0, 0); 158 converted_frame_buf_addr, block_height, 0, 0);
162 159
163 gpu.MemoryManager().WriteBlock(output_surface_luma_address, luma_buffer.data(), size); 160 gpu.MemoryManager().WriteBlock(output_surface_luma_address, luma_buffer.data(), size);
164 } else { 161 } else {
165 // send pitch linear frame 162 // send pitch linear frame
163 const size_t linear_size = width * height * 4;
166 gpu.MemoryManager().WriteBlock(output_surface_luma_address, converted_frame_buf_addr, 164 gpu.MemoryManager().WriteBlock(output_surface_luma_address, converted_frame_buf_addr,
167 linear_size); 165 linear_size);
168 } 166 }
@@ -173,9 +171,10 @@ void Vic::WriteYUVFrame(const AVFrame* frame, const VicConfig& config) {
173 171
174 const std::size_t surface_width = config.surface_width_minus1 + 1; 172 const std::size_t surface_width = config.surface_width_minus1 + 1;
175 const std::size_t surface_height = config.surface_height_minus1 + 1; 173 const std::size_t surface_height = config.surface_height_minus1 + 1;
174 const std::size_t aligned_width = (surface_width + 0xff) & ~0xffUL;
175 // Use the minimum of surface/frame dimensions to avoid buffer overflow.
176 const auto frame_width = std::min(surface_width, static_cast<size_t>(frame->width)); 176 const auto frame_width = std::min(surface_width, static_cast<size_t>(frame->width));
177 const auto frame_height = std::min(surface_height, static_cast<size_t>(frame->height)); 177 const auto frame_height = std::min(surface_height, static_cast<size_t>(frame->height));
178 const std::size_t aligned_width = (surface_width + 0xff) & ~0xffUL;
179 178
180 const auto stride = static_cast<size_t>(frame->linesize[0]); 179 const auto stride = static_cast<size_t>(frame->linesize[0]);
181 180
diff --git a/src/video_core/query_cache.h b/src/video_core/query_cache.h
index 73231061a..392f82eb7 100644
--- a/src/video_core/query_cache.h
+++ b/src/video_core/query_cache.h
@@ -258,9 +258,9 @@ private:
258 258
259 void AsyncFlushQuery(VAddr addr) { 259 void AsyncFlushQuery(VAddr addr) {
260 if (!uncommitted_flushes) { 260 if (!uncommitted_flushes) {
261 uncommitted_flushes = std::make_shared<std::unordered_set<VAddr>>(); 261 uncommitted_flushes = std::make_shared<std::vector<VAddr>>();
262 } 262 }
263 uncommitted_flushes->insert(addr); 263 uncommitted_flushes->push_back(addr);
264 } 264 }
265 265
266 static constexpr std::uintptr_t PAGE_SIZE = 4096; 266 static constexpr std::uintptr_t PAGE_SIZE = 4096;
@@ -276,8 +276,8 @@ private:
276 276
277 std::array<CounterStream, VideoCore::NumQueryTypes> streams; 277 std::array<CounterStream, VideoCore::NumQueryTypes> streams;
278 278
279 std::shared_ptr<std::unordered_set<VAddr>> uncommitted_flushes{}; 279 std::shared_ptr<std::vector<VAddr>> uncommitted_flushes{};
280 std::list<std::shared_ptr<std::unordered_set<VAddr>>> committed_flushes; 280 std::list<std::shared_ptr<std::vector<VAddr>>> committed_flushes;
281}; 281};
282 282
283template <class QueryCache, class HostCounter> 283template <class QueryCache, class HostCounter>
diff --git a/src/video_core/rasterizer_accelerated.h b/src/video_core/rasterizer_accelerated.h
index ea879bfdd..249644e50 100644
--- a/src/video_core/rasterizer_accelerated.h
+++ b/src/video_core/rasterizer_accelerated.h
@@ -42,7 +42,7 @@ private:
42 }; 42 };
43 static_assert(sizeof(CacheEntry) == 8, "CacheEntry should be 8 bytes!"); 43 static_assert(sizeof(CacheEntry) == 8, "CacheEntry should be 8 bytes!");
44 44
45 std::array<CacheEntry, 0x1000000> cached_pages; 45 std::array<CacheEntry, 0x2000000> cached_pages;
46 Core::Memory::Memory& cpu_memory; 46 Core::Memory::Memory& cpu_memory;
47}; 47};
48 48
diff --git a/src/video_core/renderer_vulkan/vk_master_semaphore.h b/src/video_core/renderer_vulkan/vk_master_semaphore.h
index 4f8688118..0886b7da8 100644
--- a/src/video_core/renderer_vulkan/vk_master_semaphore.h
+++ b/src/video_core/renderer_vulkan/vk_master_semaphore.h
@@ -21,12 +21,12 @@ public:
21 21
22 /// Returns the current logical tick. 22 /// Returns the current logical tick.
23 [[nodiscard]] u64 CurrentTick() const noexcept { 23 [[nodiscard]] u64 CurrentTick() const noexcept {
24 return current_tick.load(std::memory_order_relaxed); 24 return current_tick.load(std::memory_order_acquire);
25 } 25 }
26 26
27 /// Returns the last known GPU tick. 27 /// Returns the last known GPU tick.
28 [[nodiscard]] u64 KnownGpuTick() const noexcept { 28 [[nodiscard]] u64 KnownGpuTick() const noexcept {
29 return gpu_tick.load(std::memory_order_relaxed); 29 return gpu_tick.load(std::memory_order_acquire);
30 } 30 }
31 31
32 /// Returns the timeline semaphore handle. 32 /// Returns the timeline semaphore handle.
@@ -41,12 +41,21 @@ public:
41 41
42 /// Advance to the logical tick and return the old one 42 /// Advance to the logical tick and return the old one
43 [[nodiscard]] u64 NextTick() noexcept { 43 [[nodiscard]] u64 NextTick() noexcept {
44 return current_tick.fetch_add(1, std::memory_order::relaxed); 44 return current_tick.fetch_add(1, std::memory_order_release);
45 } 45 }
46 46
47 /// Refresh the known GPU tick 47 /// Refresh the known GPU tick
48 void Refresh() { 48 void Refresh() {
49 gpu_tick.store(semaphore.GetCounter(), std::memory_order_relaxed); 49 u64 this_tick{};
50 u64 counter{};
51 do {
52 this_tick = gpu_tick.load(std::memory_order_acquire);
53 counter = semaphore.GetCounter();
54 if (counter < this_tick) {
55 return;
56 }
57 } while (!gpu_tick.compare_exchange_weak(this_tick, counter, std::memory_order_release,
58 std::memory_order_relaxed));
50 } 59 }
51 60
52 /// Waits for a tick to be hit on the GPU 61 /// Waits for a tick to be hit on the GPU
diff --git a/src/video_core/renderer_vulkan/vk_query_cache.cpp b/src/video_core/renderer_vulkan/vk_query_cache.cpp
index c9cb32d71..259cba156 100644
--- a/src/video_core/renderer_vulkan/vk_query_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_query_cache.cpp
@@ -117,7 +117,8 @@ u64 HostCounter::BlockingQuery() const {
117 cache.GetScheduler().Wait(tick); 117 cache.GetScheduler().Wait(tick);
118 u64 data; 118 u64 data;
119 const VkResult query_result = cache.GetDevice().GetLogical().GetQueryResults( 119 const VkResult query_result = cache.GetDevice().GetLogical().GetQueryResults(
120 query.first, query.second, 1, sizeof(data), &data, sizeof(data), VK_QUERY_RESULT_64_BIT); 120 query.first, query.second, 1, sizeof(data), &data, sizeof(data),
121 VK_QUERY_RESULT_64_BIT | VK_QUERY_RESULT_WAIT_BIT);
121 122
122 switch (query_result) { 123 switch (query_result) {
123 case VK_SUCCESS: 124 case VK_SUCCESS:
diff --git a/src/yuzu/about_dialog.cpp b/src/yuzu/about_dialog.cpp
index 6b0155a78..04ab4ae21 100644
--- a/src/yuzu/about_dialog.cpp
+++ b/src/yuzu/about_dialog.cpp
@@ -8,7 +8,8 @@
8#include "ui_aboutdialog.h" 8#include "ui_aboutdialog.h"
9#include "yuzu/about_dialog.h" 9#include "yuzu/about_dialog.h"
10 10
11AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDialog) { 11AboutDialog::AboutDialog(QWidget* parent)
12 : QDialog(parent), ui{std::make_unique<Ui::AboutDialog>()} {
12 const auto branch_name = std::string(Common::g_scm_branch); 13 const auto branch_name = std::string(Common::g_scm_branch);
13 const auto description = std::string(Common::g_scm_desc); 14 const auto description = std::string(Common::g_scm_desc);
14 const auto build_id = std::string(Common::g_build_id); 15 const auto build_id = std::string(Common::g_build_id);
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/applets/qt_web_browser.cpp b/src/yuzu/applets/qt_web_browser.cpp
index 7d433ca50..da8c6882a 100644
--- a/src/yuzu/applets/qt_web_browser.cpp
+++ b/src/yuzu/applets/qt_web_browser.cpp
@@ -3,6 +3,7 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#ifdef YUZU_USE_QT_WEB_ENGINE 5#ifdef YUZU_USE_QT_WEB_ENGINE
6#include <QApplication>
6#include <QKeyEvent> 7#include <QKeyEvent>
7 8
8#include <QWebEngineProfile> 9#include <QWebEngineProfile>
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index 8b9e186b0..40fd47406 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
@@ -87,15 +86,15 @@ void EmuThread::run() {
87 } 86 }
88 87
89 running_guard = true; 88 running_guard = true;
90 Core::System::ResultStatus result = system.Run(); 89 Core::SystemResultStatus result = system.Run();
91 if (result != Core::System::ResultStatus::Success) { 90 if (result != Core::SystemResultStatus::Success) {
92 running_guard = false; 91 running_guard = false;
93 this->SetRunning(false); 92 this->SetRunning(false);
94 emit ErrorThrown(result, system.GetStatusDetails()); 93 emit ErrorThrown(result, system.GetStatusDetails());
95 } 94 }
96 running_wait.Wait(); 95 running_wait.Wait();
97 result = system.Pause(); 96 result = system.Pause();
98 if (result != Core::System::ResultStatus::Success) { 97 if (result != Core::SystemResultStatus::Success) {
99 running_guard = false; 98 running_guard = false;
100 this->SetRunning(false); 99 this->SetRunning(false);
101 emit ErrorThrown(result, system.GetStatusDetails()); 100 emit ErrorThrown(result, system.GetStatusDetails());
@@ -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..e6a0666e9 100644
--- a/src/yuzu/bootmanager.h
+++ b/src/yuzu/bootmanager.h
@@ -16,7 +16,6 @@
16#include <QWindow> 16#include <QWindow>
17 17
18#include "common/thread.h" 18#include "common/thread.h"
19#include "core/core.h"
20#include "core/frontend/emu_window.h" 19#include "core/frontend/emu_window.h"
21 20
22class GRenderWindow; 21class GRenderWindow;
@@ -24,6 +23,11 @@ class GMainWindow;
24class QKeyEvent; 23class QKeyEvent;
25class QStringList; 24class QStringList;
26 25
26namespace Core {
27enum class SystemResultStatus : u32;
28class System;
29} // namespace Core
30
27namespace InputCommon { 31namespace InputCommon {
28class InputSubsystem; 32class InputSubsystem;
29} 33}
@@ -34,13 +38,14 @@ enum class MouseButton;
34 38
35namespace VideoCore { 39namespace VideoCore {
36enum class LoadCallbackStage; 40enum class LoadCallbackStage;
37} 41class RendererBase;
42} // namespace VideoCore
38 43
39class EmuThread final : public QThread { 44class EmuThread final : public QThread {
40 Q_OBJECT 45 Q_OBJECT
41 46
42public: 47public:
43 explicit EmuThread(); 48 explicit EmuThread(Core::System& system_);
44 ~EmuThread() override; 49 ~EmuThread() override;
45 50
46 /** 51 /**
@@ -101,6 +106,7 @@ private:
101 std::condition_variable_any running_cv; 106 std::condition_variable_any running_cv;
102 Common::Event running_wait{}; 107 Common::Event running_wait{};
103 std::atomic_bool running_guard{false}; 108 std::atomic_bool running_guard{false};
109 Core::System& system;
104 110
105signals: 111signals:
106 /** 112 /**
@@ -121,7 +127,7 @@ signals:
121 */ 127 */
122 void DebugModeLeft(); 128 void DebugModeLeft();
123 129
124 void ErrorThrown(Core::System::ResultStatus, std::string); 130 void ErrorThrown(Core::SystemResultStatus, std::string);
125 131
126 void LoadProgress(VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total); 132 void LoadProgress(VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total);
127}; 133};
@@ -131,7 +137,8 @@ class GRenderWindow : public QWidget, public Core::Frontend::EmuWindow {
131 137
132public: 138public:
133 explicit GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_, 139 explicit GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_,
134 std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_); 140 std::shared_ptr<InputCommon::InputSubsystem> input_subsystem_,
141 Core::System& system_);
135 ~GRenderWindow() override; 142 ~GRenderWindow() override;
136 143
137 // EmuWindow implementation. 144 // EmuWindow implementation.
@@ -232,6 +239,8 @@ private:
232 239
233 std::array<std::size_t, 16> touch_ids{}; 240 std::array<std::size_t, 16> touch_ids{};
234 241
242 Core::System& system;
243
235protected: 244protected:
236 void showEvent(QShowEvent* event) override; 245 void showEvent(QShowEvent* event) override;
237 bool eventFilter(QObject* object, QEvent* event) override; 246 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..c33488718 100644
--- a/src/yuzu/configuration/configure_audio.cpp
+++ b/src/yuzu/configuration/configure_audio.cpp
@@ -14,8 +14,8 @@
14#include "yuzu/configuration/configuration_shared.h" 14#include "yuzu/configuration/configuration_shared.h"
15#include "yuzu/configuration/configure_audio.h" 15#include "yuzu/configuration/configure_audio.h"
16 16
17ConfigureAudio::ConfigureAudio(QWidget* parent) 17ConfigureAudio::ConfigureAudio(const Core::System& system_, QWidget* parent)
18 : QWidget(parent), ui(std::make_unique<Ui::ConfigureAudio>()) { 18 : QWidget(parent), ui(std::make_unique<Ui::ConfigureAudio>()), system{system_} {
19 ui->setupUi(this); 19 ui->setupUi(this);
20 20
21 InitializeAudioOutputSinkComboBox(); 21 InitializeAudioOutputSinkComboBox();
@@ -32,7 +32,7 @@ ConfigureAudio::ConfigureAudio(QWidget* parent)
32 32
33 SetConfiguration(); 33 SetConfiguration();
34 34
35 const bool is_powered_on = Core::System::GetInstance().IsPoweredOn(); 35 const bool is_powered_on = system_.IsPoweredOn();
36 ui->output_sink_combo_box->setEnabled(!is_powered_on); 36 ui->output_sink_combo_box->setEnabled(!is_powered_on);
37 ui->audio_device_combo_box->setEnabled(!is_powered_on); 37 ui->audio_device_combo_box->setEnabled(!is_powered_on);
38} 38}
diff --git a/src/yuzu/configuration/configure_audio.h b/src/yuzu/configuration/configure_audio.h
index 5a01c8de7..5d2d05e47 100644
--- a/src/yuzu/configuration/configure_audio.h
+++ b/src/yuzu/configuration/configure_audio.h
@@ -7,6 +7,10 @@
7#include <memory> 7#include <memory>
8#include <QWidget> 8#include <QWidget>
9 9
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(const Core::System& system_, QWidget* parent = nullptr);
23 ~ConfigureAudio() override; 27 ~ConfigureAudio() override;
24 28
25 void ApplyConfiguration(); 29 void ApplyConfiguration();
30 void SetConfiguration();
26 31
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 const Core::System& system;
44}; 50};
diff --git a/src/yuzu/configuration/configure_audio.ui b/src/yuzu/configuration/configure_audio.ui
index bf736fc2c..d1ac8ad02 100644
--- a/src/yuzu/configuration/configure_audio.ui
+++ b/src/yuzu/configuration/configure_audio.ui
@@ -10,6 +10,9 @@
10 <height>368</height> 10 <height>368</height>
11 </rect> 11 </rect>
12 </property> 12 </property>
13 <property name="accessibleName">
14 <string>Audio</string>
15 </property>
13 <layout class="QVBoxLayout"> 16 <layout class="QVBoxLayout">
14 <item> 17 <item>
15 <widget class="QGroupBox" name="groupBox"> 18 <widget class="QGroupBox" name="groupBox">
diff --git a/src/yuzu/configuration/configure_cpu.cpp b/src/yuzu/configuration/configure_cpu.cpp
index 784b6484e..f66cab5d4 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(const Core::System& system_, QWidget* parent)
17 : QWidget(parent), ui{std::make_unique<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..ed9af0e9f 100644
--- a/src/yuzu/configuration/configure_cpu.h
+++ b/src/yuzu/configuration/configure_cpu.h
@@ -8,6 +8,10 @@
8#include <QWidget> 8#include <QWidget>
9#include "common/settings.h" 9#include "common/settings.h"
10 10
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(const Core::System& system_, QWidget* parent = nullptr);
24 ~ConfigureCpu() override; 28 ~ConfigureCpu() override;
25 29
26 void ApplyConfiguration(); 30 void ApplyConfiguration();
31 void SetConfiguration();
27 32
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 const Core::System& system;
45}; 50};
diff --git a/src/yuzu/configuration/configure_cpu.ui b/src/yuzu/configuration/configure_cpu.ui
index 5b9457faf..d8064db24 100644
--- a/src/yuzu/configuration/configure_cpu.ui
+++ b/src/yuzu/configuration/configure_cpu.ui
@@ -7,12 +7,15 @@
7 <x>0</x> 7 <x>0</x>
8 <y>0</y> 8 <y>0</y>
9 <width>448</width> 9 <width>448</width>
10 <height>433</height> 10 <height>439</height>
11 </rect> 11 </rect>
12 </property> 12 </property>
13 <property name="windowTitle"> 13 <property name="windowTitle">
14 <string>Form</string> 14 <string>Form</string>
15 </property> 15 </property>
16 <property name="accessibleName">
17 <string>CPU</string>
18 </property>
16 <layout class="QVBoxLayout"> 19 <layout class="QVBoxLayout">
17 <item> 20 <item>
18 <layout class="QVBoxLayout"> 21 <layout class="QVBoxLayout">
diff --git a/src/yuzu/configuration/configure_cpu_debug.cpp b/src/yuzu/configuration/configure_cpu_debug.cpp
index 98e2d2be5..05a90963d 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(const Core::System& system_, QWidget* parent)
15 : QWidget(parent), ui(new Ui::ConfigureCpuDebug) { 15 : QWidget(parent), ui{std::make_unique<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..d06c4c63f 100644
--- a/src/yuzu/configuration/configure_cpu_debug.h
+++ b/src/yuzu/configuration/configure_cpu_debug.h
@@ -7,6 +7,10 @@
7#include <memory> 7#include <memory>
8#include <QWidget> 8#include <QWidget>
9 9
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(const Core::System& system_, QWidget* parent = nullptr);
19 ~ConfigureCpuDebug() override; 23 ~ConfigureCpuDebug() override;
20 24
21 void ApplyConfiguration(); 25 void ApplyConfiguration();
@@ -27,4 +31,6 @@ private:
27 void SetConfiguration(); 31 void SetConfiguration();
28 32
29 std::unique_ptr<Ui::ConfigureCpuDebug> ui; 33 std::unique_ptr<Ui::ConfigureCpuDebug> ui;
34
35 const Core::System& system;
30}; 36};
diff --git a/src/yuzu/configuration/configure_cpu_debug.ui b/src/yuzu/configuration/configure_cpu_debug.ui
index abf469b55..6e635bb2f 100644
--- a/src/yuzu/configuration/configure_cpu_debug.ui
+++ b/src/yuzu/configuration/configure_cpu_debug.ui
@@ -13,6 +13,9 @@
13 <property name="windowTitle"> 13 <property name="windowTitle">
14 <string>Form</string> 14 <string>Form</string>
15 </property> 15 </property>
16 <property name="accessibleName">
17 <string>CPU</string>
18 </property>
16 <layout class="QVBoxLayout"> 19 <layout class="QVBoxLayout">
17 <item> 20 <item>
18 <layout class="QVBoxLayout"> 21 <layout class="QVBoxLayout">
diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp
index c0b240c1e..07bfa0360 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(const Core::System& system_, QWidget* parent)
18 : QWidget(parent), ui{std::make_unique<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..73f71c9e3 100644
--- a/src/yuzu/configuration/configure_debug.h
+++ b/src/yuzu/configuration/configure_debug.h
@@ -7,6 +7,10 @@
7#include <memory> 7#include <memory>
8#include <QWidget> 8#include <QWidget>
9 9
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(const Core::System& system_, QWidget* parent = nullptr);
19 ~ConfigureDebug() override; 23 ~ConfigureDebug() override;
20 24
21 void ApplyConfiguration(); 25 void ApplyConfiguration();
@@ -27,4 +31,6 @@ private:
27 void SetConfiguration(); 31 void SetConfiguration();
28 32
29 std::unique_ptr<Ui::ConfigureDebug> ui; 33 std::unique_ptr<Ui::ConfigureDebug> ui;
34
35 const Core::System& system;
30}; 36};
diff --git a/src/yuzu/configuration/configure_debug_controller.cpp b/src/yuzu/configuration/configure_debug_controller.cpp
index a878ef9c6..31ec48384 100644
--- a/src/yuzu/configuration/configure_debug_controller.cpp
+++ b/src/yuzu/configuration/configure_debug_controller.cpp
@@ -2,16 +2,17 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include "core/core.h"
5#include "ui_configure_debug_controller.h" 6#include "ui_configure_debug_controller.h"
6#include "yuzu/configuration/configure_debug_controller.h" 7#include "yuzu/configuration/configure_debug_controller.h"
7#include "yuzu/configuration/configure_input_player.h" 8#include "yuzu/configuration/configure_input_player.h"
8 9
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..e69cca1ef 100644
--- a/src/yuzu/configuration/configure_debug_tab.cpp
+++ b/src/yuzu/configuration/configure_debug_tab.cpp
@@ -2,21 +2,29 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <memory>
5#include "ui_configure_debug_tab.h" 6#include "ui_configure_debug_tab.h"
7#include "yuzu/configuration/configure_cpu_debug.h"
8#include "yuzu/configuration/configure_debug.h"
6#include "yuzu/configuration/configure_debug_tab.h" 9#include "yuzu/configuration/configure_debug_tab.h"
7 10
8ConfigureDebugTab::ConfigureDebugTab(QWidget* parent) 11ConfigureDebugTab::ConfigureDebugTab(const Core::System& system_, QWidget* parent)
9 : QWidget(parent), ui(new Ui::ConfigureDebugTab) { 12 : QWidget(parent), ui{std::make_unique<Ui::ConfigureDebugTab>()},
13 debug_tab{std::make_unique<ConfigureDebug>(system_, this)},
14 cpu_debug_tab{std::make_unique<ConfigureCpuDebug>(system_, this)} {
10 ui->setupUi(this); 15 ui->setupUi(this);
11 16
17 ui->tabWidget->addTab(debug_tab.get(), tr("Debug"));
18 ui->tabWidget->addTab(cpu_debug_tab.get(), tr("CPU"));
19
12 SetConfiguration(); 20 SetConfiguration();
13} 21}
14 22
15ConfigureDebugTab::~ConfigureDebugTab() = default; 23ConfigureDebugTab::~ConfigureDebugTab() = default;
16 24
17void ConfigureDebugTab::ApplyConfiguration() { 25void ConfigureDebugTab::ApplyConfiguration() {
18 ui->debugTab->ApplyConfiguration(); 26 debug_tab->ApplyConfiguration();
19 ui->cpuDebugTab->ApplyConfiguration(); 27 cpu_debug_tab->ApplyConfiguration();
20} 28}
21 29
22void ConfigureDebugTab::SetCurrentIndex(int index) { 30void ConfigureDebugTab::SetCurrentIndex(int index) {
diff --git a/src/yuzu/configuration/configure_debug_tab.h b/src/yuzu/configuration/configure_debug_tab.h
index 0a96d43d0..4f68260aa 100644
--- a/src/yuzu/configuration/configure_debug_tab.h
+++ b/src/yuzu/configuration/configure_debug_tab.h
@@ -7,6 +7,13 @@
7#include <memory> 7#include <memory>
8#include <QWidget> 8#include <QWidget>
9 9
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(const Core::System& system_, QWidget* parent = nullptr);
19 ~ConfigureDebugTab() override; 26 ~ConfigureDebugTab() override;
20 27
21 void ApplyConfiguration(); 28 void ApplyConfiguration();
@@ -29,4 +36,7 @@ private:
29 void SetConfiguration(); 36 void SetConfiguration();
30 37
31 std::unique_ptr<Ui::ConfigureDebugTab> ui; 38 std::unique_ptr<Ui::ConfigureDebugTab> ui;
39
40 std::unique_ptr<ConfigureDebug> debug_tab;
41 std::unique_ptr<ConfigureCpuDebug> cpu_debug_tab;
32}; 42};
diff --git a/src/yuzu/configuration/configure_debug_tab.ui b/src/yuzu/configuration/configure_debug_tab.ui
index 7dc6dd704..15ec74727 100644
--- a/src/yuzu/configuration/configure_debug_tab.ui
+++ b/src/yuzu/configuration/configure_debug_tab.ui
@@ -13,40 +13,19 @@
13 <property name="windowTitle"> 13 <property name="windowTitle">
14 <string>Form</string> 14 <string>Form</string>
15 </property> 15 </property>
16 <property name="accessibleName">
17 <string>Debug</string>
18 </property>
16 <layout class="QVBoxLayout" name="verticalLayout"> 19 <layout class="QVBoxLayout" name="verticalLayout">
17 <item> 20 <item>
18 <widget class="QTabWidget" name="tabWidget"> 21 <widget class="QTabWidget" name="tabWidget">
19 <property name="currentIndex"> 22 <property name="currentIndex">
20 <number>1</number> 23 <number>-1</number>
21 </property> 24 </property>
22 <widget class="ConfigureDebug" name="debugTab">
23 <attribute name="title">
24 <string>General</string>
25 </attribute>
26 </widget>
27 <widget class="ConfigureCpuDebug" name="cpuDebugTab">
28 <attribute name="title">
29 <string>CPU</string>
30 </attribute>
31 </widget>
32 </widget> 25 </widget>
33 </item> 26 </item>
34 </layout> 27 </layout>
35 </widget> 28 </widget>
36 <customwidgets>
37 <customwidget>
38 <class>ConfigureDebug</class>
39 <extends>QWidget</extends>
40 <header>configuration/configure_debug.h</header>
41 <container>1</container>
42 </customwidget>
43 <customwidget>
44 <class>ConfigureCpuDebug</class>
45 <extends>QWidget</extends>
46 <header>configuration/configure_cpu_debug.h</header>
47 <container>1</container>
48 </customwidget>
49 </customwidgets>
50 <resources/> 29 <resources/>
51 <connections/> 30 <connections/>
52</ui> 31</ui>
diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp
index fe4186157..4fa0c4a43 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{std::make_unique<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..7af3ea97e 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(const Core::System& system_, QWidget* parent)
19 : QWidget(parent), ui(new Ui::ConfigureGeneral) { 19 : QWidget(parent), ui{std::make_unique<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..85c1dd4a8 100644
--- a/src/yuzu/configuration/configure_general.h
+++ b/src/yuzu/configuration/configure_general.h
@@ -8,6 +8,10 @@
8#include <memory> 8#include <memory>
9#include <QWidget> 9#include <QWidget>
10 10
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(const Core::System& system_, QWidget* parent = nullptr);
28 ~ConfigureGeneral() override; 32 ~ConfigureGeneral() override;
29 33
30 void SetResetCallback(std::function<void()> callback); 34 void SetResetCallback(std::function<void()> callback);
31 void ResetDefaults(); 35 void ResetDefaults();
32 void ApplyConfiguration(); 36 void ApplyConfiguration();
37 void SetConfiguration();
33 38
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 const Core::System& system;
48}; 53};
diff --git a/src/yuzu/configuration/configure_general.ui b/src/yuzu/configuration/configure_general.ui
index 69b6c2d66..f9f0e3ebf 100644
--- a/src/yuzu/configuration/configure_general.ui
+++ b/src/yuzu/configuration/configure_general.ui
@@ -13,6 +13,9 @@
13 <property name="windowTitle"> 13 <property name="windowTitle">
14 <string>Form</string> 14 <string>Form</string>
15 </property> 15 </property>
16 <property name="accessibleName">
17 <string>General</string>
18 </property>
16 <layout class="QHBoxLayout" name="HorizontalLayout"> 19 <layout class="QHBoxLayout" name="HorizontalLayout">
17 <item> 20 <item>
18 <layout class="QVBoxLayout" name="VerticalLayout"> 21 <layout class="QVBoxLayout" name="VerticalLayout">
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp
index c594164be..8e20cc6f3 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(const Core::System& system_, QWidget* parent)
23 : QWidget(parent), ui(new Ui::ConfigureGraphics) { 23 : QWidget(parent), ui{std::make_unique<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..1b101c940 100644
--- a/src/yuzu/configuration/configure_graphics.h
+++ b/src/yuzu/configuration/configure_graphics.h
@@ -10,6 +10,10 @@
10#include <QWidget> 10#include <QWidget>
11#include "common/settings.h" 11#include "common/settings.h"
12 12
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(const Core::System& system_, QWidget* parent = nullptr);
26 ~ConfigureGraphics() override; 30 ~ConfigureGraphics() override;
27 31
28 void ApplyConfiguration(); 32 void ApplyConfiguration();
33 void SetConfiguration();
29 34
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 const Core::System& system;
59}; 64};
diff --git a/src/yuzu/configuration/configure_graphics.ui b/src/yuzu/configuration/configure_graphics.ui
index 1a12cfa4d..beae74344 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">
@@ -200,17 +203,17 @@
200 <widget class="QComboBox" name="nvdec_emulation"> 203 <widget class="QComboBox" name="nvdec_emulation">
201 <item> 204 <item>
202 <property name="text"> 205 <property name="text">
203 <string>Disabled</string> 206 <string>No Video Output</string>
204 </property> 207 </property>
205 </item> 208 </item>
206 <item> 209 <item>
207 <property name="text"> 210 <property name="text">
208 <string>CPU Decoding</string> 211 <string>CPU Video Decoding</string>
209 </property> 212 </property>
210 </item> 213 </item>
211 <item> 214 <item>
212 <property name="text"> 215 <property name="text">
213 <string>GPU Decoding</string> 216 <string>GPU Video Decoding (Default)</string>
214 </property> 217 </property>
215 </item> 218 </item>
216 </widget> 219 </widget>
diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp
index bfd464061..30c5a3595 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(const Core::System& system_, QWidget* parent)
12 : QWidget(parent), ui(new Ui::ConfigureGraphicsAdvanced) { 12 : QWidget(parent), ui{std::make_unique<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..0a1724ce4 100644
--- a/src/yuzu/configuration/configure_graphics_advanced.h
+++ b/src/yuzu/configuration/configure_graphics_advanced.h
@@ -7,6 +7,10 @@
7#include <memory> 7#include <memory>
8#include <QWidget> 8#include <QWidget>
9 9
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(const Core::System& system_, QWidget* parent = nullptr);
23 ~ConfigureGraphicsAdvanced() override; 27 ~ConfigureGraphicsAdvanced() override;
24 28
25 void ApplyConfiguration(); 29 void ApplyConfiguration();
30 void SetConfiguration();
26 31
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 const Core::System& system;
40}; 45};
diff --git a/src/yuzu/configuration/configure_graphics_advanced.ui b/src/yuzu/configuration/configure_graphics_advanced.ui
index b91abc2f0..d06b45f17 100644
--- a/src/yuzu/configuration/configure_graphics_advanced.ui
+++ b/src/yuzu/configuration/configure_graphics_advanced.ui
@@ -13,6 +13,9 @@
13 <property name="windowTitle"> 13 <property name="windowTitle">
14 <string>Form</string> 14 <string>Form</string>
15 </property> 15 </property>
16 <property name="accessibleName">
17 <string>Advanced</string>
18 </property>
16 <layout class="QVBoxLayout" name="verticalLayout_1"> 19 <layout class="QVBoxLayout" name="verticalLayout_1">
17 <item> 20 <item>
18 <layout class="QVBoxLayout" name="verticalLayout_2"> 21 <layout class="QVBoxLayout" name="verticalLayout_2">
diff --git a/src/yuzu/configuration/configure_hotkeys.ui b/src/yuzu/configuration/configure_hotkeys.ui
index 6d9f861e3..a6902a5d8 100644
--- a/src/yuzu/configuration/configure_hotkeys.ui
+++ b/src/yuzu/configuration/configure_hotkeys.ui
@@ -13,6 +13,9 @@
13 <property name="windowTitle"> 13 <property name="windowTitle">
14 <string>Hotkey Settings</string> 14 <string>Hotkey Settings</string>
15 </property> 15 </property>
16 <property name="accessibleName">
17 <string>Hotkeys</string>
18 </property>
16 <layout class="QVBoxLayout" name="verticalLayout"> 19 <layout class="QVBoxLayout" name="verticalLayout">
17 <item> 20 <item>
18 <layout class="QHBoxLayout" name="horizontalLayout"> 21 <layout class="QHBoxLayout" name="horizontalLayout">
diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp
index 422022d02..1599299db 100644
--- a/src/yuzu/configuration/configure_input.cpp
+++ b/src/yuzu/configuration/configure_input.cpp
@@ -39,12 +39,11 @@ void CallConfigureDialog(ConfigureInput& parent, Args&&... args) {
39} 39}
40} // Anonymous namespace 40} // Anonymous namespace
41 41
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..65e615963 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{std::make_unique<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..99d5f4686 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(const Core::System& system_, QWidget* parent)
80 : QWidget(parent), ui(new Ui::ConfigureProfileManager), 80 : QWidget(parent), ui{std::make_unique<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..575cb89d5 100644
--- a/src/yuzu/configuration/configure_profile_manager.h
+++ b/src/yuzu/configuration/configure_profile_manager.h
@@ -9,6 +9,10 @@
9#include <QList> 9#include <QList>
10#include <QWidget> 10#include <QWidget>
11 11
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(const Core::System& system_, QWidget* parent = nullptr);
31 ~ConfigureProfileManager() override; 35 ~ConfigureProfileManager() override;
32 36
33 void ApplyConfiguration(); 37 void ApplyConfiguration();
@@ -58,4 +62,6 @@ private:
58 bool enabled = false; 62 bool enabled = false;
59 63
60 std::unique_ptr<Service::Account::ProfileManager> profile_manager; 64 std::unique_ptr<Service::Account::ProfileManager> profile_manager;
65
66 const Core::System& system;
61}; 67};
diff --git a/src/yuzu/configuration/configure_profile_manager.ui b/src/yuzu/configuration/configure_profile_manager.ui
index dedba4998..cfe7478c8 100644
--- a/src/yuzu/configuration/configure_profile_manager.ui
+++ b/src/yuzu/configuration/configure_profile_manager.ui
@@ -6,13 +6,16 @@
6 <rect> 6 <rect>
7 <x>0</x> 7 <x>0</x>
8 <y>0</y> 8 <y>0</y>
9 <width>366</width> 9 <width>390</width>
10 <height>483</height> 10 <height>483</height>
11 </rect> 11 </rect>
12 </property> 12 </property>
13 <property name="windowTitle"> 13 <property name="windowTitle">
14 <string>Form</string> 14 <string>Form</string>
15 </property> 15 </property>
16 <property name="accessibleName">
17 <string>Profiles</string>
18 </property>
16 <layout class="QHBoxLayout" name="horizontalLayout"> 19 <layout class="QHBoxLayout" name="horizontalLayout">
17 <item> 20 <item>
18 <layout class="QVBoxLayout" name="verticalLayout"> 21 <layout class="QVBoxLayout" name="verticalLayout">
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp
index 24a67ad46..eea45f8ea 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{std::make_unique<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..46e5409db 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{std::make_unique<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/discord_impl.cpp b/src/yuzu/discord_impl.cpp
index a93733b26..66f928af6 100644
--- a/src/yuzu/discord_impl.cpp
+++ b/src/yuzu/discord_impl.cpp
@@ -13,7 +13,7 @@
13 13
14namespace DiscordRPC { 14namespace DiscordRPC {
15 15
16DiscordImpl::DiscordImpl() { 16DiscordImpl::DiscordImpl(Core::System& system_) : system{system_} {
17 DiscordEventHandlers handlers{}; 17 DiscordEventHandlers handlers{};
18 18
19 // The number is the client ID for yuzu, it's used for images and the 19 // The number is the client ID for yuzu, it's used for images and the
@@ -35,12 +35,13 @@ void DiscordImpl::Update() {
35 std::chrono::system_clock::now().time_since_epoch()) 35 std::chrono::system_clock::now().time_since_epoch())
36 .count(); 36 .count();
37 std::string title; 37 std::string title;
38 if (Core::System::GetInstance().IsPoweredOn()) 38 if (system.IsPoweredOn()) {
39 Core::System::GetInstance().GetAppLoader().ReadTitle(title); 39 system.GetAppLoader().ReadTitle(title);
40 }
40 DiscordRichPresence presence{}; 41 DiscordRichPresence presence{};
41 presence.largeImageKey = "yuzu_logo"; 42 presence.largeImageKey = "yuzu_logo";
42 presence.largeImageText = "yuzu is an emulator for the Nintendo Switch"; 43 presence.largeImageText = "yuzu is an emulator for the Nintendo Switch";
43 if (Core::System::GetInstance().IsPoweredOn()) { 44 if (system.IsPoweredOn()) {
44 presence.state = title.c_str(); 45 presence.state = title.c_str();
45 presence.details = "Currently in game"; 46 presence.details = "Currently in game";
46 } else { 47 } else {
diff --git a/src/yuzu/discord_impl.h b/src/yuzu/discord_impl.h
index 4bfda8cdf..03ad42681 100644
--- a/src/yuzu/discord_impl.h
+++ b/src/yuzu/discord_impl.h
@@ -6,15 +6,21 @@
6 6
7#include "yuzu/discord.h" 7#include "yuzu/discord.h"
8 8
9namespace Core {
10class System;
11}
12
9namespace DiscordRPC { 13namespace DiscordRPC {
10 14
11class DiscordImpl : public DiscordInterface { 15class DiscordImpl : public DiscordInterface {
12public: 16public:
13 DiscordImpl(); 17 DiscordImpl(Core::System& system_);
14 ~DiscordImpl() override; 18 ~DiscordImpl() override;
15 19
16 void Pause() override; 20 void Pause() override;
17 void Update() override; 21 void Update() override;
22
23 Core::System& system;
18}; 24};
19 25
20} // namespace DiscordRPC 26} // namespace DiscordRPC
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index ba54423ff..6bd0f9ee9 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -304,8 +304,8 @@ void GameList::OnFilterCloseClicked() {
304} 304}
305 305
306GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvider* provider, 306GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvider* provider,
307 GMainWindow* parent) 307 Core::System& system_, GMainWindow* parent)
308 : QWidget{parent}, vfs(std::move(vfs)), provider(provider) { 308 : QWidget{parent}, vfs(std::move(vfs)), provider(provider), system{system_} {
309 watcher = new QFileSystemWatcher(this); 309 watcher = new QFileSystemWatcher(this);
310 connect(watcher, &QFileSystemWatcher::directoryChanged, this, &GameList::RefreshGameDirectory); 310 connect(watcher, &QFileSystemWatcher::directoryChanged, this, &GameList::RefreshGameDirectory);
311 311
@@ -737,7 +737,8 @@ void GameList::PopulateAsync(QVector<UISettings::GameDir>& game_dirs) {
737 737
738 emit ShouldCancelWorker(); 738 emit ShouldCancelWorker();
739 739
740 GameListWorker* worker = new GameListWorker(vfs, provider, game_dirs, compatibility_list); 740 GameListWorker* worker =
741 new GameListWorker(vfs, provider, game_dirs, compatibility_list, system);
741 742
742 connect(worker, &GameListWorker::EntryReady, this, &GameList::AddEntry, Qt::QueuedConnection); 743 connect(worker, &GameListWorker::EntryReady, this, &GameList::AddEntry, Qt::QueuedConnection);
743 connect(worker, &GameListWorker::DirEntryReady, this, &GameList::AddDirEntry, 744 connect(worker, &GameListWorker::DirEntryReady, this, &GameList::AddDirEntry,
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h
index 10339dcca..675469e66 100644
--- a/src/yuzu/game_list.h
+++ b/src/yuzu/game_list.h
@@ -72,7 +72,8 @@ public:
72 }; 72 };
73 73
74 explicit GameList(std::shared_ptr<FileSys::VfsFilesystem> vfs, 74 explicit GameList(std::shared_ptr<FileSys::VfsFilesystem> vfs,
75 FileSys::ManualContentProvider* provider, GMainWindow* parent = nullptr); 75 FileSys::ManualContentProvider* provider, Core::System& system_,
76 GMainWindow* parent = nullptr);
76 ~GameList() override; 77 ~GameList() override;
77 78
78 QString GetLastFilterResultItem() const; 79 QString GetLastFilterResultItem() const;
@@ -145,6 +146,8 @@ private:
145 CompatibilityList compatibility_list; 146 CompatibilityList compatibility_list;
146 147
147 friend class GameListSearchField; 148 friend class GameListSearchField;
149
150 Core::System& system;
148}; 151};
149 152
150class GameListPlaceholder : public QWidget { 153class GameListPlaceholder : public QWidget {
diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp
index 2d5492157..fd92b36df 100644
--- a/src/yuzu/game_list_worker.cpp
+++ b/src/yuzu/game_list_worker.cpp
@@ -228,16 +228,15 @@ QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::stri
228GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs, 228GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs,
229 FileSys::ManualContentProvider* provider, 229 FileSys::ManualContentProvider* provider,
230 QVector<UISettings::GameDir>& game_dirs, 230 QVector<UISettings::GameDir>& game_dirs,
231 const CompatibilityList& compatibility_list) 231 const CompatibilityList& compatibility_list, Core::System& system_)
232 : vfs(std::move(vfs)), provider(provider), game_dirs(game_dirs), 232 : vfs(std::move(vfs)), provider(provider), game_dirs(game_dirs),
233 compatibility_list(compatibility_list) {} 233 compatibility_list(compatibility_list), system{system_} {}
234 234
235GameListWorker::~GameListWorker() = default; 235GameListWorker::~GameListWorker() = default;
236 236
237void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) { 237void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) {
238 using namespace FileSys; 238 using namespace FileSys;
239 239
240 auto& system = Core::System::GetInstance();
241 const auto& cache = dynamic_cast<ContentProviderUnion&>(system.GetContentProvider()); 240 const auto& cache = dynamic_cast<ContentProviderUnion&>(system.GetContentProvider());
242 241
243 auto installed_games = cache.ListEntriesFilterOrigin(std::nullopt, TitleType::Application, 242 auto installed_games = cache.ListEntriesFilterOrigin(std::nullopt, TitleType::Application,
@@ -285,10 +284,7 @@ void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) {
285 284
286void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_path, bool deep_scan, 285void GameListWorker::ScanFileSystem(ScanTarget target, const std::string& dir_path, bool deep_scan,
287 GameListDir* parent_dir) { 286 GameListDir* parent_dir) {
288 auto& system = Core::System::GetInstance(); 287 const auto callback = [this, target, parent_dir](const std::filesystem::path& path) -> bool {
289
290 const auto callback = [this, target, parent_dir,
291 &system](const std::filesystem::path& path) -> bool {
292 if (stop_processing) { 288 if (stop_processing) {
293 // Breaks the callback loop. 289 // Breaks the callback loop.
294 return false; 290 return false;
diff --git a/src/yuzu/game_list_worker.h b/src/yuzu/game_list_worker.h
index 396bb2623..1383e9fbc 100644
--- a/src/yuzu/game_list_worker.h
+++ b/src/yuzu/game_list_worker.h
@@ -19,6 +19,10 @@
19#include "common/common_types.h" 19#include "common/common_types.h"
20#include "yuzu/compatibility_list.h" 20#include "yuzu/compatibility_list.h"
21 21
22namespace Core {
23class System;
24}
25
22class QStandardItem; 26class QStandardItem;
23 27
24namespace FileSys { 28namespace FileSys {
@@ -37,7 +41,7 @@ public:
37 explicit GameListWorker(std::shared_ptr<FileSys::VfsFilesystem> vfs, 41 explicit GameListWorker(std::shared_ptr<FileSys::VfsFilesystem> vfs,
38 FileSys::ManualContentProvider* provider, 42 FileSys::ManualContentProvider* provider,
39 QVector<UISettings::GameDir>& game_dirs, 43 QVector<UISettings::GameDir>& game_dirs,
40 const CompatibilityList& compatibility_list); 44 const CompatibilityList& compatibility_list, Core::System& system_);
41 ~GameListWorker() override; 45 ~GameListWorker() override;
42 46
43 /// Starts the processing of directory tree information. 47 /// Starts the processing of directory tree information.
@@ -80,4 +84,6 @@ private:
80 84
81 QStringList watch_list; 85 QStringList watch_list;
82 std::atomic_bool stop_processing; 86 std::atomic_bool stop_processing;
87
88 Core::System& system;
83}; 89};
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 552c2cc63..2af582fe5 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -104,6 +104,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
104#include "core/telemetry_session.h" 104#include "core/telemetry_session.h"
105#include "input_common/main.h" 105#include "input_common/main.h"
106#include "input_common/tas/tas_input.h" 106#include "input_common/tas/tas_input.h"
107#include "ui_main.h"
107#include "util/overlay_dialog.h" 108#include "util/overlay_dialog.h"
108#include "video_core/gpu.h" 109#include "video_core/gpu.h"
109#include "video_core/renderer_base.h" 110#include "video_core/renderer_base.h"
@@ -171,7 +172,7 @@ void GMainWindow::ShowTelemetryCallout() {
171 "<br/><br/>Would you like to share your usage data with us?"); 172 "<br/><br/>Would you like to share your usage data with us?");
172 if (QMessageBox::question(this, tr("Telemetry"), telemetry_message) != QMessageBox::Yes) { 173 if (QMessageBox::question(this, tr("Telemetry"), telemetry_message) != QMessageBox::Yes) {
173 Settings::values.enable_telemetry = false; 174 Settings::values.enable_telemetry = false;
174 Core::System::GetInstance().ApplySettings(); 175 system->ApplySettings();
175 } 176 }
176} 177}
177 178
@@ -191,14 +192,16 @@ static void RemoveCachedContents() {
191} 192}
192 193
193GMainWindow::GMainWindow() 194GMainWindow::GMainWindow()
194 : input_subsystem{std::make_shared<InputCommon::InputSubsystem>()}, 195 : ui{std::make_unique<Ui::MainWindow>()}, system{std::make_unique<Core::System>()},
195 config{std::make_unique<Config>()}, vfs{std::make_shared<FileSys::RealVfsFilesystem>()}, 196 input_subsystem{std::make_shared<InputCommon::InputSubsystem>()},
197 config{std::make_unique<Config>(*system)},
198 vfs{std::make_shared<FileSys::RealVfsFilesystem>()},
196 provider{std::make_unique<FileSys::ManualContentProvider>()} { 199 provider{std::make_unique<FileSys::ManualContentProvider>()} {
197 Common::Log::Initialize(); 200 Common::Log::Initialize();
198 LoadTranslation(); 201 LoadTranslation();
199 202
200 setAcceptDrops(true); 203 setAcceptDrops(true);
201 ui.setupUi(this); 204 ui->setupUi(this);
202 statusBar()->hide(); 205 statusBar()->hide();
203 206
204 default_theme_paths = QIcon::themeSearchPaths(); 207 default_theme_paths = QIcon::themeSearchPaths();
@@ -255,11 +258,10 @@ GMainWindow::GMainWindow()
255 258
256 show(); 259 show();
257 260
258 Core::System::GetInstance().SetContentProvider( 261 system->SetContentProvider(std::make_unique<FileSys::ContentProviderUnion>());
259 std::make_unique<FileSys::ContentProviderUnion>()); 262 system->RegisterContentProvider(FileSys::ContentProviderUnionSlot::FrontendManual,
260 Core::System::GetInstance().RegisterContentProvider( 263 provider.get());
261 FileSys::ContentProviderUnionSlot::FrontendManual, provider.get()); 264 system->GetFileSystemController().CreateFactories(*vfs);
262 Core::System::GetInstance().GetFileSystemController().CreateFactories(*vfs);
263 265
264 // Remove cached contents generated during the previous session 266 // Remove cached contents generated during the previous session
265 RemoveCachedContents(); 267 RemoveCachedContents();
@@ -274,16 +276,16 @@ GMainWindow::GMainWindow()
274 ShowTelemetryCallout(); 276 ShowTelemetryCallout();
275 277
276 // make sure menubar has the arrow cursor instead of inheriting from this 278 // make sure menubar has the arrow cursor instead of inheriting from this
277 ui.menubar->setCursor(QCursor()); 279 ui->menubar->setCursor(QCursor());
278 statusBar()->setCursor(QCursor()); 280 statusBar()->setCursor(QCursor());
279 281
280 mouse_hide_timer.setInterval(default_mouse_timeout); 282 mouse_hide_timer.setInterval(default_mouse_timeout);
281 connect(&mouse_hide_timer, &QTimer::timeout, this, &GMainWindow::HideMouseCursor); 283 connect(&mouse_hide_timer, &QTimer::timeout, this, &GMainWindow::HideMouseCursor);
282 connect(ui.menubar, &QMenuBar::hovered, this, &GMainWindow::ShowMouseCursor); 284 connect(ui->menubar, &QMenuBar::hovered, this, &GMainWindow::ShowMouseCursor);
283 285
284 MigrateConfigFiles(); 286 MigrateConfigFiles();
285 287
286 ui.action_Fullscreen->setChecked(false); 288 ui->action_Fullscreen->setChecked(false);
287 289
288 QStringList args = QApplication::arguments(); 290 QStringList args = QApplication::arguments();
289 291
@@ -302,7 +304,7 @@ GMainWindow::GMainWindow()
302 304
303 // Launch game in fullscreen mode 305 // Launch game in fullscreen mode
304 if (args[i] == QStringLiteral("-f")) { 306 if (args[i] == QStringLiteral("-f")) {
305 ui.action_Fullscreen->setChecked(true); 307 ui->action_Fullscreen->setChecked(true);
306 continue; 308 continue;
307 } 309 }
308 310
@@ -405,12 +407,12 @@ void GMainWindow::RegisterMetaTypes() {
405 qRegisterMetaType<Service::AM::Applets::WebExitReason>("Service::AM::Applets::WebExitReason"); 407 qRegisterMetaType<Service::AM::Applets::WebExitReason>("Service::AM::Applets::WebExitReason");
406 408
407 // Register loader types 409 // Register loader types
408 qRegisterMetaType<Core::System::ResultStatus>("Core::System::ResultStatus"); 410 qRegisterMetaType<Core::SystemResultStatus>("Core::SystemResultStatus");
409} 411}
410 412
411void GMainWindow::ControllerSelectorReconfigureControllers( 413void GMainWindow::ControllerSelectorReconfigureControllers(
412 const Core::Frontend::ControllerParameters& parameters) { 414 const Core::Frontend::ControllerParameters& parameters) {
413 QtControllerSelectorDialog dialog(this, parameters, input_subsystem.get()); 415 QtControllerSelectorDialog dialog(this, parameters, input_subsystem.get(), *system);
414 416
415 dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | 417 dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint |
416 Qt::WindowTitleHint | Qt::WindowSystemMenuHint); 418 Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
@@ -420,7 +422,7 @@ void GMainWindow::ControllerSelectorReconfigureControllers(
420 emit ControllerSelectorReconfigureFinished(); 422 emit ControllerSelectorReconfigureFinished();
421 423
422 // Don't forget to apply settings. 424 // Don't forget to apply settings.
423 Core::System::GetInstance().ApplySettings(); 425 system->ApplySettings();
424 config->Save(); 426 config->Save();
425 427
426 UpdateStatusButtons(); 428 UpdateStatusButtons();
@@ -454,8 +456,8 @@ void GMainWindow::SoftwareKeyboardInitialize(
454 return; 456 return;
455 } 457 }
456 458
457 software_keyboard = new QtSoftwareKeyboardDialog(render_window, Core::System::GetInstance(), 459 software_keyboard = new QtSoftwareKeyboardDialog(render_window, *system, is_inline,
458 is_inline, std::move(initialize_parameters)); 460 std::move(initialize_parameters));
459 461
460 if (is_inline) { 462 if (is_inline) {
461 connect( 463 connect(
@@ -566,11 +568,11 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
566 return; 568 return;
567 } 569 }
568 570
569 QtNXWebEngineView web_browser_view(this, Core::System::GetInstance(), input_subsystem.get()); 571 QtNXWebEngineView web_browser_view(this, *system, input_subsystem.get());
570 572
571 ui.action_Pause->setEnabled(false); 573 ui->action_Pause->setEnabled(false);
572 ui.action_Restart->setEnabled(false); 574 ui->action_Restart->setEnabled(false);
573 ui.action_Stop->setEnabled(false); 575 ui->action_Stop->setEnabled(false);
574 576
575 { 577 {
576 QProgressDialog loading_progress(this); 578 QProgressDialog loading_progress(this);
@@ -634,7 +636,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
634 web_browser_view.SetFinished(true); 636 web_browser_view.SetFinished(true);
635 } 637 }
636 }); 638 });
637 ui.menubar->addAction(exit_action); 639 ui->menubar->addAction(exit_action);
638 640
639 while (!web_browser_view.IsFinished()) { 641 while (!web_browser_view.IsFinished()) {
640 QCoreApplication::processEvents(); 642 QCoreApplication::processEvents();
@@ -676,11 +678,11 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
676 render_window->show(); 678 render_window->show();
677 } 679 }
678 680
679 ui.action_Pause->setEnabled(true); 681 ui->action_Pause->setEnabled(true);
680 ui.action_Restart->setEnabled(true); 682 ui->action_Restart->setEnabled(true);
681 ui.action_Stop->setEnabled(true); 683 ui->action_Stop->setEnabled(true);
682 684
683 ui.menubar->removeAction(exit_action); 685 ui->menubar->removeAction(exit_action);
684 686
685 QCoreApplication::processEvents(); 687 QCoreApplication::processEvents();
686 688
@@ -696,21 +698,21 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
696 698
697void GMainWindow::InitializeWidgets() { 699void GMainWindow::InitializeWidgets() {
698#ifdef YUZU_ENABLE_COMPATIBILITY_REPORTING 700#ifdef YUZU_ENABLE_COMPATIBILITY_REPORTING
699 ui.action_Report_Compatibility->setVisible(true); 701 ui->action_Report_Compatibility->setVisible(true);
700#endif 702#endif
701 render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem); 703 render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem, *system);
702 render_window->hide(); 704 render_window->hide();
703 705
704 game_list = new GameList(vfs, provider.get(), this); 706 game_list = new GameList(vfs, provider.get(), *system, this);
705 ui.horizontalLayout->addWidget(game_list); 707 ui->horizontalLayout->addWidget(game_list);
706 708
707 game_list_placeholder = new GameListPlaceholder(this); 709 game_list_placeholder = new GameListPlaceholder(this);
708 ui.horizontalLayout->addWidget(game_list_placeholder); 710 ui->horizontalLayout->addWidget(game_list_placeholder);
709 game_list_placeholder->setVisible(false); 711 game_list_placeholder->setVisible(false);
710 712
711 loading_screen = new LoadingScreen(this); 713 loading_screen = new LoadingScreen(this);
712 loading_screen->hide(); 714 loading_screen->hide();
713 ui.horizontalLayout->addWidget(loading_screen); 715 ui->horizontalLayout->addWidget(loading_screen);
714 connect(loading_screen, &LoadingScreen::Hidden, [&] { 716 connect(loading_screen, &LoadingScreen::Hidden, [&] {
715 loading_screen->Clear(); 717 loading_screen->Clear();
716 if (emulation_running) { 718 if (emulation_running) {
@@ -767,14 +769,14 @@ void GMainWindow::InitializeWidgets() {
767 tr("Handheld controller can't be used on docked mode. Pro " 769 tr("Handheld controller can't be used on docked mode. Pro "
768 "controller will be selected.")); 770 "controller will be selected."));
769 controller_type = Settings::ControllerType::ProController; 771 controller_type = Settings::ControllerType::ProController;
770 ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get()); 772 ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(), *system);
771 configure_dialog.ApplyConfiguration(); 773 configure_dialog.ApplyConfiguration();
772 controller_dialog->refreshConfiguration(); 774 controller_dialog->refreshConfiguration();
773 } 775 }
774 776
775 Settings::values.use_docked_mode.SetValue(!is_docked); 777 Settings::values.use_docked_mode.SetValue(!is_docked);
776 dock_status_button->setChecked(!is_docked); 778 dock_status_button->setChecked(!is_docked);
777 OnDockedModeChanged(is_docked, !is_docked); 779 OnDockedModeChanged(is_docked, !is_docked, *system);
778 }); 780 });
779 dock_status_button->setText(tr("DOCK")); 781 dock_status_button->setText(tr("DOCK"));
780 dock_status_button->setCheckable(true); 782 dock_status_button->setCheckable(true);
@@ -798,7 +800,7 @@ void GMainWindow::InitializeWidgets() {
798 } 800 }
799 } 801 }
800 802
801 Core::System::GetInstance().ApplySettings(); 803 system->ApplySettings();
802 UpdateGPUAccuracyButton(); 804 UpdateGPUAccuracyButton();
803 }); 805 });
804 UpdateGPUAccuracyButton(); 806 UpdateGPUAccuracyButton();
@@ -826,7 +828,7 @@ void GMainWindow::InitializeWidgets() {
826 Settings::values.renderer_backend.SetValue(Settings::RendererBackend::OpenGL); 828 Settings::values.renderer_backend.SetValue(Settings::RendererBackend::OpenGL);
827 } 829 }
828 830
829 Core::System::GetInstance().ApplySettings(); 831 system->ApplySettings();
830 }); 832 });
831 statusBar()->insertPermanentWidget(0, renderer_status_button); 833 statusBar()->insertPermanentWidget(0, renderer_status_button);
832 834
@@ -835,7 +837,7 @@ void GMainWindow::InitializeWidgets() {
835} 837}
836 838
837void GMainWindow::InitializeDebugWidgets() { 839void GMainWindow::InitializeDebugWidgets() {
838 QMenu* debug_menu = ui.menu_View_Debugging; 840 QMenu* debug_menu = ui->menu_View_Debugging;
839 841
840#if MICROPROFILE_ENABLED 842#if MICROPROFILE_ENABLED
841 microProfileDialog = new MicroProfileDialog(this); 843 microProfileDialog = new MicroProfileDialog(this);
@@ -843,7 +845,7 @@ void GMainWindow::InitializeDebugWidgets() {
843 debug_menu->addAction(microProfileDialog->toggleViewAction()); 845 debug_menu->addAction(microProfileDialog->toggleViewAction());
844#endif 846#endif
845 847
846 waitTreeWidget = new WaitTreeWidget(this); 848 waitTreeWidget = new WaitTreeWidget(*system, this);
847 addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget); 849 addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget);
848 waitTreeWidget->hide(); 850 waitTreeWidget->hide();
849 debug_menu->addAction(waitTreeWidget->toggleViewAction()); 851 debug_menu->addAction(waitTreeWidget->toggleViewAction());
@@ -864,16 +866,16 @@ void GMainWindow::InitializeRecentFileMenuActions() {
864 actions_recent_files[i]->setVisible(false); 866 actions_recent_files[i]->setVisible(false);
865 connect(actions_recent_files[i], &QAction::triggered, this, &GMainWindow::OnMenuRecentFile); 867 connect(actions_recent_files[i], &QAction::triggered, this, &GMainWindow::OnMenuRecentFile);
866 868
867 ui.menu_recent_files->addAction(actions_recent_files[i]); 869 ui->menu_recent_files->addAction(actions_recent_files[i]);
868 } 870 }
869 ui.menu_recent_files->addSeparator(); 871 ui->menu_recent_files->addSeparator();
870 QAction* action_clear_recent_files = new QAction(this); 872 QAction* action_clear_recent_files = new QAction(this);
871 action_clear_recent_files->setText(tr("&Clear Recent Files")); 873 action_clear_recent_files->setText(tr("&Clear Recent Files"));
872 connect(action_clear_recent_files, &QAction::triggered, this, [this] { 874 connect(action_clear_recent_files, &QAction::triggered, this, [this] {
873 UISettings::values.recent_files.clear(); 875 UISettings::values.recent_files.clear();
874 UpdateRecentFiles(); 876 UpdateRecentFiles();
875 }); 877 });
876 ui.menu_recent_files->addAction(action_clear_recent_files); 878 ui->menu_recent_files->addAction(action_clear_recent_files);
877 879
878 UpdateRecentFiles(); 880 UpdateRecentFiles();
879} 881}
@@ -892,43 +894,43 @@ void GMainWindow::InitializeHotkeys() {
892 const QString fullscreen = QStringLiteral("Fullscreen"); 894 const QString fullscreen = QStringLiteral("Fullscreen");
893 const QString capture_screenshot = QStringLiteral("Capture Screenshot"); 895 const QString capture_screenshot = QStringLiteral("Capture Screenshot");
894 896
895 ui.action_Load_File->setShortcut(hotkey_registry.GetKeySequence(main_window, load_file)); 897 ui->action_Load_File->setShortcut(hotkey_registry.GetKeySequence(main_window, load_file));
896 ui.action_Load_File->setShortcutContext( 898 ui->action_Load_File->setShortcutContext(
897 hotkey_registry.GetShortcutContext(main_window, load_file)); 899 hotkey_registry.GetShortcutContext(main_window, load_file));
898 900
899 ui.action_Load_Amiibo->setShortcut(hotkey_registry.GetKeySequence(main_window, load_amiibo)); 901 ui->action_Load_Amiibo->setShortcut(hotkey_registry.GetKeySequence(main_window, load_amiibo));
900 ui.action_Load_Amiibo->setShortcutContext( 902 ui->action_Load_Amiibo->setShortcutContext(
901 hotkey_registry.GetShortcutContext(main_window, load_amiibo)); 903 hotkey_registry.GetShortcutContext(main_window, load_amiibo));
902 904
903 ui.action_Exit->setShortcut(hotkey_registry.GetKeySequence(main_window, exit_yuzu)); 905 ui->action_Exit->setShortcut(hotkey_registry.GetKeySequence(main_window, exit_yuzu));
904 ui.action_Exit->setShortcutContext(hotkey_registry.GetShortcutContext(main_window, exit_yuzu)); 906 ui->action_Exit->setShortcutContext(hotkey_registry.GetShortcutContext(main_window, exit_yuzu));
905 907
906 ui.action_Restart->setShortcut(hotkey_registry.GetKeySequence(main_window, restart_emulation)); 908 ui->action_Restart->setShortcut(hotkey_registry.GetKeySequence(main_window, restart_emulation));
907 ui.action_Restart->setShortcutContext( 909 ui->action_Restart->setShortcutContext(
908 hotkey_registry.GetShortcutContext(main_window, restart_emulation)); 910 hotkey_registry.GetShortcutContext(main_window, restart_emulation));
909 911
910 ui.action_Stop->setShortcut(hotkey_registry.GetKeySequence(main_window, stop_emulation)); 912 ui->action_Stop->setShortcut(hotkey_registry.GetKeySequence(main_window, stop_emulation));
911 ui.action_Stop->setShortcutContext( 913 ui->action_Stop->setShortcutContext(
912 hotkey_registry.GetShortcutContext(main_window, stop_emulation)); 914 hotkey_registry.GetShortcutContext(main_window, stop_emulation));
913 915
914 ui.action_Show_Filter_Bar->setShortcut( 916 ui->action_Show_Filter_Bar->setShortcut(
915 hotkey_registry.GetKeySequence(main_window, toggle_filter_bar)); 917 hotkey_registry.GetKeySequence(main_window, toggle_filter_bar));
916 ui.action_Show_Filter_Bar->setShortcutContext( 918 ui->action_Show_Filter_Bar->setShortcutContext(
917 hotkey_registry.GetShortcutContext(main_window, toggle_filter_bar)); 919 hotkey_registry.GetShortcutContext(main_window, toggle_filter_bar));
918 920
919 ui.action_Show_Status_Bar->setShortcut( 921 ui->action_Show_Status_Bar->setShortcut(
920 hotkey_registry.GetKeySequence(main_window, toggle_status_bar)); 922 hotkey_registry.GetKeySequence(main_window, toggle_status_bar));
921 ui.action_Show_Status_Bar->setShortcutContext( 923 ui->action_Show_Status_Bar->setShortcutContext(
922 hotkey_registry.GetShortcutContext(main_window, toggle_status_bar)); 924 hotkey_registry.GetShortcutContext(main_window, toggle_status_bar));
923 925
924 ui.action_Capture_Screenshot->setShortcut( 926 ui->action_Capture_Screenshot->setShortcut(
925 hotkey_registry.GetKeySequence(main_window, capture_screenshot)); 927 hotkey_registry.GetKeySequence(main_window, capture_screenshot));
926 ui.action_Capture_Screenshot->setShortcutContext( 928 ui->action_Capture_Screenshot->setShortcutContext(
927 hotkey_registry.GetShortcutContext(main_window, capture_screenshot)); 929 hotkey_registry.GetShortcutContext(main_window, capture_screenshot));
928 930
929 ui.action_Fullscreen->setShortcut( 931 ui->action_Fullscreen->setShortcut(
930 hotkey_registry.GetHotkey(main_window, fullscreen, this)->key()); 932 hotkey_registry.GetHotkey(main_window, fullscreen, this)->key());
931 ui.action_Fullscreen->setShortcutContext( 933 ui->action_Fullscreen->setShortcutContext(
932 hotkey_registry.GetShortcutContext(main_window, fullscreen)); 934 hotkey_registry.GetShortcutContext(main_window, fullscreen));
933 935
934 connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Load File"), this), 936 connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Load File"), this),
@@ -946,19 +948,19 @@ void GMainWindow::InitializeHotkeys() {
946 }); 948 });
947 connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Restart Emulation"), this), 949 connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Restart Emulation"), this),
948 &QShortcut::activated, this, [this] { 950 &QShortcut::activated, this, [this] {
949 if (!Core::System::GetInstance().IsPoweredOn()) { 951 if (!system->IsPoweredOn()) {
950 return; 952 return;
951 } 953 }
952 BootGame(game_path); 954 BootGame(game_path);
953 }); 955 });
954 connect(hotkey_registry.GetHotkey(main_window, fullscreen, render_window), 956 connect(hotkey_registry.GetHotkey(main_window, fullscreen, render_window),
955 &QShortcut::activated, ui.action_Fullscreen, &QAction::trigger); 957 &QShortcut::activated, ui->action_Fullscreen, &QAction::trigger);
956 connect(hotkey_registry.GetHotkey(main_window, fullscreen, render_window), 958 connect(hotkey_registry.GetHotkey(main_window, fullscreen, render_window),
957 &QShortcut::activatedAmbiguously, ui.action_Fullscreen, &QAction::trigger); 959 &QShortcut::activatedAmbiguously, ui->action_Fullscreen, &QAction::trigger);
958 connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Exit Fullscreen"), this), 960 connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Exit Fullscreen"), this),
959 &QShortcut::activated, this, [&] { 961 &QShortcut::activated, this, [&] {
960 if (emulation_running) { 962 if (emulation_running) {
961 ui.action_Fullscreen->setChecked(false); 963 ui->action_Fullscreen->setChecked(false);
962 ToggleFullscreen(); 964 ToggleFullscreen();
963 } 965 }
964 }); 966 });
@@ -987,7 +989,7 @@ void GMainWindow::InitializeHotkeys() {
987 }); 989 });
988 connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Load Amiibo"), this), 990 connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Load Amiibo"), this),
989 &QShortcut::activated, this, [&] { 991 &QShortcut::activated, this, [&] {
990 if (ui.action_Load_Amiibo->isEnabled()) { 992 if (ui->action_Load_Amiibo->isEnabled()) {
991 OnLoadAmiibo(); 993 OnLoadAmiibo();
992 } 994 }
993 }); 995 });
@@ -1002,7 +1004,7 @@ void GMainWindow::InitializeHotkeys() {
1002 Settings::values.use_docked_mode.SetValue( 1004 Settings::values.use_docked_mode.SetValue(
1003 !Settings::values.use_docked_mode.GetValue()); 1005 !Settings::values.use_docked_mode.GetValue());
1004 OnDockedModeChanged(!Settings::values.use_docked_mode.GetValue(), 1006 OnDockedModeChanged(!Settings::values.use_docked_mode.GetValue(),
1005 Settings::values.use_docked_mode.GetValue()); 1007 Settings::values.use_docked_mode.GetValue(), *system);
1006 dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue()); 1008 dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue());
1007 }); 1009 });
1008 connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Mute Audio"), this), 1010 connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Mute Audio"), this),
@@ -1068,20 +1070,20 @@ void GMainWindow::RestoreUIState() {
1068 1070
1069 game_list->LoadInterfaceLayout(); 1071 game_list->LoadInterfaceLayout();
1070 1072
1071 ui.action_Single_Window_Mode->setChecked(UISettings::values.single_window_mode.GetValue()); 1073 ui->action_Single_Window_Mode->setChecked(UISettings::values.single_window_mode.GetValue());
1072 ToggleWindowMode(); 1074 ToggleWindowMode();
1073 1075
1074 ui.action_Fullscreen->setChecked(UISettings::values.fullscreen.GetValue()); 1076 ui->action_Fullscreen->setChecked(UISettings::values.fullscreen.GetValue());
1075 1077
1076 ui.action_Display_Dock_Widget_Headers->setChecked( 1078 ui->action_Display_Dock_Widget_Headers->setChecked(
1077 UISettings::values.display_titlebar.GetValue()); 1079 UISettings::values.display_titlebar.GetValue());
1078 OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked()); 1080 OnDisplayTitleBars(ui->action_Display_Dock_Widget_Headers->isChecked());
1079 1081
1080 ui.action_Show_Filter_Bar->setChecked(UISettings::values.show_filter_bar.GetValue()); 1082 ui->action_Show_Filter_Bar->setChecked(UISettings::values.show_filter_bar.GetValue());
1081 game_list->SetFilterVisible(ui.action_Show_Filter_Bar->isChecked()); 1083 game_list->SetFilterVisible(ui->action_Show_Filter_Bar->isChecked());
1082 1084
1083 ui.action_Show_Status_Bar->setChecked(UISettings::values.show_status_bar.GetValue()); 1085 ui->action_Show_Status_Bar->setChecked(UISettings::values.show_status_bar.GetValue());
1084 statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked()); 1086 statusBar()->setVisible(ui->action_Show_Status_Bar->isChecked());
1085 Debugger::ToggleConsole(); 1087 Debugger::ToggleConsole();
1086} 1088}
1087 1089
@@ -1093,11 +1095,11 @@ void GMainWindow::OnAppFocusStateChanged(Qt::ApplicationState state) {
1093 state != Qt::ApplicationActive) { 1095 state != Qt::ApplicationActive) {
1094 LOG_DEBUG(Frontend, "ApplicationState unusual flag: {} ", state); 1096 LOG_DEBUG(Frontend, "ApplicationState unusual flag: {} ", state);
1095 } 1097 }
1096 if (ui.action_Pause->isEnabled() && 1098 if (ui->action_Pause->isEnabled() &&
1097 (state & (Qt::ApplicationHidden | Qt::ApplicationInactive))) { 1099 (state & (Qt::ApplicationHidden | Qt::ApplicationInactive))) {
1098 auto_paused = true; 1100 auto_paused = true;
1099 OnPauseGame(); 1101 OnPauseGame();
1100 } else if (ui.action_Start->isEnabled() && auto_paused && state == Qt::ApplicationActive) { 1102 } else if (ui->action_Start->isEnabled() && auto_paused && state == Qt::ApplicationActive) {
1101 auto_paused = false; 1103 auto_paused = false;
1102 OnStartGame(); 1104 OnStartGame();
1103 } 1105 }
@@ -1142,53 +1144,60 @@ void GMainWindow::ConnectWidgetEvents() {
1142 1144
1143void GMainWindow::ConnectMenuEvents() { 1145void GMainWindow::ConnectMenuEvents() {
1144 // File 1146 // File
1145 connect(ui.action_Load_File, &QAction::triggered, this, &GMainWindow::OnMenuLoadFile); 1147 connect(ui->action_Load_File, &QAction::triggered, this, &GMainWindow::OnMenuLoadFile);
1146 connect(ui.action_Load_Folder, &QAction::triggered, this, &GMainWindow::OnMenuLoadFolder); 1148 connect(ui->action_Load_Folder, &QAction::triggered, this, &GMainWindow::OnMenuLoadFolder);
1147 connect(ui.action_Install_File_NAND, &QAction::triggered, this, 1149 connect(ui->action_Install_File_NAND, &QAction::triggered, this,
1148 &GMainWindow::OnMenuInstallToNAND); 1150 &GMainWindow::OnMenuInstallToNAND);
1149 connect(ui.action_Exit, &QAction::triggered, this, &QMainWindow::close); 1151 connect(ui->action_Exit, &QAction::triggered, this, &QMainWindow::close);
1150 connect(ui.action_Load_Amiibo, &QAction::triggered, this, &GMainWindow::OnLoadAmiibo); 1152 connect(ui->action_Load_Amiibo, &QAction::triggered, this, &GMainWindow::OnLoadAmiibo);
1151 1153
1152 // Emulation 1154 // Emulation
1153 connect(ui.action_Start, &QAction::triggered, this, &GMainWindow::OnStartGame); 1155 connect(ui->action_Start, &QAction::triggered, this, &GMainWindow::OnStartGame);
1154 connect(ui.action_Pause, &QAction::triggered, this, &GMainWindow::OnPauseGame); 1156 connect(ui->action_Pause, &QAction::triggered, this, &GMainWindow::OnPauseGame);
1155 connect(ui.action_Stop, &QAction::triggered, this, &GMainWindow::OnStopGame); 1157 connect(ui->action_Stop, &QAction::triggered, this, &GMainWindow::OnStopGame);
1156 connect(ui.action_Report_Compatibility, &QAction::triggered, this, 1158 connect(ui->action_Report_Compatibility, &QAction::triggered, this,
1157 &GMainWindow::OnMenuReportCompatibility); 1159 &GMainWindow::OnMenuReportCompatibility);
1158 connect(ui.action_Open_Mods_Page, &QAction::triggered, this, &GMainWindow::OnOpenModsPage); 1160 connect(ui->action_Open_Mods_Page, &QAction::triggered, this, &GMainWindow::OnOpenModsPage);
1159 connect(ui.action_Open_Quickstart_Guide, &QAction::triggered, this, 1161 connect(ui->action_Open_Quickstart_Guide, &QAction::triggered, this,
1160 &GMainWindow::OnOpenQuickstartGuide); 1162 &GMainWindow::OnOpenQuickstartGuide);
1161 connect(ui.action_Open_FAQ, &QAction::triggered, this, &GMainWindow::OnOpenFAQ); 1163 connect(ui->action_Open_FAQ, &QAction::triggered, this, &GMainWindow::OnOpenFAQ);
1162 connect(ui.action_Restart, &QAction::triggered, this, [this] { BootGame(QString(game_path)); }); 1164 connect(ui->action_Restart, &QAction::triggered, this,
1163 connect(ui.action_Configure, &QAction::triggered, this, &GMainWindow::OnConfigure); 1165 [this] { BootGame(QString(game_path)); });
1164 connect(ui.action_Configure_Tas, &QAction::triggered, this, &GMainWindow::OnConfigureTas); 1166 connect(ui->action_Configure, &QAction::triggered, this, &GMainWindow::OnConfigure);
1165 connect(ui.action_Configure_Current_Game, &QAction::triggered, this, 1167 connect(ui->action_Configure_Tas, &QAction::triggered, this, &GMainWindow::OnConfigureTas);
1168 connect(ui->action_Configure_Current_Game, &QAction::triggered, this,
1166 &GMainWindow::OnConfigurePerGame); 1169 &GMainWindow::OnConfigurePerGame);
1167 1170
1168 // View 1171 // View
1169 connect(ui.action_Single_Window_Mode, &QAction::triggered, this, 1172 connect(ui->action_Single_Window_Mode, &QAction::triggered, this,
1170 &GMainWindow::ToggleWindowMode); 1173 &GMainWindow::ToggleWindowMode);
1171 connect(ui.action_Display_Dock_Widget_Headers, &QAction::triggered, this, 1174 connect(ui->action_Display_Dock_Widget_Headers, &QAction::triggered, this,
1172 &GMainWindow::OnDisplayTitleBars); 1175 &GMainWindow::OnDisplayTitleBars);
1173 connect(ui.action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar); 1176 connect(ui->action_Show_Filter_Bar, &QAction::triggered, this, &GMainWindow::OnToggleFilterBar);
1174 connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible); 1177 connect(ui->action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible);
1175 connect(ui.action_Reset_Window_Size_720, &QAction::triggered, this, 1178
1179 connect(ui->action_Reset_Window_Size_720, &QAction::triggered, this,
1176 &GMainWindow::ResetWindowSize720); 1180 &GMainWindow::ResetWindowSize720);
1177 connect(ui.action_Reset_Window_Size_1080, &QAction::triggered, this, 1181 connect(ui->action_Reset_Window_Size_900, &QAction::triggered, this,
1182 &GMainWindow::ResetWindowSize900);
1183 connect(ui->action_Reset_Window_Size_1080, &QAction::triggered, this,
1178 &GMainWindow::ResetWindowSize1080); 1184 &GMainWindow::ResetWindowSize1080);
1185 ui->menu_Reset_Window_Size->addAction(ui->action_Reset_Window_Size_720);
1186 ui->menu_Reset_Window_Size->addAction(ui->action_Reset_Window_Size_900);
1187 ui->menu_Reset_Window_Size->addAction(ui->action_Reset_Window_Size_1080);
1179 1188
1180 // Fullscreen 1189 // Fullscreen
1181 connect(ui.action_Fullscreen, &QAction::triggered, this, &GMainWindow::ToggleFullscreen); 1190 connect(ui->action_Fullscreen, &QAction::triggered, this, &GMainWindow::ToggleFullscreen);
1182 1191
1183 // Movie 1192 // Movie
1184 connect(ui.action_Capture_Screenshot, &QAction::triggered, this, 1193 connect(ui->action_Capture_Screenshot, &QAction::triggered, this,
1185 &GMainWindow::OnCaptureScreenshot); 1194 &GMainWindow::OnCaptureScreenshot);
1186 1195
1187 // Help 1196 // Help
1188 connect(ui.action_Open_yuzu_Folder, &QAction::triggered, this, &GMainWindow::OnOpenYuzuFolder); 1197 connect(ui->action_Open_yuzu_Folder, &QAction::triggered, this, &GMainWindow::OnOpenYuzuFolder);
1189 connect(ui.action_Rederive, &QAction::triggered, this, 1198 connect(ui->action_Rederive, &QAction::triggered, this,
1190 std::bind(&GMainWindow::OnReinitializeKeys, this, ReinitializeKeyBehavior::Warning)); 1199 std::bind(&GMainWindow::OnReinitializeKeys, this, ReinitializeKeyBehavior::Warning));
1191 connect(ui.action_About, &QAction::triggered, this, &GMainWindow::OnAbout); 1200 connect(ui->action_About, &QAction::triggered, this, &GMainWindow::OnAbout);
1192} 1201}
1193 1202
1194void GMainWindow::OnDisplayTitleBars(bool show) { 1203void GMainWindow::OnDisplayTitleBars(bool show) {
@@ -1232,10 +1241,9 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
1232 return false; 1241 return false;
1233 } 1242 }
1234 1243
1235 Core::System& system{Core::System::GetInstance()}; 1244 system->SetFilesystem(vfs);
1236 system.SetFilesystem(vfs);
1237 1245
1238 system.SetAppletFrontendSet({ 1246 system->SetAppletFrontendSet({
1239 std::make_unique<QtControllerSelector>(*this), // Controller Selector 1247 std::make_unique<QtControllerSelector>(*this), // Controller Selector
1240 std::make_unique<QtErrorDisplay>(*this), // Error Display 1248 std::make_unique<QtErrorDisplay>(*this), // Error Display
1241 nullptr, // Parental Controls 1249 nullptr, // Parental Controls
@@ -1245,14 +1253,14 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
1245 std::make_unique<QtWebBrowser>(*this), // Web Browser 1253 std::make_unique<QtWebBrowser>(*this), // Web Browser
1246 }); 1254 });
1247 1255
1248 const Core::System::ResultStatus result{ 1256 const Core::SystemResultStatus result{
1249 system.Load(*render_window, filename.toStdString(), program_id, program_index)}; 1257 system->Load(*render_window, filename.toStdString(), program_id, program_index)};
1250 1258
1251 const auto drd_callout = (UISettings::values.callout_flags.GetValue() & 1259 const auto drd_callout = (UISettings::values.callout_flags.GetValue() &
1252 static_cast<u32>(CalloutFlag::DRDDeprecation)) == 0; 1260 static_cast<u32>(CalloutFlag::DRDDeprecation)) == 0;
1253 1261
1254 if (result == Core::System::ResultStatus::Success && 1262 if (result == Core::SystemResultStatus::Success &&
1255 system.GetAppLoader().GetFileType() == Loader::FileType::DeconstructedRomDirectory && 1263 system->GetAppLoader().GetFileType() == Loader::FileType::DeconstructedRomDirectory &&
1256 drd_callout) { 1264 drd_callout) {
1257 UISettings::values.callout_flags = UISettings::values.callout_flags.GetValue() | 1265 UISettings::values.callout_flags = UISettings::values.callout_flags.GetValue() |
1258 static_cast<u32>(CalloutFlag::DRDDeprecation); 1266 static_cast<u32>(CalloutFlag::DRDDeprecation);
@@ -1266,14 +1274,14 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
1266 "wiki</a>. This message will not be shown again.")); 1274 "wiki</a>. This message will not be shown again."));
1267 } 1275 }
1268 1276
1269 if (result != Core::System::ResultStatus::Success) { 1277 if (result != Core::SystemResultStatus::Success) {
1270 switch (result) { 1278 switch (result) {
1271 case Core::System::ResultStatus::ErrorGetLoader: 1279 case Core::SystemResultStatus::ErrorGetLoader:
1272 LOG_CRITICAL(Frontend, "Failed to obtain loader for {}!", filename.toStdString()); 1280 LOG_CRITICAL(Frontend, "Failed to obtain loader for {}!", filename.toStdString());
1273 QMessageBox::critical(this, tr("Error while loading ROM!"), 1281 QMessageBox::critical(this, tr("Error while loading ROM!"),
1274 tr("The ROM format is not supported.")); 1282 tr("The ROM format is not supported."));
1275 break; 1283 break;
1276 case Core::System::ResultStatus::ErrorVideoCore: 1284 case Core::SystemResultStatus::ErrorVideoCore:
1277 QMessageBox::critical( 1285 QMessageBox::critical(
1278 this, tr("An error occurred initializing the video core."), 1286 this, tr("An error occurred initializing the video core."),
1279 tr("yuzu has encountered an error while running the video core, please see the " 1287 tr("yuzu has encountered an error while running the video core, please see the "
@@ -1287,8 +1295,8 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
1287 break; 1295 break;
1288 1296
1289 default: 1297 default:
1290 if (result > Core::System::ResultStatus::ErrorLoader) { 1298 if (result > Core::SystemResultStatus::ErrorLoader) {
1291 const u16 loader_id = static_cast<u16>(Core::System::ResultStatus::ErrorLoader); 1299 const u16 loader_id = static_cast<u16>(Core::SystemResultStatus::ErrorLoader);
1292 const u16 error_id = static_cast<u16>(result) - loader_id; 1300 const u16 error_id = static_cast<u16>(result) - loader_id;
1293 const std::string error_code = fmt::format("({:04X}-{:04X})", loader_id, error_id); 1301 const std::string error_code = fmt::format("({:04X}-{:04X})", loader_id, error_id);
1294 LOG_CRITICAL(Frontend, "Failed to load ROM! {}", error_code); 1302 LOG_CRITICAL(Frontend, "Failed to load ROM! {}", error_code);
@@ -1316,7 +1324,7 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p
1316 } 1324 }
1317 game_path = filename; 1325 game_path = filename;
1318 1326
1319 system.TelemetrySession().AddField(Common::Telemetry::FieldType::App, "Frontend", "Qt"); 1327 system->TelemetrySession().AddField(Common::Telemetry::FieldType::App, "Frontend", "Qt");
1320 return true; 1328 return true;
1321} 1329}
1322 1330
@@ -1342,9 +1350,8 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
1342 1350
1343 last_filename_booted = filename; 1351 last_filename_booted = filename;
1344 1352
1345 auto& system = Core::System::GetInstance();
1346 const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData()); 1353 const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData());
1347 const auto loader = Loader::GetLoader(system, v_file, program_id, program_index); 1354 const auto loader = Loader::GetLoader(*system, v_file, program_id, program_index);
1348 1355
1349 if (loader != nullptr && loader->ReadProgramId(title_id) == Loader::ResultStatus::Success && 1356 if (loader != nullptr && loader->ReadProgramId(title_id) == Loader::ResultStatus::Success &&
1350 type == StartGameType::Normal) { 1357 type == StartGameType::Normal) {
@@ -1353,7 +1360,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
1353 const auto config_file_name = title_id == 0 1360 const auto config_file_name = title_id == 0
1354 ? Common::FS::PathToUTF8String(file_path.filename()) 1361 ? Common::FS::PathToUTF8String(file_path.filename())
1355 : fmt::format("{:016X}", title_id); 1362 : fmt::format("{:016X}", title_id);
1356 Config per_game_config(config_file_name, Config::ConfigType::PerGameConfig); 1363 Config per_game_config(*system, config_file_name, Config::ConfigType::PerGameConfig);
1357 } 1364 }
1358 1365
1359 ConfigureVibration::SetAllVibrationDevices(); 1366 ConfigureVibration::SetAllVibrationDevices();
@@ -1376,16 +1383,16 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
1376 return; 1383 return;
1377 1384
1378 // Create and start the emulation thread 1385 // Create and start the emulation thread
1379 emu_thread = std::make_unique<EmuThread>(); 1386 emu_thread = std::make_unique<EmuThread>(*system);
1380 emit EmulationStarting(emu_thread.get()); 1387 emit EmulationStarting(emu_thread.get());
1381 emu_thread->start(); 1388 emu_thread->start();
1382 1389
1383 // Register an ExecuteProgram callback such that Core can execute a sub-program 1390 // Register an ExecuteProgram callback such that Core can execute a sub-program
1384 system.RegisterExecuteProgramCallback( 1391 system->RegisterExecuteProgramCallback(
1385 [this](std::size_t program_index) { render_window->ExecuteProgram(program_index); }); 1392 [this](std::size_t program_index) { render_window->ExecuteProgram(program_index); });
1386 1393
1387 // Register an Exit callback such that Core can exit the currently running application. 1394 // Register an Exit callback such that Core can exit the currently running application.
1388 system.RegisterExitCallback([this]() { render_window->Exit(); }); 1395 system->RegisterExitCallback([this]() { render_window->Exit(); });
1389 1396
1390 connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame); 1397 connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
1391 connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity); 1398 connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity);
@@ -1401,7 +1408,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
1401 1408
1402 // Update the GUI 1409 // Update the GUI
1403 UpdateStatusButtons(); 1410 UpdateStatusButtons();
1404 if (ui.action_Single_Window_Mode->isChecked()) { 1411 if (ui->action_Single_Window_Mode->isChecked()) {
1405 game_list->hide(); 1412 game_list->hide();
1406 game_list_placeholder->hide(); 1413 game_list_placeholder->hide();
1407 } 1414 }
@@ -1419,11 +1426,11 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
1419 1426
1420 std::string title_name; 1427 std::string title_name;
1421 std::string title_version; 1428 std::string title_version;
1422 const auto res = system.GetGameName(title_name); 1429 const auto res = system->GetGameName(title_name);
1423 1430
1424 const auto metadata = [&system, title_id] { 1431 const auto metadata = [this, title_id] {
1425 const FileSys::PatchManager pm(title_id, system.GetFileSystemController(), 1432 const FileSys::PatchManager pm(title_id, system->GetFileSystemController(),
1426 system.GetContentProvider()); 1433 system->GetContentProvider());
1427 return pm.GetControlMetadata(); 1434 return pm.GetControlMetadata();
1428 }(); 1435 }();
1429 if (metadata.first != nullptr) { 1436 if (metadata.first != nullptr) {
@@ -1434,20 +1441,20 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t
1434 title_name = Common::FS::PathToUTF8String( 1441 title_name = Common::FS::PathToUTF8String(
1435 std::filesystem::path{filename.toStdU16String()}.filename()); 1442 std::filesystem::path{filename.toStdU16String()}.filename());
1436 } 1443 }
1437 const bool is_64bit = system.Kernel().CurrentProcess()->Is64BitProcess(); 1444 const bool is_64bit = system->Kernel().CurrentProcess()->Is64BitProcess();
1438 const auto instruction_set_suffix = is_64bit ? tr("(64-bit)") : tr("(32-bit)"); 1445 const auto instruction_set_suffix = is_64bit ? tr("(64-bit)") : tr("(32-bit)");
1439 title_name = tr("%1 %2", "%1 is the title name. %2 indicates if the title is 64-bit or 32-bit") 1446 title_name = tr("%1 %2", "%1 is the title name. %2 indicates if the title is 64-bit or 32-bit")
1440 .arg(QString::fromStdString(title_name), instruction_set_suffix) 1447 .arg(QString::fromStdString(title_name), instruction_set_suffix)
1441 .toStdString(); 1448 .toStdString();
1442 LOG_INFO(Frontend, "Booting game: {:016X} | {} | {}", title_id, title_name, title_version); 1449 LOG_INFO(Frontend, "Booting game: {:016X} | {} | {}", title_id, title_name, title_version);
1443 const auto gpu_vendor = system.GPU().Renderer().GetDeviceVendor(); 1450 const auto gpu_vendor = system->GPU().Renderer().GetDeviceVendor();
1444 UpdateWindowTitle(title_name, title_version, gpu_vendor); 1451 UpdateWindowTitle(title_name, title_version, gpu_vendor);
1445 1452
1446 loading_screen->Prepare(system.GetAppLoader()); 1453 loading_screen->Prepare(system->GetAppLoader());
1447 loading_screen->show(); 1454 loading_screen->show();
1448 1455
1449 emulation_running = true; 1456 emulation_running = true;
1450 if (ui.action_Fullscreen->isChecked()) { 1457 if (ui->action_Fullscreen->isChecked()) {
1451 ShowFullscreen(); 1458 ShowFullscreen();
1452 } 1459 }
1453 OnStartGame(); 1460 OnStartGame();
@@ -1458,7 +1465,7 @@ void GMainWindow::ShutdownGame() {
1458 return; 1465 return;
1459 } 1466 }
1460 1467
1461 if (ui.action_Fullscreen->isChecked()) { 1468 if (ui->action_Fullscreen->isChecked()) {
1462 HideFullscreen(); 1469 HideFullscreen();
1463 } 1470 }
1464 1471
@@ -1479,15 +1486,15 @@ void GMainWindow::ShutdownGame() {
1479 disconnect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame); 1486 disconnect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
1480 1487
1481 // Update the GUI 1488 // Update the GUI
1482 ui.action_Start->setEnabled(false); 1489 ui->action_Start->setEnabled(false);
1483 ui.action_Start->setText(tr("Start")); 1490 ui->action_Start->setText(tr("Start"));
1484 ui.action_Pause->setEnabled(false); 1491 ui->action_Pause->setEnabled(false);
1485 ui.action_Stop->setEnabled(false); 1492 ui->action_Stop->setEnabled(false);
1486 ui.action_Restart->setEnabled(false); 1493 ui->action_Restart->setEnabled(false);
1487 ui.action_Configure_Current_Game->setEnabled(false); 1494 ui->action_Configure_Current_Game->setEnabled(false);
1488 ui.action_Report_Compatibility->setEnabled(false); 1495 ui->action_Report_Compatibility->setEnabled(false);
1489 ui.action_Load_Amiibo->setEnabled(false); 1496 ui->action_Load_Amiibo->setEnabled(false);
1490 ui.action_Capture_Screenshot->setEnabled(false); 1497 ui->action_Capture_Screenshot->setEnabled(false);
1491 render_window->hide(); 1498 render_window->hide();
1492 loading_screen->hide(); 1499 loading_screen->hide();
1493 loading_screen->Clear(); 1500 loading_screen->Clear();
@@ -1549,7 +1556,7 @@ void GMainWindow::UpdateRecentFiles() {
1549 } 1556 }
1550 1557
1551 // Enable the recent files menu if the list isn't empty 1558 // Enable the recent files menu if the list isn't empty
1552 ui.menu_recent_files->setEnabled(num_recent_files != 0); 1559 ui->menu_recent_files->setEnabled(num_recent_files != 0);
1553} 1560}
1554 1561
1555void GMainWindow::OnGameListLoadFile(QString game_path, u64 program_id) { 1562void GMainWindow::OnGameListLoadFile(QString game_path, u64 program_id) {
@@ -1560,18 +1567,17 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
1560 const std::string& game_path) { 1567 const std::string& game_path) {
1561 std::filesystem::path path; 1568 std::filesystem::path path;
1562 QString open_target; 1569 QString open_target;
1563 auto& system = Core::System::GetInstance();
1564 1570
1565 const auto [user_save_size, device_save_size] = [this, &game_path, &program_id, &system] { 1571 const auto [user_save_size, device_save_size] = [this, &game_path, &program_id] {
1566 const FileSys::PatchManager pm{program_id, system.GetFileSystemController(), 1572 const FileSys::PatchManager pm{program_id, system->GetFileSystemController(),
1567 system.GetContentProvider()}; 1573 system->GetContentProvider()};
1568 const auto control = pm.GetControlMetadata().first; 1574 const auto control = pm.GetControlMetadata().first;
1569 if (control != nullptr) { 1575 if (control != nullptr) {
1570 return std::make_pair(control->GetDefaultNormalSaveSize(), 1576 return std::make_pair(control->GetDefaultNormalSaveSize(),
1571 control->GetDeviceSaveDataSize()); 1577 control->GetDeviceSaveDataSize());
1572 } else { 1578 } else {
1573 const auto file = Core::GetGameFileFromPath(vfs, game_path); 1579 const auto file = Core::GetGameFileFromPath(vfs, game_path);
1574 const auto loader = Loader::GetLoader(system, file); 1580 const auto loader = Loader::GetLoader(*system, file);
1575 1581
1576 FileSys::NACP nacp{}; 1582 FileSys::NACP nacp{};
1577 loader->ReadControlData(nacp); 1583 loader->ReadControlData(nacp);
@@ -1614,14 +1620,14 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
1614 ASSERT(user_id); 1620 ASSERT(user_id);
1615 1621
1616 const auto user_save_data_path = FileSys::SaveDataFactory::GetFullPath( 1622 const auto user_save_data_path = FileSys::SaveDataFactory::GetFullPath(
1617 system, FileSys::SaveDataSpaceId::NandUser, FileSys::SaveDataType::SaveData, 1623 *system, FileSys::SaveDataSpaceId::NandUser, FileSys::SaveDataType::SaveData,
1618 program_id, user_id->uuid, 0); 1624 program_id, user_id->uuid, 0);
1619 1625
1620 path = Common::FS::ConcatPathSafe(nand_dir, user_save_data_path); 1626 path = Common::FS::ConcatPathSafe(nand_dir, user_save_data_path);
1621 } else { 1627 } else {
1622 // Device save data 1628 // Device save data
1623 const auto device_save_data_path = FileSys::SaveDataFactory::GetFullPath( 1629 const auto device_save_data_path = FileSys::SaveDataFactory::GetFullPath(
1624 system, FileSys::SaveDataSpaceId::NandUser, FileSys::SaveDataType::SaveData, 1630 *system, FileSys::SaveDataSpaceId::NandUser, FileSys::SaveDataType::SaveData,
1625 program_id, {}, 0); 1631 program_id, {}, 0);
1626 1632
1627 path = Common::FS::ConcatPathSafe(nand_dir, device_save_data_path); 1633 path = Common::FS::ConcatPathSafe(nand_dir, device_save_data_path);
@@ -1660,7 +1666,7 @@ void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) {
1660 const auto shader_cache_folder_path{shader_cache_dir / fmt::format("{:016x}", program_id)}; 1666 const auto shader_cache_folder_path{shader_cache_dir / fmt::format("{:016x}", program_id)};
1661 if (!Common::FS::CreateDirs(shader_cache_folder_path)) { 1667 if (!Common::FS::CreateDirs(shader_cache_folder_path)) {
1662 QMessageBox::warning(this, tr("Error Opening Transferable Shader Cache"), 1668 QMessageBox::warning(this, tr("Error Opening Transferable Shader Cache"),
1663 tr("Filed to create the shader cache directory for this title.")); 1669 tr("Failed to create the shader cache directory for this title."));
1664 return; 1670 return;
1665 } 1671 }
1666 const auto shader_path_string{Common::FS::PathToUTF8String(shader_cache_folder_path)}; 1672 const auto shader_path_string{Common::FS::PathToUTF8String(shader_cache_folder_path)};
@@ -1748,7 +1754,7 @@ void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryT
1748} 1754}
1749 1755
1750void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) { 1756void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) {
1751 const auto& fs_controller = Core::System::GetInstance().GetFileSystemController(); 1757 const auto& fs_controller = system->GetFileSystemController();
1752 const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) || 1758 const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) ||
1753 fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id); 1759 fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id);
1754 1760
@@ -1764,7 +1770,7 @@ void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) {
1764 1770
1765void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) { 1771void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) {
1766 const auto update_id = program_id | 0x800; 1772 const auto update_id = program_id | 0x800;
1767 const auto& fs_controller = Core::System::GetInstance().GetFileSystemController(); 1773 const auto& fs_controller = system->GetFileSystemController();
1768 const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) || 1774 const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) ||
1769 fs_controller.GetSDMCContents()->RemoveExistingEntry(update_id); 1775 fs_controller.GetSDMCContents()->RemoveExistingEntry(update_id);
1770 1776
@@ -1779,8 +1785,8 @@ void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type)
1779 1785
1780void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) { 1786void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) {
1781 u32 count{}; 1787 u32 count{};
1782 const auto& fs_controller = Core::System::GetInstance().GetFileSystemController(); 1788 const auto& fs_controller = system->GetFileSystemController();
1783 const auto dlc_entries = Core::System::GetInstance().GetContentProvider().ListEntriesFilter( 1789 const auto dlc_entries = system->GetContentProvider().ListEntriesFilter(
1784 FileSys::TitleType::AOC, FileSys::ContentRecordType::Data); 1790 FileSys::TitleType::AOC, FileSys::ContentRecordType::Data);
1785 1791
1786 for (const auto& entry : dlc_entries) { 1792 for (const auto& entry : dlc_entries) {
@@ -1918,8 +1924,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
1918 "cancelled the operation.")); 1924 "cancelled the operation."));
1919 }; 1925 };
1920 1926
1921 auto& system = Core::System::GetInstance(); 1927 const auto loader = Loader::GetLoader(*system, vfs->OpenFile(game_path, FileSys::Mode::Read));
1922 const auto loader = Loader::GetLoader(system, vfs->OpenFile(game_path, FileSys::Mode::Read));
1923 if (loader == nullptr) { 1928 if (loader == nullptr) {
1924 failed(); 1929 failed();
1925 return; 1930 return;
@@ -1931,7 +1936,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
1931 return; 1936 return;
1932 } 1937 }
1933 1938
1934 const auto& installed = system.GetContentProvider(); 1939 const auto& installed = system->GetContentProvider();
1935 const auto romfs_title_id = SelectRomFSDumpTarget(installed, program_id); 1940 const auto romfs_title_id = SelectRomFSDumpTarget(installed, program_id);
1936 1941
1937 if (!romfs_title_id) { 1942 if (!romfs_title_id) {
@@ -1951,7 +1956,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
1951 1956
1952 if (*romfs_title_id == program_id) { 1957 if (*romfs_title_id == program_id) {
1953 const u64 ivfc_offset = loader->ReadRomFSIVFCOffset(); 1958 const u64 ivfc_offset = loader->ReadRomFSIVFCOffset();
1954 const FileSys::PatchManager pm{program_id, system.GetFileSystemController(), installed}; 1959 const FileSys::PatchManager pm{program_id, system->GetFileSystemController(), installed};
1955 romfs = 1960 romfs =
1956 pm.PatchRomFS(file, ivfc_offset, FileSys::ContentRecordType::Program, nullptr, false); 1961 pm.PatchRomFS(file, ivfc_offset, FileSys::ContentRecordType::Program, nullptr, false);
1957 } else { 1962 } else {
@@ -2077,7 +2082,7 @@ void GMainWindow::OnGameListAddDirectory() {
2077} 2082}
2078 2083
2079void GMainWindow::OnGameListShowList(bool show) { 2084void GMainWindow::OnGameListShowList(bool show) {
2080 if (emulation_running && ui.action_Single_Window_Mode->isChecked()) 2085 if (emulation_running && ui->action_Single_Window_Mode->isChecked())
2081 return; 2086 return;
2082 game_list->setVisible(show); 2087 game_list->setVisible(show);
2083 game_list_placeholder->setVisible(!show); 2088 game_list_placeholder->setVisible(!show);
@@ -2086,7 +2091,7 @@ void GMainWindow::OnGameListShowList(bool show) {
2086void GMainWindow::OnGameListOpenPerGameProperties(const std::string& file) { 2091void GMainWindow::OnGameListOpenPerGameProperties(const std::string& file) {
2087 u64 title_id{}; 2092 u64 title_id{};
2088 const auto v_file = Core::GetGameFileFromPath(vfs, file); 2093 const auto v_file = Core::GetGameFileFromPath(vfs, file);
2089 const auto loader = Loader::GetLoader(Core::System::GetInstance(), v_file); 2094 const auto loader = Loader::GetLoader(*system, v_file);
2090 2095
2091 if (loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) { 2096 if (loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) {
2092 QMessageBox::information(this, tr("Properties"), 2097 QMessageBox::information(this, tr("Properties"),
@@ -2179,7 +2184,7 @@ void GMainWindow::OnMenuInstallToNAND() {
2179 QStringList failed_files{}; // Files that failed to install due to errors 2184 QStringList failed_files{}; // Files that failed to install due to errors
2180 bool detected_base_install{}; // Whether a base game was attempted to be installed 2185 bool detected_base_install{}; // Whether a base game was attempted to be installed
2181 2186
2182 ui.action_Install_File_NAND->setEnabled(false); 2187 ui->action_Install_File_NAND->setEnabled(false);
2183 2188
2184 install_progress = new QProgressDialog(QString{}, tr("Cancel"), 0, total_size, this); 2189 install_progress = new QProgressDialog(QString{}, tr("Cancel"), 0, total_size, this);
2185 install_progress->setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint & 2190 install_progress->setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint &
@@ -2255,7 +2260,7 @@ void GMainWindow::OnMenuInstallToNAND() {
2255 Common::FS::RemoveDirRecursively(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) / 2260 Common::FS::RemoveDirRecursively(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) /
2256 "game_list"); 2261 "game_list");
2257 game_list->PopulateAsync(UISettings::values.game_dirs); 2262 game_list->PopulateAsync(UISettings::values.game_dirs);
2258 ui.action_Install_File_NAND->setEnabled(true); 2263 ui->action_Install_File_NAND->setEnabled(true);
2259} 2264}
2260 2265
2261InstallResult GMainWindow::InstallNSPXCI(const QString& filename) { 2266InstallResult GMainWindow::InstallNSPXCI(const QString& filename) {
@@ -2300,9 +2305,8 @@ InstallResult GMainWindow::InstallNSPXCI(const QString& filename) {
2300 if (nsp->GetStatus() != Loader::ResultStatus::Success) { 2305 if (nsp->GetStatus() != Loader::ResultStatus::Success) {
2301 return InstallResult::Failure; 2306 return InstallResult::Failure;
2302 } 2307 }
2303 const auto res = 2308 const auto res = system->GetFileSystemController().GetUserNANDContents()->InstallEntry(
2304 Core::System::GetInstance().GetFileSystemController().GetUserNANDContents()->InstallEntry( 2309 *nsp, true, qt_raw_copy);
2305 *nsp, true, qt_raw_copy);
2306 switch (res) { 2310 switch (res) {
2307 case FileSys::InstallResult::Success: 2311 case FileSys::InstallResult::Success:
2308 return InstallResult::Success; 2312 return InstallResult::Success;
@@ -2380,19 +2384,13 @@ InstallResult GMainWindow::InstallNCA(const QString& filename) {
2380 static_cast<size_t>(FileSys::TitleType::FirmwarePackageB); 2384 static_cast<size_t>(FileSys::TitleType::FirmwarePackageB);
2381 } 2385 }
2382 2386
2383 FileSys::InstallResult res; 2387 const bool is_application = index >= static_cast<s32>(FileSys::TitleType::Application);
2384 if (index >= static_cast<s32>(FileSys::TitleType::Application)) { 2388 const auto& fs_controller = system->GetFileSystemController();
2385 res = Core::System::GetInstance() 2389 auto* registered_cache = is_application ? fs_controller.GetUserNANDContents()
2386 .GetFileSystemController() 2390 : fs_controller.GetSystemNANDContents();
2387 .GetUserNANDContents()
2388 ->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy);
2389 } else {
2390 res = Core::System::GetInstance()
2391 .GetFileSystemController()
2392 .GetSystemNANDContents()
2393 ->InstallEntry(*nca, static_cast<FileSys::TitleType>(index), true, qt_raw_copy);
2394 }
2395 2391
2392 const auto res = registered_cache->InstallEntry(*nca, static_cast<FileSys::TitleType>(index),
2393 true, qt_raw_copy);
2396 if (res == FileSys::InstallResult::Success) { 2394 if (res == FileSys::InstallResult::Success) {
2397 return InstallResult::Success; 2395 return InstallResult::Success;
2398 } else if (res == FileSys::InstallResult::OverwriteExisting) { 2396 } else if (res == FileSys::InstallResult::OverwriteExisting) {
@@ -2426,40 +2424,39 @@ void GMainWindow::OnStartGame() {
2426 2424
2427 connect(emu_thread.get(), &EmuThread::ErrorThrown, this, &GMainWindow::OnCoreError); 2425 connect(emu_thread.get(), &EmuThread::ErrorThrown, this, &GMainWindow::OnCoreError);
2428 2426
2429 ui.action_Start->setEnabled(false); 2427 ui->action_Start->setEnabled(false);
2430 ui.action_Start->setText(tr("&Continue")); 2428 ui->action_Start->setText(tr("&Continue"));
2431 2429
2432 ui.action_Pause->setEnabled(true); 2430 ui->action_Pause->setEnabled(true);
2433 ui.action_Stop->setEnabled(true); 2431 ui->action_Stop->setEnabled(true);
2434 ui.action_Restart->setEnabled(true); 2432 ui->action_Restart->setEnabled(true);
2435 ui.action_Configure_Current_Game->setEnabled(true); 2433 ui->action_Configure_Current_Game->setEnabled(true);
2436 ui.action_Report_Compatibility->setEnabled(true); 2434 ui->action_Report_Compatibility->setEnabled(true);
2437 2435
2438 discord_rpc->Update(); 2436 discord_rpc->Update();
2439 ui.action_Load_Amiibo->setEnabled(true); 2437 ui->action_Load_Amiibo->setEnabled(true);
2440 ui.action_Capture_Screenshot->setEnabled(true); 2438 ui->action_Capture_Screenshot->setEnabled(true);
2441} 2439}
2442 2440
2443void GMainWindow::OnPauseGame() { 2441void GMainWindow::OnPauseGame() {
2444 emu_thread->SetRunning(false); 2442 emu_thread->SetRunning(false);
2445 2443
2446 ui.action_Start->setEnabled(true); 2444 ui->action_Start->setEnabled(true);
2447 ui.action_Pause->setEnabled(false); 2445 ui->action_Pause->setEnabled(false);
2448 ui.action_Stop->setEnabled(true); 2446 ui->action_Stop->setEnabled(true);
2449 ui.action_Capture_Screenshot->setEnabled(false); 2447 ui->action_Capture_Screenshot->setEnabled(false);
2450 2448
2451 AllowOSSleep(); 2449 AllowOSSleep();
2452} 2450}
2453 2451
2454void GMainWindow::OnStopGame() { 2452void GMainWindow::OnStopGame() {
2455 auto& system{Core::System::GetInstance()}; 2453 if (system->GetExitLock() && !ConfirmForceLockedExit()) {
2456 if (system.GetExitLock() && !ConfirmForceLockedExit()) {
2457 return; 2454 return;
2458 } 2455 }
2459 2456
2460 ShutdownGame(); 2457 ShutdownGame();
2461 2458
2462 Settings::RestoreGlobalState(system.IsPoweredOn()); 2459 Settings::RestoreGlobalState(system->IsPoweredOn());
2463 UpdateStatusButtons(); 2460 UpdateStatusButtons();
2464} 2461}
2465 2462
@@ -2477,8 +2474,8 @@ void GMainWindow::OnExit() {
2477} 2474}
2478 2475
2479void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_text) { 2476void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_text) {
2480 OverlayDialog dialog(render_window, Core::System::GetInstance(), error_code, error_text, 2477 OverlayDialog dialog(render_window, *system, error_code, error_text, QString{}, tr("OK"),
2481 QString{}, tr("OK"), Qt::AlignLeft | Qt::AlignVCenter); 2478 Qt::AlignLeft | Qt::AlignVCenter);
2482 dialog.exec(); 2479 dialog.exec();
2483 2480
2484 emit ErrorDisplayFinished(); 2481 emit ErrorDisplayFinished();
@@ -2487,7 +2484,7 @@ void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_tex
2487void GMainWindow::OnMenuReportCompatibility() { 2484void GMainWindow::OnMenuReportCompatibility() {
2488 if (!Settings::values.yuzu_token.GetValue().empty() && 2485 if (!Settings::values.yuzu_token.GetValue().empty() &&
2489 !Settings::values.yuzu_username.GetValue().empty()) { 2486 !Settings::values.yuzu_username.GetValue().empty()) {
2490 CompatDB compatdb{this}; 2487 CompatDB compatdb{system->TelemetrySession(), this};
2491 compatdb.exec(); 2488 compatdb.exec();
2492 } else { 2489 } else {
2493 QMessageBox::critical( 2490 QMessageBox::critical(
@@ -2523,7 +2520,7 @@ void GMainWindow::ToggleFullscreen() {
2523 if (!emulation_running) { 2520 if (!emulation_running) {
2524 return; 2521 return;
2525 } 2522 }
2526 if (ui.action_Fullscreen->isChecked()) { 2523 if (ui->action_Fullscreen->isChecked()) {
2527 ShowFullscreen(); 2524 ShowFullscreen();
2528 } else { 2525 } else {
2529 HideFullscreen(); 2526 HideFullscreen();
@@ -2531,10 +2528,10 @@ void GMainWindow::ToggleFullscreen() {
2531} 2528}
2532 2529
2533void GMainWindow::ShowFullscreen() { 2530void GMainWindow::ShowFullscreen() {
2534 if (ui.action_Single_Window_Mode->isChecked()) { 2531 if (ui->action_Single_Window_Mode->isChecked()) {
2535 UISettings::values.geometry = saveGeometry(); 2532 UISettings::values.geometry = saveGeometry();
2536 2533
2537 ui.menubar->hide(); 2534 ui->menubar->hide();
2538 statusBar()->hide(); 2535 statusBar()->hide();
2539 2536
2540 if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { 2537 if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) {
@@ -2568,7 +2565,7 @@ void GMainWindow::ShowFullscreen() {
2568} 2565}
2569 2566
2570void GMainWindow::HideFullscreen() { 2567void GMainWindow::HideFullscreen() {
2571 if (ui.action_Single_Window_Mode->isChecked()) { 2568 if (ui->action_Single_Window_Mode->isChecked()) {
2572 if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { 2569 if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) {
2573 showNormal(); 2570 showNormal();
2574 restoreGeometry(UISettings::values.geometry); 2571 restoreGeometry(UISettings::values.geometry);
@@ -2580,8 +2577,8 @@ void GMainWindow::HideFullscreen() {
2580 show(); 2577 show();
2581 } 2578 }
2582 2579
2583 statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked()); 2580 statusBar()->setVisible(ui->action_Show_Status_Bar->isChecked());
2584 ui.menubar->show(); 2581 ui->menubar->show();
2585 } else { 2582 } else {
2586 if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) { 2583 if (Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive) {
2587 render_window->showNormal(); 2584 render_window->showNormal();
@@ -2597,10 +2594,10 @@ void GMainWindow::HideFullscreen() {
2597} 2594}
2598 2595
2599void GMainWindow::ToggleWindowMode() { 2596void GMainWindow::ToggleWindowMode() {
2600 if (ui.action_Single_Window_Mode->isChecked()) { 2597 if (ui->action_Single_Window_Mode->isChecked()) {
2601 // Render in the main window... 2598 // Render in the main window...
2602 render_window->BackupGeometry(); 2599 render_window->BackupGeometry();
2603 ui.horizontalLayout->addWidget(render_window); 2600 ui->horizontalLayout->addWidget(render_window);
2604 render_window->setFocusPolicy(Qt::StrongFocus); 2601 render_window->setFocusPolicy(Qt::StrongFocus);
2605 if (emulation_running) { 2602 if (emulation_running) {
2606 render_window->setVisible(true); 2603 render_window->setVisible(true);
@@ -2610,7 +2607,7 @@ void GMainWindow::ToggleWindowMode() {
2610 2607
2611 } else { 2608 } else {
2612 // Render in a separate window... 2609 // Render in a separate window...
2613 ui.horizontalLayout->removeWidget(render_window); 2610 ui->horizontalLayout->removeWidget(render_window);
2614 render_window->setParent(nullptr); 2611 render_window->setParent(nullptr);
2615 render_window->setFocusPolicy(Qt::NoFocus); 2612 render_window->setFocusPolicy(Qt::NoFocus);
2616 if (emulation_running) { 2613 if (emulation_running) {
@@ -2621,39 +2618,37 @@ void GMainWindow::ToggleWindowMode() {
2621 } 2618 }
2622} 2619}
2623 2620
2624void GMainWindow::ResetWindowSize720() { 2621void GMainWindow::ResetWindowSize(u32 width, u32 height) {
2625 const auto aspect_ratio = Layout::EmulationAspectRatio( 2622 const auto aspect_ratio = Layout::EmulationAspectRatio(
2626 static_cast<Layout::AspectRatio>(Settings::values.aspect_ratio.GetValue()), 2623 static_cast<Layout::AspectRatio>(Settings::values.aspect_ratio.GetValue()),
2627 static_cast<float>(Layout::ScreenUndocked::Height) / Layout::ScreenUndocked::Width); 2624 static_cast<float>(height) / width);
2628 if (!ui.action_Single_Window_Mode->isChecked()) { 2625 if (!ui->action_Single_Window_Mode->isChecked()) {
2629 render_window->resize(Layout::ScreenUndocked::Height / aspect_ratio, 2626 render_window->resize(height / aspect_ratio, height);
2630 Layout::ScreenUndocked::Height);
2631 } else { 2627 } else {
2632 resize(Layout::ScreenUndocked::Height / aspect_ratio, 2628 const bool show_status_bar = ui->action_Show_Status_Bar->isChecked();
2633 Layout::ScreenUndocked::Height + menuBar()->height() + 2629 const auto status_bar_height = show_status_bar ? statusBar()->height() : 0;
2634 (ui.action_Show_Status_Bar->isChecked() ? statusBar()->height() : 0)); 2630 resize(height / aspect_ratio, height + menuBar()->height() + status_bar_height);
2635 } 2631 }
2636} 2632}
2637 2633
2634void GMainWindow::ResetWindowSize720() {
2635 ResetWindowSize(Layout::ScreenUndocked::Width, Layout::ScreenUndocked::Height);
2636}
2637
2638void GMainWindow::ResetWindowSize900() {
2639 ResetWindowSize(1600U, 900U);
2640}
2641
2638void GMainWindow::ResetWindowSize1080() { 2642void GMainWindow::ResetWindowSize1080() {
2639 const auto aspect_ratio = Layout::EmulationAspectRatio( 2643 ResetWindowSize(Layout::ScreenDocked::Width, Layout::ScreenDocked::Height);
2640 static_cast<Layout::AspectRatio>(Settings::values.aspect_ratio.GetValue()),
2641 static_cast<float>(Layout::ScreenDocked::Height) / Layout::ScreenDocked::Width);
2642 if (!ui.action_Single_Window_Mode->isChecked()) {
2643 render_window->resize(Layout::ScreenDocked::Height / aspect_ratio,
2644 Layout::ScreenDocked::Height);
2645 } else {
2646 resize(Layout::ScreenDocked::Height / aspect_ratio,
2647 Layout::ScreenDocked::Height + menuBar()->height() +
2648 (ui.action_Show_Status_Bar->isChecked() ? statusBar()->height() : 0));
2649 }
2650} 2644}
2651 2645
2652void GMainWindow::OnConfigure() { 2646void GMainWindow::OnConfigure() {
2653 const auto old_theme = UISettings::values.theme; 2647 const auto old_theme = UISettings::values.theme;
2654 const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue(); 2648 const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue();
2655 2649
2656 ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get()); 2650 Settings::SetConfiguringGlobal(true);
2651 ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(), *system);
2657 connect(&configure_dialog, &ConfigureDialog::LanguageChanged, this, 2652 connect(&configure_dialog, &ConfigureDialog::LanguageChanged, this,
2658 &GMainWindow::OnLanguageChanged); 2653 &GMainWindow::OnLanguageChanged);
2659 2654
@@ -2689,7 +2684,7 @@ void GMainWindow::OnConfigure() {
2689 2684
2690 Settings::values.disabled_addons.clear(); 2685 Settings::values.disabled_addons.clear();
2691 2686
2692 config = std::make_unique<Config>(); 2687 config = std::make_unique<Config>(*system);
2693 UISettings::values.reset_to_defaults = false; 2688 UISettings::values.reset_to_defaults = false;
2694 2689
2695 UISettings::values.game_dirs = std::move(old_game_dirs); 2690 UISettings::values.game_dirs = std::move(old_game_dirs);
@@ -2738,12 +2733,11 @@ void GMainWindow::OnConfigure() {
2738} 2733}
2739 2734
2740void GMainWindow::OnConfigureTas() { 2735void GMainWindow::OnConfigureTas() {
2741 const auto& system = Core::System::GetInstance();
2742 ConfigureTasDialog dialog(this); 2736 ConfigureTasDialog dialog(this);
2743 const auto result = dialog.exec(); 2737 const auto result = dialog.exec();
2744 2738
2745 if (result != QDialog::Accepted && !UISettings::values.configuration_applied) { 2739 if (result != QDialog::Accepted && !UISettings::values.configuration_applied) {
2746 Settings::RestoreGlobalState(system.IsPoweredOn()); 2740 Settings::RestoreGlobalState(system->IsPoweredOn());
2747 return; 2741 return;
2748 } else if (result == QDialog::Accepted) { 2742 } else if (result == QDialog::Accepted) {
2749 dialog.ApplyConfiguration(); 2743 dialog.ApplyConfiguration();
@@ -2751,20 +2745,20 @@ void GMainWindow::OnConfigureTas() {
2751} 2745}
2752 2746
2753void GMainWindow::OnConfigurePerGame() { 2747void GMainWindow::OnConfigurePerGame() {
2754 const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); 2748 const u64 title_id = system->CurrentProcess()->GetTitleID();
2755 OpenPerGameConfiguration(title_id, game_path.toStdString()); 2749 OpenPerGameConfiguration(title_id, game_path.toStdString());
2756} 2750}
2757 2751
2758void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file_name) { 2752void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file_name) {
2759 const auto v_file = Core::GetGameFileFromPath(vfs, file_name); 2753 const auto v_file = Core::GetGameFileFromPath(vfs, file_name);
2760 const auto& system = Core::System::GetInstance();
2761 2754
2762 ConfigurePerGame dialog(this, title_id, file_name); 2755 Settings::SetConfiguringGlobal(false);
2756 ConfigurePerGame dialog(this, title_id, file_name, *system);
2763 dialog.LoadFromFile(v_file); 2757 dialog.LoadFromFile(v_file);
2764 const auto result = dialog.exec(); 2758 const auto result = dialog.exec();
2765 2759
2766 if (result != QDialog::Accepted && !UISettings::values.configuration_applied) { 2760 if (result != QDialog::Accepted && !UISettings::values.configuration_applied) {
2767 Settings::RestoreGlobalState(system.IsPoweredOn()); 2761 Settings::RestoreGlobalState(system->IsPoweredOn());
2768 return; 2762 return;
2769 } else if (result == QDialog::Accepted) { 2763 } else if (result == QDialog::Accepted) {
2770 dialog.ApplyConfiguration(); 2764 dialog.ApplyConfiguration();
@@ -2776,7 +2770,7 @@ void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file
2776 } 2770 }
2777 2771
2778 // Do not cause the global config to write local settings into the config file 2772 // Do not cause the global config to write local settings into the config file
2779 const bool is_powered_on = system.IsPoweredOn(); 2773 const bool is_powered_on = system->IsPoweredOn();
2780 Settings::RestoreGlobalState(is_powered_on); 2774 Settings::RestoreGlobalState(is_powered_on);
2781 2775
2782 UISettings::values.configuration_applied = false; 2776 UISettings::values.configuration_applied = false;
@@ -2799,8 +2793,7 @@ void GMainWindow::OnLoadAmiibo() {
2799} 2793}
2800 2794
2801void GMainWindow::LoadAmiibo(const QString& filename) { 2795void GMainWindow::LoadAmiibo(const QString& filename) {
2802 Core::System& system{Core::System::GetInstance()}; 2796 Service::SM::ServiceManager& sm = system->ServiceManager();
2803 Service::SM::ServiceManager& sm = system.ServiceManager();
2804 auto nfc = sm.GetService<Service::NFP::Module::Interface>("nfp:user"); 2797 auto nfc = sm.GetService<Service::NFP::Module::Interface>("nfp:user");
2805 if (nfc == nullptr) { 2798 if (nfc == nullptr) {
2806 return; 2799 return;
@@ -2842,8 +2835,8 @@ void GMainWindow::OnAbout() {
2842} 2835}
2843 2836
2844void GMainWindow::OnToggleFilterBar() { 2837void GMainWindow::OnToggleFilterBar() {
2845 game_list->SetFilterVisible(ui.action_Show_Filter_Bar->isChecked()); 2838 game_list->SetFilterVisible(ui->action_Show_Filter_Bar->isChecked());
2846 if (ui.action_Show_Filter_Bar->isChecked()) { 2839 if (ui->action_Show_Filter_Bar->isChecked()) {
2847 game_list->SetFilterFocus(); 2840 game_list->SetFilterFocus();
2848 } else { 2841 } else {
2849 game_list->ClearFilter(); 2842 game_list->ClearFilter();
@@ -2851,7 +2844,7 @@ void GMainWindow::OnToggleFilterBar() {
2851} 2844}
2852 2845
2853void GMainWindow::OnCaptureScreenshot() { 2846void GMainWindow::OnCaptureScreenshot() {
2854 const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); 2847 const u64 title_id = system->CurrentProcess()->GetTitleID();
2855 const auto screenshot_path = 2848 const auto screenshot_path =
2856 QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir)); 2849 QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir));
2857 const auto date = 2850 const auto date =
@@ -2957,9 +2950,8 @@ void GMainWindow::UpdateStatusBar() {
2957 tas_label->clear(); 2950 tas_label->clear();
2958 } 2951 }
2959 2952
2960 auto& system = Core::System::GetInstance(); 2953 auto results = system->GetAndResetPerfStats();
2961 auto results = system.GetAndResetPerfStats(); 2954 auto& shader_notify = system->GPU().ShaderNotify();
2962 auto& shader_notify = system.GPU().ShaderNotify();
2963 const int shaders_building = shader_notify.ShadersBuilding(); 2955 const int shaders_building = shader_notify.ShadersBuilding();
2964 2956
2965 if (shaders_building > 0) { 2957 if (shaders_building > 0) {
@@ -3021,7 +3013,7 @@ void GMainWindow::UpdateStatusButtons() {
3021} 3013}
3022 3014
3023void GMainWindow::UpdateUISettings() { 3015void GMainWindow::UpdateUISettings() {
3024 if (!ui.action_Fullscreen->isChecked()) { 3016 if (!ui->action_Fullscreen->isChecked()) {
3025 UISettings::values.geometry = saveGeometry(); 3017 UISettings::values.geometry = saveGeometry();
3026 UISettings::values.renderwindow_geometry = render_window->saveGeometry(); 3018 UISettings::values.renderwindow_geometry = render_window->saveGeometry();
3027 } 3019 }
@@ -3030,11 +3022,11 @@ void GMainWindow::UpdateUISettings() {
3030 UISettings::values.microprofile_geometry = microProfileDialog->saveGeometry(); 3022 UISettings::values.microprofile_geometry = microProfileDialog->saveGeometry();
3031 UISettings::values.microprofile_visible = microProfileDialog->isVisible(); 3023 UISettings::values.microprofile_visible = microProfileDialog->isVisible();
3032#endif 3024#endif
3033 UISettings::values.single_window_mode = ui.action_Single_Window_Mode->isChecked(); 3025 UISettings::values.single_window_mode = ui->action_Single_Window_Mode->isChecked();
3034 UISettings::values.fullscreen = ui.action_Fullscreen->isChecked(); 3026 UISettings::values.fullscreen = ui->action_Fullscreen->isChecked();
3035 UISettings::values.display_titlebar = ui.action_Display_Dock_Widget_Headers->isChecked(); 3027 UISettings::values.display_titlebar = ui->action_Display_Dock_Widget_Headers->isChecked();
3036 UISettings::values.show_filter_bar = ui.action_Show_Filter_Bar->isChecked(); 3028 UISettings::values.show_filter_bar = ui->action_Show_Filter_Bar->isChecked();
3037 UISettings::values.show_status_bar = ui.action_Show_Status_Bar->isChecked(); 3029 UISettings::values.show_status_bar = ui->action_Show_Status_Bar->isChecked();
3038 UISettings::values.first_start = false; 3030 UISettings::values.first_start = false;
3039} 3031}
3040 3032
@@ -3060,7 +3052,7 @@ void GMainWindow::OnMouseActivity() {
3060 } 3052 }
3061} 3053}
3062 3054
3063void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string details) { 3055void GMainWindow::OnCoreError(Core::SystemResultStatus result, std::string details) {
3064 QMessageBox::StandardButton answer; 3056 QMessageBox::StandardButton answer;
3065 QString status_message; 3057 QString status_message;
3066 const QString common_message = 3058 const QString common_message =
@@ -3075,7 +3067,7 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
3075 "back to the game list? Continuing emulation may result in crashes, corrupted save " 3067 "back to the game list? Continuing emulation may result in crashes, corrupted save "
3076 "data, or other bugs."); 3068 "data, or other bugs.");
3077 switch (result) { 3069 switch (result) {
3078 case Core::System::ResultStatus::ErrorSystemFiles: { 3070 case Core::SystemResultStatus::ErrorSystemFiles: {
3079 QString message; 3071 QString message;
3080 if (details.empty()) { 3072 if (details.empty()) {
3081 message = 3073 message =
@@ -3091,7 +3083,7 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
3091 break; 3083 break;
3092 } 3084 }
3093 3085
3094 case Core::System::ResultStatus::ErrorSharedFont: { 3086 case Core::SystemResultStatus::ErrorSharedFont: {
3095 const QString message = 3087 const QString message =
3096 tr("yuzu was unable to locate the Switch shared fonts. %1").arg(common_message); 3088 tr("yuzu was unable to locate the Switch shared fonts. %1").arg(common_message);
3097 answer = QMessageBox::question(this, tr("Shared Fonts Not Found"), message, 3089 answer = QMessageBox::question(this, tr("Shared Fonts Not Found"), message,
@@ -3120,7 +3112,7 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det
3120 if (emu_thread) { 3112 if (emu_thread) {
3121 ShutdownGame(); 3113 ShutdownGame();
3122 3114
3123 Settings::RestoreGlobalState(Core::System::GetInstance().IsPoweredOn()); 3115 Settings::RestoreGlobalState(system->IsPoweredOn());
3124 UpdateStatusButtons(); 3116 UpdateStatusButtons();
3125 } 3117 }
3126 } else { 3118 } else {
@@ -3162,9 +3154,8 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
3162 const auto function = [this, &keys, &pdm] { 3154 const auto function = [this, &keys, &pdm] {
3163 keys.PopulateFromPartitionData(pdm); 3155 keys.PopulateFromPartitionData(pdm);
3164 3156
3165 auto& system = Core::System::GetInstance(); 3157 system->GetFileSystemController().CreateFactories(*vfs);
3166 system.GetFileSystemController().CreateFactories(*vfs); 3158 keys.DeriveETicket(pdm, system->GetContentProvider());
3167 keys.DeriveETicket(pdm, system.GetContentProvider());
3168 }; 3159 };
3169 3160
3170 QString errors; 3161 QString errors;
@@ -3206,7 +3197,7 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
3206 prog.close(); 3197 prog.close();
3207 } 3198 }
3208 3199
3209 Core::System::GetInstance().GetFileSystemController().CreateFactories(*vfs); 3200 system->GetFileSystemController().CreateFactories(*vfs);
3210 3201
3211 if (behavior == ReinitializeKeyBehavior::Warning) { 3202 if (behavior == ReinitializeKeyBehavior::Warning) {
3212 game_list->PopulateAsync(UISettings::values.game_dirs); 3203 game_list->PopulateAsync(UISettings::values.game_dirs);
@@ -3274,7 +3265,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
3274 if (emu_thread != nullptr) { 3265 if (emu_thread != nullptr) {
3275 ShutdownGame(); 3266 ShutdownGame();
3276 3267
3277 Settings::RestoreGlobalState(Core::System::GetInstance().IsPoweredOn()); 3268 Settings::RestoreGlobalState(system->IsPoweredOn());
3278 UpdateStatusButtons(); 3269 UpdateStatusButtons();
3279 } 3270 }
3280 3271
@@ -3349,7 +3340,7 @@ bool GMainWindow::ConfirmForceLockedExit() {
3349} 3340}
3350 3341
3351void GMainWindow::RequestGameExit() { 3342void GMainWindow::RequestGameExit() {
3352 auto& sm{Core::System::GetInstance().ServiceManager()}; 3343 auto& sm{system->ServiceManager()};
3353 auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE"); 3344 auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE");
3354 auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE"); 3345 auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE");
3355 bool has_signalled = false; 3346 bool has_signalled = false;
@@ -3365,7 +3356,7 @@ void GMainWindow::RequestGameExit() {
3365} 3356}
3366 3357
3367void GMainWindow::filterBarSetChecked(bool state) { 3358void GMainWindow::filterBarSetChecked(bool state) {
3368 ui.action_Show_Filter_Bar->setChecked(state); 3359 ui->action_Show_Filter_Bar->setChecked(state);
3369 emit(OnToggleFilterBar()); 3360 emit(OnToggleFilterBar());
3370} 3361}
3371 3362
@@ -3433,17 +3424,17 @@ void GMainWindow::OnLanguageChanged(const QString& locale) {
3433 3424
3434 UISettings::values.language = locale; 3425 UISettings::values.language = locale;
3435 LoadTranslation(); 3426 LoadTranslation();
3436 ui.retranslateUi(this); 3427 ui->retranslateUi(this);
3437 UpdateWindowTitle(); 3428 UpdateWindowTitle();
3438 3429
3439 if (emulation_running) 3430 if (emulation_running)
3440 ui.action_Start->setText(tr("&Continue")); 3431 ui->action_Start->setText(tr("&Continue"));
3441} 3432}
3442 3433
3443void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) { 3434void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) {
3444#ifdef USE_DISCORD_PRESENCE 3435#ifdef USE_DISCORD_PRESENCE
3445 if (state) { 3436 if (state) {
3446 discord_rpc = std::make_unique<DiscordRPC::DiscordImpl>(); 3437 discord_rpc = std::make_unique<DiscordRPC::DiscordImpl>(*system);
3447 } else { 3438 } else {
3448 discord_rpc = std::make_unique<DiscordRPC::NullImpl>(); 3439 discord_rpc = std::make_unique<DiscordRPC::NullImpl>();
3449 } 3440 }
@@ -3497,8 +3488,7 @@ int main(int argc, char* argv[]) {
3497 // generating shaders 3488 // generating shaders
3498 setlocale(LC_ALL, "C"); 3489 setlocale(LC_ALL, "C");
3499 3490
3500 Core::System::InitializeGlobalInstance(); 3491 GMainWindow main_window{};
3501 GMainWindow main_window;
3502 // After settings have been loaded by GMainWindow, apply the filter 3492 // After settings have been loaded by GMainWindow, apply the filter
3503 main_window.show(); 3493 main_window.show();
3504 3494
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 60ce01471..aed15a0a0 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -13,9 +13,7 @@
13#include <QTranslator> 13#include <QTranslator>
14 14
15#include "common/common_types.h" 15#include "common/common_types.h"
16#include "core/core.h"
17#include "core/hle/service/acc/profile_manager.h" 16#include "core/hle/service/acc/profile_manager.h"
18#include "ui_main.h"
19#include "yuzu/compatibility_list.h" 17#include "yuzu/compatibility_list.h"
20#include "yuzu/hotkeys.h" 18#include "yuzu/hotkeys.h"
21 19
@@ -45,6 +43,11 @@ enum class StartGameType {
45 Global, // Only uses global configuration 43 Global, // Only uses global configuration
46}; 44};
47 45
46namespace Core {
47enum class SystemResultStatus : u32;
48class System;
49} // namespace Core
50
48namespace Core::Frontend { 51namespace Core::Frontend {
49struct ControllerParameters; 52struct ControllerParameters;
50struct InlineAppearParameters; 53struct InlineAppearParameters;
@@ -73,6 +76,10 @@ enum class SwkbdReplyType : u32;
73enum class WebExitReason : u32; 76enum class WebExitReason : u32;
74} // namespace Service::AM::Applets 77} // namespace Service::AM::Applets
75 78
79namespace Ui {
80class MainWindow;
81}
82
76enum class EmulatedDirectoryTarget { 83enum class EmulatedDirectoryTarget {
77 NAND, 84 NAND,
78 SDMC, 85 SDMC,
@@ -107,7 +114,7 @@ class GMainWindow : public QMainWindow {
107public: 114public:
108 void filterBarSetChecked(bool state); 115 void filterBarSetChecked(bool state);
109 void UpdateUITheme(); 116 void UpdateUITheme();
110 GMainWindow(); 117 explicit GMainWindow();
111 ~GMainWindow() override; 118 ~GMainWindow() override;
112 119
113 bool DropAction(QDropEvent* event); 120 bool DropAction(QDropEvent* event);
@@ -272,10 +279,12 @@ private slots:
272 void ShowFullscreen(); 279 void ShowFullscreen();
273 void HideFullscreen(); 280 void HideFullscreen();
274 void ToggleWindowMode(); 281 void ToggleWindowMode();
282 void ResetWindowSize(u32 width, u32 height);
275 void ResetWindowSize720(); 283 void ResetWindowSize720();
284 void ResetWindowSize900();
276 void ResetWindowSize1080(); 285 void ResetWindowSize1080();
277 void OnCaptureScreenshot(); 286 void OnCaptureScreenshot();
278 void OnCoreError(Core::System::ResultStatus, std::string); 287 void OnCoreError(Core::SystemResultStatus, std::string);
279 void OnReinitializeKeys(ReinitializeKeyBehavior behavior); 288 void OnReinitializeKeys(ReinitializeKeyBehavior behavior);
280 void OnLanguageChanged(const QString& locale); 289 void OnLanguageChanged(const QString& locale);
281 void OnMouseActivity(); 290 void OnMouseActivity();
@@ -304,8 +313,9 @@ private:
304 void OpenPerGameConfiguration(u64 title_id, const std::string& file_name); 313 void OpenPerGameConfiguration(u64 title_id, const std::string& file_name);
305 QString GetTasStateDescription() const; 314 QString GetTasStateDescription() const;
306 315
307 Ui::MainWindow ui; 316 std::unique_ptr<Ui::MainWindow> ui;
308 317
318 std::unique_ptr<Core::System> system;
309 std::unique_ptr<DiscordRPC::DiscordInterface> discord_rpc; 319 std::unique_ptr<DiscordRPC::DiscordInterface> discord_rpc;
310 std::shared_ptr<InputCommon::InputSubsystem> input_subsystem; 320 std::shared_ptr<InputCommon::InputSubsystem> input_subsystem;
311 321
diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui
index 653c010d8..a62e39a06 100644
--- a/src/yuzu/main.ui
+++ b/src/yuzu/main.ui
@@ -78,6 +78,35 @@
78 <property name="title"> 78 <property name="title">
79 <string>&amp;View</string> 79 <string>&amp;View</string>
80 </property> 80 </property>
81 <widget class="QMenu" name="menu_Reset_Window_Size">
82 <property name="title">
83 <string>&amp;Reset Window Size</string>
84 </property>
85 </widget>
86 <action name="action_Reset_Window_Size_720">
87 <property name="text">
88 <string>Reset Window Size to &amp;720p</string>
89 </property>
90 <property name="iconText">
91 <string>Reset Window Size to 720p</string>
92 </property>
93 </action>
94 <action name="action_Reset_Window_Size_900">
95 <property name="text">
96 <string>Reset Window Size to &amp;900p</string>
97 </property>
98 <property name="iconText">
99 <string>Reset Window Size to 900p</string>
100 </property>
101 </action>
102 <action name="action_Reset_Window_Size_1080">
103 <property name="text">
104 <string>Reset Window Size to &amp;1080p</string>
105 </property>
106 <property name="iconText">
107 <string>Reset Window Size to 1080p</string>
108 </property>
109 </action>
81 <widget class="QMenu" name="menu_View_Debugging"> 110 <widget class="QMenu" name="menu_View_Debugging">
82 <property name="title"> 111 <property name="title">
83 <string>&amp;Debugging</string> 112 <string>&amp;Debugging</string>
@@ -88,9 +117,8 @@
88 <addaction name="action_Display_Dock_Widget_Headers"/> 117 <addaction name="action_Display_Dock_Widget_Headers"/>
89 <addaction name="action_Show_Filter_Bar"/> 118 <addaction name="action_Show_Filter_Bar"/>
90 <addaction name="action_Show_Status_Bar"/> 119 <addaction name="action_Show_Status_Bar"/>
91 <addaction name="action_Reset_Window_Size_720"/>
92 <addaction name="action_Reset_Window_Size_1080"/>
93 <addaction name="separator"/> 120 <addaction name="separator"/>
121 <addaction name="menu_Reset_Window_Size"/>
94 <addaction name="menu_View_Debugging"/> 122 <addaction name="menu_View_Debugging"/>
95 </widget> 123 </widget>
96 <widget class="QMenu" name="menu_Tools"> 124 <widget class="QMenu" name="menu_Tools">
@@ -216,22 +244,6 @@
216 <string>Show Status Bar</string> 244 <string>Show Status Bar</string>
217 </property> 245 </property>
218 </action> 246 </action>
219 <action name="action_Reset_Window_Size_720">
220 <property name="text">
221 <string>Reset Window Size to &amp;720p</string>
222 </property>
223 <property name="iconText">
224 <string>Reset Window Size to 720p</string>
225 </property>
226 </action>
227 <action name="action_Reset_Window_Size_1080">
228 <property name="text">
229 <string>Reset Window Size to &amp;1080p</string>
230 </property>
231 <property name="iconText">
232 <string>Reset Window Size to 1080p</string>
233 </property>
234 </action>
235 <action name="action_Fullscreen"> 247 <action name="action_Fullscreen">
236 <property name="checkable"> 248 <property name="checkable">
237 <bool>true</bool> 249 <bool>true</bool>
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h
index 81f741f20..cac19452f 100644
--- a/src/yuzu/uisettings.h
+++ b/src/yuzu/uisettings.h
@@ -60,7 +60,7 @@ struct Values {
60 Settings::BasicSetting<bool> confirm_before_closing{true, "confirmClose"}; 60 Settings::BasicSetting<bool> confirm_before_closing{true, "confirmClose"};
61 Settings::BasicSetting<bool> first_start{true, "firstStart"}; 61 Settings::BasicSetting<bool> first_start{true, "firstStart"};
62 Settings::BasicSetting<bool> pause_when_in_background{false, "pauseWhenInBackground"}; 62 Settings::BasicSetting<bool> pause_when_in_background{false, "pauseWhenInBackground"};
63 Settings::BasicSetting<bool> hide_mouse{false, "hideInactiveMouse"}; 63 Settings::BasicSetting<bool> hide_mouse{true, "hideInactiveMouse"};
64 64
65 Settings::BasicSetting<bool> select_user_on_boot{false, "select_user_on_boot"}; 65 Settings::BasicSetting<bool> select_user_on_boot{false, "select_user_on_boot"};
66 66
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp
index 434518d53..8ca20679a 100644
--- a/src/yuzu_cmd/config.cpp
+++ b/src/yuzu_cmd/config.cpp
@@ -518,6 +518,9 @@ void Config::ReadValues() {
518 ReadSetting("WebService", Settings::values.web_api_url); 518 ReadSetting("WebService", Settings::values.web_api_url);
519 ReadSetting("WebService", Settings::values.yuzu_username); 519 ReadSetting("WebService", Settings::values.yuzu_username);
520 ReadSetting("WebService", Settings::values.yuzu_token); 520 ReadSetting("WebService", Settings::values.yuzu_token);
521
522 // Network
523 ReadSetting("Network", Settings::values.network_interface);
521} 524}
522 525
523void Config::Reload() { 526void Config::Reload() {
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h
index 8119a50d8..339dca766 100644
--- a/src/yuzu_cmd/default_ini.h
+++ b/src/yuzu_cmd/default_ini.h
@@ -428,6 +428,12 @@ web_api_url = https://api.yuzu-emu.org
428yuzu_username = 428yuzu_username =
429yuzu_token = 429yuzu_token =
430 430
431[Network]
432# Name of the network interface device to use with yuzu LAN play.
433# e.g. On *nix: 'enp7s0', 'wlp6s0u1u3u3', 'lo'
434# e.g. On Windows: 'Ethernet', 'Wi-Fi'
435network_interface =
436
431[AddOns] 437[AddOns]
432# Used to disable add-ons 438# Used to disable add-ons
433# List of title IDs of games that will have add-ons disabled (separated by '|'): 439# List of title IDs of games that will have add-ons disabled (separated by '|'):
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp
index ba2c993ba..67587cc54 100644
--- a/src/yuzu_cmd/yuzu.cpp
+++ b/src/yuzu_cmd/yuzu.cpp
@@ -146,9 +146,8 @@ int main(int argc, char** argv) {
146 return -1; 146 return -1;
147 } 147 }
148 148
149 Core::System::InitializeGlobalInstance(); 149 Core::System system{};
150 auto& system{Core::System::GetInstance()}; 150 InputCommon::InputSubsystem input_subsystem{};
151 InputCommon::InputSubsystem input_subsystem;
152 151
153 // Apply the command line arguments 152 // Apply the command line arguments
154 system.ApplySettings(); 153 system.ApplySettings();
@@ -167,27 +166,27 @@ int main(int argc, char** argv) {
167 system.SetFilesystem(std::make_shared<FileSys::RealVfsFilesystem>()); 166 system.SetFilesystem(std::make_shared<FileSys::RealVfsFilesystem>());
168 system.GetFileSystemController().CreateFactories(*system.GetFilesystem()); 167 system.GetFileSystemController().CreateFactories(*system.GetFilesystem());
169 168
170 const Core::System::ResultStatus load_result{system.Load(*emu_window, filepath)}; 169 const Core::SystemResultStatus load_result{system.Load(*emu_window, filepath)};
171 170
172 switch (load_result) { 171 switch (load_result) {
173 case Core::System::ResultStatus::ErrorGetLoader: 172 case Core::SystemResultStatus::ErrorGetLoader:
174 LOG_CRITICAL(Frontend, "Failed to obtain loader for {}!", filepath); 173 LOG_CRITICAL(Frontend, "Failed to obtain loader for {}!", filepath);
175 return -1; 174 return -1;
176 case Core::System::ResultStatus::ErrorLoader: 175 case Core::SystemResultStatus::ErrorLoader:
177 LOG_CRITICAL(Frontend, "Failed to load ROM!"); 176 LOG_CRITICAL(Frontend, "Failed to load ROM!");
178 return -1; 177 return -1;
179 case Core::System::ResultStatus::ErrorNotInitialized: 178 case Core::SystemResultStatus::ErrorNotInitialized:
180 LOG_CRITICAL(Frontend, "CPUCore not initialized"); 179 LOG_CRITICAL(Frontend, "CPUCore not initialized");
181 return -1; 180 return -1;
182 case Core::System::ResultStatus::ErrorVideoCore: 181 case Core::SystemResultStatus::ErrorVideoCore:
183 LOG_CRITICAL(Frontend, "Failed to initialize VideoCore!"); 182 LOG_CRITICAL(Frontend, "Failed to initialize VideoCore!");
184 return -1; 183 return -1;
185 case Core::System::ResultStatus::Success: 184 case Core::SystemResultStatus::Success:
186 break; // Expected case 185 break; // Expected case
187 default: 186 default:
188 if (static_cast<u32>(load_result) > 187 if (static_cast<u32>(load_result) >
189 static_cast<u32>(Core::System::ResultStatus::ErrorLoader)) { 188 static_cast<u32>(Core::SystemResultStatus::ErrorLoader)) {
190 const u16 loader_id = static_cast<u16>(Core::System::ResultStatus::ErrorLoader); 189 const u16 loader_id = static_cast<u16>(Core::SystemResultStatus::ErrorLoader);
191 const u16 error_id = static_cast<u16>(load_result) - loader_id; 190 const u16 error_id = static_cast<u16>(load_result) - loader_id;
192 LOG_CRITICAL(Frontend, 191 LOG_CRITICAL(Frontend,
193 "While attempting to load the ROM requested, an error occurred. Please " 192 "While attempting to load the ROM requested, an error occurred. Please "