aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/hle/service/fs/archive.h
diff options
context:
space:
mode:
authorGravatar Subv <subv2112@gmail.com>2015-02-07 13:06:48 -0500
committerGravatar Yuri Kunde Schlesner <yuriks@yuriks.net>2015-02-10 13:43:45 -0200
commit071663e07423cac6037c72153edafea1efe9da9f (patch)
treebe08a19970e7ea3ef1e8c48aaf927ff323a0abd1 /src/core/hle/service/fs/archive.h
parentca1a87ef7d32a938c1ed3a59f8638cca54071a24 (diff)
Archives: Expose the File and Directory classes to HLE
Diffstat (limited to 'src/core/hle/service/fs/archive.h')
-rw-r--r--src/core/hle/service/fs/archive.h34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h
index 3d9b8a76..e27ad7d6 100644
--- a/src/core/hle/service/fs/archive.h
+++ b/src/core/hle/service/fs/archive.h
@@ -8,6 +8,7 @@
#include "core/file_sys/archive_backend.h"
#include "core/hle/kernel/kernel.h"
+#include "core/hle/kernel/session.h"
#include "core/hle/result.h"
/// The unique system identifier hash, also known as ID0
@@ -36,6 +37,35 @@ enum class ArchiveIdCode : u32 {
typedef u64 ArchiveHandle;
+class File : public Kernel::Session {
+public:
+ File(std::unique_ptr<FileSys::FileBackend>&& backend, const FileSys::Path& path)
+ : path(path), priority(0), backend(std::move(backend)) {
+ }
+
+ std::string GetName() const override { return "Path: " + path.DebugStr(); }
+
+ FileSys::Path path; ///< Path of the file
+ u32 priority; ///< Priority of the file. TODO(Subv): Find out what this means
+ std::unique_ptr<FileSys::FileBackend> backend; ///< File backend interface
+
+ ResultVal<bool> SyncRequest() override;
+};
+
+class Directory : public Kernel::Session {
+public:
+ Directory(std::unique_ptr<FileSys::DirectoryBackend>&& backend, const FileSys::Path& path)
+ : path(path), backend(std::move(backend)) {
+ }
+
+ std::string GetName() const override { return "Directory: " + path.DebugStr(); }
+
+ FileSys::Path path; ///< Path of the directory
+ std::unique_ptr<FileSys::DirectoryBackend> backend; ///< File backend interface
+
+ ResultVal<bool> SyncRequest() override;
+};
+
/**
* Opens an archive
* @param id_code IdCode of the archive to open
@@ -64,7 +94,7 @@ ResultCode RegisterArchiveType(std::unique_ptr<FileSys::ArchiveFactory>&& factor
* @param mode Mode under which to open the File
* @return The opened File object as a Session
*/
-ResultVal<Kernel::SharedPtr<Kernel::Session>> OpenFileFromArchive(ArchiveHandle archive_handle,
+ResultVal<Kernel::SharedPtr<File>> OpenFileFromArchive(ArchiveHandle archive_handle,
const FileSys::Path& path, const FileSys::Mode mode);
/**
@@ -128,7 +158,7 @@ ResultCode RenameDirectoryBetweenArchives(ArchiveHandle src_archive_handle, cons
* @param path Path to the Directory inside of the Archive
* @return The opened Directory object as a Session
*/
-ResultVal<Kernel::SharedPtr<Kernel::Session>> OpenDirectoryFromArchive(ArchiveHandle archive_handle,
+ResultVal<Kernel::SharedPtr<Directory>> OpenDirectoryFromArchive(ArchiveHandle archive_handle,
const FileSys::Path& path);
/**