diff options
author | neonloop | 2021-04-03 23:13:51 +0000 |
---|---|---|
committer | neonloop | 2021-04-03 23:13:51 +0000 |
commit | 67c4ecd9a17491c102cdc8e5d08b22ab422826c8 (patch) | |
tree | cdf5b1f2f0554b2ec98b0d6444fbec841968ddaa | |
parent | 076eba28b80edeb7566d8e12713b029bd324a67b (diff) | |
download | pcsx_rearmed-67c4ecd9a17491c102cdc8e5d08b22ab422826c8.tar.gz pcsx_rearmed-67c4ecd9a17491c102cdc8e5d08b22ab422826c8.tar.bz2 pcsx_rearmed-67c4ecd9a17491c102cdc8e5d08b22ab422826c8.zip |
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.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | frontend/main.h | 16 | ||||
-rw-r--r-- | frontend/plugin_lib.c | 25 |
3 files changed, 41 insertions, 2 deletions
@@ -306,7 +306,7 @@ OBJS += frontend/plat_trimui.o frontend/blit320.o frontend/main.o frontend/menu.o: CFLAGS += -include frontend/menu_trimui.h USE_PLUGIN_LIB = 1 USE_FRONTEND = 1 -CFLAGS += -DGPULIB_USE_MMAP -DGPU_UNAI_USE_INT_DIV_MULTINV -fomit-frame-pointer -ffast-math -ffunction-sections -fsingle-precision-constant +CFLAGS += -DGPULIB_USE_MMAP -DGPU_UNAI_USE_INT_DIV_MULTINV -DMENU_SHOULDER_COMBO -fomit-frame-pointer -ffast-math -ffunction-sections -fsingle-precision-constant CFLAGS += $(SDL_CFLAGS) -DTRIMUI LDFLAGS += $(SDL_LDFLAGS) -flto -fwhole-program endif diff --git a/frontend/main.h b/frontend/main.h index b53a2a3..56f555c 100644 --- a/frontend/main.h +++ b/frontend/main.h @@ -83,11 +83,27 @@ enum sched_action { #define SACTION_GUN_MASK (0x0f << SACTION_GUN_TRIGGER) +#ifdef MENU_SHOULDER_COMBO +int emu_menu_press; +int emu_menu_cancel; +#endif + static inline void emu_set_action(enum sched_action action_) { extern enum sched_action emu_action, emu_action_old; extern int stop; +#ifdef MENU_SHOULDER_COMBO + if (action_ == SACTION_NONE) { + if (emu_menu_press && !emu_menu_cancel) + action_ = SACTION_ENTER_MENU; + emu_menu_press = 0; + emu_menu_cancel = 0; + } else if (action_ == SACTION_ENTER_MENU) { + emu_menu_press = 1; + action_ = SACTION_NONE; + } +#endif if (action_ == SACTION_NONE) emu_action_old = 0; else if (action_ != emu_action_old) 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); |