Skip to content

Commit 76f4408

Browse files
authored
qt: Error if installing DLC without game. (#1476)
1 parent 2918335 commit 76f4408

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/qt_gui/main_window.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,12 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int
673673
QMessageBox::critical(this, tr("PKG ERROR"), QString::fromStdString(failreason));
674674
return;
675675
}
676+
if (!psf.Open(pkg.sfo)) {
677+
QMessageBox::critical(this, tr("PKG ERROR"),
678+
"Could not read SFO. Check log for details");
679+
return;
680+
}
681+
auto category = psf.GetString("CATEGORY");
676682
InstallDirSelect ids;
677683
ids.exec();
678684
auto game_install_dir = ids.getSelectedDirectory();
@@ -689,12 +695,6 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int
689695
QMessageBox msgBox;
690696
msgBox.setWindowTitle(tr("PKG Extraction"));
691697

692-
if (!psf.Open(pkg.sfo)) {
693-
QMessageBox::critical(this, tr("PKG ERROR"),
694-
"Could not read SFO. Check log for details");
695-
return;
696-
}
697-
698698
std::string content_id;
699699
if (auto value = psf.GetString("CONTENT_ID"); value.has_value()) {
700700
content_id = std::string{*value};
@@ -709,7 +709,6 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int
709709
QString addonDirPath;
710710
Common::FS::PathToQString(addonDirPath, addon_extract_path);
711711
QDir addon_dir(addonDirPath);
712-
auto category = psf.GetString("CATEGORY");
713712

714713
if (pkgType.contains("PATCH")) {
715714
QString pkg_app_version;
@@ -802,9 +801,10 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int
802801
}
803802
} else {
804803
// Do nothing;
805-
if (pkgType.contains("PATCH")) {
806-
QMessageBox::information(this, tr("PKG Extraction"),
807-
tr("PKG is a patch, please install the game first!"));
804+
if (pkgType.contains("PATCH") || category == "ac") {
805+
QMessageBox::information(
806+
this, tr("PKG Extraction"),
807+
tr("PKG is a patch or DLC, please install the game first!"));
808808
return;
809809
}
810810
// what else?

0 commit comments

Comments
 (0)