[XAM] Implemented XamUserGetUserFlags & XamUserGetUserFlagsFromXUID

This commit is contained in:
Adrian 2024-11-24 14:50:09 +00:00 committed by Radosław Gliński
parent c06b1f6e98
commit 05ae4ac6e9
3 changed files with 27 additions and 0 deletions

View File

@ -160,6 +160,8 @@ class UserProfile {
uint32_t signin_state() const { return 1; }
uint32_t type() const { return 1 | 2; /* local | online profile? */ }
uint32_t GetCachedFlags() const { return account_info_.GetCachedFlags(); };
void AddSetting(std::unique_ptr<UserSetting> setting);
UserSetting* GetSetting(uint32_t setting_id);

View File

@ -707,6 +707,29 @@ dword_result_t XamUserGetSubscriptionType_entry(dword_t user_index,
}
DECLARE_XAM_EXPORT1(XamUserGetSubscriptionType, kUserProfiles, kStub);
dword_result_t XamUserGetUserFlags_entry(dword_t user_index) {
if (!kernel_state()->xam_state()->IsUserSignedIn(user_index)) {
return 0;
}
const auto& user_profile =
kernel_state()->xam_state()->GetUserProfile(user_index);
return user_profile->GetCachedFlags();
}
DECLARE_XAM_EXPORT1(XamUserGetUserFlags, kUserProfiles, kImplemented);
dword_result_t XamUserGetUserFlagsFromXUID_entry(qword_t xuid) {
if (!kernel_state()->xam_state()->IsUserSignedIn(xuid)) {
return 0;
}
const auto& user_profile = kernel_state()->xam_state()->GetUserProfile(xuid);
return user_profile->GetCachedFlags();
}
DECLARE_XAM_EXPORT1(XamUserGetUserFlagsFromXUID, kUserProfiles, kImplemented);
constexpr uint8_t kStatsMaxAmount = 64;
struct X_STATS_DETAILS {

View File

@ -620,6 +620,8 @@ struct X_XAMACCOUNTINFO {
AccountReservedFlags::kLiveEnabled);
}
uint32_t GetCachedFlags() const { return cached_user_flags; };
uint32_t GetCountry() const {
return (cached_user_flags & kCountryMask) >> 8;
}