diff --git a/src/core/importer.cpp b/src/core/importer.cpp index 36beeda..3f7713a 100644 --- a/src/core/importer.cpp +++ b/src/core/importer.cpp @@ -498,7 +498,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 || type == ContentType::SystemApplet; + const bool is_nand = IsNandTitle(type); auto& title_db = is_nand ? nand_title_db : sdmc_title_db; const auto physical_path = @@ -708,8 +708,7 @@ bool SDMCImporter::BuildCIA(CIABuildType build_type, const ContentSpecifier& spe return false; } - const bool is_nand = - specifier.type == ContentType::SystemTitle || specifier.type == ContentType::SystemApplet; + const bool is_nand = IsNandTitle(specifier.type); const auto physical_path = is_nand ? fmt::format("{}{:08x}/{:08x}/content/", config.system_titles_path, (specifier.id >> 32), (specifier.id & 0xFFFFFFFF)) @@ -827,8 +826,7 @@ bool SDMCImporter::CheckTitleContents(const ContentSpecifier& specifier, Common::ProgressCallbackWrapper wrapper{specifier.maximum_size}; - const bool is_nand = - specifier.type == ContentType::SystemTitle || specifier.type == ContentType::SystemApplet; + const bool is_nand = IsNandTitle(specifier.type); 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 f9a3657..477adee 100644 --- a/src/core/importer.h +++ b/src/core/importer.h @@ -42,6 +42,9 @@ constexpr bool IsTitle(ContentType type) { type == ContentType::DLC || type == ContentType::SystemTitle || type == ContentType::SystemApplet; } +constexpr bool IsNandTitle(ContentType type) { + return 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 cbea23b..4803e19 100644 --- a/src/frontend/import_dialog.cpp +++ b/src/frontend/import_dialog.cpp @@ -768,8 +768,7 @@ void ImportDialog::StartBatchDumpingCXI() { void ImportDialog::StartBuildingCIASingle(const Core::ContentSpecifier& specifier) { CIABuildDialog dialog(this, /*is_dir*/ false, - /*is_nand*/ specifier.type == Core::ContentType::SystemTitle || - specifier.type == Core::ContentType::SystemApplet, + /*is_nand*/ Core::IsNandTitle(specifier.type), /*enable_legit*/ importer->CanBuildLegitCIA(specifier), last_build_cia_path); if (dialog.exec() != QDialog::Accepted) { @@ -813,11 +812,9 @@ void ImportDialog::StartBatchBuildingCIA() { to_import.erase(removed_iter, to_import.end()); - const bool is_nand = std::all_of(to_import.begin(), to_import.end(), - [](const Core::ContentSpecifier& specifier) { - return specifier.type == Core::ContentType::SystemTitle || - specifier.type == Core::ContentType::SystemApplet; - }); + const bool is_nand = std::all_of( + to_import.begin(), to_import.end(), + [](const Core::ContentSpecifier& specifier) { return Core::IsNandTitle(specifier.type); }); const bool enable_legit = std::all_of(to_import.begin(), to_import.end(), [this](const Core::ContentSpecifier& specifier) { return importer->CanBuildLegitCIA(specifier);