diff options
author | wwylele <wwylele@gmail.com> | 2016-04-13 23:04:05 +0200 |
---|---|---|
committer | wwylele <wwylele@gmail.com> | 2016-05-04 12:02:49 +0200 |
commit | 5d5dd66d9222ced82dd61747ef4078fc1eae2496 (patch) | |
tree | e7495d933b0fbdc767426fc18940f95b7817c8ab /src/core/loader/ncch.cpp | |
parent | Merge pull request #1726 from MerryMage/read-write-region (diff) | |
download | yuzu-5d5dd66d9222ced82dd61747ef4078fc1eae2496.tar yuzu-5d5dd66d9222ced82dd61747ef4078fc1eae2496.tar.gz yuzu-5d5dd66d9222ced82dd61747ef4078fc1eae2496.tar.bz2 yuzu-5d5dd66d9222ced82dd61747ef4078fc1eae2496.tar.lz yuzu-5d5dd66d9222ced82dd61747ef4078fc1eae2496.tar.xz yuzu-5d5dd66d9222ced82dd61747ef4078fc1eae2496.tar.zst yuzu-5d5dd66d9222ced82dd61747ef4078fc1eae2496.zip |
Diffstat (limited to 'src/core/loader/ncch.cpp')
-rw-r--r-- | src/core/loader/ncch.cpp | 22 |
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 |