Allow XamUserReadProfileSettings to use xuid to define profile

This commit is contained in:
Gliniak
2022-04-15 09:28:42 +02:00
parent 84e5b159c3
commit dde8adc140
4 changed files with 42 additions and 10 deletions

View File

@@ -108,14 +108,31 @@ class KernelState {
uint8_t GetConnectedUsers() const;
void UpdateUsedUserProfiles();
bool IsUserSignedIn(uint8_t index) const {
bool IsUserSignedIn(uint32_t index) const {
return user_profiles_.find(index) != user_profiles_.cend();
}
xam::UserProfile* user_profile(uint8_t index) const {
bool IsUserSignedIn(uint64_t xuid) const {
return user_profile(xuid) != nullptr;
}
xam::UserProfile* user_profile(uint32_t index) const {
if (!IsUserSignedIn(index)) {
return nullptr;
}
return user_profiles_.at(index).get();
}
xam::UserProfile* user_profile(uint64_t xuid) const {
for (const auto& [key, value] : user_profiles_) {
if (value->xuid() == xuid) {
return user_profiles_.at(key).get();
}
}
return nullptr;
}
// Access must be guarded by the global critical region.
util::ObjectTable* object_table() { return &object_table_; }