diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-10-27 16:16:29 +0200 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-10-27 16:16:29 +0200 |
commit | 7c70746ec4f7e61b9e404045dec2ff89ce89158e (patch) | |
tree | dd796e60bbca400f8f788ac48036a7fce17eda19 /src | |
parent | Merge pull request #1533 from FernandoS27/lmem (diff) | |
download | yuzu-7c70746ec4f7e61b9e404045dec2ff89ce89158e.tar yuzu-7c70746ec4f7e61b9e404045dec2ff89ce89158e.tar.gz yuzu-7c70746ec4f7e61b9e404045dec2ff89ce89158e.tar.bz2 yuzu-7c70746ec4f7e61b9e404045dec2ff89ce89158e.tar.lz yuzu-7c70746ec4f7e61b9e404045dec2ff89ce89158e.tar.xz yuzu-7c70746ec4f7e61b9e404045dec2ff89ce89158e.tar.zst yuzu-7c70746ec4f7e61b9e404045dec2ff89ce89158e.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/core/loader/nsp.cpp | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/src/core/loader/nsp.cpp b/src/core/loader/nsp.cpp index 13e57848d..080d89904 100644 --- a/src/core/loader/nsp.cpp +++ b/src/core/loader/nsp.cpp @@ -36,6 +36,16 @@ AppLoader_NSP::AppLoader_NSP(FileSys::VirtualFile file) std::tie(nacp_file, icon_file) = FileSys::PatchManager(nsp->GetProgramTitleID()).ParseControlNCA(*control_nca); + + if (nsp->IsExtractedType()) { + secondary_loader = std::make_unique<AppLoader_DeconstructedRomDirectory>(nsp->GetExeFS()); + } else { + if (title_id == 0) + return; + + secondary_loader = std::make_unique<AppLoader_NCA>( + nsp->GetNCAFile(title_id, FileSys::ContentRecordType::Program)); + } } AppLoader_NSP::~AppLoader_NSP() = default; @@ -67,26 +77,19 @@ ResultStatus AppLoader_NSP::Load(Kernel::Process& process) { return ResultStatus::ErrorAlreadyLoaded; } - if (nsp->IsExtractedType()) { - secondary_loader = std::make_unique<AppLoader_DeconstructedRomDirectory>(nsp->GetExeFS()); - } else { - if (title_id == 0) - return ResultStatus::ErrorNSPMissingProgramNCA; - - secondary_loader = std::make_unique<AppLoader_NCA>( - nsp->GetNCAFile(title_id, FileSys::ContentRecordType::Program)); + if (title_id == 0) + return ResultStatus::ErrorNSPMissingProgramNCA; - if (nsp->GetStatus() != ResultStatus::Success) - return nsp->GetStatus(); + if (nsp->GetStatus() != ResultStatus::Success) + return nsp->GetStatus(); - if (nsp->GetProgramStatus(title_id) != ResultStatus::Success) - return nsp->GetProgramStatus(title_id); + if (nsp->GetProgramStatus(title_id) != ResultStatus::Success) + return nsp->GetProgramStatus(title_id); - if (nsp->GetNCA(title_id, FileSys::ContentRecordType::Program) == nullptr) { - if (!Core::Crypto::KeyManager::KeyFileExists(false)) - return ResultStatus::ErrorMissingProductionKeyFile; - return ResultStatus::ErrorNSPMissingProgramNCA; - } + if (nsp->GetNCA(title_id, FileSys::ContentRecordType::Program) == nullptr) { + if (!Core::Crypto::KeyManager::KeyFileExists(false)) + return ResultStatus::ErrorMissingProductionKeyFile; + return ResultStatus::ErrorNSPMissingProgramNCA; } const auto result = secondary_loader->Load(process); |