From 1262f08ac119e5d12ec48688f66e8b12e52b6d29 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Fri, 31 Jul 2015 13:56:29 +0200 Subject: [PATCH] Filesystem: Better validity checking Now that the FST in read in the constructor, m_Valid can be set to false when there are errors in the FST. --- Source/Core/DiscIO/FileSystemGCWii.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Source/Core/DiscIO/FileSystemGCWii.cpp b/Source/Core/DiscIO/FileSystemGCWii.cpp index 813201b7a0..8e8254e21c 100644 --- a/Source/Core/DiscIO/FileSystemGCWii.cpp +++ b/Source/Core/DiscIO/FileSystemGCWii.cpp @@ -64,17 +64,10 @@ FileSystemGCWii::FileSystemGCWii(const Volume* _rVolume, const Partition& partit { // Check if this is a GameCube or Wii disc if (m_rVolume->ReadSwapped(0x18, m_partition) == u32(0x5D1C9EA3)) - { m_offset_shift = 2; // Wii file system - m_Valid = true; - } else if (m_rVolume->ReadSwapped(0x1c, m_partition) == u32(0xC2339F3D)) - { m_offset_shift = 0; // GameCube file system - m_Valid = true; - } - - if (!m_Valid) + else return; const std::optional fst_offset_unshifted = m_rVolume->ReadSwapped(0x424, m_partition); @@ -112,6 +105,9 @@ FileSystemGCWii::FileSystemGCWii(const Volume* _rVolume, const Partition& partit return; for (u32 i = 0; i < number_of_file_infos; i++) m_FileInfoVector.emplace_back(m_offset_shift, fst_start + (i * 0xC), name_table_start); + + // If we haven't returned yet, everything succeeded + m_Valid = true; } FileSystemGCWii::~FileSystemGCWii()