summaryrefslogtreecommitdiff
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorGravatar Emmanuel Gil Peyrot2014-09-12 00:47:05 +0200
committerGravatar Emmanuel Gil Peyrot2014-09-17 14:35:46 +0000
commitc14e5713f52cd58f2a8206d844448a8c2d1a54b6 (patch)
tree00b089a33c950107ad161a36b1c17808a85eef88 /src/core/file_sys
parentCore: Add a Directory object, with both a stub and a passthrough implementati... (diff)
downloadyuzu-c14e5713f52cd58f2a8206d844448a8c2d1a54b6.tar.gz
yuzu-c14e5713f52cd58f2a8206d844448a8c2d1a54b6.tar.xz
yuzu-c14e5713f52cd58f2a8206d844448a8c2d1a54b6.zip
Core: Add a method to obtain a Directory from an Archive.
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/archive.h8
-rw-r--r--src/core/file_sys/archive_romfs.cpp10
-rw-r--r--src/core/file_sys/archive_romfs.h7
-rw-r--r--src/core/file_sys/archive_sdmc.cpp12
-rw-r--r--src/core/file_sys/archive_sdmc.h7
5 files changed, 44 insertions, 0 deletions
diff --git a/src/core/file_sys/archive.h b/src/core/file_sys/archive.h
index 67440ef58..560db6dea 100644
--- a/src/core/file_sys/archive.h
+++ b/src/core/file_sys/archive.h
@@ -10,6 +10,7 @@
10#include "common/bit_field.h" 10#include "common/bit_field.h"
11 11
12#include "core/file_sys/file.h" 12#include "core/file_sys/file.h"
13#include "core/file_sys/directory.h"
13 14
14#include "core/hle/kernel/kernel.h" 15#include "core/hle/kernel/kernel.h"
15 16
@@ -56,6 +57,13 @@ public:
56 virtual std::unique_ptr<File> OpenFile(const std::string& path, const Mode mode) const = 0; 57 virtual std::unique_ptr<File> OpenFile(const std::string& path, const Mode mode) const = 0;
57 58
58 /** 59 /**
60 * Open a directory specified by its path
61 * @param path Path relative to the archive
62 * @return Opened directory, or nullptr
63 */
64 virtual std::unique_ptr<Directory> OpenDirectory(const std::string& path) const = 0;
65
66 /**
59 * Read data from the archive 67 * Read data from the archive
60 * @param offset Offset in bytes to start reading data from 68 * @param offset Offset in bytes to start reading data from
61 * @param length Length in bytes of data to read from archive 69 * @param length Length in bytes of data to read from archive
diff --git a/src/core/file_sys/archive_romfs.cpp b/src/core/file_sys/archive_romfs.cpp
index 99ded4d8b..9bab3471f 100644
--- a/src/core/file_sys/archive_romfs.cpp
+++ b/src/core/file_sys/archive_romfs.cpp
@@ -5,6 +5,7 @@
5#include "common/common_types.h" 5#include "common/common_types.h"
6 6
7#include "core/file_sys/archive_romfs.h" 7#include "core/file_sys/archive_romfs.h"
8#include "core/file_sys/directory_romfs.h"
8#include "core/file_sys/file_romfs.h" 9#include "core/file_sys/file_romfs.h"
9 10
10//////////////////////////////////////////////////////////////////////////////////////////////////// 11////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -33,6 +34,15 @@ std::unique_ptr<File> Archive_RomFS::OpenFile(const std::string& path, const Mod
33} 34}
34 35
35/** 36/**
37 * Open a directory specified by its path
38 * @param path Path relative to the archive
39 * @return Opened directory, or nullptr
40 */
41std::unique_ptr<Directory> Archive_RomFS::OpenDirectory(const std::string& path) const {
42 return std::unique_ptr<Directory>(new Directory_RomFS);
43}
44
45/**
36 * Read data from the archive 46 * Read data from the archive
37 * @param offset Offset in bytes to start reading data from 47 * @param offset Offset in bytes to start reading data from
38 * @param length Length in bytes of data to read from archive 48 * @param length Length in bytes of data to read from archive
diff --git a/src/core/file_sys/archive_romfs.h b/src/core/file_sys/archive_romfs.h
index a7669dd71..fcdefa95f 100644
--- a/src/core/file_sys/archive_romfs.h
+++ b/src/core/file_sys/archive_romfs.h
@@ -37,6 +37,13 @@ public:
37 std::unique_ptr<File> OpenFile(const std::string& path, const Mode mode) const override; 37 std::unique_ptr<File> OpenFile(const std::string& path, const Mode mode) const override;
38 38
39 /** 39 /**
40 * Open a directory specified by its path
41 * @param path Path relative to the archive
42 * @return Opened directory, or nullptr
43 */
44 std::unique_ptr<Directory> OpenDirectory(const std::string& path) const override;
45
46 /**
40 * Read data from the archive 47 * Read data from the archive
41 * @param offset Offset in bytes to start reading data from 48 * @param offset Offset in bytes to start reading data from
42 * @param length Length in bytes of data to read from archive 49 * @param length Length in bytes of data to read from archive
diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp
index fb155430d..30d33be5f 100644
--- a/src/core/file_sys/archive_sdmc.cpp
+++ b/src/core/file_sys/archive_sdmc.cpp
@@ -8,6 +8,7 @@
8#include "common/file_util.h" 8#include "common/file_util.h"
9 9
10#include "core/file_sys/archive_sdmc.h" 10#include "core/file_sys/archive_sdmc.h"
11#include "core/file_sys/directory_sdmc.h"
11#include "core/file_sys/file_sdmc.h" 12#include "core/file_sys/file_sdmc.h"
12 13
13//////////////////////////////////////////////////////////////////////////////////////////////////// 14////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -45,6 +46,17 @@ std::unique_ptr<File> Archive_SDMC::OpenFile(const std::string& path, const Mode
45} 46}
46 47
47/** 48/**
49 * Open a directory specified by its path
50 * @param path Path relative to the archive
51 * @return Opened directory, or nullptr
52 */
53std::unique_ptr<Directory> Archive_SDMC::OpenDirectory(const std::string& path) const {
54 DEBUG_LOG(FILESYS, "called path=%s", path.c_str());
55 Directory_SDMC* directory = new Directory_SDMC(this, path);
56 return std::unique_ptr<Directory>(directory);
57}
58
59/**
48 * Read data from the archive 60 * Read data from the archive
49 * @param offset Offset in bytes to start reading archive from 61 * @param offset Offset in bytes to start reading archive from
50 * @param length Length in bytes to read data from archive 62 * @param length Length in bytes to read data from archive
diff --git a/src/core/file_sys/archive_sdmc.h b/src/core/file_sys/archive_sdmc.h
index 931817e5b..946f8b957 100644
--- a/src/core/file_sys/archive_sdmc.h
+++ b/src/core/file_sys/archive_sdmc.h
@@ -37,6 +37,13 @@ public:
37 std::unique_ptr<File> OpenFile(const std::string& path, const Mode mode) const override; 37 std::unique_ptr<File> OpenFile(const std::string& path, const Mode mode) const override;
38 38
39 /** 39 /**
40 * Open a directory specified by its path
41 * @param path Path relative to the archive
42 * @return Opened directory, or nullptr
43 */
44 std::unique_ptr<Directory> OpenDirectory(const std::string& path) const override;
45
46 /**
40 * Read data from the archive 47 * Read data from the archive
41 * @param offset Offset in bytes to start reading archive from 48 * @param offset Offset in bytes to start reading archive from
42 * @param length Length in bytes to read data from archive 49 * @param length Length in bytes to read data from archive