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.
This commit is contained in:
parent
afe2bc60f6
commit
1262f08ac1
|
@ -64,17 +64,10 @@ FileSystemGCWii::FileSystemGCWii(const Volume* _rVolume, const Partition& partit
|
||||||
{
|
{
|
||||||
// Check if this is a GameCube or Wii disc
|
// Check if this is a GameCube or Wii disc
|
||||||
if (m_rVolume->ReadSwapped<u32>(0x18, m_partition) == u32(0x5D1C9EA3))
|
if (m_rVolume->ReadSwapped<u32>(0x18, m_partition) == u32(0x5D1C9EA3))
|
||||||
{
|
|
||||||
m_offset_shift = 2; // Wii file system
|
m_offset_shift = 2; // Wii file system
|
||||||
m_Valid = true;
|
|
||||||
}
|
|
||||||
else if (m_rVolume->ReadSwapped<u32>(0x1c, m_partition) == u32(0xC2339F3D))
|
else if (m_rVolume->ReadSwapped<u32>(0x1c, m_partition) == u32(0xC2339F3D))
|
||||||
{
|
|
||||||
m_offset_shift = 0; // GameCube file system
|
m_offset_shift = 0; // GameCube file system
|
||||||
m_Valid = true;
|
else
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_Valid)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const std::optional<u32> fst_offset_unshifted = m_rVolume->ReadSwapped<u32>(0x424, m_partition);
|
const std::optional<u32> fst_offset_unshifted = m_rVolume->ReadSwapped<u32>(0x424, m_partition);
|
||||||
|
@ -112,6 +105,9 @@ FileSystemGCWii::FileSystemGCWii(const Volume* _rVolume, const Partition& partit
|
||||||
return;
|
return;
|
||||||
for (u32 i = 0; i < number_of_file_infos; i++)
|
for (u32 i = 0; i < number_of_file_infos; i++)
|
||||||
m_FileInfoVector.emplace_back(m_offset_shift, fst_start + (i * 0xC), name_table_start);
|
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()
|
FileSystemGCWii::~FileSystemGCWii()
|
||||||
|
|
Loading…
Reference in New Issue