diff options
Diffstat (limited to 'src/core/loader/nsp.cpp')
| -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) | |||
| 36 | 36 | ||
| 37 | std::tie(nacp_file, icon_file) = | 37 | std::tie(nacp_file, icon_file) = |
| 38 | FileSys::PatchManager(nsp->GetProgramTitleID()).ParseControlNCA(*control_nca); | 38 | FileSys::PatchManager(nsp->GetProgramTitleID()).ParseControlNCA(*control_nca); |
| 39 | |||
| 40 | if (nsp->IsExtractedType()) { | ||
| 41 | secondary_loader = std::make_unique<AppLoader_DeconstructedRomDirectory>(nsp->GetExeFS()); | ||
| 42 | } else { | ||
| 43 | if (title_id == 0) | ||
| 44 | return; | ||
| 45 | |||
| 46 | secondary_loader = std::make_unique<AppLoader_NCA>( | ||
| 47 | nsp->GetNCAFile(title_id, FileSys::ContentRecordType::Program)); | ||
| 48 | } | ||
| 39 | } | 49 | } |
| 40 | 50 | ||
| 41 | AppLoader_NSP::~AppLoader_NSP() = default; | 51 | AppLoader_NSP::~AppLoader_NSP() = default; |
| @@ -67,26 +77,19 @@ ResultStatus AppLoader_NSP::Load(Kernel::Process& process) { | |||
| 67 | return ResultStatus::ErrorAlreadyLoaded; | 77 | return ResultStatus::ErrorAlreadyLoaded; |
| 68 | } | 78 | } |
| 69 | 79 | ||
| 70 | if (nsp->IsExtractedType()) { | 80 | if (title_id == 0) |
| 71 | secondary_loader = std::make_unique<AppLoader_DeconstructedRomDirectory>(nsp->GetExeFS()); | 81 | return ResultStatus::ErrorNSPMissingProgramNCA; |
| 72 | } else { | ||
| 73 | if (title_id == 0) | ||
| 74 | return ResultStatus::ErrorNSPMissingProgramNCA; | ||
| 75 | |||
| 76 | secondary_loader = std::make_unique<AppLoader_NCA>( | ||
| 77 | nsp->GetNCAFile(title_id, FileSys::ContentRecordType::Program)); | ||
| 78 | 82 | ||
| 79 | if (nsp->GetStatus() != ResultStatus::Success) | 83 | if (nsp->GetStatus() != ResultStatus::Success) |
| 80 | return nsp->GetStatus(); | 84 | return nsp->GetStatus(); |
| 81 | 85 | ||
| 82 | if (nsp->GetProgramStatus(title_id) != ResultStatus::Success) | 86 | if (nsp->GetProgramStatus(title_id) != ResultStatus::Success) |
| 83 | return nsp->GetProgramStatus(title_id); | 87 | return nsp->GetProgramStatus(title_id); |
| 84 | 88 | ||
| 85 | if (nsp->GetNCA(title_id, FileSys::ContentRecordType::Program) == nullptr) { | 89 | if (nsp->GetNCA(title_id, FileSys::ContentRecordType::Program) == nullptr) { |
| 86 | if (!Core::Crypto::KeyManager::KeyFileExists(false)) | 90 | if (!Core::Crypto::KeyManager::KeyFileExists(false)) |
| 87 | return ResultStatus::ErrorMissingProductionKeyFile; | 91 | return ResultStatus::ErrorMissingProductionKeyFile; |
| 88 | return ResultStatus::ErrorNSPMissingProgramNCA; | 92 | return ResultStatus::ErrorNSPMissingProgramNCA; |
| 89 | } | ||
| 90 | } | 93 | } |
| 91 | 94 | ||
| 92 | const auto result = secondary_loader->Load(process); | 95 | const auto result = secondary_loader->Load(process); |