diff options
author | bunnei <bunneidev@gmail.com> | 2015-01-20 12:55:28 -0500 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2015-01-20 12:55:28 -0500 |
commit | 205170fa623efdd5eafb0c957d728babe4836f45 (patch) | |
tree | 26dd9e4c7ae9cc7a3bb09f42c942c4e47c9cc06f /src/core/loader/ncch.h | |
parent | 2a5654ea8a07965c4320f602c9423033c60971f9 (diff) | |
parent | df0d66c7cf518638112843b0bf0a8d7950b9041c (diff) |
Merge pull request #241 from linkmauve/better-loader
Improve the loader a bit
Diffstat (limited to 'src/core/loader/ncch.h')
-rw-r--r-- | src/core/loader/ncch.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h index fd9258970..9ae2de99f 100644 --- a/src/core/loader/ncch.h +++ b/src/core/loader/ncch.h @@ -5,7 +5,6 @@ #pragma once #include "common/common.h" -#include "common/file_util.h" #include "core/loader/loader.h" @@ -14,7 +13,7 @@ struct NCCH_Header { u8 signature[0x100]; - char magic[4]; + u32 magic; u32 content_size; u8 partition_id[8]; u16 maker_code; @@ -147,8 +146,14 @@ namespace Loader { /// Loads an NCCH file (e.g. from a CCI, or the first NCCH in a CXI) class AppLoader_NCCH final : public AppLoader { public: - AppLoader_NCCH(const std::string& filename); - ~AppLoader_NCCH() override; + AppLoader_NCCH(std::unique_ptr<FileUtil::IOFile>&& file) : AppLoader(std::move(file)) { } + + /** + * Returns the type of the file + * @param file FileUtil::IOFile open file + * @return FileType found, or FileType::Error if this loader doesn't know it + */ + static FileType IdentifyType(FileUtil::IOFile& file); /** * Load the application @@ -213,14 +218,11 @@ private: */ ResultStatus LoadExec() const; - std::string filename; - - bool is_loaded; - bool is_compressed; + bool is_compressed = false; - u32 entry_point; - u32 ncch_offset; // Offset to NCCH header, can be 0 or after NCSD header - u32 exefs_offset; + u32 entry_point = 0; + u32 ncch_offset = 0; // Offset to NCCH header, can be 0 or after NCSD header + u32 exefs_offset = 0; NCCH_Header ncch_header; ExeFs_Header exefs_header; |