Skip to content

Commit c20d51d

Browse files
committed
Qt: Allow user to precompile caches on demand when installing packages or adding disc games
1 parent 133b19f commit c20d51d

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

rpcs3/rpcs3qt/main_window.cpp

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,13 +1178,7 @@ bool main_window::HandlePackageInstallation(QStringList file_paths, bool from_bo
11781178
}
11791179
}
11801180

1181-
// Executes after PrecompileCachesFromInstalledPackages
1182-
m_notify_batch_game_action_cb = [this, paths]() mutable
1183-
{
1184-
ShowOptionalGamePreparations(tr("Success!"), tr("Successfully installed software from package(s)!"), std::move(paths));
1185-
};
1186-
1187-
PrecompileCachesFromInstalledPackages(paths);
1181+
ShowOptionalGamePreparations(tr("Success!"), tr("Successfully installed software from package(s)!"), std::move(paths));
11881182
});
11891183
}
11901184

@@ -2384,6 +2378,7 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri
23842378

23852379
QVBoxLayout* vlayout = new QVBoxLayout(dlg);
23862380

2381+
QCheckBox* precompile_check = new QCheckBox(tr("Precompile Caches"));
23872382
QCheckBox* desk_check = new QCheckBox(tr("Add desktop shortcut(s)"));
23882383
#ifdef _WIN32
23892384
QCheckBox* quick_check = new QCheckBox(tr("Add Start menu shortcut(s)"));
@@ -2392,10 +2387,12 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri
23922387
#else
23932388
QCheckBox* quick_check = new QCheckBox(tr("Add launcher shortcut(s)"));
23942389
#endif
2395-
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);
2390+
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);
23962391

23972392
vlayout->addWidget(label);
23982393
vlayout->addStretch(10);
2394+
vlayout->addWidget(precompile_check);
2395+
vlayout->addStretch(3);
23992396
vlayout->addWidget(desk_check);
24002397
vlayout->addStretch(3);
24012398
vlayout->addWidget(quick_check);
@@ -2408,6 +2405,7 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri
24082405

24092406
connect(btn_box, &QDialogButtonBox::accepted, this, [=, this, paths = std::move(bootable_paths)]()
24102407
{
2408+
const bool precompile_caches = precompile_check->isChecked();
24112409
const bool create_desktop_shortcuts = desk_check->isChecked();
24122410
const bool create_app_shortcut = quick_check->isChecked();
24132411

@@ -2429,35 +2427,38 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri
24292427
locations.insert(gui::utils::shortcut_location::applications);
24302428
}
24312429

2432-
if (locations.empty())
2430+
if (!locations.empty())
24332431
{
2434-
return;
2435-
}
2436-
2437-
std::vector<game_info> game_data_shortcuts;
2432+
std::vector<game_info> game_data_shortcuts;
24382433

2439-
for (const auto& [boot_path, title_id] : paths)
2440-
{
2441-
for (const game_info& gameinfo : m_game_list_frame->GetGameInfo())
2434+
for (const auto& [boot_path, title_id] : paths)
24422435
{
2443-
if (gameinfo && gameinfo->info.serial == title_id.toStdString())
2436+
for (const game_info& gameinfo : m_game_list_frame->GetGameInfo())
24442437
{
2445-
if (Emu.IsPathInsideDir(boot_path, gameinfo->info.path))
2438+
if (gameinfo && gameinfo->info.serial == title_id.toStdString())
24462439
{
2447-
if (!locations.empty())
2440+
if (Emu.IsPathInsideDir(boot_path, gameinfo->info.path))
24482441
{
2449-
game_data_shortcuts.push_back(gameinfo);
2442+
if (!locations.empty())
2443+
{
2444+
game_data_shortcuts.push_back(gameinfo);
2445+
}
24502446
}
2451-
}
24522447

2453-
break;
2448+
break;
2449+
}
24542450
}
24552451
}
2452+
2453+
if (!game_data_shortcuts.empty() && !locations.empty())
2454+
{
2455+
m_game_list_frame->CreateShortcuts(game_data_shortcuts, locations);
2456+
}
24562457
}
24572458

2458-
if (!game_data_shortcuts.empty() && !locations.empty())
2459+
if (precompile_caches)
24592460
{
2460-
m_game_list_frame->CreateShortcuts(game_data_shortcuts, locations);
2461+
PrecompileCachesFromInstalledPackages(paths);
24612462
}
24622463
});
24632464

0 commit comments

Comments
 (0)