Merge pull request #7025 from lioncash/integrity

VolumeWii: Use ReadSwapped for retrieving the partition data size in CheckIntegrity()
This commit is contained in:
Léo Lam 2018-05-30 10:55:13 +02:00 committed by GitHub
commit eb9969a1e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -394,11 +394,11 @@ bool VolumeWii::CheckIntegrity(const Partition& partition) const
return false;
// Get partition data size
u32 part_size_div4;
m_reader->Read(partition.offset + 0x2BC, sizeof(u32), reinterpret_cast<u8*>(&part_size_div4));
const u64 part_data_size = static_cast<u64>(Common::swap32(part_size_div4)) * 4;
const auto part_data_size = ReadSwappedAndShifted(partition.offset + 0x2BC, PARTITION_NONE);
if (!part_data_size)
return false;
const u32 num_clusters = static_cast<u32>(part_data_size / 0x8000);
const u32 num_clusters = static_cast<u32>(part_data_size.value() / 0x8000);
for (u32 cluster_id = 0; cluster_id < num_clusters; ++cluster_id)
{
const u64 cluster_offset =