mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 16:32:39 +00:00
Added recursive search to pkg installing
This commit is contained in:
parent
5ad8aeb30c
commit
79cebcbef4
@ -122,7 +122,7 @@ void PathToQString(QString& result, const std::filesystem::path& path);
|
|||||||
*
|
*
|
||||||
* @param dir Base directory to start the search from
|
* @param dir Base directory to start the search from
|
||||||
* @param game_id The game ID to search for
|
* @param game_id The game ID to search for
|
||||||
* @param max_depth Maximum directory depth to search (default: 2)
|
* @param max_depth Maximum directory depth to search
|
||||||
*
|
*
|
||||||
* @returns Path to eboot.bin if found, std::nullopt otherwise
|
* @returns Path to eboot.bin if found, std::nullopt otherwise
|
||||||
*/
|
*/
|
||||||
|
@ -728,12 +728,42 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int
|
|||||||
InstallDirSelect ids;
|
InstallDirSelect ids;
|
||||||
ids.exec();
|
ids.exec();
|
||||||
auto game_install_dir = ids.getSelectedDirectory();
|
auto game_install_dir = ids.getSelectedDirectory();
|
||||||
auto game_folder_path = game_install_dir / pkg.GetTitleID();
|
|
||||||
QString pkgType = QString::fromStdString(pkg.GetPkgFlags());
|
QString pkgType = QString::fromStdString(pkg.GetPkgFlags());
|
||||||
bool use_game_update = pkgType.contains("PATCH") && Config::getSeparateUpdateEnabled();
|
bool use_game_update = pkgType.contains("PATCH") && Config::getSeparateUpdateEnabled();
|
||||||
auto game_update_path = use_game_update
|
|
||||||
? game_install_dir / (std::string(pkg.GetTitleID()) + "-UPDATE")
|
// Default paths
|
||||||
: game_folder_path;
|
auto game_folder_path = game_install_dir / pkg.GetTitleID();
|
||||||
|
auto game_update_path = use_game_update
|
||||||
|
? game_folder_path.parent_path() / (std::string{pkg.GetTitleID()} + "-UPDATE")
|
||||||
|
: game_folder_path;
|
||||||
|
const int max_depth = 5;
|
||||||
|
|
||||||
|
if (pkgType.contains("PATCH")) {
|
||||||
|
// For patches, try to find the game recursively
|
||||||
|
auto found_game = Common::FS::FindGameByID(game_install_dir,
|
||||||
|
std::string{pkg.GetTitleID()}, max_depth);
|
||||||
|
if (found_game.has_value()) {
|
||||||
|
game_folder_path = found_game.value().parent_path();
|
||||||
|
game_update_path = use_game_update
|
||||||
|
? game_folder_path.parent_path() / (std::string{pkg.GetTitleID()} + "-UPDATE")
|
||||||
|
: game_folder_path;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// For base games, we check if the game is already installed
|
||||||
|
auto found_game = Common::FS::FindGameByID(game_install_dir,
|
||||||
|
std::string{pkg.GetTitleID()}, max_depth);
|
||||||
|
if (found_game.has_value()) {
|
||||||
|
game_folder_path = found_game.value().parent_path();
|
||||||
|
}
|
||||||
|
// If the game is not found, we install it in the game install directory
|
||||||
|
else {
|
||||||
|
game_folder_path = game_install_dir / pkg.GetTitleID();
|
||||||
|
}
|
||||||
|
game_update_path = use_game_update
|
||||||
|
? game_folder_path.parent_path() / (std::string{pkg.GetTitleID()} + "-UPDATE")
|
||||||
|
: game_folder_path;
|
||||||
|
}
|
||||||
|
|
||||||
QString gameDirPath;
|
QString gameDirPath;
|
||||||
Common::FS::PathToQString(gameDirPath, game_folder_path);
|
Common::FS::PathToQString(gameDirPath, game_folder_path);
|
||||||
QDir game_dir(gameDirPath);
|
QDir game_dir(gameDirPath);
|
||||||
@ -878,7 +908,8 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int
|
|||||||
connect(&futureWatcher, &QFutureWatcher<void>::finished, this, [=, this]() {
|
connect(&futureWatcher, &QFutureWatcher<void>::finished, this, [=, this]() {
|
||||||
if (pkgNum == nPkg) {
|
if (pkgNum == nPkg) {
|
||||||
QString path;
|
QString path;
|
||||||
Common::FS::PathToQString(path, game_install_dir);
|
// We want to show the parent path instead of the full path
|
||||||
|
Common::FS::PathToQString(path, game_folder_path.parent_path());
|
||||||
QMessageBox extractMsgBox(this);
|
QMessageBox extractMsgBox(this);
|
||||||
extractMsgBox.setWindowTitle(tr("Extraction Finished"));
|
extractMsgBox.setWindowTitle(tr("Extraction Finished"));
|
||||||
extractMsgBox.setText(
|
extractMsgBox.setText(
|
||||||
|
Loading…
Reference in New Issue
Block a user