diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2022-08-04 22:20:08 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-04 22:20:08 +0200 |
| commit | 5508c52a952557728f6a594686e4b637fa2b2766 (patch) | |
| tree | 0ab11c263c4ffda0a6ce17f5fd38faf5428c10b5 /Source/Core/DiscIO/DiscScrubber.cpp | |
| parent | ceae42b754c479dd60461323afa5a8bc90a4dfc2 (diff) | |
| parent | 6fc3bbbdd9caa53157ea850f19fa0f8d5da7c3f7 (diff) | |
Merge pull request #10932 from JosJuice/nfs
DiscIO: Add support for the NFS format
Diffstat (limited to 'Source/Core/DiscIO/DiscScrubber.cpp')
| -rw-r--r-- | Source/Core/DiscIO/DiscScrubber.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Source/Core/DiscIO/DiscScrubber.cpp b/Source/Core/DiscIO/DiscScrubber.cpp index de0f17bb64..22aa06571e 100644 --- a/Source/Core/DiscIO/DiscScrubber.cpp +++ b/Source/Core/DiscIO/DiscScrubber.cpp @@ -30,7 +30,7 @@ bool DiscScrubber::SetupScrub(const Volume* disc) return false; m_disc = disc; - m_file_size = m_disc->GetSize(); + m_file_size = m_disc->GetDataSize(); // Round up when diving by CLUSTER_SIZE, otherwise MarkAsUsed might write out of bounds const size_t num_clusters = static_cast<size_t>((m_file_size + CLUSTER_SIZE - 1) / CLUSTER_SIZE); @@ -47,7 +47,11 @@ bool DiscScrubber::SetupScrub(const Volume* disc) bool DiscScrubber::CanBlockBeScrubbed(u64 offset) const { - return m_is_scrubbing && m_free_table[offset / CLUSTER_SIZE]; + if (!m_is_scrubbing) + return false; + + const u64 cluster_index = offset / CLUSTER_SIZE; + return cluster_index >= m_free_table.size() || m_free_table[cluster_index]; } void DiscScrubber::MarkAsUsed(u64 offset, u64 size) @@ -92,7 +96,7 @@ void DiscScrubber::MarkAsUsedE(u64 partition_data_offset, u64 offset, u64 size) // Compensate for 0x400 (SHA-1) per 0x8000 (cluster), and round to whole clusters u64 DiscScrubber::ToClusterOffset(u64 offset) const { - if (m_disc->IsEncryptedAndHashed()) + if (m_disc->HasWiiHashes()) return offset / 0x7c00 * CLUSTER_SIZE; else return Common::AlignDown(offset, CLUSTER_SIZE); |
