summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys/registered_cache.cpp
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2020-07-05 16:38:34 +0200
committerMorph <39850852+Morph1984@users.noreply.github.com>2020-07-15 19:27:04 +0200
commit8794e623d99d6179ab15f76ddf473002d112fc3a (patch)
tree5df4ba59717ae22c75a0b0a097ffeb054c51c60a /src/core/file_sys/registered_cache.cpp
parentregistered_cache: Remove previous update/dlc if it exists on install (diff)
downloadyuzu-8794e623d99d6179ab15f76ddf473002d112fc3a.tar
yuzu-8794e623d99d6179ab15f76ddf473002d112fc3a.tar.gz
yuzu-8794e623d99d6179ab15f76ddf473002d112fc3a.tar.bz2
yuzu-8794e623d99d6179ab15f76ddf473002d112fc3a.tar.lz
yuzu-8794e623d99d6179ab15f76ddf473002d112fc3a.tar.xz
yuzu-8794e623d99d6179ab15f76ddf473002d112fc3a.tar.zst
yuzu-8794e623d99d6179ab15f76ddf473002d112fc3a.zip
Diffstat (limited to 'src/core/file_sys/registered_cache.cpp')
-rw-r--r--src/core/file_sys/registered_cache.cpp22
1 files changed, 9 insertions, 13 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
return InstallEntry(*xci.GetSecurePartitionNSP(), overwrite_if_exists, copy);
}
-bool RegisteredCache::RemoveExistingEntry(const u64 title_id) {
+bool RegisteredCache::RemoveExistingEntry(u64 title_id) {
const auto delete_nca = [this](const NcaID& id) {
const auto path = GetRelativePathFromNcaID(id, false, true, false);
@@ -566,25 +566,23 @@ bool RegisteredCache::RemoveExistingEntry(const u64 title_id) {
return res;
};
- // Get the Content Provider
- const auto& installed = Core::System::GetInstance().GetContentProvider();
// If an update exists, remove
- if (installed.HasEntry(title_id, ContentRecordType::Meta)) {
+ if (HasEntry(title_id, ContentRecordType::Meta)) {
LOG_INFO(Loader,
"Previous Update (v{}) for title_id={:016X} detected! Attempting to remove...",
- installed.GetEntryVersion(title_id).value_or(0), title_id);
+ GetEntryVersion(title_id).value_or(0), title_id);
// Get all the ncas associated with the current update CNMT and delete them
- const auto& meta_old_id =
+ const auto meta_old_id =
GetNcaIDFromMetadata(title_id, ContentRecordType::Meta).value_or(NcaID{});
- const auto& program_id =
+ const auto program_id =
GetNcaIDFromMetadata(title_id, ContentRecordType::Program).value_or(NcaID{});
- const auto& data_id =
+ const auto data_id =
GetNcaIDFromMetadata(title_id, ContentRecordType::Data).value_or(NcaID{});
- const auto& control_id =
+ const auto control_id =
GetNcaIDFromMetadata(title_id, ContentRecordType::Control).value_or(NcaID{});
- const auto& html_id =
+ const auto html_id =
GetNcaIDFromMetadata(title_id, ContentRecordType::HtmlDocument).value_or(NcaID{});
- const auto& legal_id =
+ const auto legal_id =
GetNcaIDFromMetadata(title_id, ContentRecordType::LegalInformation).value_or(NcaID{});
delete_nca(meta_old_id);
@@ -618,9 +616,7 @@ InstallResult RegisteredCache::InstallEntry(const NSP& nsp, bool overwrite_if_ex
const auto cnmt_file = section0->GetFiles()[0];
const CNMT cnmt(cnmt_file);
- // Get the title id stored within the CNMT
const auto title_id = cnmt.GetTitleID();
- // Removes an entry if it exists
const auto result = RemoveExistingEntry(title_id);
// Install Metadata File