diff options
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>& | |||
| 173 | if (!file.IsOpen()) | 173 | if (!file.IsOpen()) |
| 174 | return ResultStatus::Error; | 174 | return ResultStatus::Error; |
| 175 | 175 | ||
| 176 | ResultStatus result = LoadExeFS(); | ||
| 177 | if (result != ResultStatus::Success) | ||
| 178 | return result; | ||
| 179 | |||
| 176 | LOG_DEBUG(Loader, "%d sections:", kMaxSections); | 180 | LOG_DEBUG(Loader, "%d sections:", kMaxSections); |
| 177 | // Iterate through the ExeFs archive until we find a section with the specified name... | 181 | // Iterate through the ExeFs archive until we find a section with the specified name... |
| 178 | for (unsigned section_number = 0; section_number < kMaxSections; section_number++) { | 182 | for (unsigned section_number = 0; section_number < kMaxSections; section_number++) { |
| @@ -215,9 +219,9 @@ ResultStatus AppLoader_NCCH::LoadSectionExeFS(const char* name, std::vector<u8>& | |||
| 215 | return ResultStatus::ErrorNotUsed; | 219 | return ResultStatus::ErrorNotUsed; |
| 216 | } | 220 | } |
| 217 | 221 | ||
| 218 | ResultStatus AppLoader_NCCH::Load() { | 222 | ResultStatus AppLoader_NCCH::LoadExeFS() { |
| 219 | if (is_loaded) | 223 | if (is_exefs_loaded) |
| 220 | return ResultStatus::ErrorAlreadyLoaded; | 224 | return ResultStatus::Success; |
| 221 | 225 | ||
| 222 | if (!file.IsOpen()) | 226 | if (!file.IsOpen()) |
| 223 | return ResultStatus::Error; | 227 | return ResultStatus::Error; |
| @@ -282,6 +286,18 @@ ResultStatus AppLoader_NCCH::Load() { | |||
| 282 | if (file.ReadBytes(&exefs_header, sizeof(ExeFs_Header)) != sizeof(ExeFs_Header)) | 286 | if (file.ReadBytes(&exefs_header, sizeof(ExeFs_Header)) != sizeof(ExeFs_Header)) |
| 283 | return ResultStatus::Error; | 287 | return ResultStatus::Error; |
| 284 | 288 | ||
| 289 | is_exefs_loaded = true; | ||
| 290 | return ResultStatus::Success; | ||
| 291 | } | ||
| 292 | |||
| 293 | ResultStatus AppLoader_NCCH::Load() { | ||
| 294 | if (is_loaded) | ||
| 295 | return ResultStatus::ErrorAlreadyLoaded; | ||
| 296 | |||
| 297 | ResultStatus result = LoadExeFS(); | ||
| 298 | if (result != ResultStatus::Success) | ||
| 299 | return result; | ||
| 300 | |||
| 285 | is_loaded = true; // Set state to loaded | 301 | is_loaded = true; // Set state to loaded |
| 286 | 302 | ||
| 287 | return LoadExec(); // Load the executable into memory for booting | 303 | return LoadExec(); // Load the executable into memory for booting |