diff options
| author | 2018-08-10 11:10:44 -0400 | |
|---|---|---|
| committer | 2018-08-11 22:50:48 -0400 | |
| commit | e5504a060d4af12682abbdf674834397d566502a (patch) | |
| tree | e71a50f911d489a38eda2f5ffd373b0d364db10d /src/core/file_sys | |
| parent | file_sys: Comply to style guidelines (diff) | |
| download | yuzu-e5504a060d4af12682abbdf674834397d566502a.tar.gz yuzu-e5504a060d4af12682abbdf674834397d566502a.tar.xz yuzu-e5504a060d4af12682abbdf674834397d566502a.zip | |
registered_cache: Fix missing reading from yuzu_meta
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/registered_cache.cpp | 23 |
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 { | |||
| 129 | return file; | 129 | return file; |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | boost::optional<NcaID> RegisteredCache::GetNcaIDFromMetadata(u64 title_id, | 132 | static boost::optional<NcaID> CheckMapForContentRecord( |
| 133 | ContentRecordType type) const { | 133 | const boost::container::flat_map<u64, CNMT>& map, u64 title_id, ContentRecordType type) { |
| 134 | if (type == ContentRecordType::Meta && meta_id.find(title_id) != meta_id.end()) | 134 | if (map.find(title_id) == map.end()) |
| 135 | return meta_id.at(title_id); | ||
| 136 | if (meta.find(title_id) == meta.end()) | ||
| 137 | return boost::none; | 135 | return boost::none; |
| 138 | 136 | ||
| 139 | const auto& cnmt = meta.at(title_id); | 137 | const auto& cnmt = map.at(title_id); |
| 140 | 138 | ||
| 141 | const auto iter = std::find_if(cnmt.GetContentRecords().begin(), cnmt.GetContentRecords().end(), | 139 | const auto iter = std::find_if(cnmt.GetContentRecords().begin(), cnmt.GetContentRecords().end(), |
| 142 | [type](const ContentRecord& rec) { return rec.type == type; }); | 140 | [type](const ContentRecord& rec) { return rec.type == type; }); |
| @@ -146,6 +144,17 @@ boost::optional<NcaID> RegisteredCache::GetNcaIDFromMetadata(u64 title_id, | |||
| 146 | return boost::make_optional(iter->nca_id); | 144 | return boost::make_optional(iter->nca_id); |
| 147 | } | 145 | } |
| 148 | 146 | ||
| 147 | boost::optional<NcaID> RegisteredCache::GetNcaIDFromMetadata(u64 title_id, | ||
| 148 | ContentRecordType type) const { | ||
| 149 | if (type == ContentRecordType::Meta && meta_id.find(title_id) != meta_id.end()) | ||
| 150 | return meta_id.at(title_id); | ||
| 151 | |||
| 152 | const auto res1 = CheckMapForContentRecord(yuzu_meta, title_id, type); | ||
| 153 | if (res1 != boost::none) | ||
| 154 | return res1; | ||
| 155 | return CheckMapForContentRecord(meta, title_id, type); | ||
| 156 | } | ||
| 157 | |||
| 149 | std::vector<NcaID> RegisteredCache::AccumulateFiles() const { | 158 | std::vector<NcaID> RegisteredCache::AccumulateFiles() const { |
| 150 | std::vector<NcaID> ids; | 159 | std::vector<NcaID> ids; |
| 151 | for (const auto& d2_dir : dir->GetSubdirectories()) { | 160 | for (const auto& d2_dir : dir->GetSubdirectories()) { |
| @@ -398,7 +407,7 @@ bool RegisteredCache::RawInstallNCA(std::shared_ptr<NCA> nca, boost::optional<Nc | |||
| 398 | std::string path = GetRelativePathFromNcaID(id, false, true); | 407 | std::string path = GetRelativePathFromNcaID(id, false, true); |
| 399 | 408 | ||
| 400 | if (GetFileAtID(id) != nullptr) { | 409 | if (GetFileAtID(id) != nullptr) { |
| 401 | LOG_WARNING(Loader, "OW Attempt"); | 410 | LOG_WARNING(Loader, "Attempting to overwrite existing NCA. Skipping..."); |
| 402 | return false; | 411 | return false; |
| 403 | } | 412 | } |
| 404 | 413 | ||