From 77f9ecd32b075fb8986103de5e446fa330210526 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Wed, 10 Apr 2019 12:12:49 -0400 Subject: card_image: Add functions to query gamecard update partition Includes version and meta title ID, used by fsp-srv/IDeviceOperator --- src/core/file_sys/card_image.cpp | 20 ++++++++++++++++++++ src/core/file_sys/card_image.h | 4 ++++ 2 files changed, 24 insertions(+) (limited to 'src/core/file_sys') diff --git a/src/core/file_sys/card_image.cpp b/src/core/file_sys/card_image.cpp index 626ed0042..9fb6e0178 100644 --- a/src/core/file_sys/card_image.cpp +++ b/src/core/file_sys/card_image.cpp @@ -175,6 +175,26 @@ VirtualDir XCI::GetParentDirectory() const { return file->GetContainingDirectory(); } +VirtualDir XCI::ConcatenatedPseudoDirectory() { + const auto out = std::make_shared(); + for (const auto& part_id : {XCIPartition::Normal, XCIPartition::Logo, XCIPartition::Secure}) { + const auto& part = GetPartition(part_id); + if (part == nullptr) + continue; + + for (const auto& file : part->GetFiles()) + out->AddFile(file); + } + + return out; +} + +std::array XCI::GetCertificate() const { + std::array out; + file->Read(out.data(), out.size(), GAMECARD_CERTIFICATE_OFFSET); + return out; +} + Loader::ResultStatus XCI::AddNCAFromPartition(XCIPartition part) { const auto partition_index = static_cast(part); const auto& partition = partitions[partition_index]; diff --git a/src/core/file_sys/card_image.h b/src/core/file_sys/card_image.h index a350496f7..5a83acc1c 100644 --- a/src/core/file_sys/card_image.h +++ b/src/core/file_sys/card_image.h @@ -91,6 +91,8 @@ public: VirtualDir GetLogoPartition() const; u64 GetProgramTitleID() const; + u32 GetSystemUpdateVersion(); + u64 GetSystemUpdateTitleID() const; bool HasProgramNCA() const; VirtualFile GetProgramNCAFile() const; @@ -120,6 +122,8 @@ private: std::shared_ptr program; std::vector> ncas; + u64 update_normal_partition_end; + Core::Crypto::KeyManager keys; }; } // namespace FileSys -- cgit v1.2.3