aboutsummaryrefslogtreecommitdiff
path: root/src/core/loader/xci.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-04-09 17:03:04 -0400
committerLioncash <mathew1800@gmail.com>2019-04-11 22:11:41 -0400
commite49ee38660fae190844ff0d5112c368e4f927e10 (patch)
tree2d2782d0df46e9458ec2a2728f5cd66f27963ea9 /src/core/loader/xci.cpp
parent67744e08c9c9c15e4e7e5dbe007d0c39968eab26 (diff)
core/core: Move process execution start to System's Load()
This gives us significantly more control over where in the initialization process we start execution of the main process. Previously we were running the main process before the CPU or GPU threads were initialized (not good). This amends execution to start after all of our threads are properly set up.
Diffstat (limited to 'src/core/loader/xci.cpp')
-rw-r--r--src/core/loader/xci.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/core/loader/xci.cpp b/src/core/loader/xci.cpp
index 89f7bbf774..1e285a0531 100644
--- a/src/core/loader/xci.cpp
+++ b/src/core/loader/xci.cpp
@@ -48,31 +48,35 @@ FileType AppLoader_XCI::IdentifyType(const FileSys::VirtualFile& file) {
return FileType::Error;
}
-ResultStatus AppLoader_XCI::Load(Kernel::Process& process) {
+AppLoader_XCI::LoadResult AppLoader_XCI::Load(Kernel::Process& process) {
if (is_loaded) {
- return ResultStatus::ErrorAlreadyLoaded;
+ return {ResultStatus::ErrorAlreadyLoaded, {}};
}
- if (xci->GetStatus() != ResultStatus::Success)
- return xci->GetStatus();
+ if (xci->GetStatus() != ResultStatus::Success) {
+ return {xci->GetStatus(), {}};
+ }
- if (xci->GetProgramNCAStatus() != ResultStatus::Success)
- return xci->GetProgramNCAStatus();
+ if (xci->GetProgramNCAStatus() != ResultStatus::Success) {
+ return {xci->GetProgramNCAStatus(), {}};
+ }
- if (!xci->HasProgramNCA() && !Core::Crypto::KeyManager::KeyFileExists(false))
- return ResultStatus::ErrorMissingProductionKeyFile;
+ if (!xci->HasProgramNCA() && !Core::Crypto::KeyManager::KeyFileExists(false)) {
+ return {ResultStatus::ErrorMissingProductionKeyFile, {}};
+ }
const auto result = nca_loader->Load(process);
- if (result != ResultStatus::Success)
+ if (result.first != ResultStatus::Success) {
return result;
+ }
FileSys::VirtualFile update_raw;
- if (ReadUpdateRaw(update_raw) == ResultStatus::Success && update_raw != nullptr)
+ if (ReadUpdateRaw(update_raw) == ResultStatus::Success && update_raw != nullptr) {
Service::FileSystem::SetPackedUpdate(std::move(update_raw));
+ }
is_loaded = true;
-
- return ResultStatus::Success;
+ return result;
}
ResultStatus AppLoader_XCI::ReadRomFS(FileSys::VirtualFile& file) {