From e130afff739a9025b4b48be847020a23c18b429f Mon Sep 17 00:00:00 2001 From: radius Date: Tue, 3 Apr 2018 00:28:10 -0500 Subject: [PATCH] remap-redux part2: cleanup --- input/input_driver.c | 5 +++-- input/input_mapper.c | 6 +----- input/input_mapper.h | 3 +-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/input/input_driver.c b/input/input_driver.c index 1e694ef4e0..3432549352 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -673,9 +673,10 @@ int16_t input_state(unsigned port, unsigned device, if (((id < RARCH_FIRST_META_KEY) || (device == RETRO_DEVICE_KEYBOARD))) { bool bind_valid = libretro_input_binds[port] && libretro_input_binds[port][id].valid; - rarch_joypad_info_t joypad_info; + if (bind_valid || device == RETRO_DEVICE_KEYBOARD) { + rarch_joypad_info_t joypad_info; joypad_info.axis_threshold = input_driver_axis_threshold; joypad_info.joy_idx = settings->uints.input_joypad_map[port]; joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx]; @@ -691,7 +692,7 @@ int16_t input_state(unsigned port, unsigned device, #ifdef HAVE_KEYMAPPER if (input_driver_mapper) input_mapper_state(input_driver_mapper, - &res, port, device, idx, id, clear); + &res, port, device, idx, id); #endif #ifdef HAVE_OVERLAY diff --git a/input/input_mapper.c b/input/input_mapper.c index 64c95cf02d..e97ce1974f 100644 --- a/input/input_mapper.c +++ b/input/input_mapper.c @@ -47,7 +47,6 @@ #define MAPPER_GET_KEY(state, key) (((state)->keys[(key) / 32] >> ((key) % 32)) & 1) #define MAPPER_SET_KEY(state, key) (state)->keys[(key) / 32] |= 1 << ((key) % 32) -#define MAPPER_UNSET_KEY(state, key) (state)->keys[(key) / 32] |= 0 << ((key) % 32) struct input_mapper { @@ -214,8 +213,7 @@ void input_mapper_state( unsigned port, unsigned device, unsigned idx, - unsigned id, - bool clear) + unsigned id) { if (!handle) return; @@ -223,8 +221,6 @@ void input_mapper_state( switch (device) { case RETRO_DEVICE_JOYPAD: - /* we should get the new buttons here via input_remapper_button_pressed but it doesn't work because the old state is still there - so both actions trigger */ if (input_mapper_button_pressed(handle, id)) *ret = 1; break; diff --git a/input/input_mapper.h b/input/input_mapper.h index fd40cba04d..5f2b91e51b 100644 --- a/input/input_mapper.h +++ b/input/input_mapper.h @@ -45,8 +45,7 @@ void input_mapper_state( unsigned port, unsigned device, unsigned idx, - unsigned id, - bool clear); + unsigned id); RETRO_END_DECLS