diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/registered_cache.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index 92417ef70..37351c561 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp | |||
| @@ -566,12 +566,13 @@ bool RegisteredCache::RemoveExistingEntry(u64 title_id) { | |||
| 566 | return res; | 566 | return res; |
| 567 | }; | 567 | }; |
| 568 | 568 | ||
| 569 | // If an update exists, remove | 569 | // If an entry exists in the registered cache, remove it |
| 570 | if (HasEntry(title_id, ContentRecordType::Meta)) { | 570 | if (HasEntry(title_id, ContentRecordType::Meta)) { |
| 571 | LOG_INFO(Loader, | 571 | LOG_INFO(Loader, |
| 572 | "Previous Update (v{}) for title_id={:016X} detected! Attempting to remove...", | 572 | "Previously installed entry (v{}) for title_id={:016X} detected! " |
| 573 | "Attempting to remove...", | ||
| 573 | GetEntryVersion(title_id).value_or(0), title_id); | 574 | GetEntryVersion(title_id).value_or(0), title_id); |
| 574 | // Get all the ncas associated with the current update CNMT and delete them | 575 | // Get all the ncas associated with the current CNMT and delete them |
| 575 | const auto meta_old_id = | 576 | const auto meta_old_id = |
| 576 | GetNcaIDFromMetadata(title_id, ContentRecordType::Meta).value_or(NcaID{}); | 577 | GetNcaIDFromMetadata(title_id, ContentRecordType::Meta).value_or(NcaID{}); |
| 577 | const auto program_id = | 578 | const auto program_id = |
| @@ -612,7 +613,22 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_ex | |||
| 612 | const auto meta_id_raw = (*meta_iter)->GetName().substr(0, 32); | 613 | const auto meta_id_raw = (*meta_iter)->GetName().substr(0, 32); |
| 613 | const auto meta_id = Common::HexStringToArray<16>(meta_id_raw); | 614 | const auto meta_id = Common::HexStringToArray<16>(meta_id_raw); |
| 614 | 615 | ||
| 616 | if ((*meta_iter)->GetSubdirectories().empty()) { | ||
| 617 | LOG_ERROR(Loader, | ||
| 618 | "The file you are attempting to install does not contain a section0 within the " | ||
| 619 | "metadata NCA and is therefore malformed. Verify that the file is valid."); | ||
| 620 | return InstallResult::ErrorMetaFailed; | ||
| 621 | } | ||
| 622 | |||
| 615 | const auto section0 = (*meta_iter)->GetSubdirectories()[0]; | 623 | const auto section0 = (*meta_iter)->GetSubdirectories()[0]; |
| 624 | |||
| 625 | if (section0->GetFiles().empty()) { | ||
| 626 | LOG_ERROR(Loader, | ||
| 627 | "The file you are attempting to install does not contain a CNMT within the " | ||
| 628 | "metadata NCA and is therefore malformed. Verify that the file is valid."); | ||
| 629 | return InstallResult::ErrorMetaFailed; | ||
| 630 | } | ||
| 631 | |||
| 616 | const auto cnmt_file = section0->GetFiles()[0]; | 632 | const auto cnmt_file = section0->GetFiles()[0]; |
| 617 | const CNMT cnmt(cnmt_file); | 633 | const CNMT cnmt(cnmt_file); |
| 618 | 634 | ||