diff --git a/src/core/importer.cpp b/src/core/importer.cpp index 5f29131..d071334 100644 --- a/src/core/importer.cpp +++ b/src/core/importer.cpp @@ -488,7 +488,7 @@ static std::string FindTMD(const std::string& path) { } bool SDMCImporter::LoadTMD(ContentType type, u64 id, TitleMetadata& out) const { - const bool is_nand = type == ContentType::SystemTitle; + const bool is_nand = type == ContentType::SystemTitle || type == ContentType::SystemApplet; auto& title_db = is_nand ? nand_title_db : sdmc_title_db; const auto physical_path = @@ -656,8 +656,7 @@ void SDMCImporter::AbortDumpCXI() { } bool SDMCImporter::CanBuildLegitCIA(const ContentSpecifier& specifier) const { - if (specifier.type != ContentType::Application && specifier.type != ContentType::Update && - specifier.type != ContentType::DLC && specifier.type != ContentType::SystemTitle) { + if (!CanBuildCIA(specifier.type)) { return false; } @@ -681,9 +680,7 @@ bool SDMCImporter::BuildCIA(CIABuildType build_type, const ContentSpecifier& spe return false; } - if (specifier.type != ContentType::Application && specifier.type != ContentType::Update && - specifier.type != ContentType::DLC && specifier.type != ContentType::SystemTitle) { - + if (!CanBuildCIA(specifier.type)) { LOG_ERROR(Core, "Unsupported specifier type {}", static_cast(specifier.type)); return false; } @@ -694,7 +691,8 @@ bool SDMCImporter::BuildCIA(CIABuildType build_type, const ContentSpecifier& spe return false; } - const bool is_nand = specifier.type == ContentType::SystemTitle; + const bool is_nand = + specifier.type == ContentType::SystemTitle || specifier.type == ContentType::SystemApplet; const auto physical_path = is_nand ? fmt::format("{}{:08x}/{:08x}/content/", config.system_titles_path, (specifier.id >> 32), (specifier.id & 0xFFFFFFFF)) diff --git a/src/core/importer.h b/src/core/importer.h index 0079d74..0b53a66 100644 --- a/src/core/importer.h +++ b/src/core/importer.h @@ -36,6 +36,12 @@ enum class ContentType { SystemApplet, // This should belong to System Title, but they cause problems so a new category. }; +constexpr bool CanBuildCIA(ContentType type) { + return type == ContentType::Application || type == ContentType::Update || + type == ContentType::DLC || type == ContentType::SystemTitle || + type == ContentType::SystemApplet; +} + /** * Encryption type of an importable content. */ diff --git a/src/frontend/import_dialog.cpp b/src/frontend/import_dialog.cpp index 5f7d562..ee60468 100644 --- a/src/frontend/import_dialog.cpp +++ b/src/frontend/import_dialog.cpp @@ -511,10 +511,8 @@ void ImportDialog::OnContextMenu(const QPoint& point) { connect(dump_cxi, &QAction::triggered, [this, specifier] { StartDumpingCXISingle(specifier); }); } - if (specifier.type == Core::ContentType::Application || - specifier.type == Core::ContentType::Update || - specifier.type == Core::ContentType::DLC) { - QAction* build_cia = context_menu.addAction(tr("Build CIA (standard)")); + if (Core::CanBuildCIA(specifier.type)) { + QAction* build_cia = context_menu.addAction(tr("Build CIA...")); connect(build_cia, &QAction::triggered, [this, specifier] { StartBuildingCIASingle(specifier); }); } @@ -802,7 +800,8 @@ void ImportDialog::StartBatchDumpingCXI() { void ImportDialog::StartBuildingCIASingle(const Core::ContentSpecifier& specifier) { CIABuildDialog dialog(this, /*is_dir*/ false, - /*is_nand*/ specifier.type == Core::ContentType::SystemTitle, + /*is_nand*/ specifier.type == Core::ContentType::SystemTitle || + specifier.type == Core::ContentType::SystemApplet, /*enable_legit*/ importer->CanBuildLegitCIA(specifier), last_build_cia_path); if (dialog.exec() != QDialog::Accepted) { @@ -829,12 +828,8 @@ void ImportDialog::StartBatchBuildingCIA() { } const auto removed_iter = std::remove_if( - to_import.begin(), to_import.end(), [](const Core::ContentSpecifier& specifier) { - return specifier.type != Core::ContentType::Application && - specifier.type != Core::ContentType::Update && - specifier.type != Core::ContentType::DLC && - specifier.type != Core::ContentType::SystemTitle; - }); + to_import.begin(), to_import.end(), + [](const Core::ContentSpecifier& specifier) { return !Core::CanBuildCIA(specifier.type); }); if (removed_iter == to_import.begin()) { // No Titles selected QMessageBox::critical(this, tr("threeSD"), tr("The contents selected are not supported.
You can only build " @@ -852,7 +847,8 @@ void ImportDialog::StartBatchBuildingCIA() { const bool is_nand = std::all_of(to_import.begin(), to_import.end(), [](const Core::ContentSpecifier& specifier) { - return specifier.type == Core::ContentType::SystemTitle; + return specifier.type == Core::ContentType::SystemTitle || + specifier.type == Core::ContentType::SystemApplet; }); const bool enable_legit = std::all_of(to_import.begin(), to_import.end(), [this](const Core::ContentSpecifier& specifier) {