mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 13:23:32 +00:00
Simplification/cleanup
This commit is contained in:
parent
422ce9396c
commit
95e807749d
@ -894,9 +894,11 @@ void input_menu_keys_pressed(void *data, retro_bits_t* p_new_state)
|
|||||||
|
|
||||||
for (i = 0; i < RARCH_BIND_LIST_END; i++)
|
for (i = 0; i < RARCH_BIND_LIST_END; i++)
|
||||||
{
|
{
|
||||||
|
bool bit_pressed = false;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(((!input_driver_block_libretro_input && ((i < RARCH_FIRST_META_KEY)))
|
(!input_driver_block_libretro_input && ((i < RARCH_FIRST_META_KEY)))
|
||||||
|| !input_driver_block_hotkey))
|
|| !input_driver_block_hotkey
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const input_device_driver_t *first = current_input->get_joypad_driver
|
const input_device_driver_t *first = current_input->get_joypad_driver
|
||||||
@ -906,21 +908,20 @@ void input_menu_keys_pressed(void *data, retro_bits_t* p_new_state)
|
|||||||
|
|
||||||
for (port = 0; port < port_max; port++)
|
for (port = 0; port < port_max; port++)
|
||||||
{
|
{
|
||||||
uint64_t joykey = 0;
|
uint64_t joykey = 0;
|
||||||
uint32_t joyaxis = 0;
|
uint32_t joyaxis = 0;
|
||||||
bool pressed = false;
|
|
||||||
const struct retro_keybind *mtkey = &input_config_binds[port][i];
|
const struct retro_keybind *mtkey = &input_config_binds[port][i];
|
||||||
|
|
||||||
if (!mtkey->valid)
|
if (!mtkey->valid)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
joypad_info.joy_idx = settings->uints.input_joypad_map[port];
|
joypad_info.joy_idx = settings->uints.input_joypad_map[port];
|
||||||
joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx];
|
joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx];
|
||||||
joypad_info.axis_threshold = input_driver_axis_threshold;
|
joypad_info.axis_threshold = input_driver_axis_threshold;
|
||||||
|
|
||||||
joykey = (input_config_binds[port][i].joykey != NO_BTN)
|
joykey = (input_config_binds[port][i].joykey != NO_BTN)
|
||||||
? input_config_binds[port][i].joykey : joypad_info.auto_binds[i].joykey;
|
? input_config_binds[port][i].joykey : joypad_info.auto_binds[i].joykey;
|
||||||
joyaxis = (input_config_binds[port][i].joyaxis != AXIS_NONE)
|
joyaxis = (input_config_binds[port][i].joyaxis != AXIS_NONE)
|
||||||
? input_config_binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis;
|
? input_config_binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis;
|
||||||
|
|
||||||
if (sec)
|
if (sec)
|
||||||
@ -929,33 +930,30 @@ void input_menu_keys_pressed(void *data, retro_bits_t* p_new_state)
|
|||||||
{
|
{
|
||||||
int16_t axis = sec->axis(joypad_info.joy_idx, joyaxis);
|
int16_t axis = sec->axis(joypad_info.joy_idx, joyaxis);
|
||||||
float scaled_axis = (float)abs(axis) / 0x8000;
|
float scaled_axis = (float)abs(axis) / 0x8000;
|
||||||
pressed = scaled_axis > joypad_info.axis_threshold;
|
bit_pressed = scaled_axis > joypad_info.axis_threshold;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pressed = true;
|
bit_pressed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pressed && first)
|
if (!bit_pressed && first)
|
||||||
{
|
{
|
||||||
if ((uint16_t)joykey == NO_BTN || !first->button(joypad_info.joy_idx, (uint16_t)joykey))
|
if ((uint16_t)joykey == NO_BTN || !first->button(joypad_info.joy_idx, (uint16_t)joykey))
|
||||||
{
|
{
|
||||||
int16_t axis = first->axis(joypad_info.joy_idx, joyaxis);
|
int16_t axis = first->axis(joypad_info.joy_idx, joyaxis);
|
||||||
float scaled_axis = (float)abs(axis) / 0x8000;
|
float scaled_axis = (float)abs(axis) / 0x8000;
|
||||||
pressed = scaled_axis > joypad_info.axis_threshold;
|
bit_pressed = scaled_axis > joypad_info.axis_threshold;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pressed = true;
|
bit_pressed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pressed)
|
if (bit_pressed)
|
||||||
{
|
break;
|
||||||
BIT256_SET_PTR(p_new_state, i);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input_keys_pressed_iterate(i, p_new_state))
|
if (bit_pressed || input_keys_pressed_iterate(i, p_new_state))
|
||||||
{
|
{
|
||||||
BIT256_SET_PTR(p_new_state, i);
|
BIT256_SET_PTR(p_new_state, i);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user