diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/file_sys/card_image.cpp | 9 | ||||
| -rw-r--r-- | src/core/file_sys/card_image.h | 2 | ||||
| -rw-r--r-- | src/core/loader/xci.cpp | 11 |
3 files changed, 17 insertions, 5 deletions
diff --git a/src/core/file_sys/card_image.cpp b/src/core/file_sys/card_image.cpp index 1d7c7fb10..508f09e56 100644 --- a/src/core/file_sys/card_image.cpp +++ b/src/core/file_sys/card_image.cpp | |||
| @@ -43,6 +43,8 @@ XCI::XCI(VirtualFile file_) : file(std::move(file_)), partitions(0x4) { | |||
| 43 | partitions[static_cast<size_t>(partition)] = std::make_shared<PartitionFilesystem>(raw); | 43 | partitions[static_cast<size_t>(partition)] = std::make_shared<PartitionFilesystem>(raw); |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | program_nca_status = Loader::ResultStatus::ErrorXCIMissingProgramNCA; | ||
| 47 | |||
| 46 | auto result = AddNCAFromPartition(XCIPartition::Secure); | 48 | auto result = AddNCAFromPartition(XCIPartition::Secure); |
| 47 | if (result != Loader::ResultStatus::Success) { | 49 | if (result != Loader::ResultStatus::Success) { |
| 48 | status = result; | 50 | status = result; |
| @@ -76,6 +78,10 @@ Loader::ResultStatus XCI::GetStatus() const { | |||
| 76 | return status; | 78 | return status; |
| 77 | } | 79 | } |
| 78 | 80 | ||
| 81 | Loader::ResultStatus XCI::GetProgramNCAStatus() const { | ||
| 82 | return program_nca_status; | ||
| 83 | } | ||
| 84 | |||
| 79 | VirtualDir XCI::GetPartition(XCIPartition partition) const { | 85 | VirtualDir XCI::GetPartition(XCIPartition partition) const { |
| 80 | return partitions[static_cast<size_t>(partition)]; | 86 | return partitions[static_cast<size_t>(partition)]; |
| 81 | } | 87 | } |
| @@ -143,6 +149,9 @@ Loader::ResultStatus XCI::AddNCAFromPartition(XCIPartition part) { | |||
| 143 | if (file->GetExtension() != "nca") | 149 | if (file->GetExtension() != "nca") |
| 144 | continue; | 150 | continue; |
| 145 | auto nca = std::make_shared<NCA>(file); | 151 | auto nca = std::make_shared<NCA>(file); |
| 152 | if (nca->GetType() == NCAContentType::Program) { | ||
| 153 | program_nca_status = nca->GetStatus(); | ||
| 154 | } | ||
| 146 | if (nca->GetStatus() == Loader::ResultStatus::Success) { | 155 | if (nca->GetStatus() == Loader::ResultStatus::Success) { |
| 147 | ncas.push_back(std::move(nca)); | 156 | ncas.push_back(std::move(nca)); |
| 148 | } else { | 157 | } else { |
diff --git a/src/core/file_sys/card_image.h b/src/core/file_sys/card_image.h index a03d5264e..54ab828d1 100644 --- a/src/core/file_sys/card_image.h +++ b/src/core/file_sys/card_image.h | |||
| @@ -59,6 +59,7 @@ public: | |||
| 59 | explicit XCI(VirtualFile file); | 59 | explicit XCI(VirtualFile file); |
| 60 | 60 | ||
| 61 | Loader::ResultStatus GetStatus() const; | 61 | Loader::ResultStatus GetStatus() const; |
| 62 | Loader::ResultStatus GetProgramNCAStatus() const; | ||
| 62 | 63 | ||
| 63 | u8 GetFormatVersion() const; | 64 | u8 GetFormatVersion() const; |
| 64 | 65 | ||
| @@ -90,6 +91,7 @@ private: | |||
| 90 | GamecardHeader header{}; | 91 | GamecardHeader header{}; |
| 91 | 92 | ||
| 92 | Loader::ResultStatus status; | 93 | Loader::ResultStatus status; |
| 94 | Loader::ResultStatus program_nca_status; | ||
| 93 | 95 | ||
| 94 | std::vector<VirtualDir> partitions; | 96 | std::vector<VirtualDir> partitions; |
| 95 | std::vector<std::shared_ptr<NCA>> ncas; | 97 | std::vector<std::shared_ptr<NCA>> ncas; |
diff --git a/src/core/loader/xci.cpp b/src/core/loader/xci.cpp index 4c4979545..9dc4d1f35 100644 --- a/src/core/loader/xci.cpp +++ b/src/core/loader/xci.cpp | |||
| @@ -61,11 +61,12 @@ ResultStatus AppLoader_XCI::Load(Kernel::SharedPtr<Kernel::Process>& process) { | |||
| 61 | if (xci->GetStatus() != ResultStatus::Success) | 61 | if (xci->GetStatus() != ResultStatus::Success) |
| 62 | return xci->GetStatus(); | 62 | return xci->GetStatus(); |
| 63 | 63 | ||
| 64 | if (xci->GetNCAFileByType(FileSys::NCAContentType::Program) == nullptr) { | 64 | if (xci->GetProgramNCAStatus() != ResultStatus::Success) |
| 65 | if (!Core::Crypto::KeyManager::KeyFileExists(false)) | 65 | return xci->GetProgramNCAStatus(); |
| 66 | return ResultStatus::ErrorMissingProductionKeyFile; | 66 | |
| 67 | return ResultStatus::ErrorXCIMissingProgramNCA; | 67 | const auto nca = xci->GetNCAFileByType(FileSys::NCAContentType::Program); |
| 68 | } | 68 | if (nca == nullptr && !Core::Crypto::KeyManager::KeyFileExists(false)) |
| 69 | return ResultStatus::ErrorMissingProductionKeyFile; | ||
| 69 | 70 | ||
| 70 | auto result = nca_loader->Load(process); | 71 | auto result = nca_loader->Load(process); |
| 71 | if (result != ResultStatus::Success) | 72 | if (result != ResultStatus::Success) |