diff --git a/source/hactool_processor.app_fs.cpp b/source/hactool_processor.app_fs.cpp index 7a214f9..9fe7741 100644 --- a/source/hactool_processor.app_fs.cpp +++ b/source/hactool_processor.app_fs.cpp @@ -264,6 +264,9 @@ namespace ams::hactool { /* Get the version. */ const auto version = meta_header->version; + /* We'll want to insert into the appropriate tracking holder. */ + auto &target = meta_header->type == ncm::ContentMetaType::Patch ? ctx->patches : ctx->apps; + /* Add all the content metas. */ for (size_t i = 0; i < meta_reader.GetContentCount(); ++i) { const auto &info = *meta_reader.GetContentInfo(i); @@ -274,7 +277,7 @@ namespace ams::hactool { } /* Check that we don't already have an info for the content. */ - if (auto existing = ctx->apps.Find(*app_id, version, info.GetIdOffset(), info.GetType()); existing != ctx->apps.end()) { + if (auto existing = target.Find(*app_id, version, info.GetIdOffset(), info.GetType()); existing != target.end()) { fprintf(stderr, "[Warning]: Ignoring duplicate entry { %016" PRIX64 ", %" PRIu32 ", %d, %d }\n", app_id->value, version, static_cast(info.GetIdOffset()), static_cast(info.GetType())); continue; } @@ -301,7 +304,7 @@ namespace ams::hactool { } /* Add the new version for the content. */ - auto *entry = ctx->apps.Insert(*app_id, version, info.GetIdOffset(), info.GetType()); + auto *entry = target.Insert(*app_id, version, info.GetIdOffset(), info.GetType()); entry->GetData().storage = std::move(storage); } @@ -348,6 +351,18 @@ namespace ams::hactool { this->PrintFormat(field_name, "{ Idx=%d, ProgramId=%016" PRIX64 ", Version=0x%08" PRIX32 ", IdOffset=%02" PRIX32 " }", app_idx, entry.GetId().value, entry.GetVersion(), entry.GetIdOffset()); field_name = ""; } + + if (ctx.patches.begin() != ctx.patches.end()) { + field_name = "Patches"; + for (const auto &entry : ctx.patches) { + if (entry.GetType() != ncm::ContentType::Program) { + continue; + } + + this->PrintFormat(field_name, "{ ProgramId=%016" PRIX64 ", Version=0x%08" PRIX32 ", IdOffset=%02" PRIX32 " }", entry.GetId().value, entry.GetVersion(), entry.GetIdOffset()); + field_name = ""; + } + } } /* TODO */ diff --git a/source/hactool_processor.hpp b/source/hactool_processor.hpp index 8704405..0301136 100644 --- a/source/hactool_processor.hpp +++ b/source/hactool_processor.hpp @@ -83,6 +83,7 @@ namespace ams::hactool { }; ApplicationContentsHolder apps; + ApplicationContentsHolder patches; }; struct ProcessAsXciContext { diff --git a/source/hactool_processor.nca.cpp b/source/hactool_processor.nca.cpp index 560894b..b4e51cd 100644 --- a/source/hactool_processor.nca.cpp +++ b/source/hactool_processor.nca.cpp @@ -106,7 +106,7 @@ namespace ams::hactool { /* Set output reader. */ *out = std::move(nca_reader); - return ResultSuccess(); + R_SUCCEED(); } } @@ -191,7 +191,7 @@ namespace ams::hactool { break; } } else { - fprintf(stderr, "[Warning]: Failed to open NCA section %d: 2%03d-%04d, NCA may be corrupt.\n", i, res.GetModule(), res.GetDescription()); + fprintf(stderr, "[Warning]: Failed to open NCA section %d: 2%03d-%04d, NCA may be corrupt.\n", i, real_res.GetModule(), real_res.GetDescription()); } } else if (fs::ResultPartitionNotFound::Includes(res)) { ctx->has_sections[i] = false; diff --git a/source/hactool_processor.npdm.cpp b/source/hactool_processor.npdm.cpp index eace2a1..2006712 100644 --- a/source/hactool_processor.npdm.cpp +++ b/source/hactool_processor.npdm.cpp @@ -603,6 +603,7 @@ namespace ams::hactool { this->PrintMagic(ctx.acid->magic); this->PrintHex("Version", ctx.acid->version); + this->PrintHex("Unknown 209", ctx.acid->unknown_209); this->PrintHex("Sign Key Generation", ctx.npdm->signature_key_generation); diff --git a/source/hactool_processor.xci.cpp b/source/hactool_processor.xci.cpp index ec8e432..0c241b4 100644 --- a/source/hactool_processor.xci.cpp +++ b/source/hactool_processor.xci.cpp @@ -375,6 +375,18 @@ namespace ams::hactool { this->PrintFormat(field_name, "{ Idx=%d, ProgramId=%016" PRIX64 ", Version=0x%08" PRIX32 ", IdOffset=%02" PRIX32 " }", app_idx, entry.GetId().value, entry.GetVersion(), entry.GetIdOffset()); field_name = ""; } + + if (ctx.app_ctx.patches.begin() != ctx.app_ctx.patches.end()) { + field_name = "Patches"; + for (const auto &entry : ctx.app_ctx.patches) { + if (entry.GetType() != ncm::ContentType::Program) { + continue; + } + + this->PrintFormat(field_name, "{ ProgramId=%016" PRIX64 ", Version=0x%08" PRIX32 ", IdOffset=%02" PRIX32 " }", entry.GetId().value, entry.GetVersion(), entry.GetIdOffset()); + field_name = ""; + } + } } AMS_UNUSED(ctx);