diff options
| author | 2021-10-14 14:32:19 -0400 | |
|---|---|---|
| committer | 2021-10-15 17:35:33 -0400 | |
| commit | f0dc07dbac1fdddf75239ddbdaf643cd3a57f205 (patch) | |
| tree | cdae19c680367e339423f4d981e31770137c7c65 | |
| parent | core: Move ResultStatus outside of System (diff) | |
| download | yuzu-f0dc07dbac1fdddf75239ddbdaf643cd3a57f205.tar.gz yuzu-f0dc07dbac1fdddf75239ddbdaf643cd3a57f205.tar.xz yuzu-f0dc07dbac1fdddf75239ddbdaf643cd3a57f205.zip | |
yuzu: Construct system in GMainWindow
| -rw-r--r-- | src/yuzu/main.cpp | 153 | ||||
| -rw-r--r-- | src/yuzu/main.h | 11 |
2 files changed, 83 insertions, 81 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index a381eed34..3155a5c19 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -172,7 +172,7 @@ void GMainWindow::ShowTelemetryCallout() { | |||
| 172 | "<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?"); |
| 173 | if (QMessageBox::question(this, tr("Telemetry"), telemetry_message) != QMessageBox::Yes) { | 173 | if (QMessageBox::question(this, tr("Telemetry"), telemetry_message) != QMessageBox::Yes) { |
| 174 | Settings::values.enable_telemetry = false; | 174 | Settings::values.enable_telemetry = false; |
| 175 | system.ApplySettings(); | 175 | system->ApplySettings(); |
| 176 | } | 176 | } |
| 177 | } | 177 | } |
| 178 | 178 | ||
| @@ -191,9 +191,10 @@ static void RemoveCachedContents() { | |||
| 191 | Common::FS::RemoveDirRecursively(offline_system_data); | 191 | Common::FS::RemoveDirRecursively(offline_system_data); |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | GMainWindow::GMainWindow(Core::System& system_) | 194 | GMainWindow::GMainWindow() |
| 195 | : input_subsystem{std::make_shared<InputCommon::InputSubsystem>()}, system{system_}, | 195 | : system{std::make_unique<Core::System>()}, |
| 196 | config{std::make_unique<Config>(system_)}, | 196 | input_subsystem{std::make_shared<InputCommon::InputSubsystem>()}, |
| 197 | config{std::make_unique<Config>(*system)}, | ||
| 197 | vfs{std::make_shared<FileSys::RealVfsFilesystem>()}, | 198 | vfs{std::make_shared<FileSys::RealVfsFilesystem>()}, |
| 198 | provider{std::make_unique<FileSys::ManualContentProvider>()} { | 199 | provider{std::make_unique<FileSys::ManualContentProvider>()} { |
| 199 | Common::Log::Initialize(); | 200 | Common::Log::Initialize(); |
| @@ -257,10 +258,10 @@ GMainWindow::GMainWindow(Core::System& system_) | |||
| 257 | 258 | ||
| 258 | show(); | 259 | show(); |
| 259 | 260 | ||
| 260 | system.SetContentProvider(std::make_unique<FileSys::ContentProviderUnion>()); | 261 | system->SetContentProvider(std::make_unique<FileSys::ContentProviderUnion>()); |
| 261 | system.RegisterContentProvider(FileSys::ContentProviderUnionSlot::FrontendManual, | 262 | system->RegisterContentProvider(FileSys::ContentProviderUnionSlot::FrontendManual, |
| 262 | provider.get()); | 263 | provider.get()); |
| 263 | system.GetFileSystemController().CreateFactories(*vfs); | 264 | system->GetFileSystemController().CreateFactories(*vfs); |
| 264 | 265 | ||
| 265 | // Remove cached contents generated during the previous session | 266 | // Remove cached contents generated during the previous session |
| 266 | RemoveCachedContents(); | 267 | RemoveCachedContents(); |
| @@ -411,7 +412,7 @@ void GMainWindow::RegisterMetaTypes() { | |||
| 411 | 412 | ||
| 412 | void GMainWindow::ControllerSelectorReconfigureControllers( | 413 | void GMainWindow::ControllerSelectorReconfigureControllers( |
| 413 | const Core::Frontend::ControllerParameters& parameters) { | 414 | const Core::Frontend::ControllerParameters& parameters) { |
| 414 | QtControllerSelectorDialog dialog(this, parameters, input_subsystem.get(), system); | 415 | QtControllerSelectorDialog dialog(this, parameters, input_subsystem.get(), *system); |
| 415 | 416 | ||
| 416 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | | 417 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint | |
| 417 | Qt::WindowTitleHint | Qt::WindowSystemMenuHint); | 418 | Qt::WindowTitleHint | Qt::WindowSystemMenuHint); |
| @@ -421,7 +422,7 @@ void GMainWindow::ControllerSelectorReconfigureControllers( | |||
| 421 | emit ControllerSelectorReconfigureFinished(); | 422 | emit ControllerSelectorReconfigureFinished(); |
| 422 | 423 | ||
| 423 | // Don't forget to apply settings. | 424 | // Don't forget to apply settings. |
| 424 | system.ApplySettings(); | 425 | system->ApplySettings(); |
| 425 | config->Save(); | 426 | config->Save(); |
| 426 | 427 | ||
| 427 | UpdateStatusButtons(); | 428 | UpdateStatusButtons(); |
| @@ -455,7 +456,7 @@ void GMainWindow::SoftwareKeyboardInitialize( | |||
| 455 | return; | 456 | return; |
| 456 | } | 457 | } |
| 457 | 458 | ||
| 458 | software_keyboard = new QtSoftwareKeyboardDialog(render_window, system, is_inline, | 459 | software_keyboard = new QtSoftwareKeyboardDialog(render_window, *system, is_inline, |
| 459 | std::move(initialize_parameters)); | 460 | std::move(initialize_parameters)); |
| 460 | 461 | ||
| 461 | if (is_inline) { | 462 | if (is_inline) { |
| @@ -567,7 +568,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url, | |||
| 567 | return; | 568 | return; |
| 568 | } | 569 | } |
| 569 | 570 | ||
| 570 | QtNXWebEngineView web_browser_view(this, system, input_subsystem.get()); | 571 | QtNXWebEngineView web_browser_view(this, *system, input_subsystem.get()); |
| 571 | 572 | ||
| 572 | ui->action_Pause->setEnabled(false); | 573 | ui->action_Pause->setEnabled(false); |
| 573 | ui->action_Restart->setEnabled(false); | 574 | ui->action_Restart->setEnabled(false); |
| @@ -699,10 +700,10 @@ void GMainWindow::InitializeWidgets() { | |||
| 699 | #ifdef YUZU_ENABLE_COMPATIBILITY_REPORTING | 700 | #ifdef YUZU_ENABLE_COMPATIBILITY_REPORTING |
| 700 | ui->action_Report_Compatibility->setVisible(true); | 701 | ui->action_Report_Compatibility->setVisible(true); |
| 701 | #endif | 702 | #endif |
| 702 | render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem, system); | 703 | render_window = new GRenderWindow(this, emu_thread.get(), input_subsystem, *system); |
| 703 | render_window->hide(); | 704 | render_window->hide(); |
| 704 | 705 | ||
| 705 | game_list = new GameList(vfs, provider.get(), system, this); | 706 | game_list = new GameList(vfs, provider.get(), *system, this); |
| 706 | ui->horizontalLayout->addWidget(game_list); | 707 | ui->horizontalLayout->addWidget(game_list); |
| 707 | 708 | ||
| 708 | game_list_placeholder = new GameListPlaceholder(this); | 709 | game_list_placeholder = new GameListPlaceholder(this); |
| @@ -768,14 +769,14 @@ void GMainWindow::InitializeWidgets() { | |||
| 768 | tr("Handheld controller can't be used on docked mode. Pro " | 769 | tr("Handheld controller can't be used on docked mode. Pro " |
| 769 | "controller will be selected.")); | 770 | "controller will be selected.")); |
| 770 | controller_type = Settings::ControllerType::ProController; | 771 | controller_type = Settings::ControllerType::ProController; |
| 771 | ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(), system); | 772 | ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(), *system); |
| 772 | configure_dialog.ApplyConfiguration(); | 773 | configure_dialog.ApplyConfiguration(); |
| 773 | controller_dialog->refreshConfiguration(); | 774 | controller_dialog->refreshConfiguration(); |
| 774 | } | 775 | } |
| 775 | 776 | ||
| 776 | Settings::values.use_docked_mode.SetValue(!is_docked); | 777 | Settings::values.use_docked_mode.SetValue(!is_docked); |
| 777 | dock_status_button->setChecked(!is_docked); | 778 | dock_status_button->setChecked(!is_docked); |
| 778 | OnDockedModeChanged(is_docked, !is_docked, system); | 779 | OnDockedModeChanged(is_docked, !is_docked, *system); |
| 779 | }); | 780 | }); |
| 780 | dock_status_button->setText(tr("DOCK")); | 781 | dock_status_button->setText(tr("DOCK")); |
| 781 | dock_status_button->setCheckable(true); | 782 | dock_status_button->setCheckable(true); |
| @@ -799,7 +800,7 @@ void GMainWindow::InitializeWidgets() { | |||
| 799 | } | 800 | } |
| 800 | } | 801 | } |
| 801 | 802 | ||
| 802 | system.ApplySettings(); | 803 | system->ApplySettings(); |
| 803 | UpdateGPUAccuracyButton(); | 804 | UpdateGPUAccuracyButton(); |
| 804 | }); | 805 | }); |
| 805 | UpdateGPUAccuracyButton(); | 806 | UpdateGPUAccuracyButton(); |
| @@ -827,7 +828,7 @@ void GMainWindow::InitializeWidgets() { | |||
| 827 | Settings::values.renderer_backend.SetValue(Settings::RendererBackend::OpenGL); | 828 | Settings::values.renderer_backend.SetValue(Settings::RendererBackend::OpenGL); |
| 828 | } | 829 | } |
| 829 | 830 | ||
| 830 | system.ApplySettings(); | 831 | system->ApplySettings(); |
| 831 | }); | 832 | }); |
| 832 | statusBar()->insertPermanentWidget(0, renderer_status_button); | 833 | statusBar()->insertPermanentWidget(0, renderer_status_button); |
| 833 | 834 | ||
| @@ -844,7 +845,7 @@ void GMainWindow::InitializeDebugWidgets() { | |||
| 844 | debug_menu->addAction(microProfileDialog->toggleViewAction()); | 845 | debug_menu->addAction(microProfileDialog->toggleViewAction()); |
| 845 | #endif | 846 | #endif |
| 846 | 847 | ||
| 847 | waitTreeWidget = new WaitTreeWidget(system, this); | 848 | waitTreeWidget = new WaitTreeWidget(*system, this); |
| 848 | addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget); | 849 | addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget); |
| 849 | waitTreeWidget->hide(); | 850 | waitTreeWidget->hide(); |
| 850 | debug_menu->addAction(waitTreeWidget->toggleViewAction()); | 851 | debug_menu->addAction(waitTreeWidget->toggleViewAction()); |
| @@ -947,7 +948,7 @@ void GMainWindow::InitializeHotkeys() { | |||
| 947 | }); | 948 | }); |
| 948 | connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Restart Emulation"), this), | 949 | connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Restart Emulation"), this), |
| 949 | &QShortcut::activated, this, [this] { | 950 | &QShortcut::activated, this, [this] { |
| 950 | if (!system.IsPoweredOn()) { | 951 | if (!system->IsPoweredOn()) { |
| 951 | return; | 952 | return; |
| 952 | } | 953 | } |
| 953 | BootGame(game_path); | 954 | BootGame(game_path); |
| @@ -1003,7 +1004,7 @@ void GMainWindow::InitializeHotkeys() { | |||
| 1003 | Settings::values.use_docked_mode.SetValue( | 1004 | Settings::values.use_docked_mode.SetValue( |
| 1004 | !Settings::values.use_docked_mode.GetValue()); | 1005 | !Settings::values.use_docked_mode.GetValue()); |
| 1005 | OnDockedModeChanged(!Settings::values.use_docked_mode.GetValue(), | 1006 | OnDockedModeChanged(!Settings::values.use_docked_mode.GetValue(), |
| 1006 | Settings::values.use_docked_mode.GetValue(), system); | 1007 | Settings::values.use_docked_mode.GetValue(), *system); |
| 1007 | dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue()); | 1008 | dock_status_button->setChecked(Settings::values.use_docked_mode.GetValue()); |
| 1008 | }); | 1009 | }); |
| 1009 | connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Mute Audio"), this), | 1010 | connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Mute Audio"), this), |
| @@ -1240,9 +1241,9 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p | |||
| 1240 | return false; | 1241 | return false; |
| 1241 | } | 1242 | } |
| 1242 | 1243 | ||
| 1243 | system.SetFilesystem(vfs); | 1244 | system->SetFilesystem(vfs); |
| 1244 | 1245 | ||
| 1245 | system.SetAppletFrontendSet({ | 1246 | system->SetAppletFrontendSet({ |
| 1246 | std::make_unique<QtControllerSelector>(*this), // Controller Selector | 1247 | std::make_unique<QtControllerSelector>(*this), // Controller Selector |
| 1247 | std::make_unique<QtErrorDisplay>(*this), // Error Display | 1248 | std::make_unique<QtErrorDisplay>(*this), // Error Display |
| 1248 | nullptr, // Parental Controls | 1249 | nullptr, // Parental Controls |
| @@ -1253,13 +1254,13 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p | |||
| 1253 | }); | 1254 | }); |
| 1254 | 1255 | ||
| 1255 | const Core::SystemResultStatus result{ | 1256 | const Core::SystemResultStatus result{ |
| 1256 | system.Load(*render_window, filename.toStdString(), program_id, program_index)}; | 1257 | system->Load(*render_window, filename.toStdString(), program_id, program_index)}; |
| 1257 | 1258 | ||
| 1258 | const auto drd_callout = (UISettings::values.callout_flags.GetValue() & | 1259 | const auto drd_callout = (UISettings::values.callout_flags.GetValue() & |
| 1259 | static_cast<u32>(CalloutFlag::DRDDeprecation)) == 0; | 1260 | static_cast<u32>(CalloutFlag::DRDDeprecation)) == 0; |
| 1260 | 1261 | ||
| 1261 | if (result == Core::SystemResultStatus::Success && | 1262 | if (result == Core::SystemResultStatus::Success && |
| 1262 | system.GetAppLoader().GetFileType() == Loader::FileType::DeconstructedRomDirectory && | 1263 | system->GetAppLoader().GetFileType() == Loader::FileType::DeconstructedRomDirectory && |
| 1263 | drd_callout) { | 1264 | drd_callout) { |
| 1264 | UISettings::values.callout_flags = UISettings::values.callout_flags.GetValue() | | 1265 | UISettings::values.callout_flags = UISettings::values.callout_flags.GetValue() | |
| 1265 | static_cast<u32>(CalloutFlag::DRDDeprecation); | 1266 | static_cast<u32>(CalloutFlag::DRDDeprecation); |
| @@ -1323,7 +1324,7 @@ bool GMainWindow::LoadROM(const QString& filename, u64 program_id, std::size_t p | |||
| 1323 | } | 1324 | } |
| 1324 | game_path = filename; | 1325 | game_path = filename; |
| 1325 | 1326 | ||
| 1326 | system.TelemetrySession().AddField(Common::Telemetry::FieldType::App, "Frontend", "Qt"); | 1327 | system->TelemetrySession().AddField(Common::Telemetry::FieldType::App, "Frontend", "Qt"); |
| 1327 | return true; | 1328 | return true; |
| 1328 | } | 1329 | } |
| 1329 | 1330 | ||
| @@ -1350,7 +1351,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t | |||
| 1350 | last_filename_booted = filename; | 1351 | last_filename_booted = filename; |
| 1351 | 1352 | ||
| 1352 | const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData()); | 1353 | const auto v_file = Core::GetGameFileFromPath(vfs, filename.toUtf8().constData()); |
| 1353 | 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); |
| 1354 | 1355 | ||
| 1355 | if (loader != nullptr && loader->ReadProgramId(title_id) == Loader::ResultStatus::Success && | 1356 | if (loader != nullptr && loader->ReadProgramId(title_id) == Loader::ResultStatus::Success && |
| 1356 | type == StartGameType::Normal) { | 1357 | type == StartGameType::Normal) { |
| @@ -1359,7 +1360,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t | |||
| 1359 | const auto config_file_name = title_id == 0 | 1360 | const auto config_file_name = title_id == 0 |
| 1360 | ? Common::FS::PathToUTF8String(file_path.filename()) | 1361 | ? Common::FS::PathToUTF8String(file_path.filename()) |
| 1361 | : fmt::format("{:016X}", title_id); | 1362 | : fmt::format("{:016X}", title_id); |
| 1362 | Config per_game_config(system, config_file_name, Config::ConfigType::PerGameConfig); | 1363 | Config per_game_config(*system, config_file_name, Config::ConfigType::PerGameConfig); |
| 1363 | } | 1364 | } |
| 1364 | 1365 | ||
| 1365 | ConfigureVibration::SetAllVibrationDevices(); | 1366 | ConfigureVibration::SetAllVibrationDevices(); |
| @@ -1382,16 +1383,16 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t | |||
| 1382 | return; | 1383 | return; |
| 1383 | 1384 | ||
| 1384 | // Create and start the emulation thread | 1385 | // Create and start the emulation thread |
| 1385 | emu_thread = std::make_unique<EmuThread>(system); | 1386 | emu_thread = std::make_unique<EmuThread>(*system); |
| 1386 | emit EmulationStarting(emu_thread.get()); | 1387 | emit EmulationStarting(emu_thread.get()); |
| 1387 | emu_thread->start(); | 1388 | emu_thread->start(); |
| 1388 | 1389 | ||
| 1389 | // 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 |
| 1390 | system.RegisterExecuteProgramCallback( | 1391 | system->RegisterExecuteProgramCallback( |
| 1391 | [this](std::size_t program_index) { render_window->ExecuteProgram(program_index); }); | 1392 | [this](std::size_t program_index) { render_window->ExecuteProgram(program_index); }); |
| 1392 | 1393 | ||
| 1393 | // 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. |
| 1394 | system.RegisterExitCallback([this]() { render_window->Exit(); }); | 1395 | system->RegisterExitCallback([this]() { render_window->Exit(); }); |
| 1395 | 1396 | ||
| 1396 | connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame); | 1397 | connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame); |
| 1397 | connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity); | 1398 | connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity); |
| @@ -1425,11 +1426,11 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t | |||
| 1425 | 1426 | ||
| 1426 | std::string title_name; | 1427 | std::string title_name; |
| 1427 | std::string title_version; | 1428 | std::string title_version; |
| 1428 | const auto res = system.GetGameName(title_name); | 1429 | const auto res = system->GetGameName(title_name); |
| 1429 | 1430 | ||
| 1430 | const auto metadata = [this, title_id] { | 1431 | const auto metadata = [this, title_id] { |
| 1431 | const FileSys::PatchManager pm(title_id, system.GetFileSystemController(), | 1432 | const FileSys::PatchManager pm(title_id, system->GetFileSystemController(), |
| 1432 | system.GetContentProvider()); | 1433 | system->GetContentProvider()); |
| 1433 | return pm.GetControlMetadata(); | 1434 | return pm.GetControlMetadata(); |
| 1434 | }(); | 1435 | }(); |
| 1435 | if (metadata.first != nullptr) { | 1436 | if (metadata.first != nullptr) { |
| @@ -1440,16 +1441,16 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t | |||
| 1440 | title_name = Common::FS::PathToUTF8String( | 1441 | title_name = Common::FS::PathToUTF8String( |
| 1441 | std::filesystem::path{filename.toStdU16String()}.filename()); | 1442 | std::filesystem::path{filename.toStdU16String()}.filename()); |
| 1442 | } | 1443 | } |
| 1443 | const bool is_64bit = system.Kernel().CurrentProcess()->Is64BitProcess(); | 1444 | const bool is_64bit = system->Kernel().CurrentProcess()->Is64BitProcess(); |
| 1444 | 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)"); |
| 1445 | 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") |
| 1446 | .arg(QString::fromStdString(title_name), instruction_set_suffix) | 1447 | .arg(QString::fromStdString(title_name), instruction_set_suffix) |
| 1447 | .toStdString(); | 1448 | .toStdString(); |
| 1448 | 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); |
| 1449 | const auto gpu_vendor = system.GPU().Renderer().GetDeviceVendor(); | 1450 | const auto gpu_vendor = system->GPU().Renderer().GetDeviceVendor(); |
| 1450 | UpdateWindowTitle(title_name, title_version, gpu_vendor); | 1451 | UpdateWindowTitle(title_name, title_version, gpu_vendor); |
| 1451 | 1452 | ||
| 1452 | loading_screen->Prepare(system.GetAppLoader()); | 1453 | loading_screen->Prepare(system->GetAppLoader()); |
| 1453 | loading_screen->show(); | 1454 | loading_screen->show(); |
| 1454 | 1455 | ||
| 1455 | emulation_running = true; | 1456 | emulation_running = true; |
| @@ -1568,15 +1569,15 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target | |||
| 1568 | QString open_target; | 1569 | QString open_target; |
| 1569 | 1570 | ||
| 1570 | const auto [user_save_size, device_save_size] = [this, &game_path, &program_id] { | 1571 | const auto [user_save_size, device_save_size] = [this, &game_path, &program_id] { |
| 1571 | const FileSys::PatchManager pm{program_id, system.GetFileSystemController(), | 1572 | const FileSys::PatchManager pm{program_id, system->GetFileSystemController(), |
| 1572 | system.GetContentProvider()}; | 1573 | system->GetContentProvider()}; |
| 1573 | const auto control = pm.GetControlMetadata().first; | 1574 | const auto control = pm.GetControlMetadata().first; |
| 1574 | if (control != nullptr) { | 1575 | if (control != nullptr) { |
| 1575 | return std::make_pair(control->GetDefaultNormalSaveSize(), | 1576 | return std::make_pair(control->GetDefaultNormalSaveSize(), |
| 1576 | control->GetDeviceSaveDataSize()); | 1577 | control->GetDeviceSaveDataSize()); |
| 1577 | } else { | 1578 | } else { |
| 1578 | const auto file = Core::GetGameFileFromPath(vfs, game_path); | 1579 | const auto file = Core::GetGameFileFromPath(vfs, game_path); |
| 1579 | const auto loader = Loader::GetLoader(system, file); | 1580 | const auto loader = Loader::GetLoader(*system, file); |
| 1580 | 1581 | ||
| 1581 | FileSys::NACP nacp{}; | 1582 | FileSys::NACP nacp{}; |
| 1582 | loader->ReadControlData(nacp); | 1583 | loader->ReadControlData(nacp); |
| @@ -1619,14 +1620,14 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target | |||
| 1619 | ASSERT(user_id); | 1620 | ASSERT(user_id); |
| 1620 | 1621 | ||
| 1621 | const auto user_save_data_path = FileSys::SaveDataFactory::GetFullPath( | 1622 | const auto user_save_data_path = FileSys::SaveDataFactory::GetFullPath( |
| 1622 | system, FileSys::SaveDataSpaceId::NandUser, FileSys::SaveDataType::SaveData, | 1623 | *system, FileSys::SaveDataSpaceId::NandUser, FileSys::SaveDataType::SaveData, |
| 1623 | program_id, user_id->uuid, 0); | 1624 | program_id, user_id->uuid, 0); |
| 1624 | 1625 | ||
| 1625 | path = Common::FS::ConcatPathSafe(nand_dir, user_save_data_path); | 1626 | path = Common::FS::ConcatPathSafe(nand_dir, user_save_data_path); |
| 1626 | } else { | 1627 | } else { |
| 1627 | // Device save data | 1628 | // Device save data |
| 1628 | const auto device_save_data_path = FileSys::SaveDataFactory::GetFullPath( | 1629 | const auto device_save_data_path = FileSys::SaveDataFactory::GetFullPath( |
| 1629 | system, FileSys::SaveDataSpaceId::NandUser, FileSys::SaveDataType::SaveData, | 1630 | *system, FileSys::SaveDataSpaceId::NandUser, FileSys::SaveDataType::SaveData, |
| 1630 | program_id, {}, 0); | 1631 | program_id, {}, 0); |
| 1631 | 1632 | ||
| 1632 | path = Common::FS::ConcatPathSafe(nand_dir, device_save_data_path); | 1633 | path = Common::FS::ConcatPathSafe(nand_dir, device_save_data_path); |
| @@ -1753,7 +1754,7 @@ void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryT | |||
| 1753 | } | 1754 | } |
| 1754 | 1755 | ||
| 1755 | void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) { | 1756 | void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) { |
| 1756 | const auto& fs_controller = system.GetFileSystemController(); | 1757 | const auto& fs_controller = system->GetFileSystemController(); |
| 1757 | const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) || | 1758 | const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) || |
| 1758 | fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id); | 1759 | fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id); |
| 1759 | 1760 | ||
| @@ -1769,7 +1770,7 @@ void GMainWindow::RemoveBaseContent(u64 program_id, const QString& entry_type) { | |||
| 1769 | 1770 | ||
| 1770 | void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) { | 1771 | void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) { |
| 1771 | const auto update_id = program_id | 0x800; | 1772 | const auto update_id = program_id | 0x800; |
| 1772 | const auto& fs_controller = system.GetFileSystemController(); | 1773 | const auto& fs_controller = system->GetFileSystemController(); |
| 1773 | const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) || | 1774 | const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) || |
| 1774 | fs_controller.GetSDMCContents()->RemoveExistingEntry(update_id); | 1775 | fs_controller.GetSDMCContents()->RemoveExistingEntry(update_id); |
| 1775 | 1776 | ||
| @@ -1784,8 +1785,8 @@ void GMainWindow::RemoveUpdateContent(u64 program_id, const QString& entry_type) | |||
| 1784 | 1785 | ||
| 1785 | void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) { | 1786 | void GMainWindow::RemoveAddOnContent(u64 program_id, const QString& entry_type) { |
| 1786 | u32 count{}; | 1787 | u32 count{}; |
| 1787 | const auto& fs_controller = system.GetFileSystemController(); | 1788 | const auto& fs_controller = system->GetFileSystemController(); |
| 1788 | const auto dlc_entries = system.GetContentProvider().ListEntriesFilter( | 1789 | const auto dlc_entries = system->GetContentProvider().ListEntriesFilter( |
| 1789 | FileSys::TitleType::AOC, FileSys::ContentRecordType::Data); | 1790 | FileSys::TitleType::AOC, FileSys::ContentRecordType::Data); |
| 1790 | 1791 | ||
| 1791 | for (const auto& entry : dlc_entries) { | 1792 | for (const auto& entry : dlc_entries) { |
| @@ -1923,7 +1924,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa | |||
| 1923 | "cancelled the operation.")); | 1924 | "cancelled the operation.")); |
| 1924 | }; | 1925 | }; |
| 1925 | 1926 | ||
| 1926 | const auto loader = Loader::GetLoader(system, vfs->OpenFile(game_path, FileSys::Mode::Read)); | 1927 | const auto loader = Loader::GetLoader(*system, vfs->OpenFile(game_path, FileSys::Mode::Read)); |
| 1927 | if (loader == nullptr) { | 1928 | if (loader == nullptr) { |
| 1928 | failed(); | 1929 | failed(); |
| 1929 | return; | 1930 | return; |
| @@ -1935,7 +1936,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa | |||
| 1935 | return; | 1936 | return; |
| 1936 | } | 1937 | } |
| 1937 | 1938 | ||
| 1938 | const auto& installed = system.GetContentProvider(); | 1939 | const auto& installed = system->GetContentProvider(); |
| 1939 | const auto romfs_title_id = SelectRomFSDumpTarget(installed, program_id); | 1940 | const auto romfs_title_id = SelectRomFSDumpTarget(installed, program_id); |
| 1940 | 1941 | ||
| 1941 | if (!romfs_title_id) { | 1942 | if (!romfs_title_id) { |
| @@ -1955,7 +1956,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa | |||
| 1955 | 1956 | ||
| 1956 | if (*romfs_title_id == program_id) { | 1957 | if (*romfs_title_id == program_id) { |
| 1957 | const u64 ivfc_offset = loader->ReadRomFSIVFCOffset(); | 1958 | const u64 ivfc_offset = loader->ReadRomFSIVFCOffset(); |
| 1958 | const FileSys::PatchManager pm{program_id, system.GetFileSystemController(), installed}; | 1959 | const FileSys::PatchManager pm{program_id, system->GetFileSystemController(), installed}; |
| 1959 | romfs = | 1960 | romfs = |
| 1960 | pm.PatchRomFS(file, ivfc_offset, FileSys::ContentRecordType::Program, nullptr, false); | 1961 | pm.PatchRomFS(file, ivfc_offset, FileSys::ContentRecordType::Program, nullptr, false); |
| 1961 | } else { | 1962 | } else { |
| @@ -2090,7 +2091,7 @@ void GMainWindow::OnGameListShowList(bool show) { | |||
| 2090 | void GMainWindow::OnGameListOpenPerGameProperties(const std::string& file) { | 2091 | void GMainWindow::OnGameListOpenPerGameProperties(const std::string& file) { |
| 2091 | u64 title_id{}; | 2092 | u64 title_id{}; |
| 2092 | const auto v_file = Core::GetGameFileFromPath(vfs, file); | 2093 | const auto v_file = Core::GetGameFileFromPath(vfs, file); |
| 2093 | const auto loader = Loader::GetLoader(system, v_file); | 2094 | const auto loader = Loader::GetLoader(*system, v_file); |
| 2094 | 2095 | ||
| 2095 | if (loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) { | 2096 | if (loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success) { |
| 2096 | QMessageBox::information(this, tr("Properties"), | 2097 | QMessageBox::information(this, tr("Properties"), |
| @@ -2304,7 +2305,7 @@ InstallResult GMainWindow::InstallNSPXCI(const QString& filename) { | |||
| 2304 | if (nsp->GetStatus() != Loader::ResultStatus::Success) { | 2305 | if (nsp->GetStatus() != Loader::ResultStatus::Success) { |
| 2305 | return InstallResult::Failure; | 2306 | return InstallResult::Failure; |
| 2306 | } | 2307 | } |
| 2307 | const auto res = system.GetFileSystemController().GetUserNANDContents()->InstallEntry( | 2308 | const auto res = system->GetFileSystemController().GetUserNANDContents()->InstallEntry( |
| 2308 | *nsp, true, qt_raw_copy); | 2309 | *nsp, true, qt_raw_copy); |
| 2309 | switch (res) { | 2310 | switch (res) { |
| 2310 | case FileSys::InstallResult::Success: | 2311 | case FileSys::InstallResult::Success: |
| @@ -2384,7 +2385,7 @@ InstallResult GMainWindow::InstallNCA(const QString& filename) { | |||
| 2384 | } | 2385 | } |
| 2385 | 2386 | ||
| 2386 | const bool is_application = index >= static_cast<s32>(FileSys::TitleType::Application); | 2387 | const bool is_application = index >= static_cast<s32>(FileSys::TitleType::Application); |
| 2387 | const auto& fs_controller = system.GetFileSystemController(); | 2388 | const auto& fs_controller = system->GetFileSystemController(); |
| 2388 | auto* registered_cache = is_application ? fs_controller.GetUserNANDContents() | 2389 | auto* registered_cache = is_application ? fs_controller.GetUserNANDContents() |
| 2389 | : fs_controller.GetSystemNANDContents(); | 2390 | : fs_controller.GetSystemNANDContents(); |
| 2390 | 2391 | ||
| @@ -2449,13 +2450,13 @@ void GMainWindow::OnPauseGame() { | |||
| 2449 | } | 2450 | } |
| 2450 | 2451 | ||
| 2451 | void GMainWindow::OnStopGame() { | 2452 | void GMainWindow::OnStopGame() { |
| 2452 | if (system.GetExitLock() && !ConfirmForceLockedExit()) { | 2453 | if (system->GetExitLock() && !ConfirmForceLockedExit()) { |
| 2453 | return; | 2454 | return; |
| 2454 | } | 2455 | } |
| 2455 | 2456 | ||
| 2456 | ShutdownGame(); | 2457 | ShutdownGame(); |
| 2457 | 2458 | ||
| 2458 | Settings::RestoreGlobalState(system.IsPoweredOn()); | 2459 | Settings::RestoreGlobalState(system->IsPoweredOn()); |
| 2459 | UpdateStatusButtons(); | 2460 | UpdateStatusButtons(); |
| 2460 | } | 2461 | } |
| 2461 | 2462 | ||
| @@ -2473,7 +2474,7 @@ void GMainWindow::OnExit() { | |||
| 2473 | } | 2474 | } |
| 2474 | 2475 | ||
| 2475 | void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_text) { | 2476 | void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_text) { |
| 2476 | OverlayDialog dialog(render_window, system, error_code, error_text, QString{}, tr("OK"), | 2477 | OverlayDialog dialog(render_window, *system, error_code, error_text, QString{}, tr("OK"), |
| 2477 | Qt::AlignLeft | Qt::AlignVCenter); | 2478 | Qt::AlignLeft | Qt::AlignVCenter); |
| 2478 | dialog.exec(); | 2479 | dialog.exec(); |
| 2479 | 2480 | ||
| @@ -2483,7 +2484,7 @@ void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_tex | |||
| 2483 | void GMainWindow::OnMenuReportCompatibility() { | 2484 | void GMainWindow::OnMenuReportCompatibility() { |
| 2484 | if (!Settings::values.yuzu_token.GetValue().empty() && | 2485 | if (!Settings::values.yuzu_token.GetValue().empty() && |
| 2485 | !Settings::values.yuzu_username.GetValue().empty()) { | 2486 | !Settings::values.yuzu_username.GetValue().empty()) { |
| 2486 | CompatDB compatdb{system.TelemetrySession(), this}; | 2487 | CompatDB compatdb{system->TelemetrySession(), this}; |
| 2487 | compatdb.exec(); | 2488 | compatdb.exec(); |
| 2488 | } else { | 2489 | } else { |
| 2489 | QMessageBox::critical( | 2490 | QMessageBox::critical( |
| @@ -2647,7 +2648,7 @@ void GMainWindow::OnConfigure() { | |||
| 2647 | const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue(); | 2648 | const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue(); |
| 2648 | 2649 | ||
| 2649 | Settings::SetConfiguringGlobal(true); | 2650 | Settings::SetConfiguringGlobal(true); |
| 2650 | ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(), system); | 2651 | ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get(), *system); |
| 2651 | connect(&configure_dialog, &ConfigureDialog::LanguageChanged, this, | 2652 | connect(&configure_dialog, &ConfigureDialog::LanguageChanged, this, |
| 2652 | &GMainWindow::OnLanguageChanged); | 2653 | &GMainWindow::OnLanguageChanged); |
| 2653 | 2654 | ||
| @@ -2683,7 +2684,7 @@ void GMainWindow::OnConfigure() { | |||
| 2683 | 2684 | ||
| 2684 | Settings::values.disabled_addons.clear(); | 2685 | Settings::values.disabled_addons.clear(); |
| 2685 | 2686 | ||
| 2686 | config = std::make_unique<Config>(system); | 2687 | config = std::make_unique<Config>(*system); |
| 2687 | UISettings::values.reset_to_defaults = false; | 2688 | UISettings::values.reset_to_defaults = false; |
| 2688 | 2689 | ||
| 2689 | UISettings::values.game_dirs = std::move(old_game_dirs); | 2690 | UISettings::values.game_dirs = std::move(old_game_dirs); |
| @@ -2732,12 +2733,11 @@ void GMainWindow::OnConfigure() { | |||
| 2732 | } | 2733 | } |
| 2733 | 2734 | ||
| 2734 | void GMainWindow::OnConfigureTas() { | 2735 | void GMainWindow::OnConfigureTas() { |
| 2735 | const auto& system = Core::System::GetInstance(); | ||
| 2736 | ConfigureTasDialog dialog(this); | 2736 | ConfigureTasDialog dialog(this); |
| 2737 | const auto result = dialog.exec(); | 2737 | const auto result = dialog.exec(); |
| 2738 | 2738 | ||
| 2739 | if (result != QDialog::Accepted && !UISettings::values.configuration_applied) { | 2739 | if (result != QDialog::Accepted && !UISettings::values.configuration_applied) { |
| 2740 | Settings::RestoreGlobalState(system.IsPoweredOn()); | 2740 | Settings::RestoreGlobalState(system->IsPoweredOn()); |
| 2741 | return; | 2741 | return; |
| 2742 | } else if (result == QDialog::Accepted) { | 2742 | } else if (result == QDialog::Accepted) { |
| 2743 | dialog.ApplyConfiguration(); | 2743 | dialog.ApplyConfiguration(); |
| @@ -2745,7 +2745,7 @@ void GMainWindow::OnConfigureTas() { | |||
| 2745 | } | 2745 | } |
| 2746 | 2746 | ||
| 2747 | void GMainWindow::OnConfigurePerGame() { | 2747 | void GMainWindow::OnConfigurePerGame() { |
| 2748 | const u64 title_id = system.CurrentProcess()->GetTitleID(); | 2748 | const u64 title_id = system->CurrentProcess()->GetTitleID(); |
| 2749 | OpenPerGameConfiguration(title_id, game_path.toStdString()); | 2749 | OpenPerGameConfiguration(title_id, game_path.toStdString()); |
| 2750 | } | 2750 | } |
| 2751 | 2751 | ||
| @@ -2753,12 +2753,12 @@ void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file | |||
| 2753 | const auto v_file = Core::GetGameFileFromPath(vfs, file_name); | 2753 | const auto v_file = Core::GetGameFileFromPath(vfs, file_name); |
| 2754 | 2754 | ||
| 2755 | Settings::SetConfiguringGlobal(false); | 2755 | Settings::SetConfiguringGlobal(false); |
| 2756 | ConfigurePerGame dialog(this, title_id, file_name, system); | 2756 | ConfigurePerGame dialog(this, title_id, file_name, *system); |
| 2757 | dialog.LoadFromFile(v_file); | 2757 | dialog.LoadFromFile(v_file); |
| 2758 | const auto result = dialog.exec(); | 2758 | const auto result = dialog.exec(); |
| 2759 | 2759 | ||
| 2760 | if (result != QDialog::Accepted && !UISettings::values.configuration_applied) { | 2760 | if (result != QDialog::Accepted && !UISettings::values.configuration_applied) { |
| 2761 | Settings::RestoreGlobalState(system.IsPoweredOn()); | 2761 | Settings::RestoreGlobalState(system->IsPoweredOn()); |
| 2762 | return; | 2762 | return; |
| 2763 | } else if (result == QDialog::Accepted) { | 2763 | } else if (result == QDialog::Accepted) { |
| 2764 | dialog.ApplyConfiguration(); | 2764 | dialog.ApplyConfiguration(); |
| @@ -2770,7 +2770,7 @@ void GMainWindow::OpenPerGameConfiguration(u64 title_id, const std::string& file | |||
| 2770 | } | 2770 | } |
| 2771 | 2771 | ||
| 2772 | // 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 |
| 2773 | const bool is_powered_on = system.IsPoweredOn(); | 2773 | const bool is_powered_on = system->IsPoweredOn(); |
| 2774 | Settings::RestoreGlobalState(is_powered_on); | 2774 | Settings::RestoreGlobalState(is_powered_on); |
| 2775 | 2775 | ||
| 2776 | UISettings::values.configuration_applied = false; | 2776 | UISettings::values.configuration_applied = false; |
| @@ -2793,7 +2793,7 @@ void GMainWindow::OnLoadAmiibo() { | |||
| 2793 | } | 2793 | } |
| 2794 | 2794 | ||
| 2795 | void GMainWindow::LoadAmiibo(const QString& filename) { | 2795 | void GMainWindow::LoadAmiibo(const QString& filename) { |
| 2796 | Service::SM::ServiceManager& sm = system.ServiceManager(); | 2796 | Service::SM::ServiceManager& sm = system->ServiceManager(); |
| 2797 | auto nfc = sm.GetService<Service::NFP::Module::Interface>("nfp:user"); | 2797 | auto nfc = sm.GetService<Service::NFP::Module::Interface>("nfp:user"); |
| 2798 | if (nfc == nullptr) { | 2798 | if (nfc == nullptr) { |
| 2799 | return; | 2799 | return; |
| @@ -2844,7 +2844,7 @@ void GMainWindow::OnToggleFilterBar() { | |||
| 2844 | } | 2844 | } |
| 2845 | 2845 | ||
| 2846 | void GMainWindow::OnCaptureScreenshot() { | 2846 | void GMainWindow::OnCaptureScreenshot() { |
| 2847 | const u64 title_id = system.CurrentProcess()->GetTitleID(); | 2847 | const u64 title_id = system->CurrentProcess()->GetTitleID(); |
| 2848 | const auto screenshot_path = | 2848 | const auto screenshot_path = |
| 2849 | QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir)); | 2849 | QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir)); |
| 2850 | const auto date = | 2850 | const auto date = |
| @@ -2950,8 +2950,8 @@ void GMainWindow::UpdateStatusBar() { | |||
| 2950 | tas_label->clear(); | 2950 | tas_label->clear(); |
| 2951 | } | 2951 | } |
| 2952 | 2952 | ||
| 2953 | auto results = system.GetAndResetPerfStats(); | 2953 | auto results = system->GetAndResetPerfStats(); |
| 2954 | auto& shader_notify = system.GPU().ShaderNotify(); | 2954 | auto& shader_notify = system->GPU().ShaderNotify(); |
| 2955 | const int shaders_building = shader_notify.ShadersBuilding(); | 2955 | const int shaders_building = shader_notify.ShadersBuilding(); |
| 2956 | 2956 | ||
| 2957 | if (shaders_building > 0) { | 2957 | if (shaders_building > 0) { |
| @@ -3112,7 +3112,7 @@ void GMainWindow::OnCoreError(Core::SystemResultStatus result, std::string detai | |||
| 3112 | if (emu_thread) { | 3112 | if (emu_thread) { |
| 3113 | ShutdownGame(); | 3113 | ShutdownGame(); |
| 3114 | 3114 | ||
| 3115 | Settings::RestoreGlobalState(system.IsPoweredOn()); | 3115 | Settings::RestoreGlobalState(system->IsPoweredOn()); |
| 3116 | UpdateStatusButtons(); | 3116 | UpdateStatusButtons(); |
| 3117 | } | 3117 | } |
| 3118 | } else { | 3118 | } else { |
| @@ -3154,8 +3154,8 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) { | |||
| 3154 | const auto function = [this, &keys, &pdm] { | 3154 | const auto function = [this, &keys, &pdm] { |
| 3155 | keys.PopulateFromPartitionData(pdm); | 3155 | keys.PopulateFromPartitionData(pdm); |
| 3156 | 3156 | ||
| 3157 | system.GetFileSystemController().CreateFactories(*vfs); | 3157 | system->GetFileSystemController().CreateFactories(*vfs); |
| 3158 | keys.DeriveETicket(pdm, system.GetContentProvider()); | 3158 | keys.DeriveETicket(pdm, system->GetContentProvider()); |
| 3159 | }; | 3159 | }; |
| 3160 | 3160 | ||
| 3161 | QString errors; | 3161 | QString errors; |
| @@ -3197,7 +3197,7 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) { | |||
| 3197 | prog.close(); | 3197 | prog.close(); |
| 3198 | } | 3198 | } |
| 3199 | 3199 | ||
| 3200 | system.GetFileSystemController().CreateFactories(*vfs); | 3200 | system->GetFileSystemController().CreateFactories(*vfs); |
| 3201 | 3201 | ||
| 3202 | if (behavior == ReinitializeKeyBehavior::Warning) { | 3202 | if (behavior == ReinitializeKeyBehavior::Warning) { |
| 3203 | game_list->PopulateAsync(UISettings::values.game_dirs); | 3203 | game_list->PopulateAsync(UISettings::values.game_dirs); |
| @@ -3265,7 +3265,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) { | |||
| 3265 | if (emu_thread != nullptr) { | 3265 | if (emu_thread != nullptr) { |
| 3266 | ShutdownGame(); | 3266 | ShutdownGame(); |
| 3267 | 3267 | ||
| 3268 | Settings::RestoreGlobalState(system.IsPoweredOn()); | 3268 | Settings::RestoreGlobalState(system->IsPoweredOn()); |
| 3269 | UpdateStatusButtons(); | 3269 | UpdateStatusButtons(); |
| 3270 | } | 3270 | } |
| 3271 | 3271 | ||
| @@ -3340,7 +3340,7 @@ bool GMainWindow::ConfirmForceLockedExit() { | |||
| 3340 | } | 3340 | } |
| 3341 | 3341 | ||
| 3342 | void GMainWindow::RequestGameExit() { | 3342 | void GMainWindow::RequestGameExit() { |
| 3343 | auto& sm{system.ServiceManager()}; | 3343 | auto& sm{system->ServiceManager()}; |
| 3344 | auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE"); | 3344 | auto applet_oe = sm.GetService<Service::AM::AppletOE>("appletOE"); |
| 3345 | auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE"); | 3345 | auto applet_ae = sm.GetService<Service::AM::AppletAE>("appletAE"); |
| 3346 | bool has_signalled = false; | 3346 | bool has_signalled = false; |
| @@ -3434,7 +3434,7 @@ void GMainWindow::OnLanguageChanged(const QString& locale) { | |||
| 3434 | void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) { | 3434 | void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) { |
| 3435 | #ifdef USE_DISCORD_PRESENCE | 3435 | #ifdef USE_DISCORD_PRESENCE |
| 3436 | if (state) { | 3436 | if (state) { |
| 3437 | discord_rpc = std::make_unique<DiscordRPC::DiscordImpl>(system); | 3437 | discord_rpc = std::make_unique<DiscordRPC::DiscordImpl>(*system); |
| 3438 | } else { | 3438 | } else { |
| 3439 | discord_rpc = std::make_unique<DiscordRPC::NullImpl>(); | 3439 | discord_rpc = std::make_unique<DiscordRPC::NullImpl>(); |
| 3440 | } | 3440 | } |
| @@ -3488,8 +3488,7 @@ int main(int argc, char* argv[]) { | |||
| 3488 | // generating shaders | 3488 | // generating shaders |
| 3489 | setlocale(LC_ALL, "C"); | 3489 | setlocale(LC_ALL, "C"); |
| 3490 | 3490 | ||
| 3491 | Core::System::InitializeGlobalInstance(); | 3491 | GMainWindow main_window{}; |
| 3492 | GMainWindow main_window{Core::System::GetInstance()}; | ||
| 3493 | // After settings have been loaded by GMainWindow, apply the filter | 3492 | // After settings have been loaded by GMainWindow, apply the filter |
| 3494 | main_window.show(); | 3493 | main_window.show(); |
| 3495 | 3494 | ||
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index b96ac8da3..aed15a0a0 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -13,7 +13,6 @@ | |||
| 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 "yuzu/compatibility_list.h" | 17 | #include "yuzu/compatibility_list.h" |
| 19 | #include "yuzu/hotkeys.h" | 18 | #include "yuzu/hotkeys.h" |
| @@ -44,6 +43,11 @@ enum class StartGameType { | |||
| 44 | Global, // Only uses global configuration | 43 | Global, // Only uses global configuration |
| 45 | }; | 44 | }; |
| 46 | 45 | ||
| 46 | namespace Core { | ||
| 47 | enum class SystemResultStatus : u32; | ||
| 48 | class System; | ||
| 49 | } // namespace Core | ||
| 50 | |||
| 47 | namespace Core::Frontend { | 51 | namespace Core::Frontend { |
| 48 | struct ControllerParameters; | 52 | struct ControllerParameters; |
| 49 | struct InlineAppearParameters; | 53 | struct InlineAppearParameters; |
| @@ -110,7 +114,7 @@ class GMainWindow : public QMainWindow { | |||
| 110 | public: | 114 | public: |
| 111 | void filterBarSetChecked(bool state); | 115 | void filterBarSetChecked(bool state); |
| 112 | void UpdateUITheme(); | 116 | void UpdateUITheme(); |
| 113 | GMainWindow(Core::System& system_); | 117 | explicit GMainWindow(); |
| 114 | ~GMainWindow() override; | 118 | ~GMainWindow() override; |
| 115 | 119 | ||
| 116 | bool DropAction(QDropEvent* event); | 120 | bool DropAction(QDropEvent* event); |
| @@ -311,11 +315,10 @@ private: | |||
| 311 | 315 | ||
| 312 | std::unique_ptr<Ui::MainWindow> ui; | 316 | std::unique_ptr<Ui::MainWindow> ui; |
| 313 | 317 | ||
| 318 | std::unique_ptr<Core::System> system; | ||
| 314 | std::unique_ptr<DiscordRPC::DiscordInterface> discord_rpc; | 319 | std::unique_ptr<DiscordRPC::DiscordInterface> discord_rpc; |
| 315 | std::shared_ptr<InputCommon::InputSubsystem> input_subsystem; | 320 | std::shared_ptr<InputCommon::InputSubsystem> input_subsystem; |
| 316 | 321 | ||
| 317 | Core::System& system; | ||
| 318 | |||
| 319 | GRenderWindow* render_window; | 322 | GRenderWindow* render_window; |
| 320 | GameList* game_list; | 323 | GameList* game_list; |
| 321 | LoadingScreen* loading_screen; | 324 | LoadingScreen* loading_screen; |