From 3f1a3952d707bce7851652ce54701ca14334f314 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Fri, 6 Feb 2015 11:53:14 -0200 Subject: FS: Allow multiple instances of the same archive type to be open at once --- src/core/file_sys/ivfc_archive.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/core/file_sys/ivfc_archive.h') diff --git a/src/core/file_sys/ivfc_archive.h b/src/core/file_sys/ivfc_archive.h index 6f4cc86d..1aff9e0a 100644 --- a/src/core/file_sys/ivfc_archive.h +++ b/src/core/file_sys/ivfc_archive.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include "common/common_types.h" @@ -23,7 +24,9 @@ namespace FileSys { */ class IVFCArchive : public ArchiveBackend { public: - IVFCArchive(); + IVFCArchive(std::shared_ptr> data); + + std::string GetName() const override; std::unique_ptr OpenFile(const Path& path, const Mode mode) const override; bool DeleteFile(const Path& path) const override; @@ -33,16 +36,14 @@ public: bool CreateDirectory(const Path& path) const override; bool RenameDirectory(const Path& src_path, const Path& dest_path) const override; std::unique_ptr OpenDirectory(const Path& path) const override; - ResultCode Format(const Path& path) const override; protected: - friend class IVFCFile; - std::vector raw_data; + std::shared_ptr> data; }; class IVFCFile : public FileBackend { public: - IVFCFile(const IVFCArchive* archive) : archive(archive) {} + IVFCFile(std::shared_ptr> data) : data(data) {} bool Open() override { return true; } size_t Read(const u64 offset, const u32 length, u8* buffer) const override; @@ -53,7 +54,7 @@ public: void Flush() const override { } private: - const IVFCArchive* archive; + std::shared_ptr> data; }; class IVFCDirectory : public DirectoryBackend { -- cgit v1.2.3