[XAM/UI] - Stubbed XamShowSigninUIEx and XamShowNuiSigninUI

- Add XTT file header
- partially implemented XamShowSigninUIEx & XamShowNuiSigninUI
- add flags for XamShowCreateProfileUI, exXamShowSigninUI, and XamUserLogon
- Define sign in states
- Add undefined params
This commit is contained in:
The-Little-Wolf 2025-05-25 14:07:01 -07:00 committed by Radosław Gliński
parent 43d206d2e9
commit 4e8e789876
6 changed files with 121 additions and 11 deletions

View file

@ -86,13 +86,21 @@ inline const std::map<XTileType, std::string> kTileFileNames = {
static constexpr std::pair<uint16_t, uint16_t> kProfileIconSize = {64, 64};
static constexpr std::pair<uint16_t, uint16_t> kProfileIconSizeSmall = {32, 32};
enum class SignInState : uint32_t {
NotSignedIn,
SignedInLocally, // Offline
SignedInToLive, // Online
};
class UserProfile {
public:
UserProfile(const uint64_t xuid, const X_XAMACCOUNTINFO* account_info);
uint64_t xuid() const { return xuid_; }
std::string name() const { return account_info_.GetGamertagString(); }
uint32_t signin_state() const { return 1; }
uint32_t signin_state() const {
return static_cast<uint32_t>(SignInState::SignedInLocally);
};
uint32_t type() const { return 1 | 2; /* local | online profile? */ }
uint32_t GetReservedFlags() const {

View file

@ -242,6 +242,74 @@ static_assert_size(X_PASSPORT_SESSION_TOKEN, 0x1C);
#define DPAD_RIGHT_PASSCODE 0x00005813
// clang-format on
enum class CreateProfileUiFlags : uint32_t {
CreateNewProfile = 0x00000000,
SignUpForLive = 0x00000001, // Used in NXE and kinect profile page
RecoverProfile = 0x00000002, // Used in NXE and kinect profile Select
};
enum class SigninUiFlags : uint32_t {
ALL = 0x00000000, // show all profiles with option to create one or download
LocalSignInOnly = 0x00000001,
ShowOnlineEnabledOnly = 0x00000002,
AllowSignout = 0x00000004,
NUI = 0x00000008, // always set by XamShowNuiSigninUI
DisallowPlayAs = 0x00000010,
AddUser = 0x00010000,
CompleteSignIn = 0x00020000,
ShowParentalControlledOnly = 0x00040000,
EnableGuest = 0x00080000,
DisallowReload = 0x00100000,
ConvertOfflineToGuest = 0x00400000,
Unk_1 = 0x00800000, // used by XamShowSigninUIEx
DisallowGuest = 0x01000000,
Unk_2 = 0x02000000, // used by XamShowSigninUIEx
Unk_3 = 0x04000000, // used by XamShowSigninUIp
Unk_4 = 0x20000000, // used by XamShowSigninUIp
/* Known examples:
- 0x04000001 // used by XamShowSigninUI
- 0x04030000 // used by XamShowSigninUIp to login to a specific account for
NXE and Kinect
- 0x24030000 // used by XamShowSigninUIp
- 0x02230002 // used by XamShowSigninUIEx
- 0x01000002 // used by XamShowSigninUIEx
- 0x01010002 // used by XamShowSigninUIEx
- xbox live controls in family settings
*/
};
enum class UserLogonFlags : uint32_t {
OfflineOnly = 0x00000001,
ForceLiveLogOff = 0x00000002,
AddUser = 0x00000004,
RemoveUser = 0x00000008,
ForegroundPriority = 0x00000010,
NoPopupNotification = 0x00000020,
DontWaitForCompletion = 0x00000040, // overlap related
AllowMachineAccountOnly = 0x00000080,
CheckOnlineTicketsOnly = 0x00000100,
AllowDefaultUser = 0x00000200,
AllowUsersWithRequiredMessage = 0x00000400,
RestrictPopupNotification = 0x00000800,
unknown_1 = 0x00002000,
InvalidFlag = 0x00004000, // return X_E_INVALIDARG
/* Known examples:
- 0x00000008 blades 6717 log out
- 0x00000017 Blades 6717 log on
- 0x00000023
- 0x00000048 Blades
- 0x00000013 Testing Network
- 0x00000424
- 0x00000025 NXE
- 0x00000014 Blades OOBE profile creation
*/
};
enum class UserContextDevice : uint32_t {
BigButton = 3,
Microphone = 4,
};
} // namespace xam
} // namespace kernel
} // namespace xe

View file

@ -21,8 +21,9 @@ namespace xam {
enum class DeviceType : uint32_t {
Invalid = 0,
HDD = 1,
MU = 2,
MU = 2, // support removed in 9199
ODD = 4,
USBMASS = 16, // Added in 8955
};
enum class DummyDeviceId : uint32_t {

View file

@ -210,10 +210,9 @@ dword_result_t XamInputGetKeystrokeEx_entry(
}
DECLARE_XAM_EXPORT1(XamInputGetKeystrokeEx, kInput, kImplemented);
X_HRESULT_result_t XamUserGetDeviceContext_entry(
dword_t user_index,
dword_t unk, // It's set to 3 for a big button
lpdword_t out_ptr) {
X_HRESULT_result_t XamUserGetDeviceContext_entry(dword_t user_index,
dword_t device_type,
lpdword_t out_ptr) {
// Games check the result - usually with some masking.
// If this function fails they assume zero, so let's fail AND
// set zero just to be safe.

View file

@ -938,7 +938,7 @@ X_RESULT xeXamShowSigninUI(uint32_t user_index, uint32_t users_needed,
close);
}
X_RESULT xeXamShowCreateProfileUIEx(uint32_t user_index, dword_t unkn,
X_RESULT xeXamShowCreateProfileUIEx(uint32_t user_index, dword_t flag,
char* unkn2_ptr) {
Emulator* emulator = kernel_state()->emulator();
xe::ui::ImGuiDrawer* imgui_drawer = emulator->imgui_drawer();
@ -958,20 +958,42 @@ dword_result_t XamShowSigninUI_entry(dword_t users_needed, dword_t flags) {
}
DECLARE_XAM_EXPORT1(XamShowSigninUI, kUserProfiles, kImplemented);
dword_result_t XamShowSigninUIEx_entry(
dword_t users_needed, dword_t flags,
pointer_t<XAM_OVERLAPPED> overlapped_ptr) {
X_RESULT result = xeXamShowSigninUI(XUserIndexAny, users_needed, flags);
if (overlapped_ptr) {
kernel_state()->CompleteOverlappedImmediate(overlapped_ptr, result);
return X_ERROR_IO_PENDING;
} else {
return result;
}
}
DECLARE_XAM_EXPORT1(XamShowSigninUIEx, kUserProfiles, kSketchy);
dword_result_t XamShowNuiSigninUI_entry(dword_t unk, dword_t user_index,
dword_t flags) {
uint32_t users_needed = 1;
uint32_t sent_flags = flags | static_cast<uint32_t>(SigninUiFlags::NUI);
// xeXamNuiHudCheck(unk) = success then continue else return
return xeXamShowSigninUI(user_index, users_needed, sent_flags);
}
DECLARE_XAM_EXPORT1(XamShowNuiSigninUI, kUserProfiles, kSketchy);
dword_result_t XamShowSigninUIp_entry(dword_t user_index, dword_t users_needed,
dword_t flags) {
return xeXamShowSigninUI(user_index, users_needed, flags);
}
DECLARE_XAM_EXPORT1(XamShowSigninUIp, kUserProfiles, kImplemented);
dword_result_t XamShowCreateProfileUIEx_entry(dword_t user_index, dword_t unkn,
dword_result_t XamShowCreateProfileUIEx_entry(dword_t user_index, dword_t flag,
lpstring_t unkn2_ptr) {
return xeXamShowCreateProfileUIEx(user_index, unkn, unkn2_ptr);
return xeXamShowCreateProfileUIEx(user_index, flag, unkn2_ptr);
}
DECLARE_XAM_EXPORT1(XamShowCreateProfileUIEx, kUserProfiles, kImplemented);
dword_result_t XamShowCreateProfileUI_entry(dword_t user_index, dword_t unkn) {
return xeXamShowCreateProfileUIEx(user_index, unkn, 0);
dword_result_t XamShowCreateProfileUI_entry(dword_t user_index, dword_t flag) {
return xeXamShowCreateProfileUIEx(user_index, flag, 0);
}
DECLARE_XAM_EXPORT1(XamShowCreateProfileUI, kUserProfiles, kImplemented);

View file

@ -46,6 +46,7 @@ typedef uint32_t X_STATUS;
#define X_STATUS_INVALID_HANDLE ((X_STATUS)0xC0000008L)
#define X_STATUS_INVALID_PARAMETER ((X_STATUS)0xC000000DL)
#define X_STATUS_NO_SUCH_FILE ((X_STATUS)0xC000000FL)
#define X_STATUS_INVALID_DEVICE_REQUEST ((X_STATUS)0xC0000010L)
#define X_STATUS_END_OF_FILE ((X_STATUS)0xC0000011L)
#define X_STATUS_NO_MEMORY ((X_STATUS)0xC0000017L)
#define X_STATUS_ALREADY_COMMITTED ((X_STATUS)0xC0000021L)
@ -519,6 +520,17 @@ enum class XDeploymentType : uint32_t {
kOther = 3,
};
// https://www.se7ensins.com/forums/threads/xtt-file-research.966597/
struct XTTFileHeader {
uint32_t xttTag;
uint8_t signature[0x100]; // XECRYPT_SIG
uint32_t signedBlockSize;
uint32_t fileSize;
uint32_t compressedTablesSize;
uint32_t uncompressedTablesSize;
uint32_t xttFileVersion;
};
} // namespace xe
#endif // XENIA_XBOX_H_