From 6135ddc7f7e0ed0f9d951cc41ecc1cd4e598d69e Mon Sep 17 00:00:00 2001 From: squidbus <175574877+squidbus@users.noreply.github.com> Date: Sat, 2 Nov 2024 15:40:11 -0700 Subject: [PATCH] qt: Error if installing DLC without game. --- src/qt_gui/main_window.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/qt_gui/main_window.cpp b/src/qt_gui/main_window.cpp index e52820102d..8e56a6e9d6 100644 --- a/src/qt_gui/main_window.cpp +++ b/src/qt_gui/main_window.cpp @@ -673,6 +673,12 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int QMessageBox::critical(this, tr("PKG ERROR"), QString::fromStdString(failreason)); return; } + if (!psf.Open(pkg.sfo)) { + QMessageBox::critical(this, tr("PKG ERROR"), + "Could not read SFO. Check log for details"); + return; + } + auto category = psf.GetString("CATEGORY"); InstallDirSelect ids; ids.exec(); auto game_install_dir = ids.getSelectedDirectory(); @@ -689,12 +695,6 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int QMessageBox msgBox; msgBox.setWindowTitle(tr("PKG Extraction")); - if (!psf.Open(pkg.sfo)) { - QMessageBox::critical(this, tr("PKG ERROR"), - "Could not read SFO. Check log for details"); - return; - } - std::string content_id; if (auto value = psf.GetString("CONTENT_ID"); value.has_value()) { content_id = std::string{*value}; @@ -709,7 +709,6 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int QString addonDirPath; Common::FS::PathToQString(addonDirPath, addon_extract_path); QDir addon_dir(addonDirPath); - auto category = psf.GetString("CATEGORY"); if (pkgType.contains("PATCH")) { QString pkg_app_version; @@ -802,9 +801,10 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int } } else { // Do nothing; - if (pkgType.contains("PATCH")) { - QMessageBox::information(this, tr("PKG Extraction"), - tr("PKG is a patch, please install the game first!")); + if (pkgType.contains("PATCH") || category == "ac") { + QMessageBox::information( + this, tr("PKG Extraction"), + tr("PKG is a patch or DLC, please install the game first!")); return; } // what else?