ncm: update to implement new ContentMetaDatabase function for 20.0.0

This commit is contained in:
Michael Scire
2025-04-30 23:27:36 -07:00
committed by SciresM
parent b1ca5b4049
commit 791edf87a0
8 changed files with 70 additions and 1 deletions

View File

@@ -534,4 +534,34 @@ namespace ams::ncm {
R_SUCCEED();
}
Result ContentMetaDatabaseImpl::HasAttributes(sf::Out<u8> out, u8 attribute_mask) {
R_TRY(this->EnsureEnabled());
/* Create a variable to hold the combined attributes. */
u8 combined_attributes = 0;
/* Iterate over all entries. */
for (auto &entry : *m_kvs) {
/* Obtain the content meta for the key. */
const void *meta;
size_t meta_size;
R_TRY(this->GetContentMetaPointer(&meta, &meta_size, entry.GetKey()));
/* Create a reader. */
ContentMetaReader reader(meta, meta_size);
/* Accumulate the set attributes from the current entry. */
combined_attributes |= (reader.GetHeader()->attributes) & attribute_mask;
/* If all the attributes we're looking for have been found, we're done. */
if ((combined_attributes & attribute_mask) == attribute_mask) {
break;
}
}
/* Set the output. */
*out = combined_attributes;
R_SUCCEED();
}
}