mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-10 12:45:46 +00:00
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);
|
_assert_(m_reader);
|
||||||
|
|
||||||
// Source: http://wiibrew.org/wiki/WAD_files
|
// Source: http://wiibrew.org/wiki/WAD_files
|
||||||
ReadSwapped(0x00, &m_hdr_size, PARTITION_NONE);
|
m_reader->ReadSwapped(0x00, &m_hdr_size);
|
||||||
ReadSwapped(0x08, &m_cert_size, PARTITION_NONE);
|
m_reader->ReadSwapped(0x08, &m_cert_size);
|
||||||
ReadSwapped(0x10, &m_tick_size, PARTITION_NONE);
|
m_reader->ReadSwapped(0x10, &m_tick_size);
|
||||||
ReadSwapped(0x14, &m_tmd_size, PARTITION_NONE);
|
m_reader->ReadSwapped(0x14, &m_tmd_size);
|
||||||
ReadSwapped(0x18, &m_data_size, PARTITION_NONE);
|
m_reader->ReadSwapped(0x18, &m_data_size);
|
||||||
|
|
||||||
m_offset = Common::AlignUp(m_hdr_size, 0x40) + Common::AlignUp(m_cert_size, 0x40);
|
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) +
|
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
|
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
|
IOS::ES::TicketReader CVolumeWiiCrypted::GetTicket(const Partition& partition) const
|
||||||
{
|
{
|
||||||
std::vector<u8> buffer(0x2a4);
|
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)};
|
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_size = 0;
|
||||||
u32 tmd_address = 0;
|
u32 tmd_address = 0;
|
||||||
|
|
||||||
if (!ReadSwapped(partition.offset + 0x2a4, &tmd_size, PARTITION_NONE))
|
if (!m_pReader->ReadSwapped(partition.offset + 0x2a4, &tmd_size))
|
||||||
return {};
|
return {};
|
||||||
if (!ReadSwapped(partition.offset + 0x2a8, &tmd_address, PARTITION_NONE))
|
if (!m_pReader->ReadSwapped(partition.offset + 0x2a8, &tmd_address))
|
||||||
return {};
|
return {};
|
||||||
tmd_address <<= 2;
|
tmd_address <<= 2;
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ IOS::ES::TMDReader CVolumeWiiCrypted::GetTMD(const Partition& partition) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<u8> buffer(tmd_size);
|
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 {};
|
||||||
|
|
||||||
return IOS::ES::TMDReader{std::move(buffer)};
|
return IOS::ES::TMDReader{std::move(buffer)};
|
||||||
@ -246,7 +246,7 @@ std::string CVolumeWiiCrypted::GetGameID(const Partition& partition) const
|
|||||||
Region CVolumeWiiCrypted::GetRegion() const
|
Region CVolumeWiiCrypted::GetRegion() const
|
||||||
{
|
{
|
||||||
u32 region_code;
|
u32 region_code;
|
||||||
if (!ReadSwapped(0x4E000, ®ion_code, PARTITION_NONE))
|
if (!m_pReader->ReadSwapped(0x4E000, ®ion_code))
|
||||||
return Region::UNKNOWN_REGION;
|
return Region::UNKNOWN_REGION;
|
||||||
|
|
||||||
return static_cast<Region>(region_code);
|
return static_cast<Region>(region_code);
|
||||||
@ -375,7 +375,7 @@ bool CVolumeWiiCrypted::CheckIntegrity(const Partition& partition) const
|
|||||||
|
|
||||||
// Get partition data size
|
// Get partition data size
|
||||||
u32 partSizeDiv4;
|
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;
|
u64 partDataSize = (u64)Common::swap32(partSizeDiv4) * 4;
|
||||||
|
|
||||||
u32 nClusters = (u32)(partDataSize / 0x8000);
|
u32 nClusters = (u32)(partDataSize / 0x8000);
|
||||||
@ -387,7 +387,7 @@ bool CVolumeWiiCrypted::CheckIntegrity(const Partition& partition) const
|
|||||||
u8 clusterMDCrypted[0x400];
|
u8 clusterMDCrypted[0x400];
|
||||||
u8 clusterMD[0x400];
|
u8 clusterMD[0x400];
|
||||||
u8 IV[16] = {0};
|
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);
|
WARN_LOG(DISCIO, "Integrity Check: fail at cluster %d: could not read metadata", clusterID);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user