Use AccountUid in psel

This commit is contained in:
XorTroll 2019-10-10 16:38:31 +02:00
parent 1ab8728fc0
commit bc9e972f87
2 changed files with 16 additions and 16 deletions

View File

@ -27,19 +27,19 @@ typedef enum {
typedef struct { typedef struct {
u32 mode; ///< UI mode, see \ref PselUiMode. u32 mode; ///< UI mode, see \ref PselUiMode.
u32 dialogType; ///< Dialog type u32 dialogType; ///< Dialog type
union { u128 invalidUserList[ACC_USER_LIST_SIZE]; } PACKED; ///< List of user IDs which will be disabled. AccountUid invalidUserList[ACC_USER_LIST_SIZE]; ///< List of \ref AccountUid user IDs which will be disabled.
u8 unk_x0[0x8]; ///< Unknown. u8 unk_x88[0x8]; ///< Unknown.
u8 networkServiceRequired; ///< Whether the user needs to be linked to a Nintendo account. u8 networkServiceRequired; ///< Whether the user needs to be linked to a Nintendo account.
u8 unk_x1[0x2]; ///< Unknown. u8 unk_x91[0x2]; ///< Unknown.
u8 allowUserCreation; ///< (With ::PselUiMode_SelectUser) enables the option to create a new user. u8 allowUserCreation; ///< (With ::PselUiMode_SelectUser) enables the option to create a new user.
u8 skipEnabled; ///< Enables the option to skip user selection (a new button is shown) u8 skipEnabled; ///< Enables the option to skip user selection (a new button is shown)
u8 unk_x2[0xB]; ///< Unknown. u8 unk_95[0xb]; ///< Unknown.
} PselUiSettings; } PselUiSettings;
/// Result data sent after execution. /// Result data sent after execution.
typedef struct { typedef struct {
u32 result; ///< Result code. u32 result; ///< Result code.
union { u128 userId; } PACKED; ///< Selected user ID. AccountUid userId; ///< Selected \ref AccountUid.
} PselResult; } PselResult;
/** /**
@ -54,7 +54,7 @@ Result pselUiCreate(PselUiSettings *ui, PselUiMode mode);
* @param ui PselUiSettings struct. * @param ui PselUiSettings struct.
* @param user_id user ID. * @param user_id user ID.
*/ */
void pselUiAddInvalidUser(PselUiSettings *ui, u128 user_id); void pselUiAddInvalidUser(PselUiSettings *ui, AccountUid user_id);
/** /**
* @brief Sets whether users can be created in the applet * @brief Sets whether users can be created in the applet
@ -84,4 +84,4 @@ void pselUiSetSkipEnabled(PselUiSettings *ui, bool flag);
* @param out_uid Selected user ID. * @param out_uid Selected user ID.
* @note If user skips (see \ref pselUiSetSkipEnabled) this will return successfully but the output ID will be 0. * @note If user skips (see \ref pselUiSetSkipEnabled) this will return successfully but the output ID will be 0.
*/ */
Result pselUiShow(PselUiSettings *ui, u128 *out_user); Result pselUiShow(PselUiSettings *ui, AccountUid *out_user);

View File

@ -13,11 +13,11 @@ Result pselUiCreate(PselUiSettings *ui, PselUiMode mode) {
return 0; return 0;
} }
void pselUiAddInvalidUser(PselUiSettings *ui, u128 user_id) { void pselUiAddInvalidUser(PselUiSettings *ui, AccountUid user_id) {
int i; int i;
for(i = 0; i < ACC_USER_LIST_SIZE; i++) { for(i = 0; i < ACC_USER_LIST_SIZE; i++) {
if(!ui->invalidUserList[i]) { if(!accountUidIsValid(&ui->invalidUserList[i])) {
__builtin_memcpy(&ui->invalidUserList[i], &user_id, sizeof(user_id)); __builtin_memcpy(&ui->invalidUserList[i], &user_id, sizeof(user_id));
break; break;
} }
@ -47,7 +47,7 @@ static u32 _pselGetLaVersion() {
return ver; return ver;
} }
Result pselUiShow(PselUiSettings *ui, u128 *out_user) { Result pselUiShow(PselUiSettings *ui, AccountUid *out_user) {
Result rc = 0; Result rc = 0;
LibAppletArgs args; LibAppletArgs args;
u32 la_ver = _pselGetLaVersion(); u32 la_ver = _pselGetLaVersion();