From b2b13078224741c7f7a31a48d714ce19c2409ef3 Mon Sep 17 00:00:00 2001 From: Gliniak <153369+Gliniak@users.noreply.github.com> Date: Thu, 19 Feb 2026 22:53:04 +0100 Subject: [PATCH] [XAM] Improvements to XamUserCheckPrivilege - Handle case when XamUserCheckPrivilege receives ANY USER - Handle case when User is not live signed. This function returns NOT_LOGGED_IN for local accounts --- src/xenia/kernel/xam/xam_user.cc | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/xenia/kernel/xam/xam_user.cc b/src/xenia/kernel/xam/xam_user.cc index 6f5ca7c15..ecc9c202a 100644 --- a/src/xenia/kernel/xam/xam_user.cc +++ b/src/xenia/kernel/xam/xam_user.cc @@ -407,15 +407,30 @@ DECLARE_XAM_EXPORT1(XamUserWriteProfileSettings, kUserProfiles, kImplemented); dword_result_t XamUserCheckPrivilege_entry(dword_t user_index, dword_t mask, lpdword_t out_value) { - // checking all users? - if (user_index != XUserIndexAny) { - if (user_index >= XUserMaxUserCount) { - return X_ERROR_INVALID_PARAMETER; + if (user_index == XUserIndexAny) { + for (uint8_t i = 0; i < XUserMaxUserCount; ++i) { + const auto result = XamUserCheckPrivilege_entry(i, mask, out_value); + if (result != X_ERROR_NO_SUCH_USER) { + *out_value = 0; + return result; + } } + *out_value = 0; + return X_ERROR_NO_SUCH_USER; + } - if (!kernel_state()->xam_state()->IsUserSignedIn(user_index)) { - return X_ERROR_NO_SUCH_USER; - } + if (user_index >= XUserMaxUserCount) { + return X_ERROR_INVALID_PARAMETER; + } + + if (!kernel_state()->xam_state()->IsUserSignedIn(user_index)) { + return X_ERROR_NO_SUCH_USER; + } + + if (kernel_state()->xam_state()->GetUserProfile(user_index)->signin_state() != + static_cast(SignInState::SignedInToLive)) { + *out_value = 0; + return X_ERROR_NOT_LOGGED_ON; } // If we deny everything, games should hopefully not try to do stuff.