PSP2: Use system enter key by default

This commit is contained in:
Vicki Pfau 2018-01-21 00:45:15 -08:00
parent f6cc37850f
commit 789a84d2e2
3 changed files with 35 additions and 3 deletions

View File

@ -60,6 +60,7 @@ Misc:
- Libretro: Add frameskip option
- GBA Memory: 64 MiB GBA Video cartridge support
- 3DS: Scale font based on glyph heights (fixes mgba.io/i/961)
- PSP2: Use system enter key by default
0.6.1: (2017-10-01)
Bugfixes:

View File

@ -13,7 +13,21 @@ source_group("PS Vita-specific code" FILES ${OS_SRC})
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)

View File

@ -12,12 +12,14 @@
#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 @@ int main() {
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);