DiscIO: Remove m_partition and m_volume from FileSystem
The last commit made m_partition unnecessary, and m_volume has been unnecessary ever since the PR that added DiscExtractor.
This commit is contained in:
parent
38304da947
commit
ca36c977d9
|
@ -185,19 +185,19 @@ bool FileInfoGCWii::IsValid(u64 fst_size, const FileInfoGCWii& parent_directory)
|
|||
}
|
||||
|
||||
FileSystemGCWii::FileSystemGCWii(const Volume* volume, const Partition& partition)
|
||||
: FileSystem(volume, partition), m_valid(false), m_root(nullptr, 0, 0, 0)
|
||||
: m_valid(false), m_root(nullptr, 0, 0, 0)
|
||||
{
|
||||
u8 offset_shift;
|
||||
// Check if this is a GameCube or Wii disc
|
||||
if (m_volume->ReadSwapped<u32>(0x18, m_partition) == u32(0x5D1C9EA3))
|
||||
if (volume->ReadSwapped<u32>(0x18, partition) == u32(0x5D1C9EA3))
|
||||
offset_shift = 2; // Wii file system
|
||||
else if (m_volume->ReadSwapped<u32>(0x1c, m_partition) == u32(0xC2339F3D))
|
||||
else if (volume->ReadSwapped<u32>(0x1c, partition) == u32(0xC2339F3D))
|
||||
offset_shift = 0; // GameCube file system
|
||||
else
|
||||
return; // Invalid partition (maybe someone removed its data but not its partition table entry)
|
||||
|
||||
const std::optional<u64> fst_offset = GetFSTOffset(*m_volume, m_partition);
|
||||
const std::optional<u64> fst_size = GetFSTSize(*m_volume, m_partition);
|
||||
const std::optional<u64> fst_offset = GetFSTOffset(*volume, partition);
|
||||
const std::optional<u64> fst_size = GetFSTSize(*volume, partition);
|
||||
if (!fst_offset || !fst_size)
|
||||
return;
|
||||
if (*fst_size < FST_ENTRY_SIZE)
|
||||
|
@ -220,7 +220,7 @@ FileSystemGCWii::FileSystemGCWii(const Volume* volume, const Partition& partitio
|
|||
|
||||
// Read the whole FST
|
||||
m_file_system_table.resize(*fst_size);
|
||||
if (!m_volume->Read(*fst_offset, *fst_size, m_file_system_table.data(), m_partition))
|
||||
if (!volume->Read(*fst_offset, *fst_size, m_file_system_table.data(), partition))
|
||||
{
|
||||
ERROR_LOG(DISCIO, "Couldn't read file system table");
|
||||
return;
|
||||
|
|
|
@ -3,18 +3,11 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include "DiscIO/Filesystem.h"
|
||||
#include <memory>
|
||||
#include "DiscIO/Volume.h"
|
||||
|
||||
namespace DiscIO
|
||||
{
|
||||
FileInfo::~FileInfo() = default;
|
||||
|
||||
FileSystem::FileSystem(const Volume* volume, const Partition& partition)
|
||||
: m_volume(volume), m_partition(partition)
|
||||
{
|
||||
}
|
||||
|
||||
FileSystem::~FileSystem() = default;
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -106,7 +106,6 @@ protected:
|
|||
class FileSystem
|
||||
{
|
||||
public:
|
||||
FileSystem(const Volume* volume, const Partition& partition);
|
||||
virtual ~FileSystem();
|
||||
|
||||
// If IsValid is false, GetRoot must not be called.
|
||||
|
@ -118,11 +117,6 @@ public:
|
|||
virtual std::unique_ptr<FileInfo> FindFileInfo(const std::string& path) const = 0;
|
||||
// Returns nullptr if not found
|
||||
virtual std::unique_ptr<FileInfo> FindFileInfo(u64 disc_offset) const = 0;
|
||||
|
||||
virtual const Partition GetPartition() const { return m_partition; }
|
||||
protected:
|
||||
const Volume* const m_volume;
|
||||
const Partition m_partition;
|
||||
};
|
||||
|
||||
// Calling Volume::GetFileSystem instead of manually constructing a filesystem is recommended,
|
||||
|
|
Loading…
Reference in New Issue