registered_cache: Add getter to determine source slot in content provider union

Used to determine StorageId source for application data.
This commit is contained in:
Zach Hilman 2019-06-24 19:10:17 -04:00
parent a468273221
commit db2e5e5fa6
2 changed files with 17 additions and 0 deletions

View File

@ -645,6 +645,20 @@ ContentProviderUnion::ListEntriesFilterOrigin(std::optional<ContentProviderUnion
return out;
}
std::optional<ContentProviderUnionSlot> ContentProviderUnion::GetSlotForEntry(
u64 title_id, ContentRecordType type) const {
for (const auto& [slot, provider] : providers) {
if (provider == nullptr)
continue;
if (provider->HasEntry(title_id, type)) {
return slot;
}
}
return std::nullopt;
}
ManualContentProvider::~ManualContentProvider() = default;
void ManualContentProvider::AddEntry(TitleType title_type, ContentRecordType content_type,

View File

@ -199,6 +199,9 @@ public:
std::optional<TitleType> title_type = {}, std::optional<ContentRecordType> record_type = {},
std::optional<u64> title_id = {}) const;
std::optional<ContentProviderUnionSlot> GetSlotForEntry(u64 title_id,
ContentRecordType type) const;
private:
std::map<ContentProviderUnionSlot, ContentProvider*> providers;
};