From 67c4ecd9a17491c102cdc8e5d08b22ab422826c8 Mon Sep 17 00:00:00 2001 From: neonloop Date: Sat, 3 Apr 2021 23:13:51 +0000 Subject: Enables Menu+L1/R1 for L2/R2 and vice versa The menu now appears when releasing the button as long as another button hasn't been pressed. Menu+L will activate L2 if L1 is bound to L, or L1 if L2 is bound to L. This allows rebinding for games that prefer L2/R2, like Twisted Metal 2. --- frontend/plugin_lib.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'frontend/plugin_lib.c') diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c index 6c5b296..ad877ed 100644 --- a/frontend/plugin_lib.c +++ b/frontend/plugin_lib.c @@ -601,6 +601,7 @@ static void update_input(void) { int actions[IN_BINDTYPE_COUNT] = { 0, }; unsigned int emu_act; + int keystate; in_update(actions); if (in_type[0] == PSE_PAD_TYPE_ANALOGJOY || in_type[0] == PSE_PAD_TYPE_ANALOGPAD) @@ -615,9 +616,31 @@ static void update_input(void) ; emu_act = which; } + + keystate = actions[IN_BINDTYPE_PLAYER12]; +#ifdef MENU_SHOULDER_COMBO + if (emu_act == SACTION_ENTER_MENU) { + if (keystate) + emu_menu_cancel = 1; + + if (keystate & (1 << DKEY_L1)) { + keystate ^= (1 << DKEY_L1); + keystate |= (1 << DKEY_L2); + } else if (keystate & (1 << DKEY_L2)) { + keystate ^= (1 << DKEY_L2); + keystate |= (1 << DKEY_L1); + } else if (keystate & (1 << DKEY_R1)) { + keystate ^= (1 << DKEY_R1); + keystate |= (1 << DKEY_R2); + } else if (keystate & (1 << DKEY_R2)) { + keystate ^= (1 << DKEY_R2); + keystate |= (1 << DKEY_R1); + } + } +#endif emu_set_action(emu_act); - in_keystate[0] = actions[IN_BINDTYPE_PLAYER12]; + in_keystate[0] = keystate; } #else /* MAEMO */ extern void update_input(void); -- cgit v1.2.3