diff options
| author | Léo Lam <leo@leolam.fr> | 2021-03-16 11:03:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-16 11:03:36 +0100 |
| commit | c8d8f9ef8506e8ca30b134b307b77a95c7b91623 (patch) | |
| tree | ea39d6f9c2bd07120d3edaf38d7b10a16b1264a8 /Source/Core/DiscIO/VolumeVerifier.cpp | |
| parent | 3fcc018fa7173e80b52758ca81b5d00eef018ac6 (diff) | |
| parent | e47c9764de5c2e8f273c9dcf52b3730914f05521 (diff) | |
Merge pull request #9577 from JosJuice/di-unknown-size-hack
DVDInterface: Make the WBFS/CISO hack only affect WBFS/CISO
Diffstat (limited to 'Source/Core/DiscIO/VolumeVerifier.cpp')
| -rw-r--r-- | Source/Core/DiscIO/VolumeVerifier.cpp | 70 |
1 files changed, 3 insertions, 67 deletions
diff --git a/Source/Core/DiscIO/VolumeVerifier.cpp b/Source/Core/DiscIO/VolumeVerifier.cpp index 21ac8f5d39..79c589f5c1 100644 --- a/Source/Core/DiscIO/VolumeVerifier.cpp +++ b/Source/Core/DiscIO/VolumeVerifier.cpp @@ -41,8 +41,8 @@ #include "Core/IOS/IOS.h" #include "Core/IOS/IOSC.h" #include "DiscIO/Blob.h" -#include "DiscIO/DiscExtractor.h" #include "DiscIO/DiscScrubber.h" +#include "DiscIO/DiscUtils.h" #include "DiscIO/Enums.h" #include "DiscIO/Filesystem.h" #include "DiscIO/Volume.h" @@ -358,12 +358,6 @@ RedumpVerifier::Result RedumpVerifier::Finish(const Hashes<std::vector<u8>>& has return {Status::Unknown, Common::GetStringT("Unknown disc")}; } -constexpr u64 MINI_DVD_SIZE = 1459978240; // GameCube -constexpr u64 SL_DVD_SIZE = 4699979776; // Wii retail -constexpr u64 SL_DVD_R_SIZE = 4707319808; // Wii RVT-R -constexpr u64 DL_DVD_SIZE = 8511160320; // Wii retail -constexpr u64 DL_DVD_R_SIZE = 8543666176; // Wii RVT-R - constexpr u64 BLOCK_SIZE = 0x20000; VolumeVerifier::VolumeVerifier(const Volume& volume, bool redump_verification, @@ -397,7 +391,7 @@ void VolumeVerifier::Start() const std::vector<Partition> partitions = CheckPartitions(); if (IsDisc(m_volume.GetVolumeType())) - m_biggest_referenced_offset = GetBiggestReferencedOffset(partitions); + m_biggest_referenced_offset = GetBiggestReferencedOffset(m_volume, partitions); CheckMisc(); @@ -529,12 +523,11 @@ bool VolumeVerifier::CheckPartition(const Partition& partition) bool invalid_header = false; bool blank_contents = false; std::vector<u8> disc_header(0x80); - constexpr u32 WII_MAGIC = 0x5D1C9EA3; if (!m_volume.Read(0, disc_header.size(), disc_header.data(), partition)) { invalid_header = true; } - else if (Common::swap32(disc_header.data() + 0x18) != WII_MAGIC) + else if (Common::swap32(disc_header.data() + 0x18) != WII_DISC_MAGIC) { for (size_t i = 0; i < disc_header.size(); i += 4) { @@ -822,63 +815,6 @@ void VolumeVerifier::CheckVolumeSize() } } -u64 VolumeVerifier::GetBiggestReferencedOffset(const std::vector<Partition>& partitions) const -{ - const u64 disc_header_size = m_volume.GetVolumeType() == Platform::GameCubeDisc ? 0x460 : 0x50000; - u64 biggest_offset = disc_header_size; - for (const Partition& partition : partitions) - { - if (partition != PARTITION_NONE) - { - const u64 offset = m_volume.PartitionOffsetToRawOffset(0x440, partition); - biggest_offset = std::max(biggest_offset, offset); - } - - const std::optional<u64> dol_offset = GetBootDOLOffset(m_volume, partition); - if (dol_offset) - { - const std::optional<u64> dol_size = GetBootDOLSize(m_volume, partition, *dol_offset); - if (dol_size) - { - const u64 offset = m_volume.PartitionOffsetToRawOffset(*dol_offset + *dol_size, partition); - biggest_offset = std::max(biggest_offset, offset); - } - } - - const std::optional<u64> fst_offset = GetFSTOffset(m_volume, partition); - const std::optional<u64> fst_size = GetFSTSize(m_volume, partition); - if (fst_offset && fst_size) - { - const u64 offset = m_volume.PartitionOffsetToRawOffset(*fst_offset + *fst_size, partition); - biggest_offset = std::max(biggest_offset, offset); - } - - const FileSystem* fs = m_volume.GetFileSystem(partition); - if (fs) - { - const u64 offset = - m_volume.PartitionOffsetToRawOffset(GetBiggestReferencedOffset(fs->GetRoot()), partition); - biggest_offset = std::max(biggest_offset, offset); - } - } - return biggest_offset; -} - -u64 VolumeVerifier::GetBiggestReferencedOffset(const FileInfo& file_info) const -{ - if (file_info.IsDirectory()) - { - u64 biggest_offset = 0; - for (const FileInfo& f : file_info) - biggest_offset = std::max(biggest_offset, GetBiggestReferencedOffset(f)); - return biggest_offset; - } - else - { - return file_info.GetOffset() + file_info.GetSize(); - } -} - void VolumeVerifier::CheckMisc() { const std::string game_id_unencrypted = m_volume.GetGameID(PARTITION_NONE); |
