aboutsummaryrefslogtreecommitdiff
path: root/src/core/loader/ncch.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2016-05-05 18:35:24 -0400
committerbunnei <bunneidev@gmail.com>2016-05-05 18:35:24 -0400
commit143ebcaed064d481ce7463ca7693b402dc4168bf (patch)
tree1fc81259c565ed89e17029a859c06ec8231728aa /src/core/loader/ncch.cpp
parentd49edb1c93d094438af14416a7b720c71f8958b3 (diff)
parentaad34f5d625fd9b8f835ade66a3d4272f7e4878c (diff)
Merge pull request #1700 from wwylele/gamelist-icon
Qt: display game icon and title in the game list
Diffstat (limited to 'src/core/loader/ncch.cpp')
-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 066e91a9eb..d362a4419a 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