diff --git a/input/drivers/cocoa_input.c b/input/drivers/cocoa_input.c index c8a39766ab..bb59111bde 100644 --- a/input/drivers/cocoa_input.c +++ b/input/drivers/cocoa_input.c @@ -282,37 +282,30 @@ static int16_t cocoa_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned idx, unsigned id) { + int16_t ret = 0; cocoa_input_data_t *apple = (cocoa_input_data_t*)data; switch (device) { case RETRO_DEVICE_JOYPAD: - { - int16_t ret = id < RARCH_BIND_LIST_END ? - apple_key_state[rarch_keysym_lut[binds[port][id].key]] : 0; - if (!ret) - ret = input_joypad_pressed(apple->joypad, joypad_info, port, binds[port], id); + if (id < RARCH_BIND_LIST_END) + ret = apple_key_state[rarch_keysym_lut[binds[port][id].key]]; + if (!ret) + ret = input_joypad_pressed(apple->joypad, joypad_info, port, binds[port], id); #ifdef HAVE_MFI - if (!ret) - ret = input_joypad_pressed(apple->sec_joypad, joypad_info, port, binds[port], id); + if (!ret) + ret = input_joypad_pressed(apple->sec_joypad, joypad_info, port, binds[port], id); #endif - return ret; - } - break; + return ret; case RETRO_DEVICE_ANALOG: - if (binds[port]) - { - int16_t ret = 0; #ifdef HAVE_MFI - ret = input_joypad_analog(apple->sec_joypad, joypad_info, port, - idx, id, binds[port]); + ret = input_joypad_analog(apple->sec_joypad, joypad_info, port, + idx, id, binds[port]); #endif - if (!ret && binds[port]) - ret = input_joypad_analog(apple->joypad, joypad_info, port, - idx, id, binds[port]); - return ret; - } - break; + if (!ret && binds[port]) + ret = input_joypad_analog(apple->joypad, joypad_info, port, + idx, id, binds[port]); + return ret; case RETRO_DEVICE_KEYBOARD: return (id < RETROK_LAST) && apple_key_state[rarch_keysym_lut[(enum retro_key)id]]; case RETRO_DEVICE_MOUSE: diff --git a/input/drivers/linuxraw_input.c b/input/drivers/linuxraw_input.c index 19a241df30..eee4a70cd6 100644 --- a/input/drivers/linuxraw_input.c +++ b/input/drivers/linuxraw_input.c @@ -103,31 +103,25 @@ static int16_t linuxraw_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned idx, unsigned id) { + int16_t ret = 0; linuxraw_input_t *linuxraw = (linuxraw_input_t*)data; switch (device) { case RETRO_DEVICE_JOYPAD: - { - int16_t ret = ((id < RARCH_BIND_LIST_END) && binds[port]->valid && - linuxraw->state[rarch_keysym_lut[(enum retro_key)binds[port][id].key]] - ); - if (!ret) - ret = input_joypad_pressed(linuxraw->joypad, - joypad_info, port, binds[port], id); - return ret; - } - break; + ret = ((id < RARCH_BIND_LIST_END) && binds[port]->valid && + linuxraw->state[rarch_keysym_lut[(enum retro_key)binds[port][id].key]] + ); + if (!ret) + ret = input_joypad_pressed(linuxraw->joypad, + joypad_info, port, binds[port], id); + return ret; case RETRO_DEVICE_ANALOG: - if (binds[port]) - { - int16_t ret = linuxraw_analog_pressed(linuxraw, binds[port], idx, id); - if (!ret) - ret = input_joypad_analog(linuxraw->joypad, - joypad_info, port, idx, id, binds[port]); - return ret; - } - break; + ret = linuxraw_analog_pressed(linuxraw, binds[port], idx, id); + if (!ret && binds[port]) + ret = input_joypad_analog(linuxraw->joypad, + joypad_info, port, idx, id, binds[port]); + return ret; } return 0; diff --git a/input/drivers/udev_input.c b/input/drivers/udev_input.c index 226d519e51..edef36f29b 100644 --- a/input/drivers/udev_input.c +++ b/input/drivers/udev_input.c @@ -655,29 +655,24 @@ static int16_t udev_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned idx, unsigned id) { + int16_t ret = 0; udev_input_t *udev = (udev_input_t*)data; switch (device) { case RETRO_DEVICE_JOYPAD: - { - int16_t ret = BIT_GET(udev_key_state, - rarch_keysym_lut[binds[port][id].key]); - if (!ret) - ret = input_joypad_pressed(udev->joypad, - joypad_info, port, binds[port], id); - return ret; - } + ret = BIT_GET(udev_key_state, + rarch_keysym_lut[binds[port][id].key]); + if (!ret) + ret = input_joypad_pressed(udev->joypad, + joypad_info, port, binds[port], id); + return ret; case RETRO_DEVICE_ANALOG: - if (binds[port]) - { - int16_t ret = udev_analog_pressed(binds[port], idx, id); - if (!ret) - ret = input_joypad_analog(udev->joypad, - joypad_info, port, idx, id, binds[port]); - return ret; - } - break; + ret = udev_analog_pressed(binds[port], idx, id); + if (!ret && binds[port]) + ret = input_joypad_analog(udev->joypad, + joypad_info, port, idx, id, binds[port]); + return ret; case RETRO_DEVICE_KEYBOARD: return id < RETROK_LAST && BIT_GET(udev_key_state, rarch_keysym_lut[(enum retro_key)id]); diff --git a/input/drivers/x11_input.c b/input/drivers/x11_input.c index 4945333a11..c6fb1f956c 100644 --- a/input/drivers/x11_input.c +++ b/input/drivers/x11_input.c @@ -222,40 +222,36 @@ static int16_t x_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned idx, unsigned id) { + int16_t ret = 0; x11_input_t *x11 = (x11_input_t*)data; switch (device) { case RETRO_DEVICE_JOYPAD: { - int16_t ret = 0; int keycode = XKeysymToKeycode(x11->display, rarch_keysym_lut[(enum retro_key)binds[port][id].key]); ret = x11->state[keycode >> 3] & (1 << (keycode & 7)); if (!ret) ret = input_joypad_pressed(x11->joypad, joypad_info, port, binds[port], id); - return ret; } + return ret; case RETRO_DEVICE_KEYBOARD: if (id < RETROK_LAST) { int keycode = XKeysymToKeycode(x11->display, rarch_keysym_lut[(enum retro_key)id]); - return x11->state[keycode >> 3] & (1 << (keycode & 7)); + ret = x11->state[keycode >> 3] & (1 << (keycode & 7)); } - break; + return ret; case RETRO_DEVICE_ANALOG: - if (binds[port]) - { - int16_t ret = x_pressed_analog(x11, binds[port], idx, id); - if (!ret) - ret = input_joypad_analog(x11->joypad, joypad_info, - port, idx, - id, binds[port]); - return ret; - } - break; + ret = x_pressed_analog(x11, binds[port], idx, id); + if (!ret && binds[port]) + ret = input_joypad_analog(x11->joypad, joypad_info, + port, idx, + id, binds[port]); + return ret; case RETRO_DEVICE_MOUSE: return x_mouse_state(x11, id); case RARCH_DEVICE_MOUSE_SCREEN: