mirror of
https://github.com/SirHumza/orbisRPC.git
synced 2026-10-06 09:00:37 +02:00
installer: normalize X=confirm O=back via EnterButtonAssignment
This commit is contained in:
1 parent
2da941a711
commit
612e7bf844
1 file changed
+23
-3
+23
-3
@@ -10,6 +10,7 @@
|
||||
#include <orbis/ImeDialog.h>
|
||||
#include <orbis/UserService.h>
|
||||
#include <orbis/Sysmodule.h>
|
||||
#include <orbis/SystemService.h>
|
||||
#include <orbis/libkernel.h>
|
||||
#include <orbis/_types/user.h>
|
||||
|
||||
@@ -23,6 +24,7 @@ static void base_init(OrbisMsgDialogParam *param){
|
||||
}
|
||||
|
||||
static int ui_ready = 0;
|
||||
static int g_cross_default = 1; /* true unless system says Circle=confirm */
|
||||
|
||||
int ui_init(void){
|
||||
if(ui_ready) return 0;
|
||||
@@ -56,6 +58,15 @@ int ui_init(void){
|
||||
sceSysmoduleUnloadModule(ORBIS_SYSMODULE_MESSAGE_DIALOG);
|
||||
return -1;
|
||||
}
|
||||
/* The dialog's fixed mapping treats Circle as the confirm button
|
||||
* (Japanese-style). Poll the user's Enter Button Assignment so
|
||||
* we can invert the Yes/No interpretation and always make X
|
||||
* confirm — the behaviour every other app on the console uses. */
|
||||
{
|
||||
int32_t v = 0;
|
||||
if (sceSystemServiceParamGetInt(ORBIS_SYSTEM_SERVICE_PARAM_ID_ENTER_BUTTON_ASSIGN, &v) == 0)
|
||||
g_cross_default = (v == ORBIS_SYSTEM_PARAM_ENTER_BUTTON_ASSIGN_CROSS);
|
||||
}
|
||||
ui_ready = 1;
|
||||
return 0;
|
||||
}
|
||||
@@ -91,8 +102,10 @@ int ui_confirm(const char *msg){
|
||||
base_init(¶m);
|
||||
memset(&um, 0, sizeof um);
|
||||
um.msg = msg;
|
||||
/* X = enter (Yes focused), O = back/decline. The default FOCUS_NO
|
||||
* variant puts the confirm button on No, which inverts the wizard. */
|
||||
/* Yes/No dialog. The dialog's fixed layout treats Circle as
|
||||
* confirm and Cross as cancel (Japanese default); the user's
|
||||
* system setting flips this. We read the assign and invert so
|
||||
* that X always confirms — the behaviour every other app uses. */
|
||||
um.buttonType = ORBIS_MSG_DIALOG_BUTTON_TYPE_YESNO;
|
||||
param.userMsgParam = &um;
|
||||
if(sceMsgDialogOpen(¶m) < 0){ sceMsgDialogTerminate(); return -1; }
|
||||
@@ -101,7 +114,14 @@ int ui_confirm(const char *msg){
|
||||
sceMsgDialogClose();
|
||||
sceMsgDialogGetResult(&res);
|
||||
sceMsgDialogTerminate();
|
||||
return res.buttonId == ORBIS_MSG_DIALOG_BUTTON_ID_YES ? 1 : 0;
|
||||
/* Button mapping: the dialog's fixed layout treats Circle as
|
||||
* confirm and Cross as cancel (Japanese default). The user's
|
||||
* system setting flips this. Invert the interpretation when
|
||||
* Circle is the system assign so that X always confirms — the
|
||||
* behaviour every other app on the console uses. */
|
||||
int yes = (res.buttonId == ORBIS_MSG_DIALOG_BUTTON_ID_YES)
|
||||
^ (g_cross_default == 0);
|
||||
return yes ? 1 : 0;
|
||||
}
|
||||
|
||||
static int progress_open = 0;
|
||||
|
||||
Reference in new issue
Block a user