summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/VolumeWad.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2019-03-23 13:05:42 +0100
committerJosJuice <josjuice@gmail.com>2019-03-30 12:45:17 +0100
commitabb3c5bccd0a678fb5c70417064854b006ed110c (patch)
tree0c32cc6c3eb7d309719ad25094363d7e83b36ae1 /Source/Core/DiscIO/VolumeWad.cpp
parentcf9ab6ddcc93cd279aaf62897095ac5b8929bab9 (diff)
VolumeWad: Implement GetTicket
Diffstat (limited to 'Source/Core/DiscIO/VolumeWad.cpp')
-rw-r--r--Source/Core/DiscIO/VolumeWad.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp
index a7316ffde9..48a315331b 100644
--- a/Source/Core/DiscIO/VolumeWad.cpp
+++ b/Source/Core/DiscIO/VolumeWad.cpp
@@ -33,16 +33,20 @@ VolumeWAD::VolumeWAD(std::unique_ptr<BlobReader> reader) : m_reader(std::move(re
// Source: http://wiibrew.org/wiki/WAD_files
m_hdr_size = m_reader->ReadSwapped<u32>(0x00).value_or(0);
m_cert_size = m_reader->ReadSwapped<u32>(0x08).value_or(0);
- m_tick_size = m_reader->ReadSwapped<u32>(0x10).value_or(0);
+ m_ticket_size = m_reader->ReadSwapped<u32>(0x10).value_or(0);
m_tmd_size = m_reader->ReadSwapped<u32>(0x14).value_or(0);
m_data_size = m_reader->ReadSwapped<u32>(0x18).value_or(0);
- m_offset = Common::AlignUp(m_hdr_size, 0x40) + Common::AlignUp(m_cert_size, 0x40);
+ m_ticket_offset = Common::AlignUp(m_hdr_size, 0x40) + Common::AlignUp(m_cert_size, 0x40);
m_tmd_offset = Common::AlignUp(m_hdr_size, 0x40) + Common::AlignUp(m_cert_size, 0x40) +
- Common::AlignUp(m_tick_size, 0x40);
+ 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);
+ std::vector<u8> ticket_buffer(m_ticket_size);
+ Read(m_ticket_offset, m_ticket_size, ticket_buffer.data());
+ m_ticket.SetBytes(std::move(ticket_buffer));
+
if (!IOS::ES::IsValidTMDSize(m_tmd_size))
{
ERROR_LOG(DISCIO, "TMD is too large: %u bytes", m_tmd_size);
@@ -95,6 +99,11 @@ Country VolumeWAD::GetCountry(const Partition& partition) const
return CountryCodeToCountry(country_byte, Platform::WiiWAD, region);
}
+const IOS::ES::TicketReader& VolumeWAD::GetTicket(const Partition& partition) const
+{
+ return m_ticket;
+}
+
const IOS::ES::TMDReader& VolumeWAD::GetTMD(const Partition& partition) const
{
return m_tmd;
@@ -126,7 +135,7 @@ std::string VolumeWAD::GetMakerID(const Partition& partition) const
std::optional<u64> VolumeWAD::GetTitleID(const Partition& partition) const
{
- return ReadSwapped<u64>(m_offset + 0x01DC, partition);
+ return ReadSwapped<u64>(m_ticket_offset + 0x01DC, partition);
}
std::optional<u16> VolumeWAD::GetRevision(const Partition& partition) const