mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-04 10:32:15 +02:00
Add simplified API
This commit is contained in:
parent
0acbc22be0
commit
0e69e0165b
@ -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, AccountUid *user_id);
|
void pselUiAddUser(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
|
||||||
@ -87,9 +87,33 @@ NX_CONSTEXPR void pselUiSetSkipEnabled(PselUiSettings *ui, bool flag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Shows the applet with the specified UI settings.
|
* @brief Shows playerSelect applet with the specified UI settings.
|
||||||
* @param ui PselUiSettings struct.
|
* @param ui PselUiSettings struct.
|
||||||
* @param out_uid Selected user ID.
|
* @param out_user 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, AccountUid *out_user);
|
Result pselUiShow(PselUiSettings *ui, AccountUid *out_user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Shows playerSelect applet to select a user.
|
||||||
|
* @param out_user Returned selected user ID.
|
||||||
|
*/
|
||||||
|
Result pselShowUserSelector(AccountUid *out_user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Shows playerSelect applet to create a user.
|
||||||
|
* @param out_user Returned created user ID.
|
||||||
|
*/
|
||||||
|
Result pselShowUserCreator(AccountUid *out_user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Shows playerSelect applet to change a user's icon.
|
||||||
|
* @param user Input user ID.
|
||||||
|
*/
|
||||||
|
Result pselShowIconEditor(AccountUid *user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Shows playerSelect applet to change a user's nickname.
|
||||||
|
* @param user Input user ID.
|
||||||
|
*/
|
||||||
|
Result pselShowNicknameEditor(AccountUid *user);
|
@ -13,7 +13,7 @@ Result pselUiCreate(PselUiSettings *ui, PselUiMode mode) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pselUiAddInvalidUser(PselUiSettings *ui, AccountUid *user_id) {
|
void pselUiAddUser(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++) {
|
||||||
|
|
||||||
@ -45,8 +45,48 @@ Result pselUiShow(PselUiSettings *ui, AccountUid *out_user) {
|
|||||||
|
|
||||||
if (R_SUCCEEDED(rc)) {
|
if (R_SUCCEEDED(rc)) {
|
||||||
if (res.result != 0) rc = MAKERESULT(Module_Libnx, LibnxError_LibAppletBadExit);
|
if (res.result != 0) rc = MAKERESULT(Module_Libnx, LibnxError_LibAppletBadExit);
|
||||||
if (R_SUCCEEDED(rc)) *out_user = res.userId;
|
if (R_SUCCEEDED(rc)) {
|
||||||
|
if(out_user) *out_user = res.userId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result pselShowUserSelector(AccountUid *out_user) {
|
||||||
|
PselUiSettings ui;
|
||||||
|
Result rc = pselUiCreate(&ui, PselUiMode_SelectUser);
|
||||||
|
if(R_SUCCEEDED(rc)) {
|
||||||
|
rc = pselUiShow(&ui, out_user);
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result pselShowUserCreator(AccountUid *out_user) {
|
||||||
|
PselUiSettings ui;
|
||||||
|
Result rc = pselUiCreate(&ui, PselUiMode_UserCreation);
|
||||||
|
if(R_SUCCEEDED(rc)) {
|
||||||
|
rc = pselUiShow(&ui, out_user);
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result pselShowIconEditor(AccountUid *user) {
|
||||||
|
PselUiSettings ui;
|
||||||
|
Result rc = pselUiCreate(&ui, PselUiMode_IconEditor);
|
||||||
|
if(R_SUCCEEDED(rc)) {
|
||||||
|
pselUiAddUser(&ui, user);
|
||||||
|
rc = pselUiShow(&ui, NULL);
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result pselShowNicknameEditor(AccountUid *user) {
|
||||||
|
PselUiSettings ui;
|
||||||
|
Result rc = pselUiCreate(&ui, PselUiMode_NicknameEditor);
|
||||||
|
if(R_SUCCEEDED(rc)) {
|
||||||
|
pselUiAddUser(&ui, user);
|
||||||
|
rc = pselUiShow(&ui, NULL);
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user