file_sys/title_metadata: extend accessible content chunk data

This commit is contained in:
shinyquagsire23 2017-10-05 16:12:35 -06:00
parent 74d4050924
commit 8b448dc277
2 changed files with 17 additions and 2 deletions

View File

@ -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;
}

View File

@ -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<u8> tmd_signature;