diff options
author | bunnei <bunneidev@gmail.com> | 2015-07-16 18:08:46 -0400 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2015-07-16 18:08:46 -0400 |
commit | 946f0ee2f4f5e150167ad90f86a425b50baec144 (patch) | |
tree | 47586aae7237dddc7278ef5e579cf82ad1b64e11 /src/core/loader/loader.h | |
parent | 0ea2319f3c371dc5dd86fbfabfe5b54392d4b664 (diff) | |
parent | 62c2a262b2992ed5f56db098b2009ec1a20480bf (diff) |
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) { /// Interface for loading an application class AppLoader : NonCopyable { public: - AppLoader(std::unique_ptr<FileUtil::IOFile>&& file) : file(std::move(file)) { } + AppLoader(FileUtil::IOFile&& file) : file(std::move(file)) { } virtual ~AppLoader() { } /** @@ -66,7 +66,7 @@ public: * @param buffer Reference to buffer to store data * @return ResultStatus result of function */ - virtual ResultStatus ReadCode(std::vector<u8>& buffer) const { + virtual ResultStatus ReadCode(std::vector<u8>& buffer) { return ResultStatus::ErrorNotImplemented; } @@ -75,7 +75,7 @@ public: * @param buffer Reference to buffer to store data * @return ResultStatus result of function */ - virtual ResultStatus ReadIcon(std::vector<u8>& buffer) const { + virtual ResultStatus ReadIcon(std::vector<u8>& buffer) { return ResultStatus::ErrorNotImplemented; } @@ -84,7 +84,7 @@ public: * @param buffer Reference to buffer to store data * @return ResultStatus result of function */ - virtual ResultStatus ReadBanner(std::vector<u8>& buffer) const { + virtual ResultStatus ReadBanner(std::vector<u8>& buffer) { return ResultStatus::ErrorNotImplemented; } @@ -93,22 +93,25 @@ public: * @param buffer Reference to buffer to store data * @return ResultStatus result of function */ - virtual ResultStatus ReadLogo(std::vector<u8>& buffer) const { + virtual ResultStatus ReadLogo(std::vector<u8>& buffer) { return ResultStatus::ErrorNotImplemented; } /** * Get the RomFS of the application - * @param buffer Reference to buffer to store data + * Since the RomFS can be huge, we return a file reference instead of copying to a buffer + * @param romfs_file The file containing the RomFS + * @param offset The offset the romfs begins on + * @param size The size of the romfs * @return ResultStatus result of function */ - virtual ResultStatus ReadRomFS(std::vector<u8>& buffer) const { + virtual ResultStatus ReadRomFS(std::shared_ptr<FileUtil::IOFile>& romfs_file, u64& offset, u64& size) { return ResultStatus::ErrorNotImplemented; } protected: - std::unique_ptr<FileUtil::IOFile> file; - bool is_loaded = false; + FileUtil::IOFile file; + bool is_loaded = false; }; /** |