mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
(Emscripten) Cleanup
This commit is contained in:
parent
3f566fd54e
commit
454eff8688
@ -407,37 +407,6 @@ static int16_t rwebinput_mouse_state(
|
||||
}
|
||||
|
||||
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,
|
||||
const struct retro_keybind *binds,
|
||||
unsigned port, unsigned id,
|
||||
@ -480,7 +449,7 @@ static int16_t rwebinput_input_state(
|
||||
{
|
||||
if (binds[port][i].valid)
|
||||
{
|
||||
if (rwebinput_is_pressed_no_joypad(
|
||||
if (rwebinput_is_pressed(
|
||||
rwebinput, binds[port], port, i,
|
||||
keyboard_mapping_blocked))
|
||||
ret |= (1 << i);
|
||||
@ -494,7 +463,7 @@ static int16_t rwebinput_input_state(
|
||||
{
|
||||
if (binds[port][id].valid)
|
||||
{
|
||||
if (rwebinput_is_pressed_no_joypad(rwebinput,
|
||||
if (rwebinput_is_pressed(rwebinput,
|
||||
binds[port],
|
||||
port, id,
|
||||
keyboard_mapping_blocked))
|
||||
@ -523,14 +492,14 @@ static int16_t rwebinput_input_state(
|
||||
if (id_plus_valid && id_plus_key < RETROK_LAST)
|
||||
{
|
||||
if (rwebinput_is_pressed(rwebinput,
|
||||
joypad, joypad_info, binds[port], idx, id_plus,
|
||||
binds[port], idx, id_plus,
|
||||
keyboard_mapping_blocked))
|
||||
ret = 0x7fff;
|
||||
}
|
||||
if (id_minus_valid && id_minus_key < RETROK_LAST)
|
||||
{
|
||||
if (rwebinput_is_pressed(rwebinput,
|
||||
joypad, joypad_info, binds[port], idx, id_minus,
|
||||
binds[port], idx, id_minus,
|
||||
keyboard_mapping_blocked))
|
||||
ret += -0x7fff;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user