mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
(QNX) Get rid of qnx_is_pressed
This commit is contained in:
parent
5b81b6887b
commit
dd79629015
@ -743,32 +743,6 @@ static bool qnx_keyboard_pressed(qnx_input_t *qnx, unsigned id)
|
||||
return id < RETROK_LAST && BIT_GET(qnx->keyboard_state, bit);
|
||||
}
|
||||
|
||||
static int16_t qnx_is_pressed(
|
||||
qnx_input_t *qnx,
|
||||
const input_device_driver_t *joypad,
|
||||
rarch_joypad_info_t *joypad_info,
|
||||
const struct retro_keybind *binds,
|
||||
unsigned port, unsigned id)
|
||||
{
|
||||
const struct retro_keybind *bind = &binds[id];
|
||||
int key = bind->key;
|
||||
/* 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;
|
||||
if (qnx_keyboard_pressed(qnx, key))
|
||||
if ((id == RARCH_GAME_FOCUS_TOGGLE) || !input_qnx.keyboard_mapping_blocked)
|
||||
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 qnx_pointer_input_state(qnx_input_t *qnx,
|
||||
unsigned idx, unsigned id, bool screen)
|
||||
{
|
||||
@ -815,14 +789,32 @@ static int16_t qnx_input_state(void *data,
|
||||
{
|
||||
unsigned i;
|
||||
int16_t ret = 0;
|
||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||
if (input_qnx.keyboard_mapping_blocked)
|
||||
{
|
||||
if (binds[port][i].valid)
|
||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||
{
|
||||
if (qnx_is_pressed(
|
||||
qnx, qnx->joypad,
|
||||
joypad_info, binds[port], port, i))
|
||||
ret |= (1 << i);
|
||||
if (binds[port][i].valid)
|
||||
{
|
||||
if (button_is_pressed(
|
||||
qnx->joypad,
|
||||
joypad_info, binds[port], port, i))
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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))
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -834,9 +826,15 @@ static int16_t qnx_input_state(void *data,
|
||||
{
|
||||
if (binds[port][id].valid)
|
||||
{
|
||||
if (qnx_is_pressed(qnx, qnx->joypad,
|
||||
if (button_is_pressed(qnx->joypad,
|
||||
joypad_info, binds[port], port, id))
|
||||
return 1;
|
||||
else if (
|
||||
((id == RARCH_GAME_FOCUS_TOGGLE) ||
|
||||
!input_qnx.keyboard_mapping_blocked) &&
|
||||
qnx_keyboard_pressed(qnx, key)
|
||||
)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user