diff --git a/input/drivers/android_input.c b/input/drivers/android_input.c index f61f7b7965..54efa3fd07 100644 --- a/input/drivers/android_input.c +++ b/input/drivers/android_input.c @@ -1418,28 +1418,6 @@ bool android_run_events(void *data) return true; } -static int16_t android_is_pressed( - const input_device_driver_t *joypad, - rarch_joypad_info_t *joypad_info, - const struct retro_keybind *binds, - unsigned port, unsigned id) -{ - const struct retro_keybind *bind = &binds[id]; - /* Auto-binds are per joypad, not per user. */ - const uint64_t joykey = (binds[id].joykey != NO_BTN) - ? binds[id].joykey : joypad_info->auto_binds[id].joykey; - const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE) - ? binds[id].joyaxis : joypad_info->auto_binds[id].joyaxis; - if ((uint16_t)joykey != NO_BTN - && joypad->button( - joypad_info->joy_idx, (uint16_t)joykey)) - return 1; - if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis)) - / 0x8000) > joypad_info->axis_threshold) - return 1; - return 0; -} - static int16_t android_input_state(void *data, rarch_joypad_info_t *joypad_info, const struct retro_keybind **binds, unsigned port, unsigned device, @@ -1458,7 +1436,7 @@ static int16_t android_input_state(void *data, { if ( android_keyboard_port_input_pressed(binds[port], i) - || android_is_pressed( + || button_is_pressed( android->joypad, joypad_info, binds[port], port, i) ) @@ -1470,7 +1448,7 @@ static int16_t android_input_state(void *data, { if ( android_keyboard_port_input_pressed(binds[port], id) - || android_is_pressed( + || button_is_pressed( android->joypad, joypad_info, binds[port], port, id)) return 1; diff --git a/input/drivers/cocoa_input.c b/input/drivers/cocoa_input.c index 39b5181b5b..0be3ba5913 100644 --- a/input/drivers/cocoa_input.c +++ b/input/drivers/cocoa_input.c @@ -290,26 +290,6 @@ static int16_t cocoa_pointer_state(cocoa_input_data_t *apple, return 0; } -static int16_t cocoa_is_pressed( - const input_device_driver_t *joypad, - rarch_joypad_info_t *joypad_info, - const struct retro_keybind *binds, - unsigned port, unsigned id) -{ - /* Auto-binds are per joypad, not per user. */ - const uint64_t joykey = (binds[id].joykey != NO_BTN) - ? binds[id].joykey : joypad_info->auto_binds[id].joykey; - const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE) - ? binds[id].joyaxis : joypad_info->auto_binds[id].joyaxis; - if ((uint16_t)joykey != NO_BTN && joypad->button( - joypad_info->joy_idx, (uint16_t)joykey)) - return 1; - if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis)) - / 0x8000) > joypad_info->axis_threshold) - return 1; - return 0; -} - static int16_t cocoa_input_state(void *data, rarch_joypad_info_t *joypad_info, const struct retro_keybind **binds, unsigned port, @@ -328,12 +308,12 @@ static int16_t cocoa_input_state(void *data, { if (apple_key_state[rarch_keysym_lut[binds[port][i].key]]) ret |= (1 << i); - else if (cocoa_is_pressed( + else if (button_is_pressed( apple->joypad, joypad_info, binds[port], port, i)) ret |= (1 << i); #ifdef HAVE_MFI - else if (cocoa_is_pressed( + else if (button_is_pressed( apple->sec_joypad, joypad_info, binds[port], port, i)) ret |= (1 << i); @@ -346,12 +326,12 @@ static int16_t cocoa_input_state(void *data, if (id < RARCH_BIND_LIST_END) if (apple_key_state[rarch_keysym_lut[binds[port][id].key]]) return 1; - if (cocoa_is_pressed( + if (button_is_pressed( apple->joypad, joypad_info, binds[port], port, id)) return 1; #ifdef HAVE_MFI - if (cocoa_is_pressed( + if (button_is_pressed( apple->sec_joypad, joypad_info, binds[port], port, id)) return 1; diff --git a/input/drivers/ctr_input.c b/input/drivers/ctr_input.c index 1793bc0c47..909277be42 100644 --- a/input/drivers/ctr_input.c +++ b/input/drivers/ctr_input.c @@ -43,28 +43,6 @@ static void ctr_input_poll(void *data) ctr->joypad->poll(); } -static int16_t ctr_is_pressed( - const input_device_driver_t *joypad, - rarch_joypad_info_t *joypad_info, - const struct retro_keybind *binds, - unsigned port, unsigned id) -{ - const struct retro_keybind *bind = &binds[id]; - /* Auto-binds are per joypad, not per user. */ - const uint64_t joykey = (binds[id].joykey != NO_BTN) - ? binds[id].joykey : joypad_info->auto_binds[id].joykey; - const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE) - ? binds[id].joyaxis : joypad_info->auto_binds[id].joyaxis; - if ((uint16_t)joykey != NO_BTN && - joypad->button( - joypad_info->joy_idx, (uint16_t)joykey)) - return 1; - if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis)) - / 0x8000) > joypad_info->axis_threshold) - return 1; - return 0; -} - static int16_t ctr_input_state(void *data, rarch_joypad_info_t *joypad_info, const struct retro_keybind **binds, @@ -86,7 +64,7 @@ static int16_t ctr_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { if (binds[port][i].valid) - if (ctr_is_pressed( + if (button_is_pressed( ctr->joypad, joypad_info, binds[port], port, i)) ret |= (1 << i); } @@ -98,7 +76,7 @@ static int16_t ctr_input_state(void *data, if (id < RARCH_BIND_LIST_END) { if (binds[port][id].valid) - return ctr_is_pressed( + return button_is_pressed( ctr->joypad, joypad_info, binds[port], port, id); } } diff --git a/input/drivers/dos_input.c b/input/drivers/dos_input.c index 701ce085fe..90bc588d2c 100644 --- a/input/drivers/dos_input.c +++ b/input/drivers/dos_input.c @@ -69,28 +69,6 @@ static void dos_input_poll(void *data) dos->joypad->poll(); } -static int16_t dos_is_pressed( - const input_device_driver_t *joypad, - rarch_joypad_info_t *joypad_info, - const struct retro_keybind *binds, - unsigned port, unsigned id) -{ - const struct retro_keybind *bind = &binds[id]; - /* Auto-binds are per joypad, not per user. */ - const uint64_t joykey = (binds[id].joykey != NO_BTN) - ? binds[id].joykey : joypad_info->auto_binds[id].joykey; - const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE) - ? binds[id].joyaxis : joypad_info->auto_binds[id].joyaxis; - if ((uint16_t)joykey != NO_BTN - && joypad->button( - joypad_info->joy_idx, (uint16_t)joykey)) - return 1; - if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis)) - / 0x8000) > joypad_info->axis_threshold) - return 1; - return 0; -} - static int16_t dos_input_state(void *data, rarch_joypad_info_t *joypad_info, const struct retro_keybind **binds, @@ -113,7 +91,7 @@ static int16_t dos_input_state(void *data, { if ( dos_keyboard_port_input_pressed(binds[port], i) - || dos_is_pressed(dos->joypad, joypad_info, binds[port], + || button_is_pressed(dos->joypad, joypad_info, binds[port], port, i)) ret |= (1 << i); } @@ -124,7 +102,7 @@ static int16_t dos_input_state(void *data, { if ( dos_keyboard_port_input_pressed(binds[port], id) - || dos_is_pressed(dos->joypad, joypad_info, binds[port], + || button_is_pressed(dos->joypad, joypad_info, binds[port], port, id)) return 1; } diff --git a/input/drivers/gx_input.c b/input/drivers/gx_input.c index fdf0c9f11f..9b28cf2bac 100644 --- a/input/drivers/gx_input.c +++ b/input/drivers/gx_input.c @@ -134,28 +134,6 @@ static int16_t gx_mouse_state(gx_input_t *gx, unsigned id, uint16_t joy_idx) } #endif -static int16_t gx_is_pressed( - const input_device_driver_t *joypad, - rarch_joypad_info_t *joypad_info, - const struct retro_keybind *binds, - unsigned port, unsigned id) -{ - const struct retro_keybind *bind = &binds[id]; - /* Auto-binds are per joypad, not per user. */ - const uint64_t joykey = (binds[id].joykey != NO_BTN) - ? binds[id].joykey : joypad_info->auto_binds[id].joykey; - const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE) - ? binds[id].joyaxis : joypad_info->auto_binds[id].joyaxis; - if ((uint16_t)joykey != NO_BTN - && joypad->button( - joypad_info->joy_idx, (uint16_t)joykey)) - return 1; - if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis)) - / 0x8000) > joypad_info->axis_threshold) - return 1; - return 0; -} - static int16_t gx_input_state(void *data, rarch_joypad_info_t *joypad_info, const struct retro_keybind **binds, @@ -177,7 +155,7 @@ static int16_t gx_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { if ( - gx_is_pressed(gx->joypad, joypad_info, binds[port], + button_is_pressed(gx->joypad, joypad_info, binds[port], port, i)) ret |= (1 << i); } @@ -187,7 +165,7 @@ static int16_t gx_input_state(void *data, else { if ( - gx_is_pressed(gx->joypad, joypad_info, binds[port], + button_is_pressed(gx->joypad, joypad_info, binds[port], port, id)) return 1; } diff --git a/input/drivers/ps2_input.c b/input/drivers/ps2_input.c index 45a6d78d8d..7fbe16e4b7 100644 --- a/input/drivers/ps2_input.c +++ b/input/drivers/ps2_input.c @@ -41,28 +41,6 @@ static void ps2_input_poll(void *data) ps2->joypad->poll(); } -static int16_t ps2_is_pressed( - const input_device_driver_t *joypad, - rarch_joypad_info_t *joypad_info, - const struct retro_keybind *binds, - unsigned port, unsigned id) -{ - const struct retro_keybind *bind = &binds[id]; - /* Auto-binds are per joypad, not per user. */ - const uint64_t joykey = (binds[id].joykey != NO_BTN) - ? binds[id].joykey : joypad_info->auto_binds[id].joykey; - const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE) - ? binds[id].joyaxis : joypad_info->auto_binds[id].joyaxis; - if ((uint16_t)joykey != NO_BTN - && joypad->button( - joypad_info->joy_idx, (uint16_t)joykey)) - return 1; - if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis)) - / 0x8000) > joypad_info->axis_threshold) - return 1; - return 0; -} - static int16_t ps2_input_state(void *data, rarch_joypad_info_t *joypad_info, const struct retro_keybind **binds, @@ -80,7 +58,7 @@ static int16_t ps2_input_state(void *data, int16_t ret = 0; for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { - if (ps2_is_pressed(ps2->joypad, joypad_info, binds[port], + if (button_is_pressed(ps2->joypad, joypad_info, binds[port], port, i)) ret |= (1 << i); } @@ -89,7 +67,7 @@ static int16_t ps2_input_state(void *data, } else { - if (ps2_is_pressed(ps2->joypad, joypad_info, binds[port], + if (button_is_pressed(ps2->joypad, joypad_info, binds[port], port, id)) return 1; } diff --git a/input/drivers/ps3_input.c b/input/drivers/ps3_input.c index e8fe14c543..c0ac1a46d9 100644 --- a/input/drivers/ps3_input.c +++ b/input/drivers/ps3_input.c @@ -93,28 +93,6 @@ static int16_t ps3_mouse_device_state(ps3_input_t *ps3, } #endif -static int16_t ps3_is_pressed( - const input_device_driver_t *joypad, - rarch_joypad_info_t *joypad_info, - const struct retro_keybind *binds, - unsigned port, unsigned id) -{ - const struct retro_keybind *bind = &binds[id]; - /* Auto-binds are per joypad, not per user. */ - const uint64_t joykey = (binds[id].joykey != NO_BTN) - ? binds[id].joykey : joypad_info->auto_binds[id].joykey; - const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE) - ? binds[id].joyaxis : joypad_info->auto_binds[id].joyaxis; - if ((uint16_t)joykey != NO_BTN - && joypad->button( - joypad_info->joy_idx, (uint16_t)joykey)) - return 1; - if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis)) - / 0x8000) > joypad_info->axis_threshold) - return 1; - return 0; -} - static int16_t ps3_input_state(void *data, rarch_joypad_info_t *joypad_info, const struct retro_keybind **binds, @@ -136,7 +114,7 @@ static int16_t ps3_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { if ( - ps3_is_pressed(ps3->joypad, joypad_info, binds[port], + button_is_pressed(ps3->joypad, joypad_info, binds[port], port, i)) ret |= (1 << i); } @@ -145,7 +123,7 @@ static int16_t ps3_input_state(void *data, } else { - if (ps3_is_pressed(ps3->joypad, joypad_info, binds[port], + if (button_is_pressed(ps3->joypad, joypad_info, binds[port], port, id)) return 1; } diff --git a/input/drivers/ps4_input.c b/input/drivers/ps4_input.c index abf3a90c95..92e88465b6 100644 --- a/input/drivers/ps4_input.c +++ b/input/drivers/ps4_input.c @@ -45,28 +45,6 @@ static void ps4_input_poll(void *data) ps4->joypad->poll(); } -static int16_t ps4_is_pressed( - const input_device_driver_t *joypad, - rarch_joypad_info_t *joypad_info, - const struct retro_keybind *binds, - unsigned port, unsigned id) -{ - const struct retro_keybind *bind = &binds[id]; - /* Auto-binds are per joypad, not per user. */ - const uint64_t joykey = (binds[id].joykey != NO_BTN) - ? binds[id].joykey : joypad_info->auto_binds[id].joykey; - const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE) - ? binds[id].joyaxis : joypad_info->auto_binds[id].joyaxis; - if ((uint16_t)joykey != NO_BTN - && joypad->button( - joypad_info->joy_idx, (uint16_t)joykey)) - return 1; - if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis)) - / 0x8000) > joypad_info->axis_threshold) - return 1; - return 0; -} - static int16_t ps4_input_state(void *data, rarch_joypad_info_t *joypad_info, const struct retro_keybind **binds, @@ -85,7 +63,7 @@ static int16_t ps4_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { if ( - ps4_is_pressed(ps4->joypad, joypad_info, binds[port], + button_is_pressed(ps4->joypad, joypad_info, binds[port], port, i)) ret |= (1 << i); } @@ -95,7 +73,7 @@ static int16_t ps4_input_state(void *data, else { if ( - ps4_is_pressed(ps4->joypad, joypad_info, binds[port], + button_is_pressed(ps4->joypad, joypad_info, binds[port], port, id)) return 1; } diff --git a/input/drivers/psl1ght_input.c b/input/drivers/psl1ght_input.c index 425d259909..99c58967a3 100644 --- a/input/drivers/psl1ght_input.c +++ b/input/drivers/psl1ght_input.c @@ -203,28 +203,6 @@ static bool psl1ght_keyboard_port_input_pressed(ps3_input_t *ps3, unsigned id) return false; } -static int16_t psl1ght_is_pressed( - const input_device_driver_t *joypad, - rarch_joypad_info_t *joypad_info, - const struct retro_keybind *binds, - unsigned port, unsigned id) -{ - const struct retro_keybind *bind = &binds[id]; - /* Auto-binds are per joypad, not per user. */ - const uint64_t joykey = (binds[id].joykey != NO_BTN) - ? binds[id].joykey : joypad_info->auto_binds[id].joykey; - const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE) - ? binds[id].joyaxis : joypad_info->auto_binds[id].joyaxis; - if ((uint16_t)joykey != NO_BTN - && joypad->button( - joypad_info->joy_idx, (uint16_t)joykey)) - return 1; - if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis)) - / 0x8000) > joypad_info->axis_threshold) - return 1; - return 0; -} - static int16_t ps3_input_state(void *data, rarch_joypad_info_t *joypad_info, const struct retro_keybind **binds, @@ -246,7 +224,7 @@ static int16_t ps3_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { if ( - psl1ght_is_pressed(ps3->joypad, joypad_info, binds[port], + button_is_pressed(ps3->joypad, joypad_info, binds[port], port, i)) ret |= (1 << i); else if (psl1ght_keyboard_port_input_pressed(ps3, binds[port][i].key)) @@ -258,7 +236,7 @@ static int16_t ps3_input_state(void *data, else { if ( - psl1ght_is_pressed(ps3->joypad, joypad_info, binds[port], + button_is_pressed(ps3->joypad, joypad_info, binds[port], port, id)) return 1; else if (psl1ght_keyboard_port_input_pressed( diff --git a/input/drivers/psp_input.c b/input/drivers/psp_input.c index 0c2af095aa..d79d13be5c 100644 --- a/input/drivers/psp_input.c +++ b/input/drivers/psp_input.c @@ -283,28 +283,6 @@ static int16_t psp_input_mouse_state( } #endif -static int16_t psp_is_pressed( - const input_device_driver_t *joypad, - rarch_joypad_info_t *joypad_info, - const struct retro_keybind *binds, - unsigned port, unsigned id) -{ - const struct retro_keybind *bind = &binds[id]; - /* Auto-binds are per joypad, not per user. */ - const uint64_t joykey = (binds[id].joykey != NO_BTN) - ? binds[id].joykey : joypad_info->auto_binds[id].joykey; - const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE) - ? binds[id].joyaxis : joypad_info->auto_binds[id].joyaxis; - if ((uint16_t)joykey != NO_BTN - && joypad->button( - joypad_info->joy_idx, (uint16_t)joykey)) - return 1; - if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis)) - / 0x8000) > joypad_info->axis_threshold) - return 1; - return 0; -} - static int16_t psp_input_state(void *data, rarch_joypad_info_t *joypad_info, const struct retro_keybind **binds, @@ -328,7 +306,7 @@ static int16_t psp_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { if ( - psp_is_pressed(psp->joypad, joypad_info, binds[port], + button_is_pressed(psp->joypad, joypad_info, binds[port], port, i)) ret |= (1 << i); } @@ -338,7 +316,7 @@ static int16_t psp_input_state(void *data, else { if ( - psp_is_pressed(psp->joypad, joypad_info, binds[port], + button_is_pressed(psp->joypad, joypad_info, binds[port], port, id)) return 1; } diff --git a/input/drivers/switch_input.c b/input/drivers/switch_input.c index 73f68f6ee0..4e6068c17a 100644 --- a/input/drivers/switch_input.c +++ b/input/drivers/switch_input.c @@ -379,28 +379,6 @@ static int16_t switch_input_mouse_state( } #endif -static int16_t switch_is_pressed( - const input_device_driver_t *joypad, - rarch_joypad_info_t *joypad_info, - const struct retro_keybind *binds, - unsigned port, unsigned id) -{ - const struct retro_keybind *bind = &binds[id]; - /* Auto-binds are per joypad, not per user. */ - const uint64_t joykey = (binds[id].joykey != NO_BTN) - ? binds[id].joykey : joypad_info->auto_binds[id].joykey; - const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE) - ? binds[id].joyaxis : joypad_info->auto_binds[id].joyaxis; - if ((uint16_t)joykey != NO_BTN - && joypad->button( - joypad_info->joy_idx, (uint16_t)joykey)) - return 1; - if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis)) - / 0x8000) > joypad_info->axis_threshold) - return 1; - return 0; -} - static int16_t switch_input_state(void *data, rarch_joypad_info_t *joypad_info, const struct retro_keybind **binds, @@ -422,7 +400,7 @@ static int16_t switch_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { if ( - switch_is_pressed(sw->joypad, joypad_info, binds[port], + button_is_pressed(sw->joypad, joypad_info, binds[port], port, i)) ret |= (1 << i); } @@ -432,7 +410,7 @@ static int16_t switch_input_state(void *data, else { if ( - switch_is_pressed(sw->joypad, joypad_info, binds[port], + button_is_pressed(sw->joypad, joypad_info, binds[port], port, id)) return 1; } diff --git a/input/drivers/xdk_xinput_input.c b/input/drivers/xdk_xinput_input.c index 52b567e055..ec4415d9a7 100644 --- a/input/drivers/xdk_xinput_input.c +++ b/input/drivers/xdk_xinput_input.c @@ -48,28 +48,6 @@ static void xdk_input_poll(void *data) xdk->joypad->poll(); } -static int16_t xdk_is_pressed( - const input_device_driver_t *joypad, - rarch_joypad_info_t *joypad_info, - const struct retro_keybind *binds, - unsigned port, unsigned id) -{ - const struct retro_keybind *bind = &binds[id]; - /* Auto-binds are per joypad, not per user. */ - const uint64_t joykey = (binds[id].joykey != NO_BTN) - ? binds[id].joykey : joypad_info->auto_binds[id].joykey; - const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE) - ? binds[id].joyaxis : joypad_info->auto_binds[id].joyaxis; - if ((uint16_t)joykey != NO_BTN - && joypad->button( - joypad_info->joy_idx, (uint16_t)joykey)) - return 1; - if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis)) - / 0x8000) > joypad_info->axis_threshold) - return 1; - return 0; -} - static int16_t xdk_input_state(void *data, rarch_joypad_info_t *joypad_info, const struct retro_keybind **binds, @@ -92,7 +70,7 @@ static int16_t xdk_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { if ( - xdk_is_pressed(xdk->joypad, joypad_info, binds[port], + button_is_pressed(xdk->joypad, joypad_info, binds[port], port, i)) ret |= (1 << i); } @@ -102,7 +80,7 @@ static int16_t xdk_input_state(void *data, else { if ( - xdk_is_pressed(xdk->joypad, joypad_info, binds[port], + button_is_pressed(xdk->joypad, joypad_info, binds[port], port, id)) return 1; } diff --git a/input/input_driver.h b/input/input_driver.h index 6077514050..8d9cb158db 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -633,6 +633,12 @@ bool menu_input_dialog_start(menu_input_ctx_line_t *line); void menu_input_dialog_end(void); +int16_t button_is_pressed( + const input_device_driver_t *joypad, + rarch_joypad_info_t *joypad_info, + const struct retro_keybind *binds, + unsigned port, unsigned id); + RETRO_END_DECLS #endif diff --git a/retroarch.c b/retroarch.c index ac7ebbedd1..3648c3999d 100644 --- a/retroarch.c +++ b/retroarch.c @@ -24534,6 +24534,26 @@ bool input_joypad_set_rumble(const input_device_driver_t *drv, return drv->set_rumble(joy_idx, effect, strength); } +int16_t button_is_pressed( + const input_device_driver_t *joypad, + rarch_joypad_info_t *joypad_info, + const struct retro_keybind *binds, + unsigned port, unsigned id) +{ + /* Auto-binds are per joypad, not per user. */ + const uint64_t joykey = (binds[id].joykey != NO_BTN) + ? binds[id].joykey : joypad_info->auto_binds[id].joykey; + const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE) + ? binds[id].joyaxis : joypad_info->auto_binds[id].joyaxis; + if ((uint16_t)joykey != NO_BTN && joypad->button( + joypad_info->joy_idx, (uint16_t)joykey)) + return 1; + if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis)) + / 0x8000) > joypad_info->axis_threshold) + return 1; + return 0; +} + /** * input_joypad_analog: * @drv : Input device driver handle.