[XAM] UserTracker: Added option to return user specific list of contexts and properties
This commit is contained in:
parent
da89b6a0c3
commit
d2f350d0d3
|
@ -641,6 +641,50 @@ std::optional<uint32_t> UserTracker::GetUserContext(uint64_t xuid,
|
||||||
return entry->get_data()->data.u32;
|
return entry->get_data()->data.u32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<AttributeKey> UserTracker::GetUserContextIds(uint64_t xuid) const {
|
||||||
|
if (!IsUserTracked(xuid)) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto user = kernel_state()->xam_state()->GetUserProfile(xuid);
|
||||||
|
if (!user) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<AttributeKey> entries;
|
||||||
|
|
||||||
|
for (const auto& property : user->properties_) {
|
||||||
|
if (!property.IsContext()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
entries.push_back(property.GetPropertyId());
|
||||||
|
}
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<AttributeKey> UserTracker::GetUserPropertyIds(uint64_t xuid) const {
|
||||||
|
if (!IsUserTracked(xuid)) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto user = kernel_state()->xam_state()->GetUserProfile(xuid);
|
||||||
|
if (!user) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<AttributeKey> entries;
|
||||||
|
|
||||||
|
for (const auto& property : user->properties_) {
|
||||||
|
if (property.IsContext()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
entries.push_back(property.GetPropertyId());
|
||||||
|
}
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
|
||||||
void UserTracker::UpdateSettingValue(uint64_t xuid, uint32_t title_id,
|
void UserTracker::UpdateSettingValue(uint64_t xuid, uint32_t title_id,
|
||||||
UserSettingId setting_id,
|
UserSettingId setting_id,
|
||||||
int32_t difference) {
|
int32_t difference) {
|
||||||
|
|
|
@ -62,12 +62,14 @@ class UserTracker {
|
||||||
// Context
|
// Context
|
||||||
void UpdateContext(uint64_t xuid, uint32_t id, uint32_t value);
|
void UpdateContext(uint64_t xuid, uint32_t id, uint32_t value);
|
||||||
std::optional<uint32_t> GetUserContext(uint64_t xuid, uint32_t id) const;
|
std::optional<uint32_t> GetUserContext(uint64_t xuid, uint32_t id) const;
|
||||||
|
std::vector<AttributeKey> GetUserContextIds(uint64_t xuid) const;
|
||||||
|
|
||||||
// Property
|
// Property
|
||||||
void AddProperty(const uint64_t xuid, const Property* property);
|
void AddProperty(const uint64_t xuid, const Property* property);
|
||||||
X_STATUS GetProperty(const uint64_t xuid, uint32_t* property_size,
|
X_STATUS GetProperty(const uint64_t xuid, uint32_t* property_size,
|
||||||
XUSER_PROPERTY* property);
|
XUSER_PROPERTY* property);
|
||||||
const Property* GetProperty(const uint64_t xuid, const uint32_t id) const;
|
const Property* GetProperty(const uint64_t xuid, const uint32_t id) const;
|
||||||
|
std::vector<AttributeKey> GetUserPropertyIds(uint64_t xuid) const;
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
void UpsertSetting(uint64_t xuid, uint32_t title_id,
|
void UpsertSetting(uint64_t xuid, uint32_t title_id,
|
||||||
|
|
Loading…
Reference in New Issue