yuzu-emu
/
yuzu
Archived
1
0
Fork 0

registered_cache: Fix missing reading from yuzu_meta

This commit is contained in:
Zach Hilman 2018-08-10 11:10:44 -04:00
parent 167bfddafa
commit e5504a060d
1 changed files with 16 additions and 7 deletions

View File

@ -129,14 +129,12 @@ VirtualFile RegisteredCache::GetFileAtID(NcaID id) const {
return file; return file;
} }
boost::optional<NcaID> RegisteredCache::GetNcaIDFromMetadata(u64 title_id, static boost::optional<NcaID> CheckMapForContentRecord(
ContentRecordType type) const { const boost::container::flat_map<u64, CNMT>& map, u64 title_id, ContentRecordType type) {
if (type == ContentRecordType::Meta && meta_id.find(title_id) != meta_id.end()) if (map.find(title_id) == map.end())
return meta_id.at(title_id);
if (meta.find(title_id) == meta.end())
return boost::none; 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(), const auto iter = std::find_if(cnmt.GetContentRecords().begin(), cnmt.GetContentRecords().end(),
[type](const ContentRecord& rec) { return rec.type == type; }); [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); 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> RegisteredCache::AccumulateFiles() const {
std::vector<NcaID> ids; std::vector<NcaID> ids;
for (const auto& d2_dir : dir->GetSubdirectories()) { 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); std::string path = GetRelativePathFromNcaID(id, false, true);
if (GetFileAtID(id) != nullptr) { if (GetFileAtID(id) != nullptr) {
LOG_WARNING(Loader, "OW Attempt"); LOG_WARNING(Loader, "Attempting to overwrite existing NCA. Skipping...");
return false; return false;
} }