summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/VolumeVerifier.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2021-03-09 20:54:59 +0100
committerJosJuice <josjuice@gmail.com>2021-03-10 00:16:12 +0100
commitb14bf8273245374e14b1b62a1ba5e26e4cccf42d (patch)
tree1254f4453bbe3dc228f13438446cb34619d8f780 /Source/Core/DiscIO/VolumeVerifier.cpp
parent49ccc77ebb1862a61293a14ee1d1d8b18b7f1fe1 (diff)
DiscIO: Move some code from VolumeVerifier to DiscUtils
Diffstat (limited to 'Source/Core/DiscIO/VolumeVerifier.cpp')
-rw-r--r--Source/Core/DiscIO/VolumeVerifier.cpp65
1 files changed, 1 insertions, 64 deletions
diff --git a/Source/Core/DiscIO/VolumeVerifier.cpp b/Source/Core/DiscIO/VolumeVerifier.cpp
index c5fdb0cf91..d9ef9b991b 100644
--- a/Source/Core/DiscIO/VolumeVerifier.cpp
+++ b/Source/Core/DiscIO/VolumeVerifier.cpp
@@ -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();
@@ -822,63 +816,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);