summaryrefslogtreecommitdiffstats
path: root/src/core/loader/ncch.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2016-05-06 00:35:24 +0200
committerbunnei <bunneidev@gmail.com>2016-05-06 00:35:24 +0200
commit55946cdc119c53656c79667b9a81172563b443ad (patch)
tree1fc81259c565ed89e17029a859c06ec8231728aa /src/core/loader/ncch.cpp
parentMerge pull request #1706 from mailwl/mii-selector (diff)
parentadd missing header (diff)
downloadyuzu-55946cdc119c53656c79667b9a81172563b443ad.tar
yuzu-55946cdc119c53656c79667b9a81172563b443ad.tar.gz
yuzu-55946cdc119c53656c79667b9a81172563b443ad.tar.bz2
yuzu-55946cdc119c53656c79667b9a81172563b443ad.tar.lz
yuzu-55946cdc119c53656c79667b9a81172563b443ad.tar.xz
yuzu-55946cdc119c53656c79667b9a81172563b443ad.tar.zst
yuzu-55946cdc119c53656c79667b9a81172563b443ad.zip
Diffstat (limited to '')
-rw-r--r--src/core/loader/ncch.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp
index 066e91a9e..d362a4419 100644
--- a/src/core/loader/ncch.cpp
+++ b/src/core/loader/ncch.cpp
@@ -173,6 +173,10 @@ ResultStatus AppLoader_NCCH::LoadSectionExeFS(const char* name, std::vector<u8>&
if (!file.IsOpen())
return ResultStatus::Error;
+ ResultStatus result = LoadExeFS();
+ if (result != ResultStatus::Success)
+ return result;
+
LOG_DEBUG(Loader, "%d sections:", kMaxSections);
// Iterate through the ExeFs archive until we find a section with the specified name...
for (unsigned section_number = 0; section_number < kMaxSections; section_number++) {
@@ -215,9 +219,9 @@ ResultStatus AppLoader_NCCH::LoadSectionExeFS(const char* name, std::vector<u8>&
return ResultStatus::ErrorNotUsed;
}
-ResultStatus AppLoader_NCCH::Load() {
- if (is_loaded)
- return ResultStatus::ErrorAlreadyLoaded;
+ResultStatus AppLoader_NCCH::LoadExeFS() {
+ if (is_exefs_loaded)
+ return ResultStatus::Success;
if (!file.IsOpen())
return ResultStatus::Error;
@@ -282,6 +286,18 @@ ResultStatus AppLoader_NCCH::Load() {
if (file.ReadBytes(&exefs_header, sizeof(ExeFs_Header)) != sizeof(ExeFs_Header))
return ResultStatus::Error;
+ is_exefs_loaded = true;
+ return ResultStatus::Success;
+}
+
+ResultStatus AppLoader_NCCH::Load() {
+ if (is_loaded)
+ return ResultStatus::ErrorAlreadyLoaded;
+
+ ResultStatus result = LoadExeFS();
+ if (result != ResultStatus::Success)
+ return result;
+
is_loaded = true; // Set state to loaded
return LoadExec(); // Load the executable into memory for booting