mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +00:00
Inline pressed_analog functions into input_state function itself
This commit is contained in:
parent
e119d3c98e
commit
035efa5136
@ -322,42 +322,6 @@ static bool dinput_mouse_button_pressed(
|
||||
return false;
|
||||
}
|
||||
|
||||
static int16_t dinput_pressed_analog(
|
||||
struct dinput_input *di,
|
||||
const struct retro_keybind *binds,
|
||||
unsigned idx, unsigned id)
|
||||
{
|
||||
int id_minus_key = 0;
|
||||
int id_plus_key = 0;
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
int16_t ret = 0;
|
||||
bool id_plus_valid = false;
|
||||
bool id_minus_valid = false;
|
||||
|
||||
input_conv_analog_id_to_bind_id(idx, id, id_minus, id_plus);
|
||||
|
||||
id_minus_valid = binds[id_minus].valid;
|
||||
id_plus_valid = binds[id_plus].valid;
|
||||
id_minus_key = binds[id_minus].key;
|
||||
id_plus_key = binds[id_plus].key;
|
||||
|
||||
if (id_plus_valid && id_plus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key];
|
||||
if (di->state[sym] & 0x80)
|
||||
ret = 0x7fff;
|
||||
}
|
||||
if (id_minus_valid && id_minus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key];
|
||||
if (di->state[sym] & 0x80)
|
||||
ret += -0x7fff;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int16_t dinput_lightgun_aiming_state(
|
||||
struct dinput_input *di, unsigned idx, unsigned id)
|
||||
{
|
||||
@ -652,7 +616,36 @@ static int16_t dinput_input_state(
|
||||
di->state[rarch_keysym_lut[(enum retro_key)id]] & 0x80;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
if (binds[port])
|
||||
return dinput_pressed_analog(di, binds[port], idx, id);
|
||||
{
|
||||
int id_minus_key = 0;
|
||||
int id_plus_key = 0;
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
int16_t ret = 0;
|
||||
bool id_plus_valid = false;
|
||||
bool id_minus_valid = false;
|
||||
|
||||
input_conv_analog_id_to_bind_id(idx, id, id_minus, id_plus);
|
||||
|
||||
id_minus_valid = binds[port][id_minus].valid;
|
||||
id_plus_valid = binds[port][id_plus].valid;
|
||||
id_minus_key = binds[port][id_minus].key;
|
||||
id_plus_key = binds[port][id_plus].key;
|
||||
|
||||
if (id_plus_valid && id_plus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key];
|
||||
if (di->state[sym] & 0x80)
|
||||
ret = 0x7fff;
|
||||
}
|
||||
if (id_minus_valid && id_minus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key];
|
||||
if (di->state[sym] & 0x80)
|
||||
ret += -0x7fff;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case RETRO_DEVICE_MOUSE:
|
||||
{
|
||||
|
@ -72,40 +72,6 @@ static void *linuxraw_input_init(const char *joypad_driver)
|
||||
return linuxraw;
|
||||
}
|
||||
|
||||
static int16_t linuxraw_pressed_analog(linuxraw_input_t *linuxraw,
|
||||
const struct retro_keybind *binds, unsigned idx, unsigned id)
|
||||
{
|
||||
int id_minus_key = 0;
|
||||
int id_plus_key = 0;
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
int16_t ret = 0;
|
||||
bool id_plus_valid = false;
|
||||
bool id_minus_valid = false;
|
||||
|
||||
input_conv_analog_id_to_bind_id(idx, id, id_minus, id_plus);
|
||||
|
||||
id_minus_valid = binds[id_minus].valid;
|
||||
id_plus_valid = binds[id_plus].valid;
|
||||
id_minus_key = binds[id_minus].key;
|
||||
id_plus_key = binds[id_plus].key;
|
||||
|
||||
if (id_plus_valid && id_plus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key];
|
||||
if (linuxraw->state[sym] & 0x80)
|
||||
ret = 0x7fff;
|
||||
}
|
||||
if (id_minus_valid && id_minus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key];
|
||||
if (linuxraw->state[sym] & 0x80)
|
||||
ret += -0x7fff;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int16_t linuxraw_input_state(
|
||||
void *data,
|
||||
const input_device_driver_t *joypad,
|
||||
@ -161,8 +127,37 @@ static int16_t linuxraw_input_state(
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
if (binds[port])
|
||||
return linuxraw_pressed_analog(
|
||||
linuxraw, binds[port], idx, id);
|
||||
{
|
||||
int id_minus_key = 0;
|
||||
int id_plus_key = 0;
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
int16_t ret = 0;
|
||||
bool id_plus_valid = false;
|
||||
bool id_minus_valid = false;
|
||||
|
||||
input_conv_analog_id_to_bind_id(idx, id, id_minus, id_plus);
|
||||
|
||||
id_minus_valid = binds[port][id_minus].valid;
|
||||
id_plus_valid = binds[port][id_plus].valid;
|
||||
id_minus_key = binds[port][id_minus].key;
|
||||
id_plus_key = binds[port][id_plus].key;
|
||||
|
||||
if (id_plus_valid && id_plus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key];
|
||||
if (linuxraw->state[sym] & 0x80)
|
||||
ret = 0x7fff;
|
||||
}
|
||||
if (id_minus_valid && id_minus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key];
|
||||
if (linuxraw->state[sym] & 0x80)
|
||||
ret += -0x7fff;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -491,44 +491,6 @@ static int16_t rwebinput_is_pressed(
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int16_t rwebinput_pressed_analog(
|
||||
rwebinput_input_t *rwebinput,
|
||||
const input_device_driver_t *joypad,
|
||||
rarch_joypad_info_t *joypad_info,
|
||||
const struct retro_keybind *binds,
|
||||
unsigned idx, unsigned id)
|
||||
{
|
||||
int id_minus_key = 0;
|
||||
int id_plus_key = 0;
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
int16_t ret = 0;
|
||||
bool id_plus_valid = false;
|
||||
bool id_minus_valid = false;
|
||||
|
||||
input_conv_analog_id_to_bind_id(idx, id, id_minus, id_plus);
|
||||
|
||||
id_minus_valid = binds[id_minus].valid;
|
||||
id_plus_valid = binds[id_plus].valid;
|
||||
id_minus_key = binds[id_minus].key;
|
||||
id_plus_key = binds[id_plus].key;
|
||||
|
||||
if (id_plus_valid && id_plus_key < RETROK_LAST)
|
||||
{
|
||||
if (rwebinput_is_pressed(rwebinput,
|
||||
joypad, joypad_info, binds, idx, id_plus))
|
||||
ret = 0x7fff;
|
||||
}
|
||||
if (id_minus_valid && id_minus_key < RETROK_LAST)
|
||||
{
|
||||
if (rwebinput_is_pressed(rwebinput,
|
||||
joypad, joypad_info, binds, idx, id_minus))
|
||||
ret += -0x7fff;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int16_t rwebinput_input_state(
|
||||
void *data,
|
||||
const input_device_driver_t *joypad,
|
||||
@ -575,9 +537,37 @@ static int16_t rwebinput_input_state(
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
if (binds[port])
|
||||
return rwebinput_pressed_analog(
|
||||
rwebinput, joypad, joypad_info, binds[port],
|
||||
idx, id);
|
||||
{
|
||||
int id_minus_key = 0;
|
||||
int id_plus_key = 0;
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
int16_t ret = 0;
|
||||
bool id_plus_valid = false;
|
||||
bool id_minus_valid = false;
|
||||
|
||||
input_conv_analog_id_to_bind_id(idx, id, id_minus, id_plus);
|
||||
|
||||
id_minus_valid = binds[port][id_minus].valid;
|
||||
id_plus_valid = binds[port][id_plus].valid;
|
||||
id_minus_key = binds[port][id_minus].key;
|
||||
id_plus_key = binds[port][id_plus].key;
|
||||
|
||||
if (id_plus_valid && id_plus_key < RETROK_LAST)
|
||||
{
|
||||
if (rwebinput_is_pressed(rwebinput,
|
||||
joypad, joypad_info, binds[port], idx, id_plus))
|
||||
ret = 0x7fff;
|
||||
}
|
||||
if (id_minus_valid && id_minus_key < RETROK_LAST)
|
||||
{
|
||||
if (rwebinput_is_pressed(rwebinput,
|
||||
joypad, joypad_info, binds[port], idx, id_minus))
|
||||
ret += -0x7fff;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case RETRO_DEVICE_KEYBOARD:
|
||||
return rwebinput_key_pressed(rwebinput, id);
|
||||
|
@ -79,42 +79,6 @@ static bool sdl_key_pressed(int key)
|
||||
return keymap[sym];
|
||||
}
|
||||
|
||||
static int16_t sdl_pressed_analog(
|
||||
sdl_input_t *sdl,
|
||||
const struct retro_keybind *binds,
|
||||
unsigned idx, unsigned id)
|
||||
{
|
||||
int id_minus_key = 0;
|
||||
int id_plus_key = 0;
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
int16_t ret = 0;
|
||||
bool id_plus_valid = false;
|
||||
bool id_minus_valid = false;
|
||||
|
||||
input_conv_analog_id_to_bind_id(idx, id, id_minus, id_plus);
|
||||
|
||||
id_minus_valid = binds[id_minus].valid;
|
||||
id_plus_valid = binds[id_plus].valid;
|
||||
id_minus_key = binds[id_minus].key;
|
||||
id_plus_key = binds[id_plus].key;
|
||||
|
||||
if (id_plus_valid && id_plus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key];
|
||||
if (sdl_key_pressed(sym))
|
||||
ret = 0x7fff;
|
||||
}
|
||||
if (id_minus_valid && id_minus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key];
|
||||
if (sdl_key_pressed(sym))
|
||||
ret += -0x7fff;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int16_t sdl_mouse_device_state(sdl_input_t *sdl, unsigned id)
|
||||
{
|
||||
switch (id)
|
||||
@ -259,7 +223,37 @@ static int16_t sdl_input_state(
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
if (binds[port])
|
||||
return sdl_pressed_analog(sdl, binds[port], idx, id);
|
||||
{
|
||||
int id_minus_key = 0;
|
||||
int id_plus_key = 0;
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
int16_t ret = 0;
|
||||
bool id_plus_valid = false;
|
||||
bool id_minus_valid = false;
|
||||
|
||||
input_conv_analog_id_to_bind_id(idx, id, id_minus, id_plus);
|
||||
|
||||
id_minus_valid = binds[port][id_minus].valid;
|
||||
id_plus_valid = binds[port][id_plus].valid;
|
||||
id_minus_key = binds[port][id_minus].key;
|
||||
id_plus_key = binds[port][id_plus].key;
|
||||
|
||||
if (id_plus_valid && id_plus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key];
|
||||
if (sdl_key_pressed(sym))
|
||||
ret = 0x7fff;
|
||||
}
|
||||
if (id_minus_valid && id_minus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key];
|
||||
if (sdl_key_pressed(sym))
|
||||
ret += -0x7fff;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case RETRO_DEVICE_MOUSE:
|
||||
if (config_get_ptr()->uints.input_mouse_index[ port ] == 0)
|
||||
|
@ -932,42 +932,6 @@ static bool udev_mouse_button_pressed(
|
||||
return false;
|
||||
}
|
||||
|
||||
static int16_t udev_pressed_analog(
|
||||
udev_input_t *udev,
|
||||
const struct retro_keybind *binds,
|
||||
unsigned idx, unsigned id)
|
||||
{
|
||||
int id_minus_key = 0;
|
||||
int id_plus_key = 0;
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
int16_t ret = 0;
|
||||
bool id_plus_valid = false;
|
||||
bool id_minus_valid = false;
|
||||
|
||||
input_conv_analog_id_to_bind_id(idx, id, id_minus, id_plus);
|
||||
|
||||
id_minus_valid = binds[id_minus].valid;
|
||||
id_plus_valid = binds[id_plus].valid;
|
||||
id_minus_key = binds[id_minus].key;
|
||||
id_plus_key = binds[id_plus].key;
|
||||
|
||||
if (id_plus_valid && id_plus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key];
|
||||
if BIT_GET(udev->state, sym)
|
||||
ret = 0x7fff;
|
||||
}
|
||||
if (id_minus_valid && id_minus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key];
|
||||
if (BIT_GET(udev->state, sym))
|
||||
ret += -0x7fff;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int16_t udev_pointer_state(udev_input_t *udev,
|
||||
unsigned port, unsigned id, bool screen)
|
||||
{
|
||||
@ -1082,7 +1046,37 @@ static int16_t udev_input_state(
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
if (binds[port])
|
||||
return udev_pressed_analog(udev, binds[port], idx, id);
|
||||
{
|
||||
int id_minus_key = 0;
|
||||
int id_plus_key = 0;
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
int16_t ret = 0;
|
||||
bool id_plus_valid = false;
|
||||
bool id_minus_valid = false;
|
||||
|
||||
input_conv_analog_id_to_bind_id(idx, id, id_minus, id_plus);
|
||||
|
||||
id_minus_valid = binds[port][id_minus].valid;
|
||||
id_plus_valid = binds[port][id_plus].valid;
|
||||
id_minus_key = binds[port][id_minus].key;
|
||||
id_plus_key = binds[port][id_plus].key;
|
||||
|
||||
if (id_plus_valid && id_plus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key];
|
||||
if BIT_GET(udev->state, sym)
|
||||
ret = 0x7fff;
|
||||
}
|
||||
if (id_minus_valid && id_minus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key];
|
||||
if (BIT_GET(udev->state, sym))
|
||||
ret += -0x7fff;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case RETRO_DEVICE_KEYBOARD:
|
||||
return (id < RETROK_LAST) && udev_keyboard_pressed(udev, id);
|
||||
|
@ -84,40 +84,6 @@ static bool uwp_input_set_rumble(
|
||||
return false;
|
||||
}
|
||||
|
||||
static int16_t uwp_pressed_analog(uwp_input_t *uwp,
|
||||
rarch_joypad_info_t *joypad_info,
|
||||
const struct retro_keybind *binds,
|
||||
unsigned port, unsigned idx, unsigned id)
|
||||
{
|
||||
int id_minus_key = 0;
|
||||
int id_plus_key = 0;
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
int16_t ret = 0;
|
||||
bool id_plus_valid = false;
|
||||
bool id_minus_valid = false;
|
||||
|
||||
input_conv_analog_id_to_bind_id(idx, id, id_minus, id_plus);
|
||||
|
||||
id_minus_valid = binds[id_minus].valid;
|
||||
id_plus_valid = binds[id_plus].valid;
|
||||
id_minus_key = binds[id_minus].key;
|
||||
id_plus_key = binds[id_plus].key;
|
||||
|
||||
if (id_plus_valid && id_plus_key < RETROK_LAST)
|
||||
{
|
||||
if (uwp_keyboard_pressed(bind_plus_key))
|
||||
ret = 0x7fff;
|
||||
}
|
||||
if (id_minus_valid && id_minus_key < RETROK_LAST)
|
||||
{
|
||||
if (uwp_keyboard_pressed(bind_minus_key))
|
||||
ret += -0x7fff;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int16_t uwp_input_state(
|
||||
void *data,
|
||||
const input_device_driver_t *joypad,
|
||||
@ -189,7 +155,35 @@ static int16_t uwp_input_state(
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
if (binds[port])
|
||||
return uwp_pressed_analog(uwp, joypad_info, binds[port], port, index, id);
|
||||
{
|
||||
int id_minus_key = 0;
|
||||
int id_plus_key = 0;
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
int16_t ret = 0;
|
||||
bool id_plus_valid = false;
|
||||
bool id_minus_valid = false;
|
||||
|
||||
input_conv_analog_id_to_bind_id(idx, id, id_minus, id_plus);
|
||||
|
||||
id_minus_valid = binds[port][id_minus].valid;
|
||||
id_plus_valid = binds[port][id_plus].valid;
|
||||
id_minus_key = binds[port][id_minus].key;
|
||||
id_plus_key = binds[port][id_plus].key;
|
||||
|
||||
if (id_plus_valid && id_plus_key < RETROK_LAST)
|
||||
{
|
||||
if (uwp_keyboard_pressed(bind_plus_key))
|
||||
ret = 0x7fff;
|
||||
}
|
||||
if (id_minus_valid && id_minus_key < RETROK_LAST)
|
||||
{
|
||||
if (uwp_keyboard_pressed(bind_minus_key))
|
||||
ret += -0x7fff;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case RETRO_DEVICE_KEYBOARD:
|
||||
return (id < RETROK_LAST) && uwp_keyboard_pressed(id);
|
||||
|
@ -154,42 +154,6 @@ static void input_wl_poll(void *data)
|
||||
input_wl_touch_pool(wl);
|
||||
}
|
||||
|
||||
static int16_t input_wl_pressed_analog(
|
||||
input_ctx_wayland_data_t *wl,
|
||||
const struct retro_keybind *binds,
|
||||
unsigned idx, unsigned id)
|
||||
{
|
||||
int id_minus_key = 0;
|
||||
int id_plus_key = 0;
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
int16_t ret = 0;
|
||||
bool id_plus_valid = false;
|
||||
bool id_minus_valid = false;
|
||||
|
||||
input_conv_analog_id_to_bind_id(idx, id, id_minus, id_plus);
|
||||
|
||||
id_minus_valid = binds[id_minus].valid;
|
||||
id_plus_valid = binds[id_plus].valid;
|
||||
id_minus_key = binds[id_minus].key;
|
||||
id_plus_key = binds[id_plus].key;
|
||||
|
||||
if (id_plus_valid && id_plus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key];
|
||||
if (BIT_GET(wl->key_state, sym))
|
||||
ret = 0x7fff;
|
||||
}
|
||||
if (id_minus_valid && id_minus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key];
|
||||
if (BIT_GET(wl->key_state, sym))
|
||||
ret += -0x7fff;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool input_wl_state_kb(input_ctx_wayland_data_t *wl,
|
||||
const struct retro_keybind **binds,
|
||||
unsigned port, unsigned device, unsigned idx, unsigned id)
|
||||
@ -351,7 +315,37 @@ static int16_t input_wl_state(
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
if (binds[port])
|
||||
return input_wl_pressed_analog(wl, binds[port], idx, id);
|
||||
{
|
||||
int id_minus_key = 0;
|
||||
int id_plus_key = 0;
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
int16_t ret = 0;
|
||||
bool id_plus_valid = false;
|
||||
bool id_minus_valid = false;
|
||||
|
||||
input_conv_analog_id_to_bind_id(idx, id, id_minus, id_plus);
|
||||
|
||||
id_minus_valid = binds[port][id_minus].valid;
|
||||
id_plus_valid = binds[port][id_plus].valid;
|
||||
id_minus_key = binds[port][id_minus].key;
|
||||
id_plus_key = binds[port][id_plus].key;
|
||||
|
||||
if (id_plus_valid && id_plus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key];
|
||||
if (BIT_GET(wl->key_state, sym))
|
||||
ret = 0x7fff;
|
||||
}
|
||||
if (id_minus_valid && id_minus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key];
|
||||
if (BIT_GET(wl->key_state, sym))
|
||||
ret += -0x7fff;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case RETRO_DEVICE_KEYBOARD:
|
||||
return input_wl_state_kb(wl, binds, port, device, idx, id);
|
||||
|
@ -102,42 +102,6 @@ static bool x_mouse_button_pressed(
|
||||
return false;
|
||||
}
|
||||
|
||||
static int16_t x_pressed_analog(x11_input_t *x11,
|
||||
const struct retro_keybind *binds, unsigned idx, unsigned id)
|
||||
{
|
||||
int id_minus_key = 0;
|
||||
int id_plus_key = 0;
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
int16_t pressed_minus = 0;
|
||||
int16_t pressed_plus = 0;
|
||||
int16_t ret = 0;
|
||||
bool id_plus_valid = false;
|
||||
bool id_minus_valid = false;
|
||||
|
||||
input_conv_analog_id_to_bind_id(idx, id, id_minus, id_plus);
|
||||
|
||||
id_minus_valid = binds[id_minus].valid;
|
||||
id_plus_valid = binds[id_plus].valid;
|
||||
id_minus_key = binds[id_minus].key;
|
||||
id_plus_key = binds[id_plus].key;
|
||||
|
||||
if (id_plus_valid && id_plus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key];
|
||||
if (x11->state[sym >> 3] & (1 << (sym & 7)))
|
||||
ret = 0x7fff;
|
||||
}
|
||||
if (id_minus_valid && id_minus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key];
|
||||
if (x11->state[sym >> 3] & (1 << (sym & 7)))
|
||||
ret += -0x7fff;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int16_t x_lightgun_aiming_state(
|
||||
x11_input_t *x11, unsigned idx, unsigned id )
|
||||
{
|
||||
@ -347,7 +311,39 @@ static int16_t x_input_state(
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
if (binds[port])
|
||||
return x_pressed_analog(x11, binds[port], idx, id);
|
||||
{
|
||||
int id_minus_key = 0;
|
||||
int id_plus_key = 0;
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
int16_t pressed_minus = 0;
|
||||
int16_t pressed_plus = 0;
|
||||
int16_t ret = 0;
|
||||
bool id_plus_valid = false;
|
||||
bool id_minus_valid = false;
|
||||
|
||||
input_conv_analog_id_to_bind_id(idx, id, id_minus, id_plus);
|
||||
|
||||
id_minus_valid = binds[port][id_minus].valid;
|
||||
id_plus_valid = binds[port][id_plus].valid;
|
||||
id_minus_key = binds[port][id_minus].key;
|
||||
id_plus_key = binds[port][id_plus].key;
|
||||
|
||||
if (id_plus_valid && id_plus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_plus_key];
|
||||
if (x11->state[sym >> 3] & (1 << (sym & 7)))
|
||||
ret = 0x7fff;
|
||||
}
|
||||
if (id_minus_valid && id_minus_key < RETROK_LAST)
|
||||
{
|
||||
unsigned sym = rarch_keysym_lut[(enum retro_key)id_minus_key];
|
||||
if (x11->state[sym >> 3] & (1 << (sym & 7)))
|
||||
ret += -0x7fff;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case RETRO_DEVICE_KEYBOARD:
|
||||
return (id < RETROK_LAST) && x_keyboard_pressed(x11, id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user