From eb956d42f607685222b5390fd8b4ab4c59c4121a Mon Sep 17 00:00:00 2001 From: Megamouse Date: Thu, 4 Dec 2025 00:23:53 +0100 Subject: [PATCH] Qt: Allow user to precompile caches on demand when installing packages or adding disc games --- rpcs3/rpcs3qt/main_window.cpp | 49 ++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index 5509a6f69c..97cc64cb68 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -1178,13 +1178,7 @@ bool main_window::HandlePackageInstallation(QStringList file_paths, bool from_bo } } - // Executes after PrecompileCachesFromInstalledPackages - m_notify_batch_game_action_cb = [this, paths]() mutable - { - ShowOptionalGamePreparations(tr("Success!"), tr("Successfully installed software from package(s)!"), std::move(paths)); - }; - - PrecompileCachesFromInstalledPackages(paths); + ShowOptionalGamePreparations(tr("Success!"), tr("Successfully installed software from package(s)!"), std::move(paths)); }); } @@ -2384,6 +2378,7 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri QVBoxLayout* vlayout = new QVBoxLayout(dlg); + QCheckBox* precompile_check = new QCheckBox(tr("Precompile caches")); QCheckBox* desk_check = new QCheckBox(tr("Add desktop shortcut(s)")); #ifdef _WIN32 QCheckBox* quick_check = new QCheckBox(tr("Add Start menu shortcut(s)")); @@ -2392,10 +2387,12 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri #else QCheckBox* quick_check = new QCheckBox(tr("Add launcher shortcut(s)")); #endif - QLabel* label = new QLabel(tr("%1\nWould you like to install shortcuts to the installed software? (%2 new software detected)\n\n").arg(message).arg(bootable_paths.size()), dlg); + QLabel* label = new QLabel(tr("%1\nWould you like to precompile caches and install shortcuts to the installed software? (%2 new software detected)\n\n").arg(message).arg(bootable_paths.size()), dlg); vlayout->addWidget(label); vlayout->addStretch(10); + vlayout->addWidget(precompile_check); + vlayout->addStretch(3); vlayout->addWidget(desk_check); vlayout->addStretch(3); vlayout->addWidget(quick_check); @@ -2408,6 +2405,7 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri connect(btn_box, &QDialogButtonBox::accepted, this, [=, this, paths = std::move(bootable_paths)]() { + const bool precompile_caches = precompile_check->isChecked(); const bool create_desktop_shortcuts = desk_check->isChecked(); const bool create_app_shortcut = quick_check->isChecked(); @@ -2429,35 +2427,38 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri locations.insert(gui::utils::shortcut_location::applications); } - if (locations.empty()) + if (!locations.empty()) { - return; - } + std::vector game_data_shortcuts; - std::vector game_data_shortcuts; - - for (const auto& [boot_path, title_id] : paths) - { - for (const game_info& gameinfo : m_game_list_frame->GetGameInfo()) + for (const auto& [boot_path, title_id] : paths) { - if (gameinfo && gameinfo->info.serial == title_id.toStdString()) + for (const game_info& gameinfo : m_game_list_frame->GetGameInfo()) { - if (Emu.IsPathInsideDir(boot_path, gameinfo->info.path)) + if (gameinfo && gameinfo->info.serial == title_id.toStdString()) { - if (!locations.empty()) + if (Emu.IsPathInsideDir(boot_path, gameinfo->info.path)) { - game_data_shortcuts.push_back(gameinfo); + if (!locations.empty()) + { + game_data_shortcuts.push_back(gameinfo); + } } - } - break; + break; + } } } + + if (!game_data_shortcuts.empty() && !locations.empty()) + { + m_game_list_frame->CreateShortcuts(game_data_shortcuts, locations); + } } - if (!game_data_shortcuts.empty() && !locations.empty()) + if (precompile_caches) { - m_game_list_frame->CreateShortcuts(game_data_shortcuts, locations); + PrecompileCachesFromInstalledPackages(paths); } });