Skip to content

Commit 92f5621

Browse files
committed
Qt: Allow user to precompile caches on demand when installing packages or adding disc games
1 parent f5be489 commit 92f5621

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

rpcs3/rpcs3qt/main_window.cpp

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,7 @@ bool main_window::HandlePackageInstallation(QStringList file_paths, bool from_bo
11801180
{
11811181
m_game_list_frame->AddRefreshedSlot([this, paths = std::move(bootable_paths_installed)](std::set<std::string>& claimed_paths) mutable
11821182
{
1183-
// Try to claim operaions on ID
1183+
// Try to claim operations on ID
11841184
for (auto it = paths.begin(); it != paths.end();)
11851185
{
11861186
std::string resolved_path = Emu.GetCallbacks().resolve_path(it->first);
@@ -1196,13 +1196,7 @@ bool main_window::HandlePackageInstallation(QStringList file_paths, bool from_bo
11961196
}
11971197
}
11981198

1199-
// Executes after PrecompileCachesFromInstalledPackages
1200-
m_notify_batch_game_action_cb = [this, paths]() mutable
1201-
{
1202-
ShowOptionalGamePreparations(tr("Success!"), tr("Successfully installed software from package(s)!"), std::move(paths));
1203-
};
1204-
1205-
PrecompileCachesFromInstalledPackages(paths);
1199+
ShowOptionalGamePreparations(tr("Success!"), tr("Successfully installed software from package(s)!"), std::move(paths));
12061200
});
12071201
}
12081202

@@ -2402,6 +2396,8 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri
24022396

24032397
QVBoxLayout* vlayout = new QVBoxLayout(dlg);
24042398

2399+
QCheckBox* precompile_check = new QCheckBox(tr("Precompile caches"));
2400+
precompile_check->setChecked(true);
24052401
QCheckBox* desk_check = new QCheckBox(tr("Add desktop shortcut(s)"));
24062402
#ifdef _WIN32
24072403
QCheckBox* quick_check = new QCheckBox(tr("Add Start menu shortcut(s)"));
@@ -2410,10 +2406,12 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri
24102406
#else
24112407
QCheckBox* quick_check = new QCheckBox(tr("Add launcher shortcut(s)"));
24122408
#endif
2413-
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);
2409+
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);
24142410

24152411
vlayout->addWidget(label);
24162412
vlayout->addStretch(10);
2413+
vlayout->addWidget(precompile_check);
2414+
vlayout->addStretch(3);
24172415
vlayout->addWidget(desk_check);
24182416
vlayout->addStretch(3);
24192417
vlayout->addWidget(quick_check);
@@ -2426,6 +2424,7 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri
24262424

24272425
connect(btn_box, &QDialogButtonBox::accepted, this, [=, this, paths = std::move(bootable_paths)]()
24282426
{
2427+
const bool precompile_caches = precompile_check->isChecked();
24292428
const bool create_desktop_shortcuts = desk_check->isChecked();
24302429
const bool create_app_shortcut = quick_check->isChecked();
24312430

@@ -2447,43 +2446,45 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri
24472446
locations.insert(gui::utils::shortcut_location::applications);
24482447
}
24492448

2450-
if (locations.empty())
2449+
if (!locations.empty())
24512450
{
2452-
return;
2453-
}
2454-
2455-
std::vector<game_info> game_data_shortcuts;
2451+
std::vector<game_info> game_data_shortcuts;
24562452

2457-
for (const auto& [boot_path, title_id] : paths)
2458-
{
2459-
for (const game_info& gameinfo : m_game_list_frame->GetGameInfo())
2453+
for (const auto& [boot_path, title_id] : paths)
24602454
{
2461-
if (gameinfo && gameinfo->info.serial == title_id.toStdString())
2455+
for (const game_info& gameinfo : m_game_list_frame->GetGameInfo())
24622456
{
2463-
if (Emu.IsPathInsideDir(boot_path, gameinfo->info.path))
2457+
if (gameinfo && gameinfo->info.serial == title_id.toStdString())
24642458
{
2465-
if (!locations.empty())
2459+
if (Emu.IsPathInsideDir(boot_path, gameinfo->info.path))
24662460
{
2467-
game_data_shortcuts.push_back(gameinfo);
2461+
if (!locations.empty())
2462+
{
2463+
game_data_shortcuts.push_back(gameinfo);
2464+
}
24682465
}
2469-
}
24702466

2471-
break;
2467+
break;
2468+
}
24722469
}
24732470
}
2471+
2472+
if (!game_data_shortcuts.empty() && !locations.empty())
2473+
{
2474+
m_game_list_frame->CreateShortcuts(game_data_shortcuts, locations);
2475+
}
24742476
}
24752477

2476-
if (!game_data_shortcuts.empty() && !locations.empty())
2478+
if (precompile_caches)
24772479
{
2478-
m_game_list_frame->CreateShortcuts(game_data_shortcuts, locations);
2480+
PrecompileCachesFromInstalledPackages(paths);
24792481
}
24802482
});
24812483

24822484
dlg->setAttribute(Qt::WA_DeleteOnClose);
24832485
dlg->open();
24842486
}
24852487

2486-
24872488
void main_window::PrecompileCachesFromInstalledPackages(const std::map<std::string, QString>& bootable_paths)
24882489
{
24892490
std::vector<game_info> game_data;

0 commit comments

Comments
 (0)