mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 18:20:27 +00:00
(Input) Optimize input bitmask codepath
This commit is contained in:
parent
b6432cd8b4
commit
3297e464c4
@ -572,45 +572,34 @@ static int16_t dinput_input_state(void *data,
|
||||
{
|
||||
unsigned i;
|
||||
int16_t ret = 0;
|
||||
if (input_dinput.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 (button_is_pressed(
|
||||
di->joypad,
|
||||
joypad_info, binds[port], port, i))
|
||||
ret |= (1 << i);
|
||||
else if (
|
||||
settings->uints.input_mouse_index[port] == 0
|
||||
&& dinput_mouse_button_pressed(
|
||||
di, port, binds[port][i].mbutton)
|
||||
if (button_is_pressed(
|
||||
di->joypad,
|
||||
joypad_info, binds[port], port, i))
|
||||
ret |= (1 << i);
|
||||
else if (
|
||||
settings->uints.input_mouse_index[port] == 0
|
||||
&& dinput_mouse_button_pressed(
|
||||
di, port, binds[port][i].mbutton)
|
||||
)
|
||||
ret |= (1 << i);
|
||||
}
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (!input_dinput.keyboard_mapping_blocked)
|
||||
{
|
||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||
{
|
||||
if (binds[port][i].valid)
|
||||
{
|
||||
if (button_is_pressed(
|
||||
di->joypad, joypad_info,
|
||||
binds[port], port, i))
|
||||
ret |= (1 << i);
|
||||
else if ((binds[port][i].key < RETROK_LAST) &&
|
||||
if ((binds[port][i].key < RETROK_LAST) &&
|
||||
di->state[rarch_keysym_lut
|
||||
[(enum retro_key)binds[port][i].key]] & 0x80)
|
||||
ret |= (1 << i);
|
||||
else if (
|
||||
settings->uints.input_mouse_index[port] == 0
|
||||
&& dinput_mouse_button_pressed(
|
||||
di, port, binds[port][i].mbutton)
|
||||
)
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -789,30 +789,25 @@ static int16_t qnx_input_state(void *data,
|
||||
{
|
||||
unsigned i;
|
||||
int16_t ret = 0;
|
||||
if (input_qnx.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 (button_is_pressed(
|
||||
qnx->joypad,
|
||||
joypad_info, binds[port], port, i))
|
||||
ret |= (1 << i);
|
||||
}
|
||||
if (button_is_pressed(
|
||||
qnx->joypad,
|
||||
joypad_info, binds[port], port, i))
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (!input_qnx.keyboard_mapping_blocked)
|
||||
{
|
||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||
{
|
||||
if (binds[port][i].valid)
|
||||
{
|
||||
if (button_is_pressed(
|
||||
qnx->joypad,
|
||||
joypad_info, binds[port], port, i))
|
||||
ret |= (1 << i);
|
||||
else if (qnx_keyboard_pressed(qnx, key))
|
||||
if (qnx_keyboard_pressed(qnx, key))
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
@ -995,35 +995,27 @@ static int16_t udev_input_state(void *data,
|
||||
{
|
||||
unsigned i;
|
||||
int16_t ret = 0;
|
||||
if (input_udev.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 (button_is_pressed(
|
||||
udev->joypad,
|
||||
joypad_info, binds[port], port, i))
|
||||
ret |= (1 << i);
|
||||
else if (udev_mouse_button_pressed(udev, port, binds[port][i].mbutton))
|
||||
ret |= (1 << i);
|
||||
}
|
||||
if (button_is_pressed(
|
||||
udev->joypad,
|
||||
joypad_info, binds[port], port, i))
|
||||
ret |= (1 << i);
|
||||
else if (udev_mouse_button_pressed(udev, port, binds[port][i].mbutton))
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!input_udev.keyboard_mapping_blocked)
|
||||
{
|
||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||
{
|
||||
if (binds[port][i].valid)
|
||||
{
|
||||
if (button_is_pressed(udev->joypad,
|
||||
joypad_info, binds[port], port, i))
|
||||
ret |= (1 << i);
|
||||
else if ((binds[port][i].key < RETROK_LAST) &&
|
||||
if ((binds[port][i].key < RETROK_LAST) &&
|
||||
udev_keyboard_pressed(udev, binds[port][i].key))
|
||||
ret |= (1 << i);
|
||||
else if (udev_mouse_button_pressed(udev, port, binds[port][i].mbutton))
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -601,38 +601,28 @@ static int16_t winraw_input_state(void *d,
|
||||
unsigned i;
|
||||
int16_t ret = 0;
|
||||
|
||||
if (input_winraw.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 (button_is_pressed(
|
||||
wr->joypad,
|
||||
joypad_info, binds[port], port, i))
|
||||
ret |= (1 << i);
|
||||
else if (mouse && winraw_mouse_button_pressed(wr,
|
||||
mouse, port, binds[port][i].mbutton))
|
||||
ret |= (1 << i);
|
||||
}
|
||||
if (button_is_pressed(
|
||||
wr->joypad,
|
||||
joypad_info, binds[port], port, i))
|
||||
ret |= (1 << i);
|
||||
else if (mouse && winraw_mouse_button_pressed(wr,
|
||||
mouse, port, binds[port][i].mbutton))
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!input_winraw.keyboard_mapping_blocked)
|
||||
{
|
||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||
{
|
||||
if (binds[port][i].valid)
|
||||
{
|
||||
if (button_is_pressed(
|
||||
wr->joypad,
|
||||
joypad_info, binds[port], port, i))
|
||||
ret |= (1 << i);
|
||||
else if ((binds[port][i].key < RETROK_LAST) &&
|
||||
if ((binds[port][i].key < RETROK_LAST) &&
|
||||
winraw_keyboard_pressed(wr, binds[port][i].key))
|
||||
ret |= (1 << i);
|
||||
else if (mouse && winraw_mouse_button_pressed(wr,
|
||||
mouse, port, binds[port][i].mbutton))
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -290,37 +290,28 @@ static int16_t x_input_state(void *data,
|
||||
{
|
||||
unsigned i;
|
||||
int16_t ret = 0;
|
||||
if (input_x.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 (button_is_pressed(
|
||||
x11->joypad,
|
||||
joypad_info, binds[port], port, i))
|
||||
ret |= (1 << i);
|
||||
else if (x_mouse_button_pressed(x11, port,
|
||||
binds[port][i].mbutton))
|
||||
ret |= (1 << i);
|
||||
}
|
||||
if (button_is_pressed(
|
||||
x11->joypad,
|
||||
joypad_info, binds[port], port, i))
|
||||
ret |= (1 << i);
|
||||
else if (x_mouse_button_pressed(x11, port,
|
||||
binds[port][i].mbutton))
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!input_x.keyboard_mapping_blocked)
|
||||
{
|
||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||
{
|
||||
if (binds[port][i].valid)
|
||||
{
|
||||
if (button_is_pressed( x11->joypad,
|
||||
joypad_info, binds[port], port, i))
|
||||
ret |= (1 << i);
|
||||
else if ((binds[port][i].key < RETROK_LAST) &&
|
||||
if ((binds[port][i].key < RETROK_LAST) &&
|
||||
x_keyboard_pressed(x11, binds[port][i].key))
|
||||
ret |= (1 << i);
|
||||
else if (x_mouse_button_pressed(x11, port,
|
||||
binds[port][i].mbutton))
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user