From 78effbabc6e4b3131ac9eef3f9b8fd7e56a885f0 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Fri, 19 May 2017 21:31:47 +0200 Subject: [PATCH] Replace some usages of IVolume::ReadSwapped with IBlobReader::ReadSwapped Skips needing to specify PARTITION_NONE. --- Source/Core/DiscIO/VolumeWad.cpp | 10 +++++----- Source/Core/DiscIO/VolumeWiiCrypted.cpp | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp index a8316c9e04..b401a3787e 100644 --- a/Source/Core/DiscIO/VolumeWad.cpp +++ b/Source/Core/DiscIO/VolumeWad.cpp @@ -29,11 +29,11 @@ CVolumeWAD::CVolumeWAD(std::unique_ptr 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) + diff --git a/Source/Core/DiscIO/VolumeWiiCrypted.cpp b/Source/Core/DiscIO/VolumeWiiCrypted.cpp index cde3f8fda4..b77294640e 100644 --- a/Source/Core/DiscIO/VolumeWiiCrypted.cpp +++ b/Source/Core/DiscIO/VolumeWiiCrypted.cpp @@ -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 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 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_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;