diff options
| author | JosJuice <josjuice@gmail.com> | 2015-08-08 19:59:33 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2017-06-14 15:23:48 +0200 |
| commit | 87916fe09979eea276438deef83ba85fcace91e0 (patch) | |
| tree | b8b20059d8c1d7e8cdd310d8d54a37ad2d4ed819 /Source/Core/DiscIO/DiscScrubber.cpp | |
| parent | ee2b88ebb627869a6153fe3135df232793f02e87 (diff) | |
Filesystem: Replace GetFileList()
Instead of expecting callers to know how the size of directory file infos
relates to which files are in which directories, filesystems now offer a
GetRoot() method, and file infos offer a way to get their children. As
a bonus, m_FileInfoVector no longer has to be created and kept around
in RAM. Only the file info objects that actually are used are created.
Diffstat (limited to 'Source/Core/DiscIO/DiscScrubber.cpp')
| -rw-r--r-- | Source/Core/DiscIO/DiscScrubber.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/Source/Core/DiscIO/DiscScrubber.cpp b/Source/Core/DiscIO/DiscScrubber.cpp index 71d1fa16bc..009081cbb6 100644 --- a/Source/Core/DiscIO/DiscScrubber.cpp +++ b/Source/Core/DiscIO/DiscScrubber.cpp @@ -16,8 +16,6 @@ #include "Common/Logging/Log.h" #include "DiscIO/DiscScrubber.h" #include "DiscIO/Filesystem.h" -// TODO: eww -#include "DiscIO/FileSystemGCWii.h" #include "DiscIO/Volume.h" namespace DiscIO @@ -221,17 +219,21 @@ bool DiscScrubber::ParsePartitionData(const Partition& partition, PartitionHeade MarkAsUsedE(partition_data_offset, header->fst_offset, header->fst_size); // Go through the filesystem and mark entries as used - auto& file_list = filesystem->GetFileList(); - for (size_t i = 0; i < file_list.size(); ++i) - { - const std::string path = filesystem->GetPathFromFSTOffset(i); - DEBUG_LOG(DISCIO, "%s", path.empty() ? "/" : path.c_str()); - auto& file = file_list[i]; - if (!file.IsDirectory()) - MarkAsUsedE(partition_data_offset, file.GetOffset(), file.GetSize()); - } + ParseFileSystemData(partition_data_offset, filesystem->GetRoot()); return true; } +void DiscScrubber::ParseFileSystemData(u64 partition_data_offset, const FileInfo& directory) +{ + for (const DiscIO::FileInfo& file_info : directory) + { + DEBUG_LOG(DISCIO, "Scrubbing %s", file_info.GetPath().c_str()); + if (file_info.IsDirectory()) + ParseFileSystemData(partition_data_offset, file_info); + else + MarkAsUsedE(partition_data_offset, file_info.GetOffset(), file_info.GetSize()); + } +} + } // namespace DiscIO |
