Replace some usages of IVolume::ReadSwapped with IBlobReader::ReadSwapped
Skips needing to specify PARTITION_NONE.
This commit is contained in:
parent
fcb2c5bd29
commit
78effbabc6
|
@ -29,11 +29,11 @@ CVolumeWAD::CVolumeWAD(std::unique_ptr<IBlobReader> reader) : m_reader(std::move
|
|||
_assert_(m_reader);
|
||||
|
||||
// Source: http://wiibrew.org/wiki/WAD_files
|
||||
ReadSwapped(0x00, &m_hdr_size, PARTITION_NONE);
|
||||
ReadSwapped(0x08, &m_cert_size, PARTITION_NONE);
|
||||
ReadSwapped(0x10, &m_tick_size, PARTITION_NONE);
|
||||
ReadSwapped(0x14, &m_tmd_size, PARTITION_NONE);
|
||||
ReadSwapped(0x18, &m_data_size, PARTITION_NONE);
|
||||
m_reader->ReadSwapped(0x00, &m_hdr_size);
|
||||
m_reader->ReadSwapped(0x08, &m_cert_size);
|
||||
m_reader->ReadSwapped(0x10, &m_tick_size);
|
||||
m_reader->ReadSwapped(0x14, &m_tmd_size);
|
||||
m_reader->ReadSwapped(0x18, &m_data_size);
|
||||
|
||||
m_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) +
|
||||
|
|
|
@ -186,13 +186,13 @@ Partition CVolumeWiiCrypted::GetGamePartition() const
|
|||
|
||||
bool CVolumeWiiCrypted::GetTitleID(u64* buffer, const Partition& partition) const
|
||||
{
|
||||
return ReadSwapped(partition.offset + 0x1DC, buffer, PARTITION_NONE);
|
||||
return m_pReader->ReadSwapped(partition.offset + 0x1DC, buffer);
|
||||
}
|
||||
|
||||
IOS::ES::TicketReader CVolumeWiiCrypted::GetTicket(const Partition& partition) const
|
||||
{
|
||||
std::vector<u8> buffer(0x2a4);
|
||||
Read(partition.offset, buffer.size(), buffer.data(), PARTITION_NONE);
|
||||
m_pReader->Read(partition.offset, buffer.size(), buffer.data());
|
||||
return IOS::ES::TicketReader{std::move(buffer)};
|
||||
}
|
||||
|
||||
|
@ -201,9 +201,9 @@ IOS::ES::TMDReader CVolumeWiiCrypted::GetTMD(const Partition& partition) const
|
|||
u32 tmd_size = 0;
|
||||
u32 tmd_address = 0;
|
||||
|
||||
if (!ReadSwapped(partition.offset + 0x2a4, &tmd_size, PARTITION_NONE))
|
||||
if (!m_pReader->ReadSwapped(partition.offset + 0x2a4, &tmd_size))
|
||||
return {};
|
||||
if (!ReadSwapped(partition.offset + 0x2a8, &tmd_address, PARTITION_NONE))
|
||||
if (!m_pReader->ReadSwapped(partition.offset + 0x2a8, &tmd_address))
|
||||
return {};
|
||||
tmd_address <<= 2;
|
||||
|
||||
|
@ -218,7 +218,7 @@ IOS::ES::TMDReader CVolumeWiiCrypted::GetTMD(const Partition& partition) const
|
|||
}
|
||||
|
||||
std::vector<u8> buffer(tmd_size);
|
||||
if (!Read(partition.offset + tmd_address, tmd_size, buffer.data(), PARTITION_NONE))
|
||||
if (!m_pReader->Read(partition.offset + tmd_address, tmd_size, buffer.data()))
|
||||
return {};
|
||||
|
||||
return IOS::ES::TMDReader{std::move(buffer)};
|
||||
|
@ -246,7 +246,7 @@ std::string CVolumeWiiCrypted::GetGameID(const Partition& partition) const
|
|||
Region CVolumeWiiCrypted::GetRegion() const
|
||||
{
|
||||
u32 region_code;
|
||||
if (!ReadSwapped(0x4E000, ®ion_code, PARTITION_NONE))
|
||||
if (!m_pReader->ReadSwapped(0x4E000, ®ion_code))
|
||||
return Region::UNKNOWN_REGION;
|
||||
|
||||
return static_cast<Region>(region_code);
|
||||
|
@ -375,7 +375,7 @@ bool CVolumeWiiCrypted::CheckIntegrity(const Partition& partition) const
|
|||
|
||||
// Get partition data size
|
||||
u32 partSizeDiv4;
|
||||
Read(partition.offset + 0x2BC, 4, (u8*)&partSizeDiv4, PARTITION_NONE);
|
||||
m_pReader->Read(partition.offset + 0x2BC, 4, (u8*)&partSizeDiv4);
|
||||
u64 partDataSize = (u64)Common::swap32(partSizeDiv4) * 4;
|
||||
|
||||
u32 nClusters = (u32)(partDataSize / 0x8000);
|
||||
|
@ -387,7 +387,7 @@ bool CVolumeWiiCrypted::CheckIntegrity(const Partition& partition) const
|
|||
u8 clusterMDCrypted[0x400];
|
||||
u8 clusterMD[0x400];
|
||||
u8 IV[16] = {0};
|
||||
if (!Read(clusterOff, 0x400, clusterMDCrypted, PARTITION_NONE))
|
||||
if (!m_pReader->Read(clusterOff, 0x400, clusterMDCrypted))
|
||||
{
|
||||
WARN_LOG(DISCIO, "Integrity Check: fail at cluster %d: could not read metadata", clusterID);
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue