all repos — mgba @ 7b12516df45ac2bfc0597d6a584e80f8b4721255

mGBA Game Boy Advance Emulator

Vita: L2/R2 and L3/R3 can now be mapped on PSTV (fixes #1292)
Vicki Pfau vi@endrift.com
Thu, 06 Jun 2019 15:54:35 -0700
commit

7b12516df45ac2bfc0597d6a584e80f8b4721255

parent

9b9aeb0c2bd76a1f8bb8d6d0fc6b20c7432bbaed

3 files changed, 23 insertions(+), 10 deletions(-)

jump to
M CHANGESCHANGES

@@ -51,6 +51,7 @@ - Qt: Add native FPS button to settings view

- Qt: Improve sync code - Switch: Dynamic display resizing - Qt: Make mute menu option also toggle fast-forward mute (fixes mgba.io/i/1424) + - Vita: L2/R2 and L3/R3 can now be mapped on PSTV (fixes mgba.io/i/1292) 0.7.2: (2019-05-25) Emulation fixes:
M src/platform/psp2/main.csrc/platform/psp2/main.c

@@ -41,7 +41,7 @@ }

static uint32_t _pollInput(const struct mInputMap* map) { SceCtrlData pad; - sceCtrlPeekBufferPositive(0, &pad, 1); + sceCtrlPeekBufferPositiveExt2(0, &pad, 1); int input = mInputMapKeyBits(map, PSP2_INPUT, pad.buttons, 0); if (pad.buttons & SCE_CTRL_UP || pad.ly < 64) {

@@ -127,17 +127,17 @@ .name = "Vita Input",

.id = PSP2_INPUT, .keyNames = (const char*[]) { "Select", - 0, - 0, + "L3", + "R3", "Start", "Up", "Right", "Down", "Left", - "L", - "R", - 0, // L2? - 0, // R2? + "L2", + "R2", + "L1", + "R1", "\1\xC", "\1\xA", "\1\xB",
M src/platform/psp2/psp2-context.csrc/platform/psp2/psp2-context.c

@@ -267,7 +267,7 @@ }

uint16_t mPSP2PollInput(struct mGUIRunner* runner) { SceCtrlData pad; - sceCtrlPeekBufferPositive(0, &pad, 1); + sceCtrlPeekBufferPositiveExt2(0, &pad, 1); int activeKeys = mInputMapKeyBits(&runner->core->inputMap, PSP2_INPUT, pad.buttons, 0); int angles = mInputMapAxis(&runner->core->inputMap, PSP2_INPUT, 0, pad.ly);

@@ -313,8 +313,8 @@ mPSP2MapKey(&runner->core->inputMap, SCE_CTRL_UP, GBA_KEY_UP);

mPSP2MapKey(&runner->core->inputMap, SCE_CTRL_DOWN, GBA_KEY_DOWN); mPSP2MapKey(&runner->core->inputMap, SCE_CTRL_LEFT, GBA_KEY_LEFT); mPSP2MapKey(&runner->core->inputMap, SCE_CTRL_RIGHT, GBA_KEY_RIGHT); - mPSP2MapKey(&runner->core->inputMap, SCE_CTRL_LTRIGGER, GBA_KEY_L); - mPSP2MapKey(&runner->core->inputMap, SCE_CTRL_RTRIGGER, GBA_KEY_R); + mPSP2MapKey(&runner->core->inputMap, SCE_CTRL_L1, GBA_KEY_L); + mPSP2MapKey(&runner->core->inputMap, SCE_CTRL_R1, GBA_KEY_R); struct mInputAxis desc = { GBA_KEY_DOWN, GBA_KEY_UP, 192, 64 }; mInputBindAxis(&runner->core->inputMap, PSP2_INPUT, 0, &desc);

@@ -396,6 +396,18 @@

int fakeBool; if (mCoreConfigGetIntValue(&runner->config, "interframeBlending", &fakeBool)) { interframeBlending = fakeBool; + } + + // Backcompat: Old versions of mGBA use an older binding system that has different mappings for L/R + if (!sceKernelIsPSVitaTV()) { + int key = mInputMapKey(&runner->core->inputMap, PSP2_INPUT, __builtin_ctz(SCE_CTRL_L2)); + if (key >= 0) { + mPSP2MapKey(&runner->core->inputMap, SCE_CTRL_L1, key); + } + key = mInputMapKey(&runner->core->inputMap, PSP2_INPUT, __builtin_ctz(SCE_CTRL_R2)); + if (key >= 0) { + mPSP2MapKey(&runner->core->inputMap, SCE_CTRL_R1, key); + } } MutexInit(&audioContext.mutex);