(Input) Split for loops up into two - first check button keys,

then check the meta keys
This commit is contained in:
twinaphex 2019-06-20 13:31:00 +02:00
parent ce3f46adbd
commit 3a8df35d4d

View File

@ -2910,6 +2910,12 @@ static void input_menu_keys_pressed(input_bits_t *p_new_state)
} }
} }
{
const input_device_driver_t *first = current_input->get_joypad_driver
? current_input->get_joypad_driver(current_input_data) : NULL;
const input_device_driver_t *sec = current_input->get_sec_joypad_driver
? current_input->get_sec_joypad_driver(current_input_data) : NULL;
for (i = 0; i < RARCH_BIND_LIST_END; i++) for (i = 0; i < RARCH_BIND_LIST_END; i++)
{ {
bool bit_pressed = false; bool bit_pressed = false;
@ -2919,11 +2925,6 @@ static void input_menu_keys_pressed(input_bits_t *p_new_state)
|| !input_driver_block_hotkey || !input_driver_block_hotkey
) )
{ {
const input_device_driver_t *first = current_input->get_joypad_driver
? current_input->get_joypad_driver(current_input_data) : NULL;
const input_device_driver_t *sec = current_input->get_sec_joypad_driver
? current_input->get_sec_joypad_driver(current_input_data) : NULL;
for (port = 0; port < port_max; port++) for (port = 0; port < port_max; port++)
{ {
uint16_t joykey = 0; uint16_t joykey = 0;
@ -2969,11 +2970,14 @@ static void input_menu_keys_pressed(input_bits_t *p_new_state)
} }
} }
if (bit_pressed || 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);
} }
} }
}
for (i = 0; i < max_users; i++) for (i = 0; i < max_users; i++)
{ {
@ -3116,23 +3120,45 @@ static void input_keys_pressed(input_bits_t *p_new_state)
} }
} }
for (i = 0; i < RARCH_BIND_LIST_END; i++) /* Check the libretro input first */
if (!input_driver_block_libretro_input)
{ {
bool bit_pressed = ( for (i = 0; i < RARCH_FIRST_META_KEY; i++)
(!input_driver_block_libretro_input && ((i < RARCH_FIRST_META_KEY))) {
|| !input_driver_block_hotkey) bool bit_pressed =
&&
binds[i].valid && current_input->input_state(current_input_data, binds[i].valid && current_input->input_state(current_input_data,
joypad_info, &binds, joypad_info, &binds,
0, RETRO_DEVICE_JOYPAD, 0, i); 0, RETRO_DEVICE_JOYPAD, 0, i);
if (bit_pressed || 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);
} }
} }
} }
/* Check the hotkeys */
if (!input_driver_block_hotkey)
{
for (i = RARCH_FIRST_META_KEY; i < RARCH_BIND_LIST_END; i++)
{
bool bit_pressed =
binds[i].valid && current_input->input_state(current_input_data,
joypad_info, &binds,
0, RETRO_DEVICE_JOYPAD, 0, i);
if (
bit_pressed ||
input_keys_pressed_iterate(i, p_new_state))
{
BIT256_SET_PTR(p_new_state, i);
}
}
}
}
void input_get_state_for_port(void *data, unsigned port, void input_get_state_for_port(void *data, unsigned port,
input_bits_t *p_new_state) input_bits_t *p_new_state)
{ {