From f4104f5c9ad02fd4194fde3afa3ef40e4de10870 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 21 Jul 2019 16:22:41 +0200 Subject: [PATCH] Regression in https://github.com/libretro/RetroArch/commit/9c73d3305dbb0a81e14d21e13aac65444fb3bf2d - joykey needs to be uint64_t and then is later cast to uint16_t - is apparently important for hotkeys --- input/drivers/android_input.c | 16 ++++++++-------- input/drivers/cocoa_input.c | 14 +++++++------- input/drivers/ctr_input.c | 10 +++++----- input/drivers/dinput.c | 6 +++--- input/drivers/dos_input.c | 8 ++++---- input/drivers/gx_input.c | 8 ++++---- input/drivers/linuxraw_input.c | 8 ++++---- input/drivers/ps2_input.c | 8 ++++---- input/drivers/ps3_input.c | 8 ++++---- input/drivers/ps4_input.c | 8 ++++---- input/drivers/psp_input.c | 8 ++++---- input/drivers/qnx_input.c | 4 ++-- input/drivers/rwebinput_input.c | 4 ++-- input/drivers/sdl_input.c | 4 ++-- input/drivers/switch_input.c | 8 ++++---- input/drivers/udev_input.c | 4 ++-- input/drivers/uwp_input.c | 4 ++-- input/drivers/wayland_input.c | 8 ++++---- input/drivers/wiiu_input.c | 8 ++++---- input/drivers/winraw_input.c | 6 +++--- input/drivers/x11_input.c | 6 +++--- input/drivers/xdk_xinput_input.c | 8 ++++---- 22 files changed, 83 insertions(+), 83 deletions(-) diff --git a/input/drivers/android_input.c b/input/drivers/android_input.c index bbec349330..1c792e8b94 100644 --- a/input/drivers/android_input.c +++ b/input/drivers/android_input.c @@ -1361,7 +1361,7 @@ static void android_input_poll_memcpy(android_input_t *android) static bool android_input_key_pressed(android_input_t *android, int key) { - uint16_t joykey; + uint64_t joykey; uint32_t joyaxis; rarch_joypad_info_t joypad_info; joypad_info.joy_idx = 0; @@ -1383,7 +1383,7 @@ static bool android_input_key_pressed(android_input_t *android, int key) ? input_config_binds[0][key].joyaxis : joypad_info.auto_binds[key].joyaxis; - if (joykey != NO_BTN && android->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && android->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) return true; else if (((float)abs(android->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) return true; @@ -1480,12 +1480,12 @@ static int16_t android_input_state(void *data, { bool res = false; /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][i].joykey != NO_BTN) + const uint64_t joykey = (binds[port][i].joykey != NO_BTN) ? binds[port][i].joykey : joypad_info.auto_binds[i].joykey; const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE) ? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis; - if (joykey != NO_BTN && android->joypad->button( - joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && android->joypad->button( + joypad_info.joy_idx, (uint16_t)joykey)) res = true; else if (((float)abs(android->joypad->axis( joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) @@ -1500,12 +1500,12 @@ static int16_t android_input_state(void *data, { bool res = false; /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][id].joykey != NO_BTN) + const uint64_t joykey = (binds[port][id].joykey != NO_BTN) ? binds[port][id].joykey : joypad_info.auto_binds[id].joykey; const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE) ? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis; - if (joykey != NO_BTN && android->joypad->button( - joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && android->joypad->button( + joypad_info.joy_idx, (uint16_t)joykey)) res = true; else if (((float)abs(android->joypad->axis( joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) diff --git a/input/drivers/cocoa_input.c b/input/drivers/cocoa_input.c index 407cebeb4b..f2ed788911 100644 --- a/input/drivers/cocoa_input.c +++ b/input/drivers/cocoa_input.c @@ -306,14 +306,14 @@ static int16_t cocoa_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][i].joykey != NO_BTN) + const uint64_t joykey = (binds[port][i].joykey != NO_BTN) ? binds[port][i].joykey : joypad_info.auto_binds[i].joykey; const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE) ? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis; bool res = apple_key_state[rarch_keysym_lut[binds[port][i].key]]; if (!res) { - if (joykey != NO_BTN && apple->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && apple->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) res = true; else if (((float)abs(apple->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) res = true; @@ -321,7 +321,7 @@ static int16_t cocoa_input_state(void *data, #ifdef HAVE_MFI if (!res) { - if (joykey != NO_BTN && apple->sec_joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && apple->sec_joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) res = true; else if (((float)abs(apple->sec_joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) res = true; @@ -334,7 +334,7 @@ static int16_t cocoa_input_state(void *data, else { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][id].joykey != NO_BTN) + const uint64_t joykey = (binds[port][id].joykey != NO_BTN) ? binds[port][id].joykey : joypad_info.auto_binds[id].joykey; const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE) ? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis; @@ -342,8 +342,8 @@ static int16_t cocoa_input_state(void *data, ret = apple_key_state[rarch_keysym_lut[binds[port][id].key]]; if (!ret) { - if (joykey != NO_BTN && apple->joypad->button( - joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && apple->joypad->button( + joypad_info.joy_idx, (uint16_t)joykey)) ret = 1; else if (((float)abs(apple->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) ret = 1; @@ -351,7 +351,7 @@ static int16_t cocoa_input_state(void *data, #ifdef HAVE_MFI if (!ret) { - if (joykey != NO_BTN && apple->sec_joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && apple->sec_joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) ret = 1; else if (((float)abs(apple->sec_joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) ret = 1; diff --git a/input/drivers/ctr_input.c b/input/drivers/ctr_input.c index 950b538dba..30d9255494 100644 --- a/input/drivers/ctr_input.c +++ b/input/drivers/ctr_input.c @@ -65,14 +65,14 @@ static int16_t ctr_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][i].joykey != NO_BTN) + const uint64_t joykey = (binds[port][i].joykey != NO_BTN) ? binds[port][i].joykey : joypad_info.auto_binds[i].joykey; const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE) ? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis; bool res = false; - if (joykey != NO_BTN && - ctr->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && + ctr->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) res = true; else if (((float)abs(ctr->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) res = true; @@ -84,12 +84,12 @@ static int16_t ctr_input_state(void *data, else { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][id].joykey != NO_BTN) + const uint64_t joykey = (binds[port][id].joykey != NO_BTN) ? binds[port][id].joykey : joypad_info.auto_binds[id].joykey; const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE) ? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis; - if (joykey != NO_BTN && ctr->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && ctr->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) ret = 1; else if (((float)abs(ctr->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) ret = 1; diff --git a/input/drivers/dinput.c b/input/drivers/dinput.c index 272b829d61..6878f2dc58 100644 --- a/input/drivers/dinput.c +++ b/input/drivers/dinput.c @@ -329,15 +329,15 @@ static bool dinput_is_pressed(struct dinput_input *di, if (binds && binds[id].valid) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[id].joykey != NO_BTN) + 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 (dinput_mouse_button_pressed(di, port, binds[id].mbutton)) return true; - if (joykey != NO_BTN - && di->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN + && di->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) return true; if (((float)abs(di->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) return true; diff --git a/input/drivers/dos_input.c b/input/drivers/dos_input.c index f346b689a6..b191ab141a 100644 --- a/input/drivers/dos_input.c +++ b/input/drivers/dos_input.c @@ -90,13 +90,13 @@ static int16_t dos_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][i].joykey != NO_BTN) + const uint64_t joykey = (binds[port][i].joykey != NO_BTN) ? binds[port][i].joykey : joypad_info.auto_binds[i].joykey; const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE) ? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis; bool res = false; - if (joykey != NO_BTN && dos->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && dos->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) res = true; else if (((float)abs(dos->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) res = true; @@ -109,12 +109,12 @@ static int16_t dos_input_state(void *data, else { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][id].joykey != NO_BTN) + const uint64_t joykey = (binds[port][id].joykey != NO_BTN) ? binds[port][id].joykey : joypad_info.auto_binds[id].joykey; const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE) ? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis; - if (joykey != NO_BTN && dos->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && dos->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) ret = 1; else if (((float)abs(dos->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) ret = 1; diff --git a/input/drivers/gx_input.c b/input/drivers/gx_input.c index 40d585fc44..e066461815 100644 --- a/input/drivers/gx_input.c +++ b/input/drivers/gx_input.c @@ -59,13 +59,13 @@ static int16_t gx_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][i].joykey != NO_BTN) + const uint64_t joykey = (binds[port][i].joykey != NO_BTN) ? binds[port][i].joykey : joypad_info.auto_binds[i].joykey; const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE) ? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis; bool res = false; - if (joykey != NO_BTN && gx->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && gx->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) res = true; else if (((float)abs(gx->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) res = true; @@ -77,12 +77,12 @@ static int16_t gx_input_state(void *data, else { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][id].joykey != NO_BTN) + const uint64_t joykey = (binds[port][id].joykey != NO_BTN) ? binds[port][id].joykey : joypad_info.auto_binds[id].joykey; const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE) ? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis; - if (joykey != NO_BTN && gx->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && gx->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) ret = 1; else if (((float)abs(gx->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) ret = 1; diff --git a/input/drivers/linuxraw_input.c b/input/drivers/linuxraw_input.c index 37918ba922..ee85545862 100644 --- a/input/drivers/linuxraw_input.c +++ b/input/drivers/linuxraw_input.c @@ -131,12 +131,12 @@ static int16_t linuxraw_input_state(void *data, if (!res) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][i].joykey != NO_BTN) + const uint64_t joykey = (binds[port][i].joykey != NO_BTN) ? binds[port][i].joykey : joypad_info.auto_binds[i].joykey; const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE) ? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis; - if (joykey != NO_BTN && linuxraw->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && linuxraw->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) res = true; else if (((float)abs(linuxraw->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) res = true; @@ -155,11 +155,11 @@ static int16_t linuxraw_input_state(void *data, if (!ret) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][id].joykey != NO_BTN) + const uint64_t joykey = (binds[port][id].joykey != NO_BTN) ? binds[port][id].joykey : joypad_info.auto_binds[id].joykey; const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE) ? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis; - if (joykey != NO_BTN && linuxraw->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && linuxraw->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) ret = 1; else if (((float)abs(linuxraw->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) ret = 1; diff --git a/input/drivers/ps2_input.c b/input/drivers/ps2_input.c index 47df931571..19342f99f4 100644 --- a/input/drivers/ps2_input.c +++ b/input/drivers/ps2_input.c @@ -60,13 +60,13 @@ static int16_t ps2_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][i].joykey != NO_BTN) + const uint64_t joykey = (binds[port][i].joykey != NO_BTN) ? binds[port][i].joykey : joypad_info.auto_binds[i].joykey; const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE) ? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis; bool res = false; - if (joykey != NO_BTN && ps2->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && ps2->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) res = true; else if (((float)abs(ps2->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) res = true; @@ -78,12 +78,12 @@ static int16_t ps2_input_state(void *data, else { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][id].joykey != NO_BTN) + const uint64_t joykey = (binds[port][id].joykey != NO_BTN) ? binds[port][id].joykey : joypad_info.auto_binds[id].joykey; const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE) ? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis; - if (joykey != NO_BTN && ps2->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && ps2->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) ret = 1; else if (((float)abs(ps2->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) ret = 1; diff --git a/input/drivers/ps3_input.c b/input/drivers/ps3_input.c index 7fbe1bf183..aae1810c23 100644 --- a/input/drivers/ps3_input.c +++ b/input/drivers/ps3_input.c @@ -118,13 +118,13 @@ static int16_t ps3_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][i].joykey != NO_BTN) + const uint64_t joykey = (binds[port][i].joykey != NO_BTN) ? binds[port][i].joykey : joypad_info.auto_binds[i].joykey; const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE) ? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis; bool res = false; - if (joykey != NO_BTN && ps3->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && ps3->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) res = true; else if (((float)abs(ps3->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) res = true; @@ -136,12 +136,12 @@ static int16_t ps3_input_state(void *data, else { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][id].joykey != NO_BTN) + const uint64_t joykey = (binds[port][id].joykey != NO_BTN) ? binds[port][id].joykey : joypad_info.auto_binds[id].joykey; const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE) ? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis; - if (joykey != NO_BTN && ps3->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && ps3->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) ret = 1; else if (((float)abs(ps3->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) ret = 1; diff --git a/input/drivers/ps4_input.c b/input/drivers/ps4_input.c index d4e79f1b70..e3587f7cbe 100644 --- a/input/drivers/ps4_input.c +++ b/input/drivers/ps4_input.c @@ -64,13 +64,13 @@ static int16_t ps4_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][i].joykey != NO_BTN) + const uint64_t joykey = (binds[port][i].joykey != NO_BTN) ? binds[port][i].joykey : joypad_info.auto_binds[i].joykey; const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE) ? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis; bool res = false; - if (joykey != NO_BTN && ps4->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && ps4->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) res = true; else if (((float)abs(ps4->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) res = true; @@ -82,12 +82,12 @@ static int16_t ps4_input_state(void *data, else { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][id].joykey != NO_BTN) + const uint64_t joykey = (binds[port][id].joykey != NO_BTN) ? binds[port][id].joykey : joypad_info.auto_binds[id].joykey; const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE) ? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis; - if (joykey != NO_BTN && ps4->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && ps4->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) ret = 1; else if (((float)abs(ps4->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) ret = 1; diff --git a/input/drivers/psp_input.c b/input/drivers/psp_input.c index 91ca51903f..3f4c27c99a 100644 --- a/input/drivers/psp_input.c +++ b/input/drivers/psp_input.c @@ -319,13 +319,13 @@ static int16_t psp_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][i].joykey != NO_BTN) + const uint64_t joykey = (binds[port][i].joykey != NO_BTN) ? binds[port][i].joykey : joypad_info.auto_binds[i].joykey; const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE) ? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis; bool res = false; - if (joykey != NO_BTN && psp->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && psp->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) res = true; else if (((float)abs(psp->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) res = true; @@ -337,12 +337,12 @@ static int16_t psp_input_state(void *data, else { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][id].joykey != NO_BTN) + const uint64_t joykey = (binds[port][id].joykey != NO_BTN) ? binds[port][id].joykey : joypad_info.auto_binds[id].joykey; const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE) ? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis; - if (joykey != NO_BTN && psp->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && psp->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) ret = 1; else if (((float)abs(psp->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) ret = 1; diff --git a/input/drivers/qnx_input.c b/input/drivers/qnx_input.c index 78681f82ff..dd849e79e7 100644 --- a/input/drivers/qnx_input.c +++ b/input/drivers/qnx_input.c @@ -746,12 +746,12 @@ static bool qnx_is_pressed(qnx_input_t *qnx, if (binds && binds[id].valid) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[id].joykey != NO_BTN) + 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 (joykey != NO_BTN && qnx->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && qnx->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) return true; if (((float)abs(qnx->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) return true; diff --git a/input/drivers/rwebinput_input.c b/input/drivers/rwebinput_input.c index 18d698c67c..86037abdea 100644 --- a/input/drivers/rwebinput_input.c +++ b/input/drivers/rwebinput_input.c @@ -487,7 +487,7 @@ static bool rwebinput_is_pressed(rwebinput_input_t *rwebinput, if (bind->valid) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[id].joykey != NO_BTN) + 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; @@ -495,7 +495,7 @@ static bool rwebinput_is_pressed(rwebinput_input_t *rwebinput, if (port == 0 && !!rwebinput_mouse_state(&rwebinput->mouse, bind->mbutton, false)) return true; - if (joykey != NO_BTN && rwebinput->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && rwebinput->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) return true; if (((float)abs(rwebinput->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) return true; diff --git a/input/drivers/sdl_input.c b/input/drivers/sdl_input.c index e581e5e5e3..547ba89551 100644 --- a/input/drivers/sdl_input.c +++ b/input/drivers/sdl_input.c @@ -98,7 +98,7 @@ static int16_t sdl_joypad_device_state(sdl_input_t *sdl, unsigned port, unsigned id, enum input_device_type *device) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[id].joykey != NO_BTN) + 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; @@ -109,7 +109,7 @@ static int16_t sdl_joypad_device_state(sdl_input_t *sdl, return 1; } - if (joykey != NO_BTN && sdl->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && sdl->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) { *device = INPUT_DEVICE_TYPE_JOYPAD; return 1; diff --git a/input/drivers/switch_input.c b/input/drivers/switch_input.c index 8a29ed3d75..b0c021b980 100644 --- a/input/drivers/switch_input.c +++ b/input/drivers/switch_input.c @@ -388,12 +388,12 @@ static int16_t switch_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][i].joykey != NO_BTN) + const uint64_t joykey = (binds[port][i].joykey != NO_BTN) ? binds[port][i].joykey : joypad_info.auto_binds[i].joykey; const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE) ? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis; - if (joykey != NO_BTN && sw->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && sw->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) ret |= (1 << i); else if (((float)abs(sw->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) ret |= (1 << 1); @@ -402,11 +402,11 @@ static int16_t switch_input_state(void *data, else { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][id].joykey != NO_BTN) + const uint64_t joykey = (binds[port][id].joykey != NO_BTN) ? binds[port][id].joykey : joypad_info.auto_binds[id].joykey; const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE) ? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis; - if (joykey != NO_BTN && sw->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && sw->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) ret = 1; else if (((float)abs(sw->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) ret = 1; diff --git a/input/drivers/udev_input.c b/input/drivers/udev_input.c index e79992f3e3..0b53e84840 100644 --- a/input/drivers/udev_input.c +++ b/input/drivers/udev_input.c @@ -945,14 +945,14 @@ static bool udev_is_pressed(udev_input_t *udev, if (binds && binds[id].valid) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[id].joykey != NO_BTN) + 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 (udev_mouse_button_pressed(udev, port, bind->mbutton)) return true; - if (joykey != NO_BTN && udev->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && udev->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) return true; if (((float)abs(udev->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) return true; diff --git a/input/drivers/uwp_input.c b/input/drivers/uwp_input.c index 25e0367c83..fd59833211 100644 --- a/input/drivers/uwp_input.c +++ b/input/drivers/uwp_input.c @@ -139,14 +139,14 @@ static bool uwp_pressed_joypad(uwp_input_t *uwp, if (binds && binds[id].valid) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[id].joykey != NO_BTN) + 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 (uwp_mouse_state(port, bind->mbutton, false)) return true; - if (joykey != NO_BTN && uwp->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && uwp->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) return true; if (((float)abs(uwp->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) return true; diff --git a/input/drivers/wayland_input.c b/input/drivers/wayland_input.c index c568b502a4..c946cb4ebf 100644 --- a/input/drivers/wayland_input.c +++ b/input/drivers/wayland_input.c @@ -301,11 +301,11 @@ static int16_t input_wl_state(void *data, if (!res && binds[port]) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][i].joykey != NO_BTN) + const uint64_t joykey = (binds[port][i].joykey != NO_BTN) ? binds[port][i].joykey : joypad_info.auto_binds[i].joykey; const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE) ? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis; - if (joykey != NO_BTN && wl->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && wl->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) res = true; else if (((float)abs(wl->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) res = true; @@ -321,11 +321,11 @@ static int16_t input_wl_state(void *data, if (!ret && binds[port]) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][id].joykey != NO_BTN) + const uint64_t joykey = (binds[port][id].joykey != NO_BTN) ? binds[port][id].joykey : joypad_info.auto_binds[id].joykey; const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE) ? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis; - if (joykey != NO_BTN && wl->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && wl->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) ret = 1; else if (((float)abs(wl->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) ret = 1; diff --git a/input/drivers/wiiu_input.c b/input/drivers/wiiu_input.c index 385561ad53..ad42d795b9 100644 --- a/input/drivers/wiiu_input.c +++ b/input/drivers/wiiu_input.c @@ -144,13 +144,13 @@ static int16_t wiiu_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][i].joykey != NO_BTN) + const uint64_t joykey = (binds[port][i].joykey != NO_BTN) ? binds[port][i].joykey : joypad_info.auto_binds[i].joykey; const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE) ? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis; bool res = false; - if (joykey != NO_BTN && wiiu->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && wiiu->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) res = true; else if (((float)abs(wiiu->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) res = true; @@ -162,12 +162,12 @@ static int16_t wiiu_input_state(void *data, else { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][id].joykey != NO_BTN) + const uint64_t joykey = (binds[port][id].joykey != NO_BTN) ? binds[port][id].joykey : joypad_info.auto_binds[id].joykey; const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE) ? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis; - if (joykey != NO_BTN && wiiu->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && wiiu->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) ret = 1; else if (((float)abs(wiiu->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) ret = 1; diff --git a/input/drivers/winraw_input.c b/input/drivers/winraw_input.c index 65d0e632b6..30b306e5a2 100644 --- a/input/drivers/winraw_input.c +++ b/input/drivers/winraw_input.c @@ -407,14 +407,14 @@ static bool winraw_is_pressed(winraw_input_t *wr, if (binds && binds[id].valid) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[id].joykey != NO_BTN) + 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 (winraw_mouse_button_pressed(wr, port, bind->mbutton)) return true; - if (joykey != NO_BTN && - wr->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && + wr->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) return true; if (((float)abs(wr->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) return true; diff --git a/input/drivers/x11_input.c b/input/drivers/x11_input.c index 33ed6fbf36..7ddd3c4a14 100644 --- a/input/drivers/x11_input.c +++ b/input/drivers/x11_input.c @@ -139,15 +139,15 @@ static bool x_is_pressed(x11_input_t *x11, if (binds && binds[id].valid) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[id].joykey != NO_BTN) + 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 (x_mouse_button_pressed(x11, port, bind->mbutton)) return true; - if (joykey != NO_BTN - && x11->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN + && x11->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) return true; if (((float)abs(x11->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) return true; diff --git a/input/drivers/xdk_xinput_input.c b/input/drivers/xdk_xinput_input.c index f203f1683a..6ed506c7b8 100644 --- a/input/drivers/xdk_xinput_input.c +++ b/input/drivers/xdk_xinput_input.c @@ -70,13 +70,13 @@ static int16_t xdk_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][i].joykey != NO_BTN) + const uint64_t joykey = (binds[port][i].joykey != NO_BTN) ? binds[port][i].joykey : joypad_info.auto_binds[i].joykey; const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE) ? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis; bool res = false; - if (joykey != NO_BTN && xdk->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && xdk->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) res = true; else if (((float)abs(xdk->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) res = true; @@ -88,12 +88,12 @@ static int16_t xdk_input_state(void *data, else { /* Auto-binds are per joypad, not per user. */ - const uint16_t joykey = (binds[port][id].joykey != NO_BTN) + const uint64_t joykey = (binds[port][id].joykey != NO_BTN) ? binds[port][id].joykey : joypad_info.auto_binds[id].joykey; const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE) ? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis; - if (joykey != NO_BTN && xdk->joypad->button(joypad_info.joy_idx, joykey)) + if ((uint16_t)joykey != NO_BTN && xdk->joypad->button(joypad_info.joy_idx, (uint16_t)joykey)) ret = 1; else if (((float)abs(xdk->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold) ret = 1;