diff --git a/nx/include/switch/applets/psel.h b/nx/include/switch/applets/psel.h index 30f1a18a..23c35c55 100644 --- a/nx/include/switch/applets/psel.h +++ b/nx/include/switch/applets/psel.h @@ -9,7 +9,7 @@ #include "../services/applet.h" #include "../services/acc.h" -// playerSelect UI modes. +/// playerSelect UI modes. typedef enum { PselUiMode_SelectUser = 0, ///< Simple user selection (new users cannot be created). PselUiMode_UserCreation = 1, ///< Only user creation (the user is later returned). @@ -23,23 +23,23 @@ typedef enum { PselUiMode_NaLoginTest = 12, ///< NaLoginTest } PselUiMode; -// UI settings for playerSelect. +/// UI settings for playerSelect. typedef struct { - u32 mode; ///< UI mode, see \ref PselUiMode. - u32 dialogType; ///< Dialog type - u128 invalidUserList[ACC_USER_LIST_SIZE]; ///< List of user IDs which will be disabled. - u8 unk1[8]; ///< Unknown. - u8 networkServiceRequired; ///< Whether the user needs to be linked to a Nintendo account. - u8 unk2[2]; ///< Unknown. - 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 unk3[11]; ///< Unknown. + u32 mode; ///< UI mode, see \ref PselUiMode. + u32 dialogType; ///< Dialog type + union { u128 invalidUserList[ACC_USER_LIST_SIZE]; } PACKED; ///< List of user IDs which will be disabled. + u8 unk_x0[0x8]; ///< Unknown. + u8 networkServiceRequired; ///< Whether the user needs to be linked to a Nintendo account. + u8 unk_x1[0x2]; ///< Unknown. + 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 unk_x2[0xB]; ///< Unknown. } PselUiSettings; -// Result data sent after execution. +/// Result data sent after execution. typedef struct { u32 result; ///< Result code. - u128 userId; ///< Selected user ID. + union { u128 userId; } PACKED; ///< Selected user ID. } PselResult; /** diff --git a/nx/source/applets/psel.c b/nx/source/applets/psel.c index 2e53172e..142a42e5 100644 --- a/nx/source/applets/psel.c +++ b/nx/source/applets/psel.c @@ -2,7 +2,7 @@ #include "types.h" #include "result.h" #include "services/applet.h" -#include "services/set.h" +#include "services/acc.h" #include "applets/libapplet.h" #include "applets/psel.h" #include "runtime/hosversion.h" @@ -17,7 +17,7 @@ void pselUiAddInvalidUser(PselUiSettings *ui, u128 user_id) { int i; for(i = 0; i < ACC_USER_LIST_SIZE; i++) { - if(ui->invalidUserList[i] == 0) { + if(!ui->invalidUserList[i]) { __builtin_memcpy(&ui->invalidUserList[i], &user_id, sizeof(user_id)); break; } @@ -58,7 +58,7 @@ Result pselUiShow(PselUiSettings *ui, u128 *out_user) { rc = libappletLaunch(AppletId_playerSelect, &args, ui, sizeof(PselUiSettings), &res, sizeof(res), &reply_size); if (R_SUCCEEDED(rc)) { - if (R_FAILED(res.result)) rc = MAKERESULT(Module_Libnx, LibnxError_LibAppletBadExit); + if (res.result != 0) rc = MAKERESULT(Module_Libnx, LibnxError_LibAppletBadExit); if (R_SUCCEEDED(rc)) *out_user = res.userId; }