mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
VolumeWad: Implement GetTicket
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user