summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/VolumeFileBlobReader.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2017-08-02 18:16:56 +0200
committerJosJuice <josjuice@gmail.com>2017-09-15 18:57:05 +0200
commit38304da947c6b593ef94449894dc018aac633344 (patch)
treed6d79c531ef8363a302487ec70bd9d859fcb9c35 /Source/Core/DiscIO/VolumeFileBlobReader.cpp
parent0d078219358b04266206ea1e2622396db7724136 (diff)
DiscIO: Use Common::Lazy for loading filesystems
This simplifies FileMonitor a lot and also lets us clean up FilesystemPanel.
Diffstat (limited to 'Source/Core/DiscIO/VolumeFileBlobReader.cpp')
-rw-r--r--Source/Core/DiscIO/VolumeFileBlobReader.cpp16
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