diff --git a/input/drivers/android_input.c b/input/drivers/android_input.c index d652a22434..13ec5a08a3 100644 --- a/input/drivers/android_input.c +++ b/input/drivers/android_input.c @@ -953,13 +953,15 @@ static bool android_input_key_pressed(void *data, int key, enum input_device_typ { android_input_t *android = (android_input_t*)data; settings_t *settings = config_get_ptr(); - bool joypad_pressed = input_joypad_pressed(android->joypad, - 0, settings->input.binds[0], key); - if (joypad_pressed) + if (input_joypad_pressed(android->joypad, + 0, settings->input.binds[0], key)) + { *device = INPUT_DEVICE_TYPE_JOYPAD; + return true; + } - return joypad_pressed; + return false; } static bool android_input_meta_key_pressed(void *data, int key, enum input_device_type *device) diff --git a/input/drivers/cocoa_input.c b/input/drivers/cocoa_input.c index 3c36487a1c..82ecd0e337 100644 --- a/input/drivers/cocoa_input.c +++ b/input/drivers/cocoa_input.c @@ -400,15 +400,19 @@ static bool cocoa_input_key_pressed(void *data, int key, enum input_device_type { cocoa_input_data_t *apple = (cocoa_input_data_t*)data; settings_t *settings = config_get_ptr(); - bool keyboard_pressed = cocoa_input_is_pressed(apple, 0, settings->input.binds[0], key); - bool joypad_pressed = input_joypad_pressed(apple->joypad, 0, settings->input.binds[0], key); - if (keyboard_pressed) + if (cocoa_input_is_pressed(apple, 0, settings->input.binds[0], key)) + { *device = INPUT_DEVICE_TYPE_KEYBOARD; - if (joypad_pressed) + return true; + } + if (input_joypad_pressed(apple->joypad, 0, settings->input.binds[0], key)) + { *device = INPUT_DEVICE_TYPE_JOYPAD; + return true; + } - return keyboard_pressed || joypad_pressed; + return false; } static bool cocoa_input_meta_key_pressed(void *data, int key, enum input_device_type *device) diff --git a/input/drivers/ctr_input.c b/input/drivers/ctr_input.c index 2ae9d6adb9..a979d63209 100644 --- a/input/drivers/ctr_input.c +++ b/input/drivers/ctr_input.c @@ -87,22 +87,25 @@ static bool ctr_input_key_pressed(void *data, int key, enum input_device_type *d { settings_t *settings = config_get_ptr(); ctr_input_t *ctr = (ctr_input_t*)data; - bool joypad_pressed = input_joypad_pressed(ctr->joypad, 0, settings->input.binds[0], key); - if (joypad_pressed) + if (input_joypad_pressed(ctr->joypad, 0, settings->input.binds[0], key)) + { *device = INPUT_DEVICE_TYPE_JOYPAD; + return true; + } - return joypad_pressed; + return false; } static bool ctr_input_meta_key_pressed(void *data, int key, enum input_device_type *device) { - bool meta_pressed = BIT64_GET(lifecycle_state, key); - - if (meta_pressed) + if (BIT64_GET(lifecycle_state, key)) + { *device = INPUT_DEVICE_TYPE_JOYPAD; + return true; + } - return meta_pressed; + return false; } static uint64_t ctr_input_get_capabilities(void *data) diff --git a/input/drivers/gx_input.c b/input/drivers/gx_input.c index 4f61bfe5eb..11ae06833a 100644 --- a/input/drivers/gx_input.c +++ b/input/drivers/gx_input.c @@ -97,18 +97,25 @@ static bool gx_input_key_pressed(void *data, int key, enum input_device_type *de { settings_t *settings = config_get_ptr(); gx_input_t *gx = (gx_input_t*)data; - bool joypad_pressed = input_joypad_pressed(gx->joypad, 0, settings->input.binds[0], key); - if (joypad_pressed) + if (input_joypad_pressed(gx->joypad, 0, settings->input.binds[0], key)) + { *device = INPUT_DEVICE_TYPE_JOYPAD; + return true; + } - return joypad_pressed; + return false; } static bool gx_input_meta_key_pressed(void *data, int key, enum input_device_type *device) { - bool meta_pressed = BIT64_GET(lifecycle_state, key); - return meta_pressed; + if (BIT64_GET(lifecycle_state, key)) + { + *device = INPUT_DEVICE_TYPE_JOYPAD; + return true; + } + + return false; } static uint64_t gx_input_get_capabilities(void *data) diff --git a/input/drivers/linuxraw_input.c b/input/drivers/linuxraw_input.c index ec5f63ec50..349a4020f3 100644 --- a/input/drivers/linuxraw_input.c +++ b/input/drivers/linuxraw_input.c @@ -177,15 +177,20 @@ static bool linuxraw_input_key_pressed(void *data, int key, enum input_device_ty { linuxraw_input_t *linuxraw = (linuxraw_input_t*)data; settings_t *settings = config_get_ptr(); - bool keyboard_pressed = linuxraw_is_pressed(linuxraw, settings->input.binds[0], key); - bool joypad_pressed = input_joypad_pressed(linuxraw->joypad, 0, settings->input.binds[0], key); - if (keyboard_pressed) + if (linuxraw_is_pressed(linuxraw, settings->input.binds[0], key)) + { *device = INPUT_DEVICE_TYPE_KEYBOARD; - if (joypad_pressed) - *device = INPUT_DEVICE_TYPE_JOYPAD; + return true; + } - return keyboard_pressed || joypad_pressed; + if (input_joypad_pressed(linuxraw->joypad, 0, settings->input.binds[0], key)) + { + *device = INPUT_DEVICE_TYPE_JOYPAD; + return true; + } + + return false; } static bool linuxraw_input_meta_key_pressed(void *data, int key, enum input_device_type *device) diff --git a/input/drivers/ps3_input.c b/input/drivers/ps3_input.c index ede5880c1f..bef6e9dd15 100644 --- a/input/drivers/ps3_input.c +++ b/input/drivers/ps3_input.c @@ -178,12 +178,14 @@ static bool ps3_input_key_pressed(void *data, int key, enum input_device_type *d { ps3_input_t *ps3 = (ps3_input_t*)data; settings_t *settings = config_get_ptr(); - bool joypad_pressed = input_joypad_pressed(ps3->joypad, 0, settings->input.binds[0], key); - if (joypad_pressed) + if (input_joypad_pressed(ps3->joypad, 0, settings->input.binds[0], key)) + { *device = INPUT_DEVICE_TYPE_JOYPAD; + return true; + } - return joypad_pressed; + return false; } static bool ps3_input_meta_key_pressed(void *data, int key, enum input_device_type *device) diff --git a/input/drivers/psp_input.c b/input/drivers/psp_input.c index 094727e2b1..8ed0bf3aef 100644 --- a/input/drivers/psp_input.c +++ b/input/drivers/psp_input.c @@ -104,12 +104,14 @@ static bool psp_input_key_pressed(void *data, int key, enum input_device_type *d { settings_t *settings = config_get_ptr(); psp_input_t *psp = (psp_input_t*)data; - bool joypad_pressed = input_joypad_pressed(psp->joypad, 0, settings->input.binds[0], key); - if (joypad_pressed) + if (input_joypad_pressed(psp->joypad, 0, settings->input.binds[0], key)) + { *device = INPUT_DEVICE_TYPE_JOYPAD; + return true; + } - return joypad_pressed; + return false; } static bool psp_input_meta_key_pressed(void *data, int key, enum input_device_type *device) diff --git a/input/drivers/qnx_input.c b/input/drivers/qnx_input.c index 532301bb63..33381b1b8c 100644 --- a/input/drivers/qnx_input.c +++ b/input/drivers/qnx_input.c @@ -790,12 +790,14 @@ static bool qnx_input_key_pressed(void *data, int key, enum input_device_type *d { qnx_input_t *qnx = (qnx_input_t*)data; settings_t *settings = config_get_ptr(); - bool joypad_pressed = input_joypad_pressed(qnx->joypad, 0, settings->input.binds[0], key); - if (joypad_pressed) + if (input_joypad_pressed(qnx->joypad, 0, settings->input.binds[0], key)) + { *device = INPUT_DEVICE_TYPE_JOYPAD; + return true; + } - return joypad_pressed; + return false; } static bool qnx_input_meta_key_pressed(void *data, int key, enum input_device_type *device) diff --git a/input/drivers/sdl_input.c b/input/drivers/sdl_input.c index 4f19fd4110..ac4b9c58d5 100644 --- a/input/drivers/sdl_input.c +++ b/input/drivers/sdl_input.c @@ -283,21 +283,22 @@ static int16_t sdl_analog_pressed(sdl_input_t *sdl, const struct retro_keybind * static bool sdl_input_key_pressed(void *data, int key, enum input_device_type *device) { - settings_t *settings = config_get_ptr(); - const struct retro_keybind *binds = settings->input.binds[0]; - sdl_input_t *sdl = (sdl_input_t*)data; - if (key >= 0 && key < RARCH_BIND_LIST_END) { - bool keyboard_pressed = sdl_is_pressed(sdl, 0, binds, key); - bool joypad_pressed = input_joypad_pressed(sdl->joypad, 0, binds, key); + sdl_input_t *sdl = (sdl_input_t*)data; + settings_t *settings = config_get_ptr(); + const struct retro_keybind *binds = settings->input.binds[0]; - if (keyboard_pressed) + if (sdl_is_pressed(sdl, 0, binds, key)) + { *device = INPUT_DEVICE_TYPE_KEYBOARD; - if (joypad_pressed) + return true; + } + if (input_joypad_pressed(sdl->joypad, 0, binds, key)) + { *device = INPUT_DEVICE_TYPE_JOYPAD; - - return keyboard_pressed || joypad_pressed; + return true; + } } return false; } @@ -311,19 +312,19 @@ static bool sdl_input_meta_key_pressed(void *data, int key, enum input_device_ty static int16_t sdl_joypad_device_state(sdl_input_t *sdl, const struct retro_keybind **binds_, unsigned port_num, unsigned id, enum input_device_type *device) { - const struct retro_keybind *binds = binds_[port_num]; - if (id < RARCH_BIND_LIST_END) { - bool keyboard_pressed = binds[id].valid && sdl_is_pressed(sdl, port_num, binds, id); - bool joypad_pressed = binds[id].valid && input_joypad_pressed(sdl->joypad, 0, binds, id); - - if (keyboard_pressed) + const struct retro_keybind *binds = binds_[port_num]; + if (binds[id].valid && sdl_is_pressed(sdl, port_num, binds, id)) + { *device = INPUT_DEVICE_TYPE_KEYBOARD; - if (joypad_pressed) + return 1; + } + if (binds[id].valid && input_joypad_pressed(sdl->joypad, 0, binds, id)) + { *device = INPUT_DEVICE_TYPE_JOYPAD; - - return keyboard_pressed || joypad_pressed; + return 1; + } } return 0; } diff --git a/input/drivers/xdk_xinput_input.c b/input/drivers/xdk_xinput_input.c index 492f28dc4a..b3e2673bcb 100644 --- a/input/drivers/xdk_xinput_input.c +++ b/input/drivers/xdk_xinput_input.c @@ -93,12 +93,13 @@ static bool xdk_input_key_pressed(void *data, int key, enum input_device_type *d xdk_input_t *xdk = (xdk_input_t*)data; settings_t *settings = config_get_ptr(); - bool joypad_pressed = input_joypad_pressed(xdk->joypad, 0, settings->input.binds[0], key); - - if (joypad_pressed) + if (input_joypad_pressed(xdk->joypad, 0, settings->input.binds[0], key)) + { *device = INPUT_DEVICE_TYPE_JOYPAD; + return true; + } - return joypad_pressed; + return false; } static bool xdk_input_meta_key_pressed(void *data, int key, enum input_device_type *device) diff --git a/input/drivers/xenon360_input.c b/input/drivers/xenon360_input.c index 641a45a866..00bcff29a0 100644 --- a/input/drivers/xenon360_input.c +++ b/input/drivers/xenon360_input.c @@ -91,12 +91,14 @@ static void* xenon360_input_init(void) static bool xenon360_input_key_pressed(void *data, int key, enum input_device_type *device) { (void)device; - bool joypad_pressed = (lifecycle_state & (UINT64_C(1) << key)); - if (joypad_pressed) + if (lifecycle_state & (UINT64_C(1) << key)) + { *device = INPUT_DEVICE_TYPE_JOYPAD; + return true; + } - return joypad_pressed; + return false; } static bool xenon360_input_meta_key_pressed(void *data, int key, enum input_device_type *device)