[Core] Add XUID validation functions to xbox.h

This commit is contained in:
Adrian 2024-11-18 23:40:37 +00:00 committed by Radosław Gliński
parent fbad66e5bc
commit a7a981105a
1 changed files with 22 additions and 7 deletions

View File

@ -547,6 +547,28 @@ enum class XDeploymentType : uint32_t {
kUnknown = 0xFF, kUnknown = 0xFF,
}; };
inline bool IsOfflineXUID(uint64_t xuid) { return ((xuid >> 60) & 0xF) == 0xE; }
inline bool IsOnlineXUID(uint64_t xuid) {
return ((xuid >> 48) & 0xFFFF) == 0x9;
}
inline bool IsGuestXUID(uint64_t xuid) {
const uint32_t HighPart = xuid >> 48;
return ((HighPart & 0x000F) == 0x9) && ((HighPart & 0x00C0) > 0);
}
inline bool IsTeamXUID(uint64_t xuid) {
return (xuid & 0xFF00000000000140) == 0xFE00000000000100;
}
inline bool IsValidXUID(uint64_t xuid) {
const bool valid = IsOfflineXUID(xuid) || IsOnlineXUID(xuid) ||
IsTeamXUID(xuid) || IsGuestXUID(xuid);
return valid;
}
#pragma pack(push, 4) #pragma pack(push, 4)
struct X_XAMACCOUNTINFO { struct X_XAMACCOUNTINFO {
enum AccountReservedFlags { enum AccountReservedFlags {
@ -598,13 +620,6 @@ struct X_XAMACCOUNTINFO {
AccountReservedFlags::kLiveEnabled); AccountReservedFlags::kLiveEnabled);
} }
bool IsXUIDOffline() { return ((xuid_online >> 60) & 0xF) == 0xE; }
bool IsXUIDOnline() { return ((xuid_online >> 48) & 0xFFFF) == 0x9; }
bool IsXUIDValid() { return IsXUIDOffline() != IsXUIDOnline(); }
bool IsTeamXUID() {
return (xuid_online & 0xFF00000000000140) == 0xFE00000000000100;
}
uint32_t GetCountry() const { uint32_t GetCountry() const {
return (cached_user_flags & kCountryMask) >> 8; return (cached_user_flags & kCountryMask) >> 8;
} }