PSP2: Use system enter key by default
Vicki Pfau vi@endrift.com
Sun, 21 Jan 2018 00:45:15 -0800
3 files changed,
35 insertions(+),
3 deletions(-)
M
src/platform/psp2/CMakeLists.txt
→
src/platform/psp2/CMakeLists.txt
@@ -13,7 +13,21 @@
list(APPEND CORE_VFS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/sce-vfs.c) set(CORE_VFS_SRC ${CORE_VFS_SRC} PARENT_SCOPE) -set(OS_LIB -lvita2d -lSceAppMgr_stub -lSceCtrl_stub -lSceAudio_stub -lSceCamera_stub -lSceCommonDialog_stub -lSceDisplay_stub -lSceGxm_stub -lSceMotion_stub -lScePgf_stub -lScePhotoExport_stub -lScePower_stub -lSceSysmodule_stub -lSceTouch_stub -l${M_LIBRARY}) +set(OS_LIB -lvita2d -l${M_LIBRARY} + -lSceAppMgr_stub + -lSceAppUtil_stub + -lSceAudio_stub + -lSceCamera_stub + -lSceCommonDialog_stub + -lSceCtrl_stub + -lSceDisplay_stub + -lSceGxm_stub + -lSceMotion_stub + -lScePgf_stub + -lScePhotoExport_stub + -lScePower_stub + -lSceSysmodule_stub + -lSceTouch_stub) set(OBJCOPY_CMD ${OBJCOPY} -I binary -O elf32-littlearm -B arm) list(APPEND GUI_SRC ${CMAKE_CURRENT_SOURCE_DIR}/gui-font.c)
M
src/platform/psp2/main.c
→
src/platform/psp2/main.c
@@ -12,12 +12,14 @@ #include <mgba-util/gui/font.h>
#include <mgba-util/gui/file-select.h> #include <mgba-util/gui/menu.h> +#include <psp2/apputil.h> #include <psp2/ctrl.h> #include <psp2/display.h> #include <psp2/kernel/processmgr.h> #include <psp2/kernel/threadmgr.h> #include <psp2/power.h> #include <psp2/sysmodule.h> +#include <psp2/system_param.h> #include <psp2/touch.h> #include <vita2d.h>@@ -163,11 +165,26 @@
sceTouchSetSamplingState(SCE_TOUCH_PORT_FRONT, SCE_TOUCH_SAMPLING_STATE_START); sceCtrlSetSamplingMode(SCE_CTRL_MODE_ANALOG_WIDE); sceSysmoduleLoadModule(SCE_SYSMODULE_PHOTO_EXPORT); + sceSysmoduleLoadModule(SCE_SYSMODULE_APPUTIL); mGUIInit(&runner, "psvita"); - mPSP2MapKey(&runner.params.keyMap, SCE_CTRL_CROSS, GUI_INPUT_SELECT); - mPSP2MapKey(&runner.params.keyMap, SCE_CTRL_CIRCLE, GUI_INPUT_BACK); + int enterButton; + SceAppUtilInitParam initParam; + SceAppUtilBootParam bootParam; + memset(&initParam, 0, sizeof(SceAppUtilInitParam)); + memset(&bootParam, 0, sizeof(SceAppUtilBootParam)); + sceAppUtilInit(&initParam, &bootParam); + sceAppUtilSystemParamGetInt(SCE_SYSTEM_PARAM_ID_ENTER_BUTTON, &enterButton); + sceAppUtilShutdown(); + + if (enterButton == SCE_SYSTEM_PARAM_ENTER_BUTTON_CIRCLE) { + mPSP2MapKey(&runner.params.keyMap, SCE_CTRL_CROSS, GUI_INPUT_BACK); + mPSP2MapKey(&runner.params.keyMap, SCE_CTRL_CIRCLE, GUI_INPUT_SELECT); + } else { + mPSP2MapKey(&runner.params.keyMap, SCE_CTRL_CROSS, GUI_INPUT_SELECT); + mPSP2MapKey(&runner.params.keyMap, SCE_CTRL_CIRCLE, GUI_INPUT_BACK); + } mPSP2MapKey(&runner.params.keyMap, SCE_CTRL_TRIANGLE, GUI_INPUT_CANCEL); mPSP2MapKey(&runner.params.keyMap, SCE_CTRL_UP, GUI_INPUT_UP); mPSP2MapKey(&runner.params.keyMap, SCE_CTRL_DOWN, GUI_INPUT_DOWN);