diff options
| author | Lioncash <mathew1800@gmail.com> | 2018-05-30 04:27:50 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2018-05-30 04:34:57 -0400 |
| commit | efabfc0b5481b2f40c13213dfba3a2671eb96b0b (patch) | |
| tree | 965c9877a7326b70a37a6037ec8afb0d0bd8c669 /Source/Core/DiscIO/VolumeWii.cpp | |
| parent | 24e0b4bf527691d62c92cc0af9c238e13f0f6bdd (diff) | |
VolumeWii: Use ReadSwapped for retrieving the partition data size in CheckIntegrity()
Also make this a little more robust by handling the failure case for
the read as well.
Diffstat (limited to 'Source/Core/DiscIO/VolumeWii.cpp')
| -rw-r--r-- | Source/Core/DiscIO/VolumeWii.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Source/Core/DiscIO/VolumeWii.cpp b/Source/Core/DiscIO/VolumeWii.cpp index c9960a441f..5d9d4b3983 100644 --- a/Source/Core/DiscIO/VolumeWii.cpp +++ b/Source/Core/DiscIO/VolumeWii.cpp @@ -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 = |
