summaryrefslogtreecommitdiff
path: root/src/core/loader/loader.h
diff options
context:
space:
mode:
authorGravatar bunnei2018-07-07 20:24:51 -0700
committerGravatar bunnei2018-07-07 20:24:51 -0700
commit913896cbd99e414c325c9d47a987376ed6d9fffd (patch)
treeb660920a49f538f0ee00486c50a0d153d53c423d /src/core/loader/loader.h
parentMerge pull request #632 from FearlessTobi/add-discord-link (diff)
downloadyuzu-913896cbd99e414c325c9d47a987376ed6d9fffd.tar.gz
yuzu-913896cbd99e414c325c9d47a987376ed6d9fffd.tar.xz
yuzu-913896cbd99e414c325c9d47a987376ed6d9fffd.zip
Revert "Virtual Filesystem (#597)"
This reverts commit 77c684c1140f6bf3fb7d4560d06d2efb1a2ee5e2.
Diffstat (limited to 'src/core/loader/loader.h')
-rw-r--r--src/core/loader/loader.h30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h
index 1da9e8099..b76f7b13d 100644
--- a/src/core/loader/loader.h
+++ b/src/core/loader/loader.h
@@ -13,7 +13,6 @@
13#include <boost/optional.hpp> 13#include <boost/optional.hpp>
14#include "common/common_types.h" 14#include "common/common_types.h"
15#include "common/file_util.h" 15#include "common/file_util.h"
16#include "core/file_sys/vfs.h"
17#include "core/hle/kernel/kernel.h" 16#include "core/hle/kernel/kernel.h"
18 17
19namespace Kernel { 18namespace Kernel {
@@ -37,9 +36,10 @@ enum class FileType {
37/** 36/**
38 * Identifies the type of a bootable file based on the magic value in its header. 37 * Identifies the type of a bootable file based on the magic value in its header.
39 * @param file open file 38 * @param file open file
39 * @param filepath Path of the file that we are opening.
40 * @return FileType of file 40 * @return FileType of file
41 */ 41 */
42FileType IdentifyFile(FileSys::VirtualFile file); 42FileType IdentifyFile(FileUtil::IOFile& file, const std::string& filepath);
43 43
44/** 44/**
45 * Identifies the type of a bootable file based on the magic value in its header. 45 * Identifies the type of a bootable file based on the magic value in its header.
@@ -50,12 +50,12 @@ FileType IdentifyFile(FileSys::VirtualFile file);
50FileType IdentifyFile(const std::string& file_name); 50FileType IdentifyFile(const std::string& file_name);
51 51
52/** 52/**
53 * Guess the type of a bootable file from its name 53 * Guess the type of a bootable file from its extension
54 * @param name String name of bootable file 54 * @param extension String extension of bootable file
55 * @return FileType of file. Note: this will return FileType::Unknown if it is unable to determine 55 * @return FileType of file. Note: this will return FileType::Unknown if it is unable to determine
56 * a filetype, and will never return FileType::Error. 56 * a filetype, and will never return FileType::Error.
57 */ 57 */
58FileType GuessFromFilename(const std::string& name); 58FileType GuessFromExtension(const std::string& extension);
59 59
60/** 60/**
61 * Convert a FileType into a string which can be displayed to the user. 61 * Convert a FileType into a string which can be displayed to the user.
@@ -79,7 +79,7 @@ enum class ResultStatus {
79/// Interface for loading an application 79/// Interface for loading an application
80class AppLoader : NonCopyable { 80class AppLoader : NonCopyable {
81public: 81public:
82 AppLoader(FileSys::VirtualFile file) : file(std::move(file)) {} 82 AppLoader(FileUtil::IOFile&& file) : file(std::move(file)) {}
83 virtual ~AppLoader() {} 83 virtual ~AppLoader() {}
84 84
85 /** 85 /**
@@ -154,20 +154,26 @@ public:
154 /** 154 /**
155 * Get the RomFS of the application 155 * Get the RomFS of the application
156 * Since the RomFS can be huge, we return a file reference instead of copying to a buffer 156 * Since the RomFS can be huge, we return a file reference instead of copying to a buffer
157 * @param file The file containing the RomFS 157 * @param romfs_file The file containing the RomFS
158 * @param offset The offset the romfs begins on
159 * @param size The size of the romfs
158 * @return ResultStatus result of function 160 * @return ResultStatus result of function
159 */ 161 */
160 virtual ResultStatus ReadRomFS(FileSys::VirtualFile& dir) { 162 virtual ResultStatus ReadRomFS(std::shared_ptr<FileUtil::IOFile>& romfs_file, u64& offset,
163 u64& size) {
161 return ResultStatus::ErrorNotImplemented; 164 return ResultStatus::ErrorNotImplemented;
162 } 165 }
163 166
164 /** 167 /**
165 * Get the update RomFS of the application 168 * Get the update RomFS of the application
166 * Since the RomFS can be huge, we return a file reference instead of copying to a buffer 169 * Since the RomFS can be huge, we return a file reference instead of copying to a buffer
167 * @param file The file containing the RomFS 170 * @param romfs_file The file containing the RomFS
171 * @param offset The offset the romfs begins on
172 * @param size The size of the romfs
168 * @return ResultStatus result of function 173 * @return ResultStatus result of function
169 */ 174 */
170 virtual ResultStatus ReadUpdateRomFS(FileSys::VirtualFile& file) { 175 virtual ResultStatus ReadUpdateRomFS(std::shared_ptr<FileUtil::IOFile>& romfs_file, u64& offset,
176 u64& size) {
171 return ResultStatus::ErrorNotImplemented; 177 return ResultStatus::ErrorNotImplemented;
172 } 178 }
173 179
@@ -181,7 +187,7 @@ public:
181 } 187 }
182 188
183protected: 189protected:
184 FileSys::VirtualFile file; 190 FileUtil::IOFile file;
185 bool is_loaded = false; 191 bool is_loaded = false;
186}; 192};
187 193
@@ -196,6 +202,6 @@ extern const std::initializer_list<Kernel::AddressMapping> default_address_mappi
196 * @param filename String filename of bootable file 202 * @param filename String filename of bootable file
197 * @return best loader for this file 203 * @return best loader for this file
198 */ 204 */
199std::unique_ptr<AppLoader> GetLoader(FileSys::VirtualFile file); 205std::unique_ptr<AppLoader> GetLoader(const std::string& filename);
200 206
201} // namespace Loader 207} // namespace Loader