RETROK_UNKNOWN fixes and cleanups (#16250)

This commit is contained in:
sonninnos 2024-02-18 18:23:05 +02:00 committed by GitHub
parent de8e33c6b1
commit 6e6a4d8b6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 200 additions and 242 deletions

View File

@ -1510,6 +1510,9 @@ static void android_input_poll_input_gingerbread(
{ {
int keycode = AKeyEvent_getKeyCode(event); int keycode = AKeyEvent_getKeyCode(event);
if (!keycode)
break;
if (android_is_keyboard_id(id)) if (android_is_keyboard_id(id))
{ {
android_input_poll_event_type_keyboard( android_input_poll_event_type_keyboard(
@ -1572,6 +1575,9 @@ static void android_input_poll_input_default(android_input_t *android)
{ {
int keycode = AKeyEvent_getKeyCode(event); int keycode = AKeyEvent_getKeyCode(event);
if (!keycode)
break;
if (android_is_keyboard_id(id)) if (android_is_keyboard_id(id))
{ {
if (!predispatched) if (!predispatched)
@ -1736,27 +1742,37 @@ static int16_t android_input_state(
{ {
unsigned i; unsigned i;
int16_t ret = 0; int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
if (!keyboard_mapping_blocked)
{ {
if (binds[port][i].valid) for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{ {
if (ANDROID_KEYBOARD_PORT_INPUT_PRESSED(binds[port], i)) if (binds[port][i].valid)
ret |= (1 << i); {
if ( (binds[port][i].key && binds[port][i].key < RETROK_LAST)
&& ANDROID_KEYBOARD_PORT_INPUT_PRESSED(binds[port], i))
ret |= (1 << i);
}
} }
} }
return ret; return ret;
} }
if (binds[port][id].valid) if (id < RARCH_BIND_LIST_END)
if (ANDROID_KEYBOARD_PORT_INPUT_PRESSED(binds[port], id)) {
return 1; if (binds[port][id].valid)
{
if ( (binds[port][id].key && binds[port][id].key < RETROK_LAST)
&& ANDROID_KEYBOARD_PORT_INPUT_PRESSED(binds[port], id))
return 1;
}
}
break; break;
case RETRO_DEVICE_ANALOG: case RETRO_DEVICE_ANALOG:
break; break;
case RETRO_DEVICE_KEYBOARD: case RETRO_DEVICE_KEYBOARD:
return (id < RETROK_LAST) return (id && id < RETROK_LAST) && BIT_GET(android_key_state[ANDROID_KEYBOARD_PORT], rarch_keysym_lut[id]);
&& BIT_GET(android_key_state[ANDROID_KEYBOARD_PORT],
rarch_keysym_lut[id]);
case RETRO_DEVICE_MOUSE: case RETRO_DEVICE_MOUSE:
{ {
int val = 0; int val = 0;

View File

@ -82,6 +82,10 @@ void apple_direct_input_keyboard_event(bool down,
unsigned code, uint32_t character, uint32_t mod, unsigned device) unsigned code, uint32_t character, uint32_t mod, unsigned device)
{ {
int apple_key = rarch_keysym_lut[code]; int apple_key = rarch_keysym_lut[code];
if (!apple_key)
return;
apple_key_state[apple_key] = down; apple_key_state[apple_key] = down;
input_keyboard_event(down, input_keyboard_event(down,
code, code,
@ -435,7 +439,7 @@ static int16_t cocoa_input_state(
{ {
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{ {
if ((binds[port][i].key < RETROK_LAST) if ( (binds[port][i].key && binds[port][i].key < RETROK_LAST)
&& apple_key_state[rarch_keysym_lut[binds[port][i].key]]) && apple_key_state[rarch_keysym_lut[binds[port][i].key]])
ret |= (1 << i); ret |= (1 << i);
} }
@ -446,10 +450,13 @@ static int16_t cocoa_input_state(
if (binds[port][id].valid) if (binds[port][id].valid)
{ {
if (id < RARCH_BIND_LIST_END) if (id < RARCH_BIND_LIST_END)
if (!keyboard_mapping_blocked || (id == RARCH_GAME_FOCUS_TOGGLE)) {
if (apple_key_state[rarch_keysym_lut[binds[port][id].key]]) if ( (binds[port][id].key && binds[port][id].key < RETROK_LAST)
return 1; && apple_key_state[rarch_keysym_lut[binds[port][id].key]]
&& (id == RARCH_GAME_FOCUS_TOGGLE || !keyboard_mapping_blocked)
)
return 1;
}
} }
break; break;
case RETRO_DEVICE_ANALOG: case RETRO_DEVICE_ANALOG:
@ -469,12 +476,12 @@ static int16_t cocoa_input_state(
id_minus_key = binds[port][id_minus].key; id_minus_key = binds[port][id_minus].key;
id_plus_key = binds[port][id_plus].key; id_plus_key = binds[port][id_plus].key;
if (id_plus_valid && id_plus_key < RETROK_LAST) if (id_plus_valid && id_plus_key && id_plus_key < RETROK_LAST)
{ {
if (apple_key_state[rarch_keysym_lut[(enum retro_key)id_plus_key]]) if (apple_key_state[rarch_keysym_lut[(enum retro_key)id_plus_key]])
ret = 0x7fff; ret = 0x7fff;
} }
if (id_minus_valid && id_minus_key < RETROK_LAST) if (id_minus_valid && id_minus_key && id_minus_key < RETROK_LAST)
{ {
if (apple_key_state[rarch_keysym_lut[(enum retro_key)id_minus_key]]) if (apple_key_state[rarch_keysym_lut[(enum retro_key)id_minus_key]])
ret += -0x7fff; ret += -0x7fff;
@ -484,7 +491,7 @@ static int16_t cocoa_input_state(
break; break;
case RETRO_DEVICE_KEYBOARD: case RETRO_DEVICE_KEYBOARD:
return (id < RETROK_LAST) && apple_key_state[rarch_keysym_lut[(enum retro_key)id]]; return (id && id < RETROK_LAST) && apple_key_state[rarch_keysym_lut[(enum retro_key)id]];
case RETRO_DEVICE_MOUSE: case RETRO_DEVICE_MOUSE:
case RARCH_DEVICE_MOUSE_SCREEN: case RARCH_DEVICE_MOUSE_SCREEN:
{ {

View File

@ -583,9 +583,7 @@ static int16_t dinput_input_state(
{ {
if (binds[port][i].valid) if (binds[port][i].valid)
{ {
if (dinput_mouse_button_pressed( if (dinput_mouse_button_pressed(di, port, binds[port][i].mbutton))
di, port, binds[port][i].mbutton)
)
ret |= (1 << i); ret |= (1 << i);
} }
} }
@ -597,13 +595,13 @@ static int16_t dinput_input_state(
{ {
if (binds[port][i].valid) if (binds[port][i].valid)
{ {
if ((binds[port][i].key < RETROK_LAST) && if ( (binds[port][i].key && binds[port][i].key < RETROK_LAST)
di->state[rarch_keysym_lut && di->state[rarch_keysym_lut[(enum retro_key)binds[port][i].key]] & 0x80)
[(enum retro_key)binds[port][i].key]] & 0x80)
ret |= (1 << i); ret |= (1 << i);
} }
} }
} }
return ret; return ret;
} }
@ -611,26 +609,22 @@ static int16_t dinput_input_state(
{ {
if (binds[port][id].valid) if (binds[port][id].valid)
{ {
if (binds[port][id].key < RETROK_LAST if ( binds[port][id].key && binds[port][id].key < RETROK_LAST
&& (di->state[rarch_keysym_lut && (di->state[rarch_keysym_lut[(enum retro_key)binds[port][id].key]] & 0x80)
[(enum retro_key)binds[port][id].key]] & 0x80) && (id == RARCH_GAME_FOCUS_TOGGLE || !keyboard_mapping_blocked)
&& ( (id == RARCH_GAME_FOCUS_TOGGLE) )
|| !keyboard_mapping_blocked)
)
return 1;
else if (
settings->uints.input_mouse_index[port] == 0
&& dinput_mouse_button_pressed(
di, port, binds[port][id].mbutton)
)
return 1; return 1;
else if (settings->uints.input_mouse_index[port] == 0)
{
if (dinput_mouse_button_pressed(di, port, binds[port][id].mbutton))
return 1;
}
} }
} }
} }
break; break;
case RETRO_DEVICE_KEYBOARD: case RETRO_DEVICE_KEYBOARD:
return (id < RETROK_LAST) && return (id && id < RETROK_LAST) && di->state[rarch_keysym_lut[(enum retro_key)id]] & 0x80;
di->state[rarch_keysym_lut[(enum retro_key)id]] & 0x80;
case RETRO_DEVICE_ANALOG: case RETRO_DEVICE_ANALOG:
{ {
int16_t ret = 0; int16_t ret = 0;
@ -648,13 +642,13 @@ static int16_t dinput_input_state(
id_minus_key = binds[port][id_minus].key; id_minus_key = binds[port][id_minus].key;
id_plus_key = binds[port][id_plus].key; id_plus_key = binds[port][id_plus].key;
if (id_plus_valid && id_plus_key < RETROK_LAST) if (id_plus_valid && id_plus_key && id_plus_key < RETROK_LAST)
{ {
unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key]; unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key];
if (di->state[sym] & 0x80) if (di->state[sym] & 0x80)
ret = 0x7fff; ret = 0x7fff;
} }
if (id_minus_valid && id_minus_key < RETROK_LAST) if (id_minus_valid && id_minus_key && id_minus_key < RETROK_LAST)
{ {
unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key]; unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key];
if (di->state[sym] & 0x80) if (di->state[sym] & 0x80)
@ -832,6 +826,7 @@ static int16_t dinput_input_state(
? bind_joykey : autobind_joykey; ? bind_joykey : autobind_joykey;
const uint32_t joyaxis = (bind_joyaxis != AXIS_NONE) const uint32_t joyaxis = (bind_joyaxis != AXIS_NONE)
? bind_joyaxis : autobind_joyaxis; ? bind_joyaxis : autobind_joyaxis;
if (binds[port][new_id].valid) if (binds[port][new_id].valid)
{ {
if ((uint16_t)joykey != NO_BTN && joypad->button( if ((uint16_t)joykey != NO_BTN && joypad->button(
@ -841,22 +836,18 @@ static int16_t dinput_input_state(
((float)abs(joypad->axis(joyport, joyaxis)) ((float)abs(joypad->axis(joyport, joyaxis))
/ 0x8000) > axis_threshold) / 0x8000) > axis_threshold)
return 1; return 1;
else if ( else if ((binds[port][new_id].key && binds[port][new_id].key < RETROK_LAST)
binds[port][new_id].key < RETROK_LAST
&& !keyboard_mapping_blocked && !keyboard_mapping_blocked
&& di->state[rarch_keysym_lut && di->state[rarch_keysym_lut[(enum retro_key)binds[port][new_id].key]] & 0x80)
[(enum retro_key)binds[port][new_id].key]] & 0x80
)
return 1; return 1;
else else
{ {
settings = config_get_ptr(); settings = config_get_ptr();
if ( if (settings->uints.input_mouse_index[port] == 0)
settings->uints.input_mouse_index[port] == 0 {
&& dinput_mouse_button_pressed( if (dinput_mouse_button_pressed(di, port, binds[port][new_id].mbutton))
di, port, binds[port][new_id].mbutton) return 1;
) }
return 1;
} }
} }
} }

View File

@ -32,9 +32,6 @@
#include "../input_keymaps.h" #include "../input_keymaps.h"
#include "../input_driver.h" #include "../input_driver.h"
/* TODO/FIXME -
* fix game focus toggle */
typedef struct linuxraw_input typedef struct linuxraw_input
{ {
bool state[0x80]; bool state[0x80];
@ -93,15 +90,16 @@ static int16_t linuxraw_input_state(
unsigned i; unsigned i;
int16_t ret = 0; int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) if (!keyboard_mapping_blocked)
{ {
if (binds[port][i].valid) for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{ {
if ( if (binds[port][i].valid)
linuxraw->state[rarch_keysym_lut[ {
(enum retro_key)binds[port][i].key]] if ( (binds[port][i].key && binds[port][i].key < RETROK_LAST)
) && linuxraw->state[rarch_keysym_lut[(enum retro_key)binds[port][i].key]])
ret |= (1 << i); ret |= (1 << i);
}
} }
} }
@ -112,9 +110,10 @@ static int16_t linuxraw_input_state(
{ {
if (binds[port][id].valid) if (binds[port][id].valid)
{ {
if ((linuxraw->state[rarch_keysym_lut if ( (binds[port][id].key && binds[port][id].key < RETROK_LAST)
[(enum retro_key)binds[port][id].key]] && linuxraw->state[rarch_keysym_lut[(enum retro_key)binds[port][id].key]]
)) && (id == RARCH_GAME_FOCUS_TOGGLE || !keyboard_mapping_blocked)
)
return 1; return 1;
} }
} }
@ -137,13 +136,13 @@ static int16_t linuxraw_input_state(
id_minus_key = binds[port][id_minus].key; id_minus_key = binds[port][id_minus].key;
id_plus_key = binds[port][id_plus].key; id_plus_key = binds[port][id_plus].key;
if (id_plus_valid && id_plus_key < RETROK_LAST) if (id_plus_valid && id_plus_key && id_plus_key < RETROK_LAST)
{ {
unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key]; unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key];
if (linuxraw->state[sym] & 0x80) if (linuxraw->state[sym] & 0x80)
ret = 0x7fff; ret = 0x7fff;
} }
if (id_minus_valid && id_minus_key < RETROK_LAST) if (id_minus_valid && id_minus_key && id_minus_key < RETROK_LAST)
{ {
unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key]; unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key];
if (linuxraw->state[sym] & 0x80) if (linuxraw->state[sym] & 0x80)

View File

@ -405,11 +405,12 @@ static int16_t rwebinput_is_pressed(
const struct retro_keybind *bind = &binds[id]; const struct retro_keybind *bind = &binds[id];
int key = bind->key; int key = bind->key;
if ((key < RETROK_LAST) && rwebinput_key_pressed(rwebinput, key)) if ( (key && key < RETROK_LAST)
if ((id == RARCH_GAME_FOCUS_TOGGLE) || !keyboard_mapping_blocked) && rwebinput_key_pressed(rwebinput, key)
return 1; && (id == RARCH_GAME_FOCUS_TOGGLE || !keyboard_mapping_blocked)
if (port == 0 && !!rwebinput_mouse_state(&rwebinput->mouse, )
bind->mbutton, false)) return 1;
if (port == 0 && !!rwebinput_mouse_state(&rwebinput->mouse, bind->mbutton, false))
return 1; return 1;
return 0; return 0;
} }
@ -479,14 +480,14 @@ static int16_t rwebinput_input_state(
id_minus_key = binds[port][id_minus].key; id_minus_key = binds[port][id_minus].key;
id_plus_key = binds[port][id_plus].key; id_plus_key = binds[port][id_plus].key;
if (id_plus_valid && id_plus_key < RETROK_LAST) if (id_plus_valid && id_plus_key && id_plus_key < RETROK_LAST)
{ {
if (rwebinput_is_pressed(rwebinput, if (rwebinput_is_pressed(rwebinput,
binds[port], idx, id_plus, binds[port], idx, id_plus,
keyboard_mapping_blocked)) keyboard_mapping_blocked))
ret = 0x7fff; ret = 0x7fff;
} }
if (id_minus_valid && id_minus_key < RETROK_LAST) if (id_minus_valid && id_minus_key && id_minus_key < RETROK_LAST)
{ {
if (rwebinput_is_pressed(rwebinput, if (rwebinput_is_pressed(rwebinput,
binds[port], idx, id_minus, binds[port], idx, id_minus,
@ -498,11 +499,10 @@ static int16_t rwebinput_input_state(
} }
break; break;
case RETRO_DEVICE_KEYBOARD: case RETRO_DEVICE_KEYBOARD:
return ((id < RETROK_LAST) && rwebinput->keys[id]); return (id && id < RETROK_LAST) && rwebinput->keys[id];
case RETRO_DEVICE_MOUSE: case RETRO_DEVICE_MOUSE:
case RARCH_DEVICE_MOUSE_SCREEN: case RARCH_DEVICE_MOUSE_SCREEN:
return rwebinput_mouse_state(&rwebinput->mouse, id, return rwebinput_mouse_state(&rwebinput->mouse, id, device == RARCH_DEVICE_MOUSE_SCREEN);
device == RARCH_DEVICE_MOUSE_SCREEN);
case RETRO_DEVICE_POINTER: case RETRO_DEVICE_POINTER:
case RARCH_DEVICE_POINTER_SCREEN: case RARCH_DEVICE_POINTER_SCREEN:
if (idx == 0) if (idx == 0)

View File

@ -39,9 +39,6 @@
#include <dlfcn.h> #include <dlfcn.h>
#endif #endif
/* TODO/FIXME -
* fix game focus toggle */
typedef struct sdl_input typedef struct sdl_input
{ {
int mouse_x; int mouse_x;
@ -91,6 +88,9 @@ static bool sdl_key_pressed(int key)
unsigned sym = rarch_keysym_lut[(enum retro_key)key]; unsigned sym = rarch_keysym_lut[(enum retro_key)key];
#endif #endif
if (!key)
return false;
#ifdef WEBOS #ifdef WEBOS
if ( (key == RETROK_BACKSPACE ) if ( (key == RETROK_BACKSPACE )
&& sdl_webos_special_keymap[sdl_webos_spkey_back]) && sdl_webos_special_keymap[sdl_webos_spkey_back])
@ -139,11 +139,17 @@ static int16_t sdl_input_state(
{ {
unsigned i; unsigned i;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) if (!keyboard_mapping_blocked)
{ {
if (binds[port][i].valid) for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
if (sdl_key_pressed(binds[port][i].key)) {
ret |= (1 << i); if (binds[port][i].valid)
{
if ( (binds[port][i].key && binds[port][i].key < RETROK_LAST)
&& sdl_key_pressed(binds[port][i].key))
ret |= (1 << i);
}
}
} }
return ret; return ret;
@ -152,8 +158,13 @@ static int16_t sdl_input_state(
if (id < RARCH_BIND_LIST_END) if (id < RARCH_BIND_LIST_END)
{ {
if (binds[port][id].valid) if (binds[port][id].valid)
if (sdl_key_pressed(binds[port][id].key)) {
if ( (binds[port][id].key && binds[port][id].key < RETROK_LAST)
&& sdl_key_pressed(binds[port][id].key)
&& (id == RARCH_GAME_FOCUS_TOGGLE || !keyboard_mapping_blocked)
)
return 1; return 1;
}
} }
break; break;
case RETRO_DEVICE_ANALOG: case RETRO_DEVICE_ANALOG:
@ -172,18 +183,18 @@ static int16_t sdl_input_state(
id_minus_key = binds[port][id_minus].key; id_minus_key = binds[port][id_minus].key;
id_plus_key = binds[port][id_plus].key; id_plus_key = binds[port][id_plus].key;
if (id_plus_valid && id_plus_key < RETROK_LAST) if (id_plus_valid && id_plus_key && id_plus_key < RETROK_LAST)
{ {
if (sdl_key_pressed(id_plus_key)) if (sdl_key_pressed(id_plus_key))
ret = 0x7fff; ret = 0x7fff;
} }
if (id_minus_valid && id_minus_key < RETROK_LAST) if (id_minus_valid && id_minus_key && id_minus_key < RETROK_LAST)
{ {
if (sdl_key_pressed(id_minus_key)) if (sdl_key_pressed(id_minus_key))
ret += -0x7fff; ret += -0x7fff;
} }
} }
return ret; return ret;
case RETRO_DEVICE_MOUSE: case RETRO_DEVICE_MOUSE:
case RARCH_DEVICE_MOUSE_SCREEN: case RARCH_DEVICE_MOUSE_SCREEN:
if (config_get_ptr()->uints.input_mouse_index[ port ] == 0) if (config_get_ptr()->uints.input_mouse_index[ port ] == 0)
@ -284,7 +295,7 @@ static int16_t sdl_input_state(
} }
break; break;
case RETRO_DEVICE_KEYBOARD: case RETRO_DEVICE_KEYBOARD:
return (id < RETROK_LAST) && sdl_key_pressed(id); return (id && id < RETROK_LAST) && sdl_key_pressed(id);
case RETRO_DEVICE_LIGHTGUN: case RETRO_DEVICE_LIGHTGUN:
switch (id) switch (id)
{ {

View File

@ -222,12 +222,12 @@ static void switch_input_poll(void *data)
key_sym = rarch_key_map_switch[i].sym; key_sym = rarch_key_map_switch[i].sym;
key_code = input_keymaps_translate_keysym_to_rk(key_sym); key_code = input_keymaps_translate_keysym_to_rk(key_sym);
key_pressed = hidKeyboardStateGetKey(&kbd_state, key_sym); key_pressed = hidKeyboardStateGetKey(&kbd_state, key_sym);
if (key_pressed && !(sw->keyboard_state[key_sym])) if (key_sym && key_pressed && !(sw->keyboard_state[key_sym]))
{ {
sw->keyboard_state[key_sym] = true; sw->keyboard_state[key_sym] = true;
input_keyboard_event(true, key_code, 0, mod, RETRO_DEVICE_KEYBOARD); input_keyboard_event(true, key_code, 0, mod, RETRO_DEVICE_KEYBOARD);
} }
else if (!key_pressed && sw->keyboard_state[key_sym]) else if (key_sym && !key_pressed && sw->keyboard_state[key_sym])
{ {
sw->keyboard_state[key_sym] = false; sw->keyboard_state[key_sym] = false;
input_keyboard_event(false, key_code, 0, mod, RETRO_DEVICE_KEYBOARD); input_keyboard_event(false, key_code, 0, mod, RETRO_DEVICE_KEYBOARD);
@ -317,8 +317,7 @@ static int16_t switch_input_state(
break; break;
#ifdef HAVE_LIBNX #ifdef HAVE_LIBNX
case RETRO_DEVICE_KEYBOARD: case RETRO_DEVICE_KEYBOARD:
return ((id < RETROK_LAST) && return (id && id < RETROK_LAST) && sw->keyboard_state[rarch_keysym_lut[(enum retro_key)id]];
sw->keyboard_state[rarch_keysym_lut[(enum retro_key)id]]);
case RETRO_DEVICE_MOUSE: case RETRO_DEVICE_MOUSE:
case RARCH_DEVICE_MOUSE_SCREEN: case RARCH_DEVICE_MOUSE_SCREEN:
{ {

View File

@ -3692,7 +3692,7 @@ static int16_t udev_mouse_state(udev_input_t *udev,
static bool udev_keyboard_pressed(udev_input_t *udev, unsigned key) static bool udev_keyboard_pressed(udev_input_t *udev, unsigned key)
{ {
int bit = rarch_keysym_lut[key]; int bit = rarch_keysym_lut[key];
return BIT_GET(udev->state, bit); return (key) ? BIT_GET(udev->state, bit) : false;
} }
static bool udev_mouse_button_pressed( static bool udev_mouse_button_pressed(
@ -3820,14 +3820,15 @@ static int16_t udev_input_state(
ret |= (1 << i); ret |= (1 << i);
} }
} }
if (!keyboard_mapping_blocked) if (!keyboard_mapping_blocked)
{ {
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{ {
if (binds[port][i].valid) if (binds[port][i].valid)
{ {
if ((binds[port][i].key < RETROK_LAST) && if ( (binds[port][i].key && binds[port][i].key < RETROK_LAST)
udev_keyboard_pressed(udev, binds[port][i].key)) && udev_keyboard_pressed(udev, binds[port][i].key))
ret |= (1 << i); ret |= (1 << i);
} }
} }
@ -3840,21 +3841,12 @@ static int16_t udev_input_state(
{ {
if (binds[port][id].valid) if (binds[port][id].valid)
{ {
if ( if ( (binds[port][id].key && binds[port][id].key < RETROK_LAST)
(binds[port][id].key < RETROK_LAST) && && udev_keyboard_pressed(udev, binds[port][id].key)
udev_keyboard_pressed(udev, binds[port][id].key) && (id == RARCH_GAME_FOCUS_TOGGLE || !keyboard_mapping_blocked)
&& (( id != RARCH_GAME_FOCUS_TOGGLE) )
&& !keyboard_mapping_blocked)
)
return 1; return 1;
else if ( else if (udev_mouse_button_pressed(udev, port, binds[port][id].mbutton))
(binds[port][id].key < RETROK_LAST) &&
udev_keyboard_pressed(udev, binds[port][id].key)
&& ( id == RARCH_GAME_FOCUS_TOGGLE)
)
return 1;
else if (udev_mouse_button_pressed(udev, port,
binds[port][id].mbutton))
return 1; return 1;
} }
} }
@ -3877,13 +3869,13 @@ static int16_t udev_input_state(
id_minus_key = binds[port][id_minus].key; id_minus_key = binds[port][id_minus].key;
id_plus_key = binds[port][id_plus].key; id_plus_key = binds[port][id_plus].key;
if (id_plus_valid && id_plus_key < RETROK_LAST) if (id_plus_valid && id_plus_key && id_plus_key < RETROK_LAST)
{ {
unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key]; unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key];
if BIT_GET(udev->state, sym) if BIT_GET(udev->state, sym)
ret = 0x7fff; ret = 0x7fff;
} }
if (id_minus_valid && id_minus_key < RETROK_LAST) if (id_minus_valid && id_minus_key && id_minus_key < RETROK_LAST)
{ {
unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key]; unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key];
if (BIT_GET(udev->state, sym)) if (BIT_GET(udev->state, sym))
@ -3894,8 +3886,7 @@ static int16_t udev_input_state(
} }
break; break;
case RETRO_DEVICE_KEYBOARD: case RETRO_DEVICE_KEYBOARD:
return (id < RETROK_LAST) && udev_keyboard_pressed(udev, id); return (id && id < RETROK_LAST) && udev_keyboard_pressed(udev, id);
case RETRO_DEVICE_MOUSE: case RETRO_DEVICE_MOUSE:
case RARCH_DEVICE_MOUSE_SCREEN: case RARCH_DEVICE_MOUSE_SCREEN:
#ifdef UDEV_TOUCH_SUPPORT #ifdef UDEV_TOUCH_SUPPORT
@ -3951,17 +3942,13 @@ static int16_t udev_input_state(
const uint64_t bind_joyaxis = input_config_binds[port][new_id].joyaxis; const uint64_t bind_joyaxis = input_config_binds[port][new_id].joyaxis;
const uint64_t autobind_joykey = input_autoconf_binds[port][new_id].joykey; const uint64_t autobind_joykey = input_autoconf_binds[port][new_id].joykey;
const uint64_t autobind_joyaxis= input_autoconf_binds[port][new_id].joyaxis; const uint64_t autobind_joyaxis= input_autoconf_binds[port][new_id].joyaxis;
uint16_t joyport = joypad_info->joy_idx; uint16_t joyport = joypad_info->joy_idx;
float axis_threshold = joypad_info->axis_threshold; float axis_threshold = joypad_info->axis_threshold;
const uint64_t joykey = (bind_joykey != NO_BTN) const uint64_t joykey = (bind_joykey != NO_BTN)
? bind_joykey : autobind_joykey; ? bind_joykey : autobind_joykey;
const uint32_t joyaxis = (bind_joyaxis != AXIS_NONE) const uint32_t joyaxis = (bind_joyaxis != AXIS_NONE)
? bind_joyaxis : autobind_joyaxis; ? bind_joyaxis : autobind_joyaxis;
if (!keyboard_mapping_blocked)
if ((binds[port][new_id].key < RETROK_LAST)
&& udev_keyboard_pressed(udev, binds[port]
[new_id].key))
return 1;
if (binds[port][new_id].valid) if (binds[port][new_id].valid)
{ {
if ((uint16_t)joykey != NO_BTN && joypad->button( if ((uint16_t)joykey != NO_BTN && joypad->button(
@ -3971,8 +3958,12 @@ static int16_t udev_input_state(
((float)abs(joypad->axis(joyport, joyaxis)) ((float)abs(joypad->axis(joyport, joyaxis))
/ 0x8000) > axis_threshold) / 0x8000) > axis_threshold)
return 1; return 1;
if (udev_mouse_button_pressed(udev, port, else if ((binds[port][new_id].key && binds[port][new_id].key < RETROK_LAST)
binds[port][new_id].mbutton)) && !keyboard_mapping_blocked
&& udev_keyboard_pressed(udev, binds[port][new_id].key)
)
return 1;
else if (udev_mouse_button_pressed(udev, port, binds[port][new_id].mbutton))
return 1; return 1;
} }
} }

View File

@ -67,31 +67,28 @@ static int16_t uwp_input_state(
unsigned i; unsigned i;
int16_t ret = 0; int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
if (binds[port][i].valid)
{
if (uwp_mouse_state(port, binds[port][i].mbutton, false))
ret |= (1 << i);
}
}
if (!keyboard_mapping_blocked) if (!keyboard_mapping_blocked)
{ {
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{ {
if (binds[port][i].valid) if (binds[port][i].valid)
{ {
if ( if ( (binds[port][i].key && binds[port][i].key < RETROK_LAST)
((binds[port][i].key < RETROK_LAST) && uwp_keyboard_pressed(binds[port][i].key))
&& uwp_keyboard_pressed(binds[port][i].key))
)
ret |= (1 << i); ret |= (1 << i);
} }
} }
} }
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
if (binds[port][i].valid)
{
if (uwp_mouse_state(port,
binds[port][i].mbutton, false))
ret |= (1 << i);
}
}
return ret; return ret;
} }
@ -99,14 +96,12 @@ static int16_t uwp_input_state(
{ {
if (binds[port][id].valid) if (binds[port][id].valid)
{ {
if ((binds[port][id].key < RETROK_LAST) if ( (binds[port][id].key && binds[port][id].key < RETROK_LAST)
&& uwp_keyboard_pressed(binds[port][id].key) && uwp_keyboard_pressed(binds[port][id].key)
&& ((id == RARCH_GAME_FOCUS_TOGGLE) && (id == RARCH_GAME_FOCUS_TOGGLE || !keyboard_mapping_blocked)
|| !keyboard_mapping_blocked) )
)
return 1; return 1;
else if (uwp_mouse_state(port, else if (uwp_mouse_state(port, binds[port][id].mbutton, false))
binds[port][id].mbutton, false))
return 1; return 1;
} }
} }
@ -129,12 +124,12 @@ static int16_t uwp_input_state(
id_minus_key = binds[port][id_minus].key; id_minus_key = binds[port][id_minus].key;
id_plus_key = binds[port][id_plus].key; id_plus_key = binds[port][id_plus].key;
if (id_plus_valid && id_plus_key < RETROK_LAST) if (id_plus_valid && id_plus_key && id_plus_key < RETROK_LAST)
{ {
if (uwp_keyboard_pressed(id_plus_key)) if (uwp_keyboard_pressed(id_plus_key))
ret = 0x7fff; ret = 0x7fff;
} }
if (id_minus_valid && id_minus_key < RETROK_LAST) if (id_minus_valid && id_minus_key && id_minus_key < RETROK_LAST)
{ {
if (uwp_keyboard_pressed(id_minus_key)) if (uwp_keyboard_pressed(id_minus_key))
ret += -0x7fff; ret += -0x7fff;
@ -144,12 +139,10 @@ static int16_t uwp_input_state(
} }
break; break;
case RETRO_DEVICE_KEYBOARD: case RETRO_DEVICE_KEYBOARD:
return (id < RETROK_LAST) && uwp_keyboard_pressed(id); return (id && id < RETROK_LAST) && uwp_keyboard_pressed(id);
case RETRO_DEVICE_MOUSE: case RETRO_DEVICE_MOUSE:
case RARCH_DEVICE_MOUSE_SCREEN: case RARCH_DEVICE_MOUSE_SCREEN:
return uwp_mouse_state(port, id, device == RARCH_DEVICE_MOUSE_SCREEN); return uwp_mouse_state(port, id, device == RARCH_DEVICE_MOUSE_SCREEN);
case RETRO_DEVICE_POINTER: case RETRO_DEVICE_POINTER:
case RARCH_DEVICE_POINTER_SCREEN: case RARCH_DEVICE_POINTER_SCREEN:
return uwp_pointer_state(index, id, device == RARCH_DEVICE_POINTER_SCREEN); return uwp_pointer_state(index, id, device == RARCH_DEVICE_POINTER_SCREEN);

View File

@ -191,8 +191,8 @@ static int16_t input_wl_state(
{ {
if (binds[port][i].valid) if (binds[port][i].valid)
{ {
if (BIT_GET(wl->key_state, if ( (binds[port][i].key && binds[port][i].key < RETROK_LAST)
rarch_keysym_lut[binds[port][i].key]) ) && BIT_GET(wl->key_state, rarch_keysym_lut[binds[port][i].key]))
ret |= (1 << i); ret |= (1 << i);
} }
} }
@ -203,18 +203,13 @@ static int16_t input_wl_state(
if (id < RARCH_BIND_LIST_END) if (id < RARCH_BIND_LIST_END)
{ {
if (binds[port][id].valid && binds[port][id].key < RETROK_LAST) if (binds[port][id].valid)
{ {
if (id != RARCH_GAME_FOCUS_TOGGLE && !keyboard_mapping_blocked) if ( (binds[port][id].key && binds[port][id].key < RETROK_LAST)
{ && BIT_GET(wl->key_state, rarch_keysym_lut[binds[port][id].key])
if (BIT_GET(wl->key_state, rarch_keysym_lut[binds[port][id].key])) && (id == RARCH_GAME_FOCUS_TOGGLE || !keyboard_mapping_blocked)
return 1; )
} return 1;
else if (id == RARCH_GAME_FOCUS_TOGGLE)
{
if (BIT_GET(wl->key_state, rarch_keysym_lut[binds[port][id].key]))
return 1;
}
/* TODO: support default mouse-to-retropad bindings */ /* TODO: support default mouse-to-retropad bindings */
/* else if (wl_mouse_button_pressed(udev, port, binds[port][i].mbutton)) /* else if (wl_mouse_button_pressed(udev, port, binds[port][i].mbutton))
@ -241,13 +236,13 @@ static int16_t input_wl_state(
id_minus_key = binds[port][id_minus].key; id_minus_key = binds[port][id_minus].key;
id_plus_key = binds[port][id_plus].key; id_plus_key = binds[port][id_plus].key;
if (id_plus_valid && id_plus_key < RETROK_LAST) if (id_plus_valid && id_plus_key && id_plus_key < RETROK_LAST)
{ {
unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key]; unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key];
if (BIT_GET(wl->key_state, sym)) if (BIT_GET(wl->key_state, sym))
ret = 0x7fff; ret = 0x7fff;
} }
if (id_minus_valid && id_minus_key < RETROK_LAST) if (id_minus_valid && id_minus_key && id_minus_key < RETROK_LAST)
{ {
unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key]; unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key];
if (BIT_GET(wl->key_state, sym)) if (BIT_GET(wl->key_state, sym))
@ -258,8 +253,7 @@ static int16_t input_wl_state(
} }
break; break;
case RETRO_DEVICE_KEYBOARD: case RETRO_DEVICE_KEYBOARD:
return id < RETROK_LAST && return (id && id < RETROK_LAST) && BIT_GET(wl->key_state, rarch_keysym_lut[(enum retro_key)id]);
BIT_GET(wl->key_state, rarch_keysym_lut[(enum retro_key)id]);
case RETRO_DEVICE_MOUSE: case RETRO_DEVICE_MOUSE:
case RARCH_DEVICE_MOUSE_SCREEN: case RARCH_DEVICE_MOUSE_SCREEN:
if (port == 0) /* TODO/FIXME: support mouse on additional ports */ if (port == 0) /* TODO/FIXME: support mouse on additional ports */

View File

@ -60,7 +60,7 @@ static void kb_key_callback(KBDKeyEvent *key)
code = input_keymaps_translate_keysym_to_rk( code = input_keymaps_translate_keysym_to_rk(
key->scancode); key->scancode);
if (code < RETROK_LAST) if (code && code < RETROK_LAST)
keyboard_state[code] = pressed; keyboard_state[code] = pressed;
if (key->modifier & KBD_WIIU_SHIFT) if (key->modifier & KBD_WIIU_SHIFT)
@ -106,7 +106,7 @@ static int16_t wiiu_input_state(
case RETRO_DEVICE_ANALOG: case RETRO_DEVICE_ANALOG:
break; break;
case RETRO_DEVICE_KEYBOARD: case RETRO_DEVICE_KEYBOARD:
if (id < RETROK_LAST && keyboard_state[id] && (keyboard_channel > 0)) if (id && id < RETROK_LAST && keyboard_state[id] && (keyboard_channel > 0))
return 1; return 1;
break; break;
case RETRO_DEVICE_POINTER: case RETRO_DEVICE_POINTER:

View File

@ -780,8 +780,7 @@ static int16_t winraw_input_state(
{ {
if (binds[port][i].valid) if (binds[port][i].valid)
{ {
if (winraw_mouse_button_pressed(wr, if (winraw_mouse_button_pressed(wr, mouse, port, binds[port][i].mbutton))
mouse, port, binds[port][i].mbutton))
ret |= (1 << i); ret |= (1 << i);
} }
} }
@ -793,8 +792,8 @@ static int16_t winraw_input_state(
{ {
if (binds[port][i].valid) if (binds[port][i].valid)
{ {
if ((binds[port][i].key < RETROK_LAST) && if ( (binds[port][i].key && binds[port][i].key < RETROK_LAST)
WINRAW_KEYBOARD_PRESSED(wr, binds[port][i].key)) && WINRAW_KEYBOARD_PRESSED(wr, binds[port][i].key))
ret |= (1 << i); ret |= (1 << i);
} }
} }
@ -807,15 +806,12 @@ static int16_t winraw_input_state(
{ {
if (binds[port][id].valid) if (binds[port][id].valid)
{ {
if ( if ( (binds[port][id].key && binds[port][id].key < RETROK_LAST)
(binds[port][id].key < RETROK_LAST)
&& WINRAW_KEYBOARD_PRESSED(wr, binds[port][id].key) && WINRAW_KEYBOARD_PRESSED(wr, binds[port][id].key)
&& (( id == RARCH_GAME_FOCUS_TOGGLE) && (id == RARCH_GAME_FOCUS_TOGGLE || !keyboard_mapping_blocked)
|| !keyboard_mapping_blocked)
) )
return 1; return 1;
else if (mouse && winraw_mouse_button_pressed(wr, else if (mouse && winraw_mouse_button_pressed(wr, mouse, port, binds[port][id].mbutton))
mouse, port, binds[port][id].mbutton))
return 1; return 1;
} }
} }
@ -836,12 +832,12 @@ static int16_t winraw_input_state(
id_minus_key = binds[port][id_minus].key; id_minus_key = binds[port][id_minus].key;
id_plus_key = binds[port][id_plus].key; id_plus_key = binds[port][id_plus].key;
if (id_plus_valid && id_plus_key < RETROK_LAST) if (id_plus_valid && id_plus_key && id_plus_key < RETROK_LAST)
{ {
if (WINRAW_KEYBOARD_PRESSED(wr, id_plus_key)) if (WINRAW_KEYBOARD_PRESSED(wr, id_plus_key))
ret = 0x7fff; ret = 0x7fff;
} }
if (id_minus_valid && id_minus_key < RETROK_LAST) if (id_minus_valid && id_minus_key && id_minus_key < RETROK_LAST)
{ {
if (WINRAW_KEYBOARD_PRESSED(wr, id_minus_key)) if (WINRAW_KEYBOARD_PRESSED(wr, id_minus_key))
ret += -0x7fff; ret += -0x7fff;
@ -849,7 +845,7 @@ static int16_t winraw_input_state(
} }
return ret; return ret;
case RETRO_DEVICE_KEYBOARD: case RETRO_DEVICE_KEYBOARD:
return (id < RETROK_LAST) && WINRAW_KEYBOARD_PRESSED(wr, id); return (id && id < RETROK_LAST) && WINRAW_KEYBOARD_PRESSED(wr, id);
case RETRO_DEVICE_MOUSE: case RETRO_DEVICE_MOUSE:
case RARCH_DEVICE_MOUSE_SCREEN: case RARCH_DEVICE_MOUSE_SCREEN:
if (mouse) if (mouse)
@ -996,6 +992,7 @@ static int16_t winraw_input_state(
? bind_joykey : autobind_joykey; ? bind_joykey : autobind_joykey;
const uint32_t joyaxis = (bind_joyaxis != AXIS_NONE) const uint32_t joyaxis = (bind_joyaxis != AXIS_NONE)
? bind_joyaxis : autobind_joyaxis; ? bind_joyaxis : autobind_joyaxis;
if (binds[port][new_id].valid) if (binds[port][new_id].valid)
{ {
if ((uint16_t)joykey != NO_BTN && joypad->button( if ((uint16_t)joykey != NO_BTN && joypad->button(
@ -1005,19 +1002,14 @@ static int16_t winraw_input_state(
((float)abs(joypad->axis(joyport, joyaxis)) ((float)abs(joypad->axis(joyport, joyaxis))
/ 0x8000) > axis_threshold) / 0x8000) > axis_threshold)
return 1; return 1;
else if ( else if ((binds[port][new_id].key && binds[port][new_id].key < RETROK_LAST)
binds[port][new_id].key < RETROK_LAST
&& !keyboard_mapping_blocked && !keyboard_mapping_blocked
&& WINRAW_KEYBOARD_PRESSED(wr, binds[port] && WINRAW_KEYBOARD_PRESSED(wr, binds[port][new_id].key)
[new_id].key) )
)
return 1; return 1;
else else if (mouse)
{ {
if ( if (winraw_mouse_button_pressed(wr, mouse, port, binds[port][new_id].mbutton))
mouse && winraw_mouse_button_pressed(wr,
mouse, port, binds[port][new_id].mbutton)
)
return 1; return 1;
} }
} }

View File

@ -169,20 +169,20 @@ static int16_t x_input_state(
{ {
if (binds[port][i].valid) if (binds[port][i].valid)
{ {
if (x_mouse_button_pressed(x11, port, if (x_mouse_button_pressed(x11, port, binds[port][i].mbutton))
binds[port][i].mbutton))
ret |= (1 << i); ret |= (1 << i);
} }
} }
} }
if (!keyboard_mapping_blocked) if (!keyboard_mapping_blocked)
{ {
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{ {
if (binds[port][i].valid) if (binds[port][i].valid)
{ {
if ((binds[port][i].key < RETROK_LAST) && if ( (binds[port][i].key && binds[port][i].key < RETROK_LAST)
x_keyboard_pressed(x11, binds[port][i].key)) && x_keyboard_pressed(x11, binds[port][i].key))
ret |= (1 << i); ret |= (1 << i);
} }
} }
@ -195,17 +195,14 @@ static int16_t x_input_state(
{ {
if (binds[port][id].valid) if (binds[port][id].valid)
{ {
if ( if ( (binds[port][id].key && binds[port][id].key < RETROK_LAST)
((binds[port][id].key < RETROK_LAST) && && x_keyboard_pressed(x11, binds[port][id].key)
x_keyboard_pressed(x11, binds[port][id].key)) && (id == RARCH_GAME_FOCUS_TOGGLE || !keyboard_mapping_blocked)
&& (( id == RARCH_GAME_FOCUS_TOGGLE)
|| !keyboard_mapping_blocked)
) )
return 1; return 1;
else if (settings->uints.input_mouse_index[port] == 0) else if (settings->uints.input_mouse_index[port] == 0)
{ {
if (x_mouse_button_pressed(x11, port, if (x_mouse_button_pressed(x11, port, binds[port][id].mbutton))
binds[port][id].mbutton))
return 1; return 1;
} }
} }
@ -231,13 +228,13 @@ static int16_t x_input_state(
id_minus_key = binds[port][id_minus].key; id_minus_key = binds[port][id_minus].key;
id_plus_key = binds[port][id_plus].key; id_plus_key = binds[port][id_plus].key;
if (id_plus_valid && id_plus_key < RETROK_LAST) if (id_plus_valid && id_plus_key && id_plus_key < RETROK_LAST)
{ {
unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key]; unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key];
if (x11->state[sym >> 3] & (1 << (sym & 7))) if (x11->state[sym >> 3] & (1 << (sym & 7)))
ret = 0x7fff; ret = 0x7fff;
} }
if (id_minus_valid && id_minus_key < RETROK_LAST) if (id_minus_valid && id_minus_key && id_minus_key < RETROK_LAST)
{ {
unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key]; unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key];
if (x11->state[sym >> 3] & (1 << (sym & 7))) if (x11->state[sym >> 3] & (1 << (sym & 7)))
@ -248,7 +245,7 @@ static int16_t x_input_state(
} }
break; break;
case RETRO_DEVICE_KEYBOARD: case RETRO_DEVICE_KEYBOARD:
return (id < RETROK_LAST) && x_keyboard_pressed(x11, id); return (id && id < RETROK_LAST) && x_keyboard_pressed(x11, id);
case RETRO_DEVICE_MOUSE: case RETRO_DEVICE_MOUSE:
case RARCH_DEVICE_MOUSE_SCREEN: case RARCH_DEVICE_MOUSE_SCREEN:
switch (id) switch (id)
@ -395,11 +392,7 @@ static int16_t x_input_state(
? bind_joykey : autobind_joykey; ? bind_joykey : autobind_joykey;
const uint32_t joyaxis = (bind_joyaxis != AXIS_NONE) const uint32_t joyaxis = (bind_joyaxis != AXIS_NONE)
? bind_joyaxis : autobind_joyaxis; ? bind_joyaxis : autobind_joyaxis;
if (!keyboard_mapping_blocked)
if ((binds[port][new_id].key < RETROK_LAST)
&& x_keyboard_pressed(x11, binds[port]
[new_id].key) )
return 1;
if (binds[port][new_id].valid) if (binds[port][new_id].valid)
{ {
if ((uint16_t)joykey != NO_BTN && joypad->button( if ((uint16_t)joykey != NO_BTN && joypad->button(
@ -409,10 +402,14 @@ static int16_t x_input_state(
((float)abs(joypad->axis(joyport, joyaxis)) ((float)abs(joypad->axis(joyport, joyaxis))
/ 0x8000) > axis_threshold) / 0x8000) > axis_threshold)
return 1; return 1;
else if ((binds[port][new_id].key && binds[port][new_id].key < RETROK_LAST)
&& !keyboard_mapping_blocked
&& x_keyboard_pressed(x11, binds[port][new_id].key)
)
return 1;
else if (settings->uints.input_mouse_index[port] == 0) else if (settings->uints.input_mouse_index[port] == 0)
{ {
if (x_mouse_button_pressed(x11, port, if (x_mouse_button_pressed(x11, port, binds[port][new_id].mbutton))
binds[port][new_id].mbutton))
return 1; return 1;
} }
} }

View File

@ -91,18 +91,6 @@
|| ((autoconf_bind)->joyaxis != AXIS_NONE)) \ || ((autoconf_bind)->joyaxis != AXIS_NONE)) \
) )
/* Checks if hotkey or RetroPad has any bindings at all. */
#define CHECK_INPUT_DRIVER_EMPTY_BIND(port, i) \
( \
(binds[port][i].key == RETROK_UNKNOWN) \
&& (binds[port][i].mbutton == NO_BTN) \
&& ( ( binds[port][i].joykey == NO_BTN \
&& binds[port][i].joyaxis == AXIS_NONE) \
|| ( joypad_info->auto_binds[i].joykey == NO_BTN \
&& joypad_info->auto_binds[i].joyaxis == AXIS_NONE) \
) \
)
/* Human readable order of input binds */ /* Human readable order of input binds */
const unsigned input_config_bind_order[24] = { const unsigned input_config_bind_order[24] = {
RETRO_DEVICE_ID_JOYPAD_UP, RETRO_DEVICE_ID_JOYPAD_UP,
@ -792,26 +780,6 @@ static int32_t input_state_wrap(
idx, idx,
id); id);
if (device == RETRO_DEVICE_JOYPAD)
{
/* No binds, no input. This is for ignoring RETROK_UNKNOWN
* if the driver allows setting the key down somehow.
* Otherwise all hotkeys and inputs with null bind get triggered. */
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
int i;
for (i = 0; i < RARCH_FIRST_META_KEY; i++)
{
if (CHECK_INPUT_DRIVER_EMPTY_BIND(_port, i))
ret &= ~(UINT64_C(1) << i);
}
return ret;
}
else if (id != RETRO_DEVICE_ID_JOYPAD_MASK
&& CHECK_INPUT_DRIVER_EMPTY_BIND(_port, id))
return 0;
}
return ret; return ret;
} }
@ -4868,7 +4836,7 @@ static void input_keys_pressed(
port, RETRO_DEVICE_JOYPAD, 0, port, RETRO_DEVICE_JOYPAD, 0,
RETRO_DEVICE_ID_JOYPAD_MASK); RETRO_DEVICE_ID_JOYPAD_MASK);
for (i = 0; i < RARCH_FIRST_META_KEY; i++) for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{ {
if ( (ret & (UINT64_C(1) << i)) if ( (ret & (UINT64_C(1) << i))
|| input_keys_pressed_other_sources(input_st, i, p_new_state)) || input_keys_pressed_other_sources(input_st, i, p_new_state))