Allow XamUserReadProfileSettings to use xuid to define profile
This commit is contained in:
parent
84e5b159c3
commit
dde8adc140
|
@ -960,7 +960,7 @@ uint8_t KernelState::GetConnectedUsers() const {
|
|||
void KernelState::UpdateUsedUserProfiles() {
|
||||
const uint8_t used_slots_bitmask = GetConnectedUsers();
|
||||
|
||||
for (uint8_t i = 1; i < 4; i++) {
|
||||
for (uint32_t i = 1; i < 4; i++) {
|
||||
bool is_used = used_slots_bitmask & (1 << i);
|
||||
|
||||
if (IsUserSignedIn(i) && !is_used) {
|
||||
|
|
|
@ -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_; }
|
||||
|
||||
|
|
|
@ -321,7 +321,8 @@ X_RESULT ContentManager::DeleteContent(const XCONTENT_AGGREGATE_DATA& data) {
|
|||
|
||||
std::filesystem::path ContentManager::ResolveGameUserContentPath() {
|
||||
auto title_id = fmt::format("{:08X}", kernel_state_->title_id());
|
||||
auto user_name = xe::to_path(kernel_state_->user_profile(0)->name());
|
||||
auto user_name =
|
||||
xe::to_path(kernel_state_->user_profile(uint32_t(0))->name());
|
||||
|
||||
// Per-game per-profile data location:
|
||||
// content_root/title_id/profile/user_name
|
||||
|
|
|
@ -224,17 +224,31 @@ uint32_t XamUserReadProfileSettingsEx(uint32_t title_id, uint32_t user_index,
|
|||
|
||||
// Title ID = 0 means us.
|
||||
// 0xfffe07d1 = profile?
|
||||
if (!kernel_state()->IsUserSignedIn(user_index)) {
|
||||
if (!kernel_state()->IsUserSignedIn(user_index) && !xuids) {
|
||||
if (overlapped) {
|
||||
kernel_state()->CompleteOverlappedImmediate(
|
||||
kernel_state()->memory()->HostToGuestVirtual(overlapped),
|
||||
X_ERROR_NO_SUCH_USER);
|
||||
kernel_state()->CompleteOverlappedImmediate(
|
||||
kernel_state()->memory()->HostToGuestVirtual(overlapped),
|
||||
X_ERROR_NO_SUCH_USER);
|
||||
return X_ERROR_IO_PENDING;
|
||||
}
|
||||
return X_ERROR_NO_SUCH_USER;
|
||||
}
|
||||
|
||||
const auto& user_profile = kernel_state()->user_profile(user_index);
|
||||
auto user_profile = kernel_state()->user_profile(user_index);
|
||||
|
||||
if (xuids) {
|
||||
uint64_t user_xuid = static_cast<uint64_t>(xuids[0]);
|
||||
if (!kernel_state()->IsUserSignedIn(user_xuid)) {
|
||||
if (overlapped) {
|
||||
kernel_state()->CompleteOverlappedImmediate(
|
||||
kernel_state()->memory()->HostToGuestVirtual(overlapped),
|
||||
X_ERROR_NO_SUCH_USER);
|
||||
return X_ERROR_IO_PENDING;
|
||||
}
|
||||
return X_ERROR_NO_SUCH_USER;
|
||||
}
|
||||
user_profile = kernel_state()->user_profile(user_xuid);
|
||||
}
|
||||
|
||||
// First call asks for size (fill buffer_size_ptr).
|
||||
// Second call asks for buffer contents with that size.
|
||||
|
@ -529,7 +543,7 @@ dword_result_t XamShowSigninUI_entry(dword_t unk, dword_t unk_mask) {
|
|||
// Mask values vary. Probably matching user types? Local/remote?
|
||||
// Games seem to sit and loop until we trigger this notification:
|
||||
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
for (uint32_t i = 0; i < 4; i++) {
|
||||
if (kernel_state()->IsUserSignedIn(i)) {
|
||||
// XN_SYS_SIGNINCHANGED
|
||||
kernel_state()->BroadcastNotification(0xA, i);
|
||||
|
|
Loading…
Reference in New Issue