[XAM] Fixed invalid xuid being returned when only online XUID is requested

- Fixes stats loading of GoW3 savefile (and maybe checkpoints)

Co-authored-by: Adrian <78108584+AdrianCassar@users.noreply.github.com>
This commit is contained in:
Gliniak
2025-12-24 22:12:01 +01:00
parent 547226fc0b
commit 01aec51278
2 changed files with 18 additions and 9 deletions

View File

@@ -133,6 +133,9 @@ struct X_XAMACCOUNTINFO {
};
static_assert_size(X_XAMACCOUNTINFO, 0x17C);
#define X_USER_GET_SIGNIN_INFO_ONLINE_XUID_ONLY 0x00000001
#define X_USER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY 0x00000002
#define MAX_FIRSTNAME_SIZE 64
#define MAX_LASTNAME_SIZE 64
#define MAX_EMAIL_SIZE 129

View File

@@ -119,21 +119,27 @@ X_HRESULT_result_t XamUserGetSigninInfo_entry(
return X_E_INVALIDARG;
}
std::memset(info, 0, sizeof(X_USER_SIGNIN_INFO));
info.Zero();
if (user_index >= XUserMaxUserCount) {
return X_E_NO_SUCH_USER;
}
if (kernel_state()->xam_state()->IsUserSignedIn(user_index)) {
const auto& user_profile =
kernel_state()->xam_state()->GetUserProfile(user_index);
info->xuid = user_profile->xuid();
info->signin_state = user_profile->signin_state();
xe::string_util::copy_truncating(info->name, user_profile->name(),
xe::countof(info->name));
} else {
if (!kernel_state()->xam_state()->IsUserSignedIn(user_index)) {
return X_E_NO_SUCH_USER;
}
const auto& user_profile =
kernel_state()->xam_state()->GetUserProfile(user_index);
xe::string_util::copy_truncating(info->name, user_profile->name(),
xe::countof(info->name));
if (!flags || flags & X_USER_GET_SIGNIN_INFO_OFFLINE_XUID_ONLY) {
info->xuid = user_profile->xuid();
}
info->signin_state = user_profile->signin_state();
return X_E_SUCCESS;
}
DECLARE_XAM_EXPORT1(XamUserGetSigninInfo, kUserProfiles, kImplemented);