64 lines
1.9 KiB
C
64 lines
1.9 KiB
C
/**
|
|
* Copyright (c) 2026 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#include "systempsp.h"
|
|
#include "input/input.h"
|
|
#include "util/string.h"
|
|
#include "assert/assert.h"
|
|
|
|
errorret_t systemInitPSP() {
|
|
// Bind ACCEPT and CANCEL binds.
|
|
inputbuttondata_t *buttonCross, *buttonCircle, *buttonAccept, *buttonCancel;
|
|
|
|
inputbuttondata_t *i = INPUT_BUTTON_DATA;
|
|
while(i->name) {
|
|
if(stringCompare(i->name, "cross") == 0) {
|
|
buttonCross = i;
|
|
} else if(stringCompare(i->name, "circle") == 0) {
|
|
buttonCircle = i;
|
|
} else if(stringCompare(i->name, "accept") == 0) {
|
|
buttonAccept = i;
|
|
} else if(stringCompare(i->name, "cancel") == 0) {
|
|
buttonCancel = i;
|
|
}
|
|
i++;
|
|
}
|
|
|
|
assertNotNull(buttonCross, "Cross button not found!");
|
|
assertNotNull(buttonCircle, "Circle button not found!");
|
|
assertNotNull(buttonAccept, "Accept button not found!");
|
|
assertNotNull(buttonCancel, "Cancel button not found!");
|
|
|
|
if(systemPSPGetCrossButtonSetting() == PSP_UTILITY_ACCEPT_CROSS) {
|
|
buttonAccept->button.gpButton = buttonCross->button.gpButton;
|
|
buttonCancel->button.gpButton = buttonCircle->button.gpButton;
|
|
} else {
|
|
buttonAccept->button.gpButton = buttonCircle->button.gpButton;
|
|
buttonCancel->button.gpButton = buttonCross->button.gpButton;
|
|
}
|
|
|
|
errorOk();
|
|
}
|
|
|
|
systemdialogtype_t systemGetActiveDialogTypePSP() {
|
|
return SYSTEM_DIALOG_TYPE_NONE;
|
|
}
|
|
|
|
int systemPSPGetLanguage() {
|
|
int ret;
|
|
sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_LANGUAGE, &ret);
|
|
return ret;
|
|
}
|
|
|
|
int systemPSPGetCrossButtonSetting() {
|
|
int ret;
|
|
// See: https://pspdev.github.io/pspsdk/psputility__sysparam_8h.html#ab588fd5a14adc025f065e09325ffe729
|
|
sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_UNKNOWN, &ret);
|
|
return (
|
|
ret == 1 ? PSP_UTILITY_ACCEPT_CROSS : PSP_UTILITY_ACCEPT_CIRCLE
|
|
);
|
|
} |