From 8b448dc277115da574156ecbcbd5a7d7bf8856bf Mon Sep 17 00:00:00 2001 From: shinyquagsire23 Date: Thu, 5 Oct 2017 16:12:35 -0600 Subject: [PATCH] file_sys/title_metadata: extend accessible content chunk data --- src/core/file_sys/title_metadata.cpp | 12 ++++++++++++ src/core/file_sys/title_metadata.h | 7 +++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/core/file_sys/title_metadata.cpp b/src/core/file_sys/title_metadata.cpp index 1ef8840a0..fa99da1be 100644 --- a/src/core/file_sys/title_metadata.cpp +++ b/src/core/file_sys/title_metadata.cpp @@ -153,6 +153,18 @@ u32 TitleMetadata::GetDLPContentID() const { return tmd_chunks[TMDContentIndex::DLP].id; } +u32 TitleMetadata::GetContentIDByIndex(u16 index) const { + return tmd_chunks[index].id; +} + +u16 TitleMetadata::GetContentTypeByIndex(u16 index) const { + return tmd_chunks[index].type; +} + +u64 TitleMetadata::GetContentSizeByIndex(u16 index) const { + return tmd_chunks[index].size; +} + void TitleMetadata::SetTitleID(u64 title_id) { tmd_body.title_id = title_id; } diff --git a/src/core/file_sys/title_metadata.h b/src/core/file_sys/title_metadata.h index 1fc157bf3..a52641251 100644 --- a/src/core/file_sys/title_metadata.h +++ b/src/core/file_sys/title_metadata.h @@ -35,6 +35,8 @@ enum TMDContentTypeFlag : u16 { Shared = 1 << 15 }; +enum TMDContentIndex { Main = 0, Manual = 1, DLP = 2 }; + /** * Helper which implements an interface to read and write Title Metadata (TMD) files. * If a file path is provided and the file exists, it can be parsed and used, otherwise @@ -102,6 +104,9 @@ public: u32 GetBootContentID() const; u32 GetManualContentID() const; u32 GetDLPContentID() const; + u32 GetContentIDByIndex(u16 index) const; + u16 GetContentTypeByIndex(u16 index) const; + u64 GetContentSizeByIndex(u16 index) const; void SetTitleID(u64 title_id); void SetTitleType(u32 type); @@ -112,8 +117,6 @@ public: void Print() const; private: - enum TMDContentIndex { Main = 0, Manual = 1, DLP = 2 }; - Body tmd_body; u32_be signature_type; std::vector tmd_signature;