diff options
| author | Leo Lam <leolino.lam@gmail.com> | 2017-09-15 19:30:05 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-15 19:30:05 +0200 |
| commit | 7cb8d6612c6df51073037b56ebc866f180aecd71 (patch) | |
| tree | 634e4c4d34472c6f2e49fbd48bebb6bb5f82de63 /Source/Core/DiscIO/VolumeFileBlobReader.cpp | |
| parent | 7caf44c8b5a8a435ad1d9db3b2444db614d329eb (diff) | |
| parent | f294599e734f2391db9e74b6454752e75fdf368c (diff) | |
Merge pull request #5870 from JosJuice/lazy-filesystem
DiscIO: Use Common::Lazy more
Diffstat (limited to 'Source/Core/DiscIO/VolumeFileBlobReader.cpp')
| -rw-r--r-- | Source/Core/DiscIO/VolumeFileBlobReader.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Source/Core/DiscIO/VolumeFileBlobReader.cpp b/Source/Core/DiscIO/VolumeFileBlobReader.cpp index 5b243acc29..a228005436 100644 --- a/Source/Core/DiscIO/VolumeFileBlobReader.cpp +++ b/Source/Core/DiscIO/VolumeFileBlobReader.cpp @@ -10,23 +10,24 @@ namespace DiscIO { std::unique_ptr<VolumeFileBlobReader> VolumeFileBlobReader::Create(const Volume& volume, - const FileSystem& file_system, + const Partition& partition, const std::string& file_path) { - if (!file_system.IsValid()) + const FileSystem* file_system = volume.GetFileSystem(partition); + if (!file_system) return nullptr; - std::unique_ptr<FileInfo> file_info = file_system.FindFileInfo(file_path); + std::unique_ptr<FileInfo> file_info = file_system->FindFileInfo(file_path); if (!file_info || file_info->IsDirectory()) return nullptr; return std::unique_ptr<VolumeFileBlobReader>{ - new VolumeFileBlobReader(volume, file_system, std::move(file_info))}; + new VolumeFileBlobReader(volume, partition, std::move(file_info))}; } -VolumeFileBlobReader::VolumeFileBlobReader(const Volume& volume, const FileSystem& file_system, +VolumeFileBlobReader::VolumeFileBlobReader(const Volume& volume, const Partition& partition, std::unique_ptr<FileInfo> file_info) - : m_volume(volume), m_file_system(file_system), m_file_info(std::move(file_info)) + : m_volume(volume), m_partition(partition), m_file_info(std::move(file_info)) { } @@ -45,7 +46,6 @@ bool VolumeFileBlobReader::Read(u64 offset, u64 length, u8* out_ptr) if (offset + length > m_file_info->GetSize()) return false; - return m_volume.Read(m_file_info->GetOffset() + offset, length, out_ptr, - m_file_system.GetPartition()); + return m_volume.Read(m_file_info->GetOffset() + offset, length, out_ptr, m_partition); } } // namespace |
