summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-08-10 17:10:44 +0200
committerZach Hilman <zachhilman@gmail.com>2018-08-12 04:50:48 +0200
commite5504a060d4af12682abbdf674834397d566502a (patch)
treee71a50f911d489a38eda2f5ffd373b0d364db10d /src/core/file_sys
parentfile_sys: Comply to style guidelines (diff)
downloadyuzu-e5504a060d4af12682abbdf674834397d566502a.tar
yuzu-e5504a060d4af12682abbdf674834397d566502a.tar.gz
yuzu-e5504a060d4af12682abbdf674834397d566502a.tar.bz2
yuzu-e5504a060d4af12682abbdf674834397d566502a.tar.lz
yuzu-e5504a060d4af12682abbdf674834397d566502a.tar.xz
yuzu-e5504a060d4af12682abbdf674834397d566502a.tar.zst
yuzu-e5504a060d4af12682abbdf674834397d566502a.zip
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/registered_cache.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp
index 3e7706171..665126c1c 100644
--- a/src/core/file_sys/registered_cache.cpp
+++ b/src/core/file_sys/registered_cache.cpp
@@ -129,14 +129,12 @@ VirtualFile RegisteredCache::GetFileAtID(NcaID id) const {
return file;
}
-boost::optional<NcaID> RegisteredCache::GetNcaIDFromMetadata(u64 title_id,
- ContentRecordType type) const {
- if (type == ContentRecordType::Meta && meta_id.find(title_id) != meta_id.end())
- return meta_id.at(title_id);
- if (meta.find(title_id) == meta.end())
+static boost::optional<NcaID> CheckMapForContentRecord(
+ const boost::container::flat_map<u64, CNMT>& map, u64 title_id, ContentRecordType type) {
+ if (map.find(title_id) == map.end())
return boost::none;
- const auto& cnmt = meta.at(title_id);
+ const auto& cnmt = map.at(title_id);
const auto iter = std::find_if(cnmt.GetContentRecords().begin(), cnmt.GetContentRecords().end(),
[type](const ContentRecord& rec) { return rec.type == type; });
@@ -146,6 +144,17 @@ boost::optional<NcaID> RegisteredCache::GetNcaIDFromMetadata(u64 title_id,
return boost::make_optional(iter->nca_id);
}
+boost::optional<NcaID> RegisteredCache::GetNcaIDFromMetadata(u64 title_id,
+ ContentRecordType type) const {
+ if (type == ContentRecordType::Meta && meta_id.find(title_id) != meta_id.end())
+ return meta_id.at(title_id);
+
+ const auto res1 = CheckMapForContentRecord(yuzu_meta, title_id, type);
+ if (res1 != boost::none)
+ return res1;
+ return CheckMapForContentRecord(meta, title_id, type);
+}
+
std::vector<NcaID> RegisteredCache::AccumulateFiles() const {
std::vector<NcaID> ids;
for (const auto& d2_dir : dir->GetSubdirectories()) {
@@ -398,7 +407,7 @@ bool RegisteredCache::RawInstallNCA(std::shared_ptr<NCA> nca, boost::optional<Nc
std::string path = GetRelativePathFromNcaID(id, false, true);
if (GetFileAtID(id) != nullptr) {
- LOG_WARNING(Loader, "OW Attempt");
+ LOG_WARNING(Loader, "Attempting to overwrite existing NCA. Skipping...");
return false;
}