diff options
| -rw-r--r-- | src/core/file_sys/submission_package.cpp | 5 | ||||
| -rw-r--r-- | src/core/loader/nsp.cpp | 25 |
2 files changed, 17 insertions, 13 deletions
diff --git a/src/core/file_sys/submission_package.cpp b/src/core/file_sys/submission_package.cpp index 753d2f58a..691ca90c8 100644 --- a/src/core/file_sys/submission_package.cpp +++ b/src/core/file_sys/submission_package.cpp | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include "core/file_sys/content_archive.h" | 14 | #include "core/file_sys/content_archive.h" |
| 15 | #include "core/file_sys/nca_metadata.h" | 15 | #include "core/file_sys/nca_metadata.h" |
| 16 | #include "core/file_sys/partition_filesystem.h" | 16 | #include "core/file_sys/partition_filesystem.h" |
| 17 | #include "core/file_sys/program_metadata.h" | ||
| 17 | #include "core/file_sys/submission_package.h" | 18 | #include "core/file_sys/submission_package.h" |
| 18 | #include "core/loader/loader.h" | 19 | #include "core/loader/loader.h" |
| 19 | 20 | ||
| @@ -78,6 +79,10 @@ Loader::ResultStatus NSP::GetStatus() const { | |||
| 78 | } | 79 | } |
| 79 | 80 | ||
| 80 | Loader::ResultStatus NSP::GetProgramStatus(u64 title_id) const { | 81 | Loader::ResultStatus NSP::GetProgramStatus(u64 title_id) const { |
| 82 | if (IsExtractedType() && GetExeFS() != nullptr && FileSys::IsDirectoryExeFS(GetExeFS())) { | ||
| 83 | return Loader::ResultStatus::Success; | ||
| 84 | } | ||
| 85 | |||
| 81 | const auto iter = program_status.find(title_id); | 86 | const auto iter = program_status.find(title_id); |
| 82 | if (iter == program_status.end()) | 87 | if (iter == program_status.end()) |
| 83 | return Loader::ResultStatus::ErrorNSPMissingProgramNCA; | 88 | return Loader::ResultStatus::ErrorNSPMissingProgramNCA; |
diff --git a/src/core/loader/nsp.cpp b/src/core/loader/nsp.cpp index 8b90bbd30..9035dc3f9 100644 --- a/src/core/loader/nsp.cpp +++ b/src/core/loader/nsp.cpp | |||
| @@ -26,20 +26,18 @@ AppLoader_NSP::AppLoader_NSP(FileSys::VirtualFile file) | |||
| 26 | 26 | ||
| 27 | if (nsp->GetStatus() != ResultStatus::Success) | 27 | if (nsp->GetStatus() != ResultStatus::Success) |
| 28 | return; | 28 | return; |
| 29 | if (nsp->IsExtractedType()) | ||
| 30 | return; | ||
| 31 | |||
| 32 | const auto control_nca = | ||
| 33 | nsp->GetNCA(nsp->GetProgramTitleID(), FileSys::ContentRecordType::Control); | ||
| 34 | if (control_nca == nullptr || control_nca->GetStatus() != ResultStatus::Success) | ||
| 35 | return; | ||
| 36 | |||
| 37 | std::tie(nacp_file, icon_file) = | ||
| 38 | FileSys::PatchManager(nsp->GetProgramTitleID()).ParseControlNCA(*control_nca); | ||
| 39 | 29 | ||
| 40 | if (nsp->IsExtractedType()) { | 30 | if (nsp->IsExtractedType()) { |
| 41 | secondary_loader = std::make_unique<AppLoader_DeconstructedRomDirectory>(nsp->GetExeFS()); | 31 | secondary_loader = std::make_unique<AppLoader_DeconstructedRomDirectory>(nsp->GetExeFS()); |
| 42 | } else { | 32 | } else { |
| 33 | const auto control_nca = | ||
| 34 | nsp->GetNCA(nsp->GetProgramTitleID(), FileSys::ContentRecordType::Control); | ||
| 35 | if (control_nca == nullptr || control_nca->GetStatus() != ResultStatus::Success) | ||
| 36 | return; | ||
| 37 | |||
| 38 | std::tie(nacp_file, icon_file) = | ||
| 39 | FileSys::PatchManager(nsp->GetProgramTitleID()).ParseControlNCA(*control_nca); | ||
| 40 | |||
| 43 | if (title_id == 0) | 41 | if (title_id == 0) |
| 44 | return; | 42 | return; |
| 45 | 43 | ||
| @@ -56,11 +54,11 @@ FileType AppLoader_NSP::IdentifyType(const FileSys::VirtualFile& file) { | |||
| 56 | if (nsp.GetStatus() == ResultStatus::Success) { | 54 | if (nsp.GetStatus() == ResultStatus::Success) { |
| 57 | // Extracted Type case | 55 | // Extracted Type case |
| 58 | if (nsp.IsExtractedType() && nsp.GetExeFS() != nullptr && | 56 | if (nsp.IsExtractedType() && nsp.GetExeFS() != nullptr && |
| 59 | FileSys::IsDirectoryExeFS(nsp.GetExeFS()) && nsp.GetRomFS() != nullptr) { | 57 | FileSys::IsDirectoryExeFS(nsp.GetExeFS())) { |
| 60 | return FileType::NSP; | 58 | return FileType::NSP; |
| 61 | } | 59 | } |
| 62 | 60 | ||
| 63 | // Non-Ectracted Type case | 61 | // Non-Extracted Type case |
| 64 | if (!nsp.IsExtractedType() && | 62 | if (!nsp.IsExtractedType() && |
| 65 | nsp.GetNCA(nsp.GetFirstTitleID(), FileSys::ContentRecordType::Program) != nullptr && | 63 | nsp.GetNCA(nsp.GetFirstTitleID(), FileSys::ContentRecordType::Program) != nullptr && |
| 66 | AppLoader_NCA::IdentifyType(nsp.GetNCAFile( | 64 | AppLoader_NCA::IdentifyType(nsp.GetNCAFile( |
| @@ -91,7 +89,8 @@ AppLoader_NSP::LoadResult AppLoader_NSP::Load(Kernel::Process& process) { | |||
| 91 | return {nsp_program_status, {}}; | 89 | return {nsp_program_status, {}}; |
| 92 | } | 90 | } |
| 93 | 91 | ||
| 94 | if (nsp->GetNCA(title_id, FileSys::ContentRecordType::Program) == nullptr) { | 92 | if (!nsp->IsExtractedType() && |
| 93 | nsp->GetNCA(title_id, FileSys::ContentRecordType::Program) == nullptr) { | ||
| 95 | if (!Core::Crypto::KeyManager::KeyFileExists(false)) { | 94 | if (!Core::Crypto::KeyManager::KeyFileExists(false)) { |
| 96 | return {ResultStatus::ErrorMissingProductionKeyFile, {}}; | 95 | return {ResultStatus::ErrorMissingProductionKeyFile, {}}; |
| 97 | } | 96 | } |