diff options
| author | JosJuice <josjuice@gmail.com> | 2015-06-13 20:50:03 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2017-05-16 22:58:57 +0200 |
| commit | 639ce6c484c58c577c978eb9eda08e7800e959b1 (patch) | |
| tree | a38776d4f6a193d6c179a1bbab4de0d2543a55e3 /Source/Core/DiscIO/FileSystemGCWii.cpp | |
| parent | 19b8f1c10adeefd9413687ab7a7c21b509fe777d (diff) | |
FileSystemGCWii: Replace m_Wii with m_offset_shift
I replaced m_OffsetShift with m_Wii in bb93336 to support
the decrypt parameter for read functions. Doing that is no
longer necessary, so m_offset_shift is now used like before.
Diffstat (limited to 'Source/Core/DiscIO/FileSystemGCWii.cpp')
| -rw-r--r-- | Source/Core/DiscIO/FileSystemGCWii.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/Source/Core/DiscIO/FileSystemGCWii.cpp b/Source/Core/DiscIO/FileSystemGCWii.cpp index ec4f8c2c28..c3b9df3119 100644 --- a/Source/Core/DiscIO/FileSystemGCWii.cpp +++ b/Source/Core/DiscIO/FileSystemGCWii.cpp @@ -21,7 +21,7 @@ namespace DiscIO { CFileSystemGCWii::CFileSystemGCWii(const IVolume* _rVolume, const Partition& partition) - : IFileSystem(_rVolume, partition), m_Initialized(false), m_Valid(false), m_Wii(false) + : IFileSystem(_rVolume, partition), m_Initialized(false), m_Valid(false), m_offset_shift(0) { m_Valid = DetectFileSystem(); } @@ -156,7 +156,7 @@ u64 CFileSystemGCWii::GetBootDOLOffset() const { u32 offset = 0; m_rVolume->ReadSwapped(0x420, &offset, m_partition); - return static_cast<u64>(offset) << GetOffsetShift(); + return static_cast<u64>(offset) << m_offset_shift; } u32 CFileSystemGCWii::GetBootDOLSize(u64 dol_offset) const @@ -253,12 +253,12 @@ bool CFileSystemGCWii::DetectFileSystem() u32 magic_bytes; if (m_rVolume->ReadSwapped(0x18, &magic_bytes, m_partition) && magic_bytes == 0x5D1C9EA3) { - m_Wii = true; + m_offset_shift = 2; // Wii file system return true; } else if (m_rVolume->ReadSwapped(0x1c, &magic_bytes, m_partition) && magic_bytes == 0xC2339F3D) { - m_Wii = false; + m_offset_shift = 0; // GameCube file system return true; } @@ -268,13 +268,12 @@ bool CFileSystemGCWii::DetectFileSystem() void CFileSystemGCWii::InitFileSystem() { m_Initialized = true; - u32 const shift = GetOffsetShift(); // read the whole FST u32 fst_offset_unshifted; if (!m_rVolume->ReadSwapped(0x424, &fst_offset_unshifted, m_partition)) return; - u64 FSTOffset = static_cast<u64>(fst_offset_unshifted) << shift; + u64 FSTOffset = static_cast<u64>(fst_offset_unshifted) << m_offset_shift; // read all fileinfos u32 name_offset, offset, size; @@ -282,7 +281,7 @@ void CFileSystemGCWii::InitFileSystem() !m_rVolume->ReadSwapped(FSTOffset + 0x4, &offset, m_partition) || !m_rVolume->ReadSwapped(FSTOffset + 0x8, &size, m_partition)) return; - SFileInfo root = {name_offset, static_cast<u64>(offset) << shift, size}; + SFileInfo root = {name_offset, static_cast<u64>(offset) << m_offset_shift, size}; if (!root.IsDirectory()) return; @@ -313,7 +312,7 @@ void CFileSystemGCWii::InitFileSystem() m_rVolume->ReadSwapped(read_offset + 0x4, &offset, m_partition); size = 0; m_rVolume->ReadSwapped(read_offset + 0x8, &size, m_partition); - m_FileInfoVector.emplace_back(name_offset, static_cast<u64>(offset) << shift, size); + m_FileInfoVector.emplace_back(name_offset, static_cast<u64>(offset) << m_offset_shift, size); NameTableOffset += 0xC; } @@ -351,9 +350,4 @@ size_t CFileSystemGCWii::BuildFilenames(const size_t _FirstIndex, const size_t _ return CurrentIndex; } -u32 CFileSystemGCWii::GetOffsetShift() const -{ - return m_Wii ? 2 : 0; -} - } // namespace |
