input_keys_pressed - start splitting up big for loop into

optimized smaller parts
This commit is contained in:
twinaphex 2016-10-22 07:05:19 +02:00
parent 4d002ec682
commit a564ac0701

View File

@ -617,6 +617,7 @@ void state_tracker_update_input(uint16_t *input1, uint16_t *input2)
retro_input_t input_keys_pressed(void)
{
unsigned i;
bool states[RARCH_BIND_LIST_END];
retro_input_t ret;
ret.type = 0;
@ -632,38 +633,50 @@ retro_input_t input_keys_pressed(void)
else
input_driver_block_libretro_input = false;
for (i = 0; i < RARCH_BIND_LIST_END; i++)
if (current_input->key_pressed)
{
bool state = false;
if (((!input_driver_block_libretro_input && ((i < RARCH_FIRST_META_KEY)))
|| !input_driver_block_hotkey) && current_input->key_pressed)
state = current_input->key_pressed(current_input_data, i);
if (i >= RARCH_FIRST_META_KEY)
state |= current_input->meta_key_pressed(current_input_data, i);
for (i = 0; i < RARCH_BIND_LIST_END; i++)
{
if ((!input_driver_block_libretro_input && ((i < RARCH_FIRST_META_KEY)))
|| !input_driver_block_hotkey)
states[i] = current_input->key_pressed(current_input_data, i);
}
}
#ifdef HAVE_OVERLAY
state |= input_overlay_key_pressed(i);
for (i = 0; i < RARCH_BIND_LIST_END; i++)
states[i] |= input_overlay_key_pressed(i);
#endif
#ifdef HAVE_COMMAND
if (input_driver_command)
if (input_driver_command)
{
for (i = 0; i < RARCH_BIND_LIST_END; i++)
{
command_handle_t handle;
handle.handle = input_driver_command;
handle.id = i;
state |= command_get(&handle);
states[i] |= command_get(&handle);
}
}
#endif
#ifdef HAVE_NETWORKGAMEPAD
if (input_driver_remote)
state |= input_remote_key_pressed(i, 0);
if (input_driver_remote)
{
for (i = 0; i < RARCH_BIND_LIST_END; i++)
states[i] |= input_remote_key_pressed(i, 0);
}
#endif
if (state)
for (i = RARCH_FIRST_META_KEY; i < RARCH_BIND_LIST_END; i++)
states[i] |= current_input->meta_key_pressed(current_input_data, i);
for (i = 0; i < RARCH_BIND_LIST_END; i++)
{
if (states[i])
ret.state |= (UINT64_C(1) << i);
}