diff options
| author | 2015-07-16 18:08:46 -0400 | |
|---|---|---|
| committer | 2015-07-16 18:08:46 -0400 | |
| commit | 946f0ee2f4f5e150167ad90f86a425b50baec144 (patch) | |
| tree | 47586aae7237dddc7278ef5e579cf82ad1b64e11 /src/core/loader/loader.h | |
| parent | Merge pull request #931 from neobrain/move_default_attr_handler (diff) | |
| parent | Loader: Fix variable type and remove unused variable (diff) | |
| download | yuzu-946f0ee2f4f5e150167ad90f86a425b50baec144.tar.gz yuzu-946f0ee2f4f5e150167ad90f86a425b50baec144.tar.xz yuzu-946f0ee2f4f5e150167ad90f86a425b50baec144.zip | |
Merge pull request #918 from yuriks/romfs
Do not load entire RomFS to memory, read from the file as needed instead (rebased)
Diffstat (limited to 'src/core/loader/loader.h')
| -rw-r--r-- | src/core/loader/loader.h | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 52bbf35b8..a37d3348c 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h | |||
| @@ -52,7 +52,7 @@ static inline u32 MakeMagic(char a, char b, char c, char d) { | |||
| 52 | /// Interface for loading an application | 52 | /// Interface for loading an application |
| 53 | class AppLoader : NonCopyable { | 53 | class AppLoader : NonCopyable { |
| 54 | public: | 54 | public: |
| 55 | AppLoader(std::unique_ptr<FileUtil::IOFile>&& file) : file(std::move(file)) { } | 55 | AppLoader(FileUtil::IOFile&& file) : file(std::move(file)) { } |
| 56 | virtual ~AppLoader() { } | 56 | virtual ~AppLoader() { } |
| 57 | 57 | ||
| 58 | /** | 58 | /** |
| @@ -66,7 +66,7 @@ public: | |||
| 66 | * @param buffer Reference to buffer to store data | 66 | * @param buffer Reference to buffer to store data |
| 67 | * @return ResultStatus result of function | 67 | * @return ResultStatus result of function |
| 68 | */ | 68 | */ |
| 69 | virtual ResultStatus ReadCode(std::vector<u8>& buffer) const { | 69 | virtual ResultStatus ReadCode(std::vector<u8>& buffer) { |
| 70 | return ResultStatus::ErrorNotImplemented; | 70 | return ResultStatus::ErrorNotImplemented; |
| 71 | } | 71 | } |
| 72 | 72 | ||
| @@ -75,7 +75,7 @@ public: | |||
| 75 | * @param buffer Reference to buffer to store data | 75 | * @param buffer Reference to buffer to store data |
| 76 | * @return ResultStatus result of function | 76 | * @return ResultStatus result of function |
| 77 | */ | 77 | */ |
| 78 | virtual ResultStatus ReadIcon(std::vector<u8>& buffer) const { | 78 | virtual ResultStatus ReadIcon(std::vector<u8>& buffer) { |
| 79 | return ResultStatus::ErrorNotImplemented; | 79 | return ResultStatus::ErrorNotImplemented; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| @@ -84,7 +84,7 @@ public: | |||
| 84 | * @param buffer Reference to buffer to store data | 84 | * @param buffer Reference to buffer to store data |
| 85 | * @return ResultStatus result of function | 85 | * @return ResultStatus result of function |
| 86 | */ | 86 | */ |
| 87 | virtual ResultStatus ReadBanner(std::vector<u8>& buffer) const { | 87 | virtual ResultStatus ReadBanner(std::vector<u8>& buffer) { |
| 88 | return ResultStatus::ErrorNotImplemented; | 88 | return ResultStatus::ErrorNotImplemented; |
| 89 | } | 89 | } |
| 90 | 90 | ||
| @@ -93,22 +93,25 @@ public: | |||
| 93 | * @param buffer Reference to buffer to store data | 93 | * @param buffer Reference to buffer to store data |
| 94 | * @return ResultStatus result of function | 94 | * @return ResultStatus result of function |
| 95 | */ | 95 | */ |
| 96 | virtual ResultStatus ReadLogo(std::vector<u8>& buffer) const { | 96 | virtual ResultStatus ReadLogo(std::vector<u8>& buffer) { |
| 97 | return ResultStatus::ErrorNotImplemented; | 97 | return ResultStatus::ErrorNotImplemented; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | /** | 100 | /** |
| 101 | * Get the RomFS of the application | 101 | * Get the RomFS of the application |
| 102 | * @param buffer Reference to buffer to store data | 102 | * Since the RomFS can be huge, we return a file reference instead of copying to a buffer |
| 103 | * @param romfs_file The file containing the RomFS | ||
| 104 | * @param offset The offset the romfs begins on | ||
| 105 | * @param size The size of the romfs | ||
| 103 | * @return ResultStatus result of function | 106 | * @return ResultStatus result of function |
| 104 | */ | 107 | */ |
| 105 | virtual ResultStatus ReadRomFS(std::vector<u8>& buffer) const { | 108 | virtual ResultStatus ReadRomFS(std::shared_ptr<FileUtil::IOFile>& romfs_file, u64& offset, u64& size) { |
| 106 | return ResultStatus::ErrorNotImplemented; | 109 | return ResultStatus::ErrorNotImplemented; |
| 107 | } | 110 | } |
| 108 | 111 | ||
| 109 | protected: | 112 | protected: |
| 110 | std::unique_ptr<FileUtil::IOFile> file; | 113 | FileUtil::IOFile file; |
| 111 | bool is_loaded = false; | 114 | bool is_loaded = false; |
| 112 | }; | 115 | }; |
| 113 | 116 | ||
| 114 | /** | 117 | /** |