VolumeVerifier: Verify WAD contents

This commit is contained in:
JosJuice
2019-03-30 17:42:31 +01:00
parent a469fb3150
commit 8709b21ac3
5 changed files with 82 additions and 6 deletions

View File

@ -40,8 +40,8 @@ VolumeWAD::VolumeWAD(std::unique_ptr<BlobReader> reader) : m_reader(std::move(re
m_cert_chain_offset = Common::AlignUp(m_hdr_size, 0x40);
m_ticket_offset = m_cert_chain_offset + Common::AlignUp(m_cert_chain_size, 0x40);
m_tmd_offset = m_ticket_offset + Common::AlignUp(m_ticket_size, 0x40);
m_opening_bnr_offset =
m_tmd_offset + Common::AlignUp(m_tmd_size, 0x40) + Common::AlignUp(m_data_size, 0x40);
m_data_offset = m_tmd_offset + Common::AlignUp(m_tmd_size, 0x40);
m_opening_bnr_offset = m_data_offset + Common::AlignUp(m_data_size, 0x40);
std::vector<u8> ticket_buffer(m_ticket_size);
Read(m_ticket_offset, m_ticket_size, ticket_buffer.data());
@ -118,6 +118,21 @@ const std::vector<u8>& VolumeWAD::GetCertificateChain(const Partition& partition
return m_cert_chain;
}
std::vector<u64> VolumeWAD::GetContentOffsets() const
{
const std::vector<IOS::ES::Content> contents = m_tmd.GetContents();
std::vector<u64> content_offsets;
content_offsets.reserve(contents.size());
u64 offset = m_data_offset;
for (const IOS::ES::Content& content : contents)
{
content_offsets.emplace_back(offset);
offset += Common::AlignUp(content.size, 0x40);
}
return content_offsets;
}
std::string VolumeWAD::GetGameID(const Partition& partition) const
{
return m_tmd.GetGameID();