mirror of
https://github.com/libretro/RetroArch
synced 2025-03-31 19:21:06 +00:00
(RWebInput) We're going to assume joypad driver code is not
needed for RARCH_DEVICE_ANALOG
This commit is contained in:
parent
1c5f4e1dee
commit
6b63b392ea
@ -407,37 +407,6 @@ static int16_t rwebinput_mouse_state(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int16_t rwebinput_is_pressed(
|
static int16_t rwebinput_is_pressed(
|
||||||
rwebinput_input_t *rwebinput,
|
|
||||||
const input_device_driver_t *joypad,
|
|
||||||
rarch_joypad_info_t *joypad_info,
|
|
||||||
const struct retro_keybind *binds,
|
|
||||||
unsigned port, unsigned id,
|
|
||||||
bool keyboard_mapping_blocked)
|
|
||||||
{
|
|
||||||
const struct retro_keybind *bind = &binds[id];
|
|
||||||
/* Auto-binds are per joypad, not per user. */
|
|
||||||
const uint64_t joykey = (binds[id].joykey != NO_BTN)
|
|
||||||
? binds[id].joykey : joypad_info->auto_binds[id].joykey;
|
|
||||||
const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE)
|
|
||||||
? binds[id].joyaxis : joypad_info->auto_binds[id].joyaxis;
|
|
||||||
int key = bind->key;
|
|
||||||
|
|
||||||
if ((key < RETROK_LAST) && rwebinput_key_pressed(rwebinput, key))
|
|
||||||
if ((id == RARCH_GAME_FOCUS_TOGGLE) || !keyboard_mapping_blocked)
|
|
||||||
return 1;
|
|
||||||
if (port == 0 && !!rwebinput_mouse_state(&rwebinput->mouse,
|
|
||||||
bind->mbutton, false))
|
|
||||||
return 1;
|
|
||||||
if ((uint16_t)joykey != NO_BTN
|
|
||||||
&& joypad->button(joypad_info->joy_idx, (uint16_t)joykey))
|
|
||||||
return 1;
|
|
||||||
if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis))
|
|
||||||
/ 0x8000) > joypad_info->axis_threshold)
|
|
||||||
return 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int16_t rwebinput_is_pressed_no_joypad(
|
|
||||||
rwebinput_input_t *rwebinput,
|
rwebinput_input_t *rwebinput,
|
||||||
const struct retro_keybind *binds,
|
const struct retro_keybind *binds,
|
||||||
unsigned port, unsigned id,
|
unsigned port, unsigned id,
|
||||||
@ -480,7 +449,7 @@ static int16_t rwebinput_input_state(
|
|||||||
{
|
{
|
||||||
if (binds[port][i].valid)
|
if (binds[port][i].valid)
|
||||||
{
|
{
|
||||||
if (rwebinput_is_pressed_no_joypad(
|
if (rwebinput_is_pressed(
|
||||||
rwebinput, binds[port], port, i,
|
rwebinput, binds[port], port, i,
|
||||||
keyboard_mapping_blocked))
|
keyboard_mapping_blocked))
|
||||||
ret |= (1 << i);
|
ret |= (1 << i);
|
||||||
@ -494,7 +463,7 @@ static int16_t rwebinput_input_state(
|
|||||||
{
|
{
|
||||||
if (binds[port][id].valid)
|
if (binds[port][id].valid)
|
||||||
{
|
{
|
||||||
if (rwebinput_is_pressed_no_joypad(rwebinput,
|
if (rwebinput_is_pressed(rwebinput,
|
||||||
binds[port],
|
binds[port],
|
||||||
port, id,
|
port, id,
|
||||||
keyboard_mapping_blocked))
|
keyboard_mapping_blocked))
|
||||||
@ -523,14 +492,14 @@ static int16_t rwebinput_input_state(
|
|||||||
if (id_plus_valid && id_plus_key < RETROK_LAST)
|
if (id_plus_valid && id_plus_key < RETROK_LAST)
|
||||||
{
|
{
|
||||||
if (rwebinput_is_pressed(rwebinput,
|
if (rwebinput_is_pressed(rwebinput,
|
||||||
joypad, joypad_info, 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 < RETROK_LAST)
|
||||||
{
|
{
|
||||||
if (rwebinput_is_pressed(rwebinput,
|
if (rwebinput_is_pressed(rwebinput,
|
||||||
joypad, joypad_info, binds[port], idx, id_minus,
|
binds[port], idx, id_minus,
|
||||||
keyboard_mapping_blocked))
|
keyboard_mapping_blocked))
|
||||||
ret += -0x7fff;
|
ret += -0x7fff;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user