Profile Selector: Difference between revisions

No edit summary
 
(15 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This is the applet presented when launching a game that allows the user to select a user.
This is the applet presented when launching a game that allows the user to select a user.


See [[AM_services#Library_Applets]]. The profile selector expects a two [[AM_services#IStorage|IStorage]] inputs and a single [[AM_services#IStorage|IStorage]] output.
See [[AM_services#Library_Applets]].


== Library Applet Versions ==
== Library Applet Versions ==
Line 24: Line 24:
| 0x0 || 0x4 || [[#UiMode]]
| 0x0 || 0x4 || [[#UiMode]]
|-
|-
| 0x4 || 0x4 ||  
| 0x4 || 0x4 || Padding.
|-
|-
| 0x8 || 0x80 || u128 invalidUidList[8]. This is copied from [[#UserSelectionSettings]].
| 0x8 || 0x80 || u128 invalidUidList[8]. This is copied from [[#UserSelectionSettings]].
|-
|-
| 0x88 || 0x8 ||  
| 0x88 || 0x8 || [[NCM_services#ApplicationId|ApplicationId]] with ShowUserSelectorForLauncher.
|-
|-
| 0x90 || 0x1 || u8 isNetworkServiceAccountRequired. This is copied from [[#UserSelectionSettings]].
| 0x90 || 0x1 || u8 isNetworkServiceAccountRequired. This is copied from [[#UserSelectionSettings]].
Line 34: Line 34:
| 0x91 || 0x1 || u8 isSkipEnabled. This is copied from [[#UserSelectionSettings]].
| 0x91 || 0x1 || u8 isSkipEnabled. This is copied from [[#UserSelectionSettings]].
|-
|-
| 0x92 || 0x1 ||
| 0x92 || 0x1 || Set to 0x1 by ShowUserSelectorForSystem/ShowUserSelectorForLauncher.
|-
|-
| 0x93 || 0x1 || u8 isPermitted.
| 0x93 || 0x1 || u8 isPermitted. ShowUserSelector* sets this to the output bool from [[Account_services#IsUserRegistrationRequestPermitted|IsUserRegistrationRequestPermitted]]. With [[#UiMode|UserSelector]] this enables the option to create a new user. When not set, a dialog will be displayed when the user attempts to create an user.
|-
|-
| 0x94 || 0x1 || u8 showSkipButton. This is copied from [[#UserSelectionSettings]].
| 0x94 || 0x1 || u8 showSkipButton. This is copied from [[#UserSelectionSettings]].
Line 42: Line 42:
| 0x95 || 0x1 || u8 additionalSelect. This is copied from [[#UserSelectionSettings]].
| 0x95 || 0x1 || u8 additionalSelect. This is copied from [[#UserSelectionSettings]].
|-
|-
| 0x96 || 0x1 || This is copied from [[#UserSelectionSettingsForSystemService]].
| 0x96 || 0x1 || [2.0.0+] This is copied from [[#UserSelectionSettingsForSystemService]]+0x4. ShowUserSelectorForLauncher/ShowUserSelector sets this to value 1.
|-
|-
| 0x97 || 0x1 ||  
| 0x97 || 0x1 || [6.0.0+] Set to [[#UserSelectionSettings]] isUnqualifiedUserSelectable ^ 1.
|-
|-
| 0x98 || 0x4 || This is copied from [[#UserSelectionSettingsForSystemService]].
| 0x98 || 0x4 || [2.0.0+] This is copied from the 4-bytes at [[#UserSelectionSettingsForSystemService]]+0x0.
|-
|-
| 0x9C || 0x4 ||  
| 0x9C || 0x4 ||  
Line 54: Line 54:
Setting the first byte to 1 will make the applet display in order to create a new user.
Setting the first byte to 1 will make the applet display in order to create a new user.
"starter" sets the first byte to 5 in order to display initial user setup.
"starter" sets the first byte to 5 in order to display initial user setup.
[2.0.0+]: sdknso ShowUserSelectorForSystem now has an additional input param UserSelectionSettingsForSystemService: u8 +4 is copied to UiSettings+0x96, and u32 +0 is copied to UiSettings+0x98. sdknso ShowUserSelectorForLauncher/ShowUserSelector now sets u8 UiSettings+0x96 to value 1.


== UiMode ==
== UiMode ==
Line 64: Line 62:
! Value || Description
! Value || Description
|-
|-
| 0 || SelectUser
| 0 || UserSelector
|-
|-
| 1 || CreateUser
| 1 || UserCreator
|-
|-
| 2 || EnsureNsaAvailable
| 2 || EnsureNetworkServiceAccountAvailable
|-
|-
| 3 || EditUserIcon
| 3 || UserIconEditor
|-
|-
| 4 || EditUserNickname
| 4 || UserNicknameEditor
|-
|-
| 5 || CreateUserForStarter
| 5 || UserCreatorForStarter
|-
|-
| 6 || AcquireNintendoAccountAuthorization
| 6 || NintendoAccountAuthorizationRequestContext
|-
|-
| 7 || IntroduceExternalNetworkServiceAccount
| 7 || IntroduceExternalNetworkServiceAccount
Line 82: Line 80:
| 8 || [6.0.0+] IntroduceExternalNetworkServiceAccountForRegistration
| 8 || [6.0.0+] IntroduceExternalNetworkServiceAccountForRegistration
|-
|-
| 9 || [6.0.0+] LinkAccountNnid
| 9 || [6.0.0+] NintendoAccountNnidLinker
|-
| 10 || [6.0.0+] LicenseRequirementsForNetworkService
|-
|-
| 10 || [6.0.0+] ShowLicenseRequirementsForNetworkService
| 11 || [7.0.0+] LicenseRequirementsForNetworkServiceWithUserContextImpl
|-
|-
| 11 || [7.0.0+] ShowLicenseRequirementsForNetworkServiceWithUserContext
| 12 || [7.0.0+] UserCreatorForImmediateNaLoginTest
|-
|-
| 12 || [7.0.0+] CreateUserForImmediateNaLoginTest
| 13 || [13.0.0+] UserQualificationPromoter
|}
|}


Line 102: Line 102:
| 0x80 || 0x1 || u8 isSkipEnabled
| 0x80 || 0x1 || u8 isSkipEnabled
|-
|-
| 0x81 || 0x1 || u8 isNetworkServiceAccountRequired
| 0x81 || 0x1 || u8 isNetworkServiceAccountRequired. Whether the user needs to be linked to a Nintendo account.
|-
|-
| 0x82 || 0x1 || u8 showSkipButton
| 0x82 || 0x1 || u8 showSkipButton. Enables the option to skip user selection with a button.
|-
|-
| 0x83 || 0x1 || u8 additionalSelect
| 0x83 || 0x1 || u8 additionalSelect
|-
|-
| 0x84 || 0x1 || u8 isUnqualifiedUserSelectable
| 0x84 || 0x1 || [6.0.0+] u8 isUnqualifiedUserSelectable
|}
|}
ShowUserSelector* calls ShowUserSelectorCommon for launching the applet, which does the following:
* When isSkipEnabled is set, the first user in invalidUidList must not be set, and additionalSelect must be 0 (asserting otherwise). When enabled [[Account_services#TrySelectUserWithoutInteraction|TrySelectUserWithoutInteraction]] will be used to select the user (with isNetworkServiceAccountRequired), in this case the applet will only be launched if that cmd doesn't return an user.


== UserSelectionSettingsForSystemService ==
== UserSelectionSettingsForSystemService ==
This is "nn::account::UserSelectionSettingsForSystemService".
This is "nn::account::UserSelectionSettingsForSystemService". This was added as an additional input param with sdknso [2.0.0+].


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 118: Line 121:
! Offset || Size || Description
! Offset || Size || Description
|-
|-
| 0x0 || 0x4 ||
| 0x0 || 0x4 || [[#UserSelectionPurpose]]
|-
|-
| 0x4 || 0x1 ||  
| 0x4 || 0x1 || Enables the user-creation button when set. Whether user-creation when pressing the button is actually allowed is controlled by [[#UiSettings]] isPermitted.
|-
|-
| 0x5 || 0x3 || u8 padding[3]
| 0x5 || 0x3 || u8 padding[3]
|}
|}


== UiResult ==  
== UiReturnArg ==  
This is "nn::account::UiResult".
This is "nn::account::UiReturnArg". This is the struct for the output storage.


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 132: Line 135:
! Offset || Size || Description
! Offset || Size || Description
|-
|-
| 0x0 || 0x8 || Result (0 = Success, 2 = Failure)
| 0x0 || 0x8 || Result. Returned directly as the Result when launching is successful.
|-
| 0x8 || 0x10 || Uid of selected user, only used with [[#UiMode|UserSelector]] when no error is thrown (see above Result).
|}
 
== NintendoAccountStartupDialogType ==
This is "nn::account::NintendoAccountStartupDialogType".
 
{| class="wikitable" border="1"
|-
! Value || Description
|-
| 0 || LoginAndCreate
|-
| 1 || Login
|-
| 2 || Create
|}
 
== UserSelectionPurpose ==
This is "nn::account::UserSelectionPurpose". This controls the UI message text to display with [[#UiMode|UserSelector]]. Invalid values are handled as value 0.
 
{| class="wikitable" border="1"
|-
! Value || Description || UI message text
|-
| 0 || General || "Select a user."
|-
| 1 || [2.0.0+] GameCardRegistration || "Who will receive the points?"
|-
| 2 || [2.0.0+] EShopLaunch || "Who is using Nintendo eShop?"
|-
| 3 || [2.0.0+] EShopItemShow || "Who is making this purchase?"
|-
| 4 || [2.0.0+] PicturePost || "Who is posting?"
|-
| 5 || [2.0.0+] NintendoAccountLinkage || "Select a user to link to a Nintendo Account."
|-
| 6 || [2.0.0+] SettingsUpdate || "Change settings for which user?"
|-
| 7 || [2.0.0+] SaveDataDeletion || "Format data for which user?"
|-
| 8 || [4.0.0+] UserMigration || "Which user will be transferred to another console?"
|-
|-
| 0x8 || 0x10 || UUID of selected user
| 9 || [8.0.0+] SaveDataTransfer(?) || "Send save data for which user?"
|}
|}


== Usage ==  
== Usage ==  
User-processes should push a common arguments struct and the typical UserSelectionConfig struct as well. After pushing in the data and calling start, user-processes should wait upon the PopOutDataEvent and then pop a single IStorage to obtain the result structure described above.
User-processes should push a common arguments struct and [[#UiSettings]]. Official sw can optionally push an additional storage from [[Applet_Manager_services#CreateTransferMemoryStorage|CreateTransferMemoryStorage]] with flag=0 using an input buffer when that input buffer is not NULL, however sdknso itself doesn't use this besides a wrapper func which sdknso itself doesn't call (the applet itself ignores this storage, at least with [9.1.0+]). After launching the applet and waiting for it to finish, on success the output storage [[#UiReturnArg]] should be popped.


[[Category:Library Applets]]
[[Category:Library Applets]]