diff options
author | bunnei <ericbunnie@gmail.com> | 2014-06-22 15:40:21 -0400 |
---|---|---|
committer | bunnei <ericbunnie@gmail.com> | 2014-06-24 19:30:08 -0400 |
commit | a7f1c544909ee1034356666e04bea3a4b4609a95 (patch) | |
tree | 678febb505b765cc337f4ca96180758a4c295536 /src/core/loader/ncch.h | |
parent | 6aebd4ac9808c189c25185af8fb245c6d282bad0 (diff) |
Loader: Refactored loading functions to only read data from binary if called.
NCCH: Updated LoadExec to use Memory::WriteBlock function to load binary code.
Diffstat (limited to 'src/core/loader/ncch.h')
-rw-r--r-- | src/core/loader/ncch.h | 57 |
1 files changed, 44 insertions, 13 deletions
diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h index 126eb4c80..bf65425a4 100644 --- a/src/core/loader/ncch.h +++ b/src/core/loader/ncch.h @@ -156,35 +156,66 @@ public: */ ResultStatus Load(); -private: + /** + * Get the code (typically .code section) of the application + * @param error ResultStatus result of function + * @return Reference to code buffer + */ + const std::vector<u8>& ReadCode(ResultStatus& error); /** - * Reads an application ExeFS section of an NCCH file into AppLoader (e.g. .code, .logo, etc.) - * @param file Handle to file to read from - * @param name Name of section to read out of NCCH file - * @param buffer Buffer to read section into. - * @return ResultStatus result of function + * Get the icon (typically icon section) of the application + * @param error ResultStatus result of function + * @return Reference to icon buffer */ - ResultStatus LoadSectionExeFS(File::IOFile& file, const char* name, std::vector<u8>& buffer); + const std::vector<u8>& ReadIcon(ResultStatus& error); /** - * Reads RomFS of an NCCH file into AppLoader - * @param file Handle to file to read from - * @return ResultStatus result of function + * Get the banner (typically banner section) of the application + * @param error ResultStatus result of function + * @return Reference to banner buffer + */ + const std::vector<u8>& ReadBanner(ResultStatus& error); + + /** + * Get the logo (typically logo section) of the application + * @param error ResultStatus result of function + * @return Reference to logo buffer */ - ResultStatus LoadRomFS(File::IOFile& file); + const std::vector<u8>& ReadLogo(ResultStatus& error); + + /** + * Get the RomFs archive of the application + * @param error ResultStatus result of function + * @return Reference to RomFs archive buffer + */ + const std::vector<u8>& ReadRomFS(ResultStatus& error); + +private: + + /** + * Reads an application ExeFS section of an NCCH file into AppLoader (e.g. .code, .logo, etc.) + * @param name Name of section to read out of NCCH file + * @param buffer Vector to read data into + * @param error ResultStatus result of function + * @return Reference to buffer of data that was read + */ + const std::vector<u8>& LoadSectionExeFS(const char* name, std::vector<u8>& buffer, + ResultStatus& error); /** * Loads .code section into memory for booting * @return ResultStatus result of function */ - ResultStatus LoadExec() const; + ResultStatus LoadExec(); + File::IOFile file; std::string filename; + bool is_loaded; bool is_compressed; - u32 entry_point; + u32 entry_point; u32 ncch_offset; // Offset to NCCH header, can be 0 or after NCSD header u32 exefs_offset; |