diff options
| -rw-r--r-- | src/core/file_sys/registered_cache.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index e94eed3b6..f831487dd 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp | |||
| @@ -344,15 +344,18 @@ VirtualFile RegisteredCache::GetFileAtID(NcaID id) const { | |||
| 344 | 344 | ||
| 345 | static std::optional<NcaID> CheckMapForContentRecord(const std::map<u64, CNMT>& map, u64 title_id, | 345 | static std::optional<NcaID> CheckMapForContentRecord(const std::map<u64, CNMT>& map, u64 title_id, |
| 346 | ContentRecordType type) { | 346 | ContentRecordType type) { |
| 347 | if (map.find(title_id) == map.end()) | 347 | const auto cmnt_iter = map.find(title_id); |
| 348 | return {}; | 348 | if (cmnt_iter == map.cend()) { |
| 349 | 349 | return std::nullopt; | |
| 350 | const auto& cnmt = map.at(title_id); | 350 | } |
| 351 | 351 | ||
| 352 | const auto iter = std::find_if(cnmt.GetContentRecords().begin(), cnmt.GetContentRecords().end(), | 352 | const auto& cnmt = cmnt_iter->second; |
| 353 | const auto& content_records = cnmt.GetContentRecords(); | ||
| 354 | const auto iter = std::find_if(content_records.cbegin(), content_records.cend(), | ||
| 353 | [type](const ContentRecord& rec) { return rec.type == type; }); | 355 | [type](const ContentRecord& rec) { return rec.type == type; }); |
| 354 | if (iter == cnmt.GetContentRecords().end()) | 356 | if (iter == content_records.cend()) { |
| 355 | return {}; | 357 | return std::nullopt; |
| 358 | } | ||
| 356 | 359 | ||
| 357 | return std::make_optional(iter->nca_id); | 360 | return std::make_optional(iter->nca_id); |
| 358 | } | 361 | } |
| @@ -467,14 +470,16 @@ VirtualFile RegisteredCache::GetEntryUnparsed(u64 title_id, ContentRecordType ty | |||
| 467 | 470 | ||
| 468 | std::optional<u32> RegisteredCache::GetEntryVersion(u64 title_id) const { | 471 | std::optional<u32> RegisteredCache::GetEntryVersion(u64 title_id) const { |
| 469 | const auto meta_iter = meta.find(title_id); | 472 | const auto meta_iter = meta.find(title_id); |
| 470 | if (meta_iter != meta.end()) | 473 | if (meta_iter != meta.cend()) { |
| 471 | return meta_iter->second.GetTitleVersion(); | 474 | return meta_iter->second.GetTitleVersion(); |
| 475 | } | ||
| 472 | 476 | ||
| 473 | const auto yuzu_meta_iter = yuzu_meta.find(title_id); | 477 | const auto yuzu_meta_iter = yuzu_meta.find(title_id); |
| 474 | if (yuzu_meta_iter != yuzu_meta.end()) | 478 | if (yuzu_meta_iter != yuzu_meta.cend()) { |
| 475 | return yuzu_meta_iter->second.GetTitleVersion(); | 479 | return yuzu_meta_iter->second.GetTitleVersion(); |
| 480 | } | ||
| 476 | 481 | ||
| 477 | return {}; | 482 | return std::nullopt; |
| 478 | } | 483 | } |
| 479 | 484 | ||
| 480 | VirtualFile RegisteredCache::GetEntryRaw(u64 title_id, ContentRecordType type) const { | 485 | VirtualFile RegisteredCache::GetEntryRaw(u64 title_id, ContentRecordType type) const { |