libnx v4.9.0
Loading...
Searching...
No Matches
psel.h
Go to the documentation of this file.
1/**
2 * @file psel.h
3 * @brief Wrapper for using the playerSelect (user selection) LibraryApplet.
4 * @author XorTroll, yellows8
5 * @copyright libnx Authors
6 */
7#pragma once
8#include "../types.h"
9#include "../services/acc.h"
10
11/// playerSelect UI modes.
12typedef enum {
13 PselUiMode_UserSelector = 0, ///< UserSelector
14 PselUiMode_UserCreator = 1, ///< UserCreator
15 PselUiMode_EnsureNetworkServiceAccountAvailable = 2, ///< EnsureNetworkServiceAccountAvailable
16 PselUiMode_UserIconEditor = 3, ///< UserIconEditor
17 PselUiMode_UserNicknameEditor = 4, ///< UserNicknameEditor
18 PselUiMode_UserCreatorForStarter = 5, ///< UserCreatorForStarter
19 PselUiMode_NintendoAccountAuthorizationRequestContext = 6, ///< NintendoAccountAuthorizationRequestContext
20 PselUiMode_IntroduceExternalNetworkServiceAccount = 7, ///< IntroduceExternalNetworkServiceAccount
21 PselUiMode_IntroduceExternalNetworkServiceAccountForRegistration = 8, ///< [6.0.0+] IntroduceExternalNetworkServiceAccountForRegistration
22 PselUiMode_NintendoAccountNnidLinker = 9, ///< [6.0.0+] NintendoAccountNnidLinker
23 PselUiMode_LicenseRequirementsForNetworkService = 10, ///< [6.0.0+] LicenseRequirementsForNetworkService
24 PselUiMode_LicenseRequirementsForNetworkServiceWithUserContextImpl = 11, ///< [7.0.0+] LicenseRequirementsForNetworkServiceWithUserContextImpl
25 PselUiMode_UserCreatorForImmediateNaLoginTest = 12, ///< [7.0.0+] UserCreatorForImmediateNaLoginTest
26 PselUiMode_UserQualificationPromoter = 13, ///< [13.0.0+] UserQualificationPromoter
28
29/// UI message text to display with ::PselUiMode_UserSelector. Invalid values are handled as ::PselUserSelectionPurpose_General.
30typedef enum {
31 PselUserSelectionPurpose_General = 0, ///< "Select a user."
32 PselUserSelectionPurpose_GameCardRegistration = 1, ///< [2.0.0+] "Who will receive the points?"
33 PselUserSelectionPurpose_EShopLaunch = 2, ///< [2.0.0+] "Who is using Nintendo eShop?"
34 PselUserSelectionPurpose_EShopItemShow = 3, ///< [2.0.0+] "Who is making this purchase?"
35 PselUserSelectionPurpose_PicturePost = 4, ///< [2.0.0+] "Who is posting?"
36 PselUserSelectionPurpose_NintendoAccountLinkage = 5, ///< [2.0.0+] "Select a user to link to a Nintendo Account."
37 PselUserSelectionPurpose_SettingsUpdate = 6, ///< [2.0.0+] "Change settings for which user?"
38 PselUserSelectionPurpose_SaveDataDeletion = 7, ///< [2.0.0+] "Format data for which user?"
39 PselUserSelectionPurpose_UserMigration = 8, ///< [4.0.0+] "Which user will be transferred to another console?"
40 PselUserSelectionPurpose_SaveDataTransfer = 9, ///< [8.0.0+] "Send save data for which user?"
42
43/// NintendoAccountStartupDialogType
49
50/// Base UI settings for playerSelect.
51typedef struct {
52 u32 mode; ///< \ref PselUiMode
53 u32 pad; ///< Padding.
54 AccountUid invalid_uid_list[ACC_USER_LIST_SIZE]; ///< List of \ref AccountUid. TODO: This is only correct for ::PselUiMode_UserSelector, for other modes this is a single uid, followed by mode-specific data (if any).
55 u64 application_id; ///< ApplicationId with \ref pselShowUserSelectorForLauncher.
56 u8 is_network_service_account_required; ///< PselUserSelectionSettings::is_network_service_account_required.
57 u8 is_skip_enabled; ///< PselUserSelectionSettings::is_skip_enabled
58 u8 unk_x92; ///< Set to value 1 by \ref pselShowUserSelectorForSystem / \ref pselShowUserSelectorForLauncher.
59 u8 is_permitted; ///< isPermitted. With ::PselUiMode_UserSelector: enables the option to create a new user. Set to the output from \ref accountIsUserRegistrationRequestPermitted with pselShowUserSelector*. When not set, a dialog will be displayed when the user attempts to create an user.
60 u8 show_skip_button; ///< PselUserSelectionSettings::show_skip_button
61 u8 additional_select; ///< PselUserSelectionSettings::additional_select
62 u8 unk_x96; ///< [2.0.0+] Set to PselUserSelectionSettingsForSystemService::enable_user_creation_button. \ref pselShowUserSelectorForLauncher / \ref pselShowUserSelector sets this to value 1.
63 u8 unk_x97; ///< [6.0.0+] Set to PselUserSelectionSettings::is_unqualified_user_selectable ^ 1.
65
66/// UI settings for versions starting with 0x10000.
67typedef struct {
68 PselUiSettingsV1 settings; ///< \ref PselUiSettingsV1
69 u32 unk_x98; ///< [2.0.0+] Set to PselUserSelectionSettingsForSystemService::purpose.
70 u8 unk_x9c[0x4]; ///< Unknown.
72
73/// UserSelectionSettings
74typedef struct {
75 AccountUid invalid_uid_list[ACC_USER_LIST_SIZE]; ///< invalidUidList.
76 u8 is_skip_enabled; ///< isSkipEnabled. When set, the first user in invalid_uid_list must not be set, and additional_select must be 0. When enabled \ref accountTrySelectUserWithoutInteraction will be used to select the user, in this case the applet will only be launched if \ref accountTrySelectUserWithoutInteraction doesn't return an user.
77 u8 is_network_service_account_required; ///< isNetworkServiceAccountRequired. Whether the user needs to be linked to a Nintendo account.
78 u8 show_skip_button; ///< showSkipButton. Enables the option to skip user selection with a button.
79 u8 additional_select; ///< additionalSelect.
80 u8 is_unqualified_user_selectable; ///< [6.0.0+] isUnqualifiedUserSelectable
82
83/// [2.0.0+] UserSelectionSettingsForSystemService
84typedef struct {
85 u32 purpose; ///< \ref PselUserSelectionPurpose
86 u8 enable_user_creation_button; ///< Enables the user-creation button when set. Whether user-creation when pressing the button is actually allowed is controlled by PselUiSettingsV1::is_permitted.
87 u8 pad[0x3]; ///< Padding.
89
90/// Return data sent after execution.
91typedef struct {
92 Result res; ///< Result.
93 AccountUid user_id; ///< Selected \ref AccountUid.
95
96/**
97 * @brief Creates a new UI config for the playerSelect applet with the specified mode.
98 * @param ui PseluiSettings struct.
99 * @param mode playerSelect UI mode.
100 */
102
103/**
104 * @brief Adds an user to the user list of the applet.
105 * @param ui PselUiSettings struct.
106 * @param[in] user_id user ID.
107 * @note The users will be treated as invalid users for user selection mode, and as the input user for other modes.
108 */
110
111/**
112 * @brief Sets whether users can be created in the applet.
113 * @param ui PselUiSettings struct.
114 * @param flag Flag value.
115 * @note Only used for ::PselUiMode_SelectUser.
116 */
119 ui->settings.is_permitted = flag!=0;
120 }
121}
122
123/**
124 * @brief Sets whether users need to be linked to a Nintendo account.
125 * @param ui PselUiSettings struct.
126 * @param flag Flag value.
127 */
131
132/**
133 * @brief Sets whether selection can be skipped with a button.
134 * @param ui PselUiSettings struct.
135 * @param flag Flag value.
136 */
140
141/**
142 * @brief Shows the applet with the specified UI settings.
143 * @param ui PselUiSettings struct.
144 * @param out_user Selected user ID.
145 * @note If user skips (see \ref pselUiSetSkipEnabled) this will return successfully but the output ID will be 0.
146 */
148
149/**
150 * @brief This is the System version of \ref pselShowUserSelector.
151 * @note This uses \ref accountIsUserRegistrationRequestPermitted, hence \ref accountInitialize must be used prior to this. See also the docs for PselUserSelectionSettings::is_skip_enabled.
152 * @param[out] out_user Returned selected user ID.
153 * @param[in] settings \ref PselUserSelectionSettings
154 * @param[in] settings_system [2.0.0+] \ref PselUserSelectionSettingsForSystemService, ignored on prior versions.
155 */
157
158/**
159 * @brief This is the Launcher version of \ref pselShowUserSelector.
160 * @note This uses \ref accountIsUserRegistrationRequestPermitted, hence \ref accountInitialize must be used prior to this. See also the docs for PselUserSelectionSettings::is_skip_enabled.
161 * @param[out] out_user Returned selected user ID.
162 * @param[in] settings \ref PselUserSelectionSettings
163 * @param[in] application_id ApplicationId
164 */
166
167/**
168 * @brief Shows the applet to select a user.
169 * @note This uses \ref accountIsUserRegistrationRequestPermitted, hence \ref accountInitialize must be used prior to this. See also the docs for PselUserSelectionSettings::is_skip_enabled.
170 * @param[out] out_user Returned selected user ID.
171 * @param[in] settings \ref PselUserSelectionSettings
172 */
174
175/**
176 * @brief Shows the applet to create a user.
177 * @note This uses \ref accountIsUserRegistrationRequestPermitted, hence \ref accountInitialize must be used prior to this. If the output flag is 0, an error will be thrown.
178 */
180
181/**
182 * @brief Shows the applet to change a user's icon.
183 * @param[in] user Input user ID.
184 */
186
187/**
188 * @brief Shows the applet to change a user's nickname.
189 * @param[in] user Input user ID.
190 */
192
193/**
194 * @brief Shows the applet to create a user. Used by the starter applet during system setup.
195 */
197
198/**
199 * @brief Shows the applet for Nintendo Account Nnid linking.
200 * @note Only available on [6.0.0+].
201 * @param[in] user Input user ID.
202 */
204
205/**
206 * @brief Shows the applet for UserQualificationPromoter.
207 * @note Only available on [13.0.0+].
208 * @param[in] user Input user ID.
209 */
PselUserSelectionPurpose
UI message text to display with PselUiMode_UserSelector. Invalid values are handled as PselUserSelect...
Definition psel.h:30
@ PselUserSelectionPurpose_SaveDataTransfer
[8.0.0+] "Send save data for which user?"
Definition psel.h:40
@ PselUserSelectionPurpose_NintendoAccountLinkage
[2.0.0+] "Select a user to link to a Nintendo Account."
Definition psel.h:36
@ PselUserSelectionPurpose_General
"Select a user."
Definition psel.h:31
@ PselUserSelectionPurpose_PicturePost
[2.0.0+] "Who is posting?"
Definition psel.h:35
@ PselUserSelectionPurpose_GameCardRegistration
[2.0.0+] "Who will receive the points?"
Definition psel.h:32
@ PselUserSelectionPurpose_EShopLaunch
[2.0.0+] "Who is using Nintendo eShop?"
Definition psel.h:33
@ PselUserSelectionPurpose_SaveDataDeletion
[2.0.0+] "Format data for which user?"
Definition psel.h:38
@ PselUserSelectionPurpose_UserMigration
[4.0.0+] "Which user will be transferred to another console?"
Definition psel.h:39
@ PselUserSelectionPurpose_SettingsUpdate
[2.0.0+] "Change settings for which user?"
Definition psel.h:37
@ PselUserSelectionPurpose_EShopItemShow
[2.0.0+] "Who is making this purchase?"
Definition psel.h:34
Result pselShowUserIconEditor(AccountUid user)
Shows the applet to change a user's icon.
Result pselShowUserNicknameEditor(AccountUid user)
Shows the applet to change a user's nickname.
Result pselShowNintendoAccountNnidLinker(AccountUid user)
Shows the applet for Nintendo Account Nnid linking.
static void pselUiSetAllowUserCreation(PselUiSettings *ui, bool flag)
Sets whether users can be created in the applet.
Definition psel.h:117
Result pselShowUserSelector(AccountUid *out_user, const PselUserSelectionSettings *settings)
Shows the applet to select a user.
PselNintendoAccountStartupDialogType
NintendoAccountStartupDialogType.
Definition psel.h:44
@ PselNintendoAccountStartupDialogType_LoginAndCreate
LoginAndCreate.
Definition psel.h:45
@ PselNintendoAccountStartupDialogType_Create
Create.
Definition psel.h:47
@ PselNintendoAccountStartupDialogType_Login
Login.
Definition psel.h:46
Result pselShowUserCreatorForStarter(void)
Shows the applet to create a user.
Result pselShowUserQualificationPromoter(AccountUid user)
Shows the applet for UserQualificationPromoter.
void pselUiAddUser(PselUiSettings *ui, AccountUid user_id)
Adds an user to the user list of the applet.
Result pselShowUserSelectorForLauncher(AccountUid *out_user, const PselUserSelectionSettings *settings, u64 application_id)
This is the Launcher version of pselShowUserSelector.
static void pselUiSetSkipButtonEnabled(PselUiSettings *ui, bool flag)
Sets whether selection can be skipped with a button.
Definition psel.h:137
Result pselUiShow(PselUiSettings *ui, AccountUid *out_user)
Shows the applet with the specified UI settings.
Result pselUiCreate(PselUiSettings *ui, PselUiMode mode)
Creates a new UI config for the playerSelect applet with the specified mode.
Result pselShowUserCreator(void)
Shows the applet to create a user.
PselUiMode
playerSelect UI modes.
Definition psel.h:12
@ PselUiMode_LicenseRequirementsForNetworkService
[6.0.0+] LicenseRequirementsForNetworkService
Definition psel.h:23
@ PselUiMode_NintendoAccountNnidLinker
[6.0.0+] NintendoAccountNnidLinker
Definition psel.h:22
@ PselUiMode_UserQualificationPromoter
[13.0.0+] UserQualificationPromoter
Definition psel.h:26
@ PselUiMode_UserCreatorForImmediateNaLoginTest
[7.0.0+] UserCreatorForImmediateNaLoginTest
Definition psel.h:25
@ PselUiMode_LicenseRequirementsForNetworkServiceWithUserContextImpl
[7.0.0+] LicenseRequirementsForNetworkServiceWithUserContextImpl
Definition psel.h:24
@ PselUiMode_IntroduceExternalNetworkServiceAccountForRegistration
[6.0.0+] IntroduceExternalNetworkServiceAccountForRegistration
Definition psel.h:21
@ PselUiMode_UserNicknameEditor
UserNicknameEditor.
Definition psel.h:17
@ PselUiMode_IntroduceExternalNetworkServiceAccount
IntroduceExternalNetworkServiceAccount.
Definition psel.h:20
@ PselUiMode_NintendoAccountAuthorizationRequestContext
NintendoAccountAuthorizationRequestContext.
Definition psel.h:19
@ PselUiMode_UserSelector
UserSelector.
Definition psel.h:13
@ PselUiMode_UserCreatorForStarter
UserCreatorForStarter.
Definition psel.h:18
@ PselUiMode_EnsureNetworkServiceAccountAvailable
EnsureNetworkServiceAccountAvailable.
Definition psel.h:15
@ PselUiMode_UserCreator
UserCreator.
Definition psel.h:14
@ PselUiMode_UserIconEditor
UserIconEditor.
Definition psel.h:16
Result pselShowUserSelectorForSystem(AccountUid *out_user, const PselUserSelectionSettings *settings, const PselUserSelectionSettingsForSystemService *settings_system)
This is the System version of pselShowUserSelector.
static void pselUiSetNetworkServiceRequired(PselUiSettings *ui, bool flag)
Sets whether users need to be linked to a Nintendo account.
Definition psel.h:128
Account UserId.
Definition acc.h:25
Return data sent after execution.
Definition psel.h:91
Result res
Result.
Definition psel.h:92
AccountUid user_id
Selected AccountUid.
Definition psel.h:93
Base UI settings for playerSelect.
Definition psel.h:51
u8 unk_x92
Set to value 1 by pselShowUserSelectorForSystem / pselShowUserSelectorForLauncher.
Definition psel.h:58
u32 mode
PselUiMode
Definition psel.h:52
u8 unk_x97
[6.0.0+] Set to PselUserSelectionSettings::is_unqualified_user_selectable ^ 1.
Definition psel.h:63
u8 is_permitted
isPermitted. With PselUiMode_UserSelector: enables the option to create a new user....
Definition psel.h:59
u8 show_skip_button
PselUserSelectionSettings::show_skip_button.
Definition psel.h:60
u8 is_network_service_account_required
PselUserSelectionSettings::is_network_service_account_required.
Definition psel.h:56
u64 application_id
ApplicationId with pselShowUserSelectorForLauncher.
Definition psel.h:55
u8 is_skip_enabled
PselUserSelectionSettings::is_skip_enabled.
Definition psel.h:57
u8 additional_select
PselUserSelectionSettings::additional_select.
Definition psel.h:61
u32 pad
Padding.
Definition psel.h:53
u8 unk_x96
[2.0.0+] Set to PselUserSelectionSettingsForSystemService::enable_user_creation_button....
Definition psel.h:62
UI settings for versions starting with 0x10000.
Definition psel.h:67
PselUiSettingsV1 settings
PselUiSettingsV1
Definition psel.h:68
u32 unk_x98
[2.0.0+] Set to PselUserSelectionSettingsForSystemService::purpose.
Definition psel.h:69
[2.0.0+] UserSelectionSettingsForSystemService
Definition psel.h:84
u8 enable_user_creation_button
Enables the user-creation button when set. Whether user-creation when pressing the button is actually...
Definition psel.h:86
u32 purpose
PselUserSelectionPurpose
Definition psel.h:85
UserSelectionSettings.
Definition psel.h:74
u8 is_skip_enabled
isSkipEnabled. When set, the first user in invalid_uid_list must not be set, and additional_select mu...
Definition psel.h:76
u8 show_skip_button
showSkipButton. Enables the option to skip user selection with a button.
Definition psel.h:78
u8 is_network_service_account_required
isNetworkServiceAccountRequired. Whether the user needs to be linked to a Nintendo account.
Definition psel.h:77
u8 additional_select
additionalSelect.
Definition psel.h:79
u8 is_unqualified_user_selectable
[6.0.0+] isUnqualifiedUserSelectable
Definition psel.h:80
uint64_t u64
64-bit unsigned integer.
Definition types.h:22
uint8_t u8
8-bit unsigned integer.
Definition types.h:19
u32 Result
Function error code result type.
Definition types.h:44
#define NX_CONSTEXPR
Flags a function as constexpr in C++14 and above; or as (always) inline otherwise.
Definition types.h:92
uint32_t u32
32-bit unsigned integer.
Definition types.h:21