diff options
| author | 2020-07-05 10:38:34 -0400 | |
|---|---|---|
| committer | 2020-07-15 13:27:04 -0400 | |
| commit | 8794e623d99d6179ab15f76ddf473002d112fc3a (patch) | |
| tree | 5df4ba59717ae22c75a0b0a097ffeb054c51c60a /src | |
| parent | registered_cache: Remove previous update/dlc if it exists on install (diff) | |
| download | yuzu-8794e623d99d6179ab15f76ddf473002d112fc3a.tar.gz yuzu-8794e623d99d6179ab15f76ddf473002d112fc3a.tar.xz yuzu-8794e623d99d6179ab15f76ddf473002d112fc3a.zip | |
Remove global system instance and address feedback
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/registered_cache.cpp | 22 | ||||
| -rw-r--r-- | src/core/file_sys/registered_cache.h | 2 |
2 files changed, 10 insertions, 14 deletions
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index 39bfbdfd3..0f4d52d35 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp | |||
| @@ -547,7 +547,7 @@ InstallResult RegisteredCache::InstallEntry(const XCI& xci, bool overwrite_if_ex | |||
| 547 | return InstallEntry(*xci.GetSecurePartitionNSP(), overwrite_if_exists, copy); | 547 | return InstallEntry(*xci.GetSecurePartitionNSP(), overwrite_if_exists, copy); |
| 548 | } | 548 | } |
| 549 | 549 | ||
| 550 | bool RegisteredCache::RemoveExistingEntry(const u64 title_id) { | 550 | bool RegisteredCache::RemoveExistingEntry(u64 title_id) { |
| 551 | const auto delete_nca = [this](const NcaID& id) { | 551 | const auto delete_nca = [this](const NcaID& id) { |
| 552 | const auto path = GetRelativePathFromNcaID(id, false, true, false); | 552 | const auto path = GetRelativePathFromNcaID(id, false, true, false); |
| 553 | 553 | ||
| @@ -566,25 +566,23 @@ bool RegisteredCache::RemoveExistingEntry(const u64 title_id) { | |||
| 566 | return res; | 566 | return res; |
| 567 | }; | 567 | }; |
| 568 | 568 | ||
| 569 | // Get the Content Provider | ||
| 570 | const auto& installed = Core::System::GetInstance().GetContentProvider(); | ||
| 571 | // If an update exists, remove | 569 | // If an update exists, remove |
| 572 | if (installed.HasEntry(title_id, ContentRecordType::Meta)) { | 570 | if (HasEntry(title_id, ContentRecordType::Meta)) { |
| 573 | LOG_INFO(Loader, | 571 | LOG_INFO(Loader, |
| 574 | "Previous Update (v{}) for title_id={:016X} detected! Attempting to remove...", | 572 | "Previous Update (v{}) for title_id={:016X} detected! Attempting to remove...", |
| 575 | installed.GetEntryVersion(title_id).value_or(0), title_id); | 573 | GetEntryVersion(title_id).value_or(0), title_id); |
| 576 | // Get all the ncas associated with the current update CNMT and delete them | 574 | // Get all the ncas associated with the current update CNMT and delete them |
| 577 | const auto& meta_old_id = | 575 | const auto meta_old_id = |
| 578 | GetNcaIDFromMetadata(title_id, ContentRecordType::Meta).value_or(NcaID{}); | 576 | GetNcaIDFromMetadata(title_id, ContentRecordType::Meta).value_or(NcaID{}); |
| 579 | const auto& program_id = | 577 | const auto program_id = |
| 580 | GetNcaIDFromMetadata(title_id, ContentRecordType::Program).value_or(NcaID{}); | 578 | GetNcaIDFromMetadata(title_id, ContentRecordType::Program).value_or(NcaID{}); |
| 581 | const auto& data_id = | 579 | const auto data_id = |
| 582 | GetNcaIDFromMetadata(title_id, ContentRecordType::Data).value_or(NcaID{}); | 580 | GetNcaIDFromMetadata(title_id, ContentRecordType::Data).value_or(NcaID{}); |
| 583 | const auto& control_id = | 581 | const auto control_id = |
| 584 | GetNcaIDFromMetadata(title_id, ContentRecordType::Control).value_or(NcaID{}); | 582 | GetNcaIDFromMetadata(title_id, ContentRecordType::Control).value_or(NcaID{}); |
| 585 | const auto& html_id = | 583 | const auto html_id = |
| 586 | GetNcaIDFromMetadata(title_id, ContentRecordType::HtmlDocument).value_or(NcaID{}); | 584 | GetNcaIDFromMetadata(title_id, ContentRecordType::HtmlDocument).value_or(NcaID{}); |
| 587 | const auto& legal_id = | 585 | const auto legal_id = |
| 588 | GetNcaIDFromMetadata(title_id, ContentRecordType::LegalInformation).value_or(NcaID{}); | 586 | GetNcaIDFromMetadata(title_id, ContentRecordType::LegalInformation).value_or(NcaID{}); |
| 589 | 587 | ||
| 590 | delete_nca(meta_old_id); | 588 | delete_nca(meta_old_id); |
| @@ -618,9 +616,7 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_ex | |||
| 618 | const auto cnmt_file = section0->GetFiles()[0]; | 616 | const auto cnmt_file = section0->GetFiles()[0]; |
| 619 | const CNMT cnmt(cnmt_file); | 617 | const CNMT cnmt(cnmt_file); |
| 620 | 618 | ||
| 621 | // Get the title id stored within the CNMT | ||
| 622 | const auto title_id = cnmt.GetTitleID(); | 619 | const auto title_id = cnmt.GetTitleID(); |
| 623 | // Removes an entry if it exists | ||
| 624 | const auto result = RemoveExistingEntry(title_id); | 620 | const auto result = RemoveExistingEntry(title_id); |
| 625 | 621 | ||
| 626 | // Install Metadata File | 622 | // Install Metadata File |
diff --git a/src/core/file_sys/registered_cache.h b/src/core/file_sys/registered_cache.h index 8598f0543..3459c695b 100644 --- a/src/core/file_sys/registered_cache.h +++ b/src/core/file_sys/registered_cache.h | |||
| @@ -156,7 +156,7 @@ public: | |||
| 156 | std::optional<u64> title_id = {}) const override; | 156 | std::optional<u64> title_id = {}) const override; |
| 157 | 157 | ||
| 158 | // Removes an existing entry based on title id | 158 | // Removes an existing entry based on title id |
| 159 | bool RemoveExistingEntry(const u64 title_id); | 159 | bool RemoveExistingEntry(u64 title_id); |
| 160 | 160 | ||
| 161 | // Raw copies all the ncas from the xci/nsp to the csache. Does some quick checks to make sure | 161 | // Raw copies all the ncas from the xci/nsp to the csache. Does some quick checks to make sure |
| 162 | // there is a meta NCA and all of them are accessible. | 162 | // there is a meta NCA and all of them are accessible. |