input_menu_keys_pressed/keys_pressed optimizations - this time

without breaking hotkey enable
This commit is contained in:
twinaphex 2020-06-09 19:15:11 +02:00
parent bb4aa82cb3
commit b19e83aa6d

View File

@ -24029,9 +24029,22 @@ static void input_menu_keys_pressed(
}
}
/* Check the libretro input first */
if (p_rarch->input_driver_block_libretro_input)
{
for (i = 0; i < RARCH_FIRST_META_KEY; i++)
{
if (
input_keys_pressed_other_sources(
p_rarch, i, p_new_state))
{
BIT256_SET_PTR(p_new_state, i);
}
}
}
else
{
int16_t ret[MAX_USERS];
/* Check the libretro input first */
for (port = 0; port < port_max; port++)
{
joypad_info->joy_idx = settings->uints.input_joypad_map[port];
@ -24048,8 +24061,6 @@ static void input_menu_keys_pressed(
{
bool bit_pressed = false;
if (!p_rarch->input_driver_block_libretro_input)
{
for (port = 0; port < port_max; port++)
{
if (binds[port][i].valid && ret[port] & (UINT64_C(1) << i))
@ -24058,7 +24069,6 @@ static void input_menu_keys_pressed(
break;
}
}
}
if (bit_pressed || input_keys_pressed_other_sources(
p_rarch, i, p_new_state))
@ -24066,14 +24076,27 @@ static void input_menu_keys_pressed(
BIT256_SET_PTR(p_new_state, i);
}
}
}
/* Check the hotkeys */
if (p_rarch->input_driver_block_hotkey)
{
for (i = RARCH_FIRST_META_KEY; i < RARCH_BIND_LIST_END; i++)
{
if (
BIT64_GET(lifecycle_state, i)
|| input_keys_pressed_other_sources(p_rarch, i, p_new_state))
{
BIT256_SET_PTR(p_new_state, i);
}
}
}
else
{
for (i = RARCH_FIRST_META_KEY; i < RARCH_BIND_LIST_END; i++)
{
bool bit_pressed = false;
if (!p_rarch->input_driver_block_hotkey)
{
for (port = 0; port < port_max; port++)
{
const struct retro_keybind *mtkey = &input_config_binds[port][i];
@ -24091,7 +24114,6 @@ static void input_menu_keys_pressed(
break;
}
}
}
if ( bit_pressed
|| BIT64_GET(lifecycle_state, i)
@ -24179,16 +24201,29 @@ static void input_keys_pressed(
}
}
/* Check the libretro input first */
if (p_rarch->input_driver_block_libretro_input)
{
/* Check the libretro input first */
for (i = 0; i < RARCH_FIRST_META_KEY; i++)
{
if (input_keys_pressed_other_sources(p_rarch,
i, p_new_state))
{
BIT256_SET_PTR(p_new_state, i);
}
}
}
else
{
/* Check the libretro input first */
int16_t ret = p_rarch->current_input->input_state(
p_rarch->current_input_data,
joypad_info, &binds, 0, RETRO_DEVICE_JOYPAD, 0,
RETRO_DEVICE_ID_JOYPAD_MASK);
for (i = 0; i < RARCH_FIRST_META_KEY; i++)
{
bool bit_pressed = !p_rarch->input_driver_block_libretro_input
&& binds[i].valid && (ret & (UINT64_C(1) << i));
bool bit_pressed = binds[i].valid && (ret & (UINT64_C(1) << i));
if (bit_pressed || input_keys_pressed_other_sources(p_rarch,
i, p_new_state))
{
@ -24197,11 +24232,27 @@ static void input_keys_pressed(
}
}
if (p_rarch->input_driver_block_hotkey)
{
/* Check the hotkeys */
for (i = RARCH_FIRST_META_KEY; i < RARCH_BIND_LIST_END; i++)
{
bool bit_pressed = !p_rarch->input_driver_block_hotkey && binds[i].valid
&& p_rarch->current_input->input_state(p_rarch->current_input_data, joypad_info,
if (
BIT64_GET(lifecycle_state, i)
|| input_keys_pressed_other_sources(p_rarch, i, p_new_state))
{
BIT256_SET_PTR(p_new_state, i);
}
}
}
else
{
/* Check the hotkeys */
for (i = RARCH_FIRST_META_KEY; i < RARCH_BIND_LIST_END; i++)
{
bool bit_pressed = binds[i].valid
&& p_rarch->current_input->input_state(
p_rarch->current_input_data, joypad_info,
&binds, 0, RETRO_DEVICE_JOYPAD, 0, i);
if ( bit_pressed
|| BIT64_GET(lifecycle_state, i)
@ -24210,6 +24261,8 @@ static void input_keys_pressed(
BIT256_SET_PTR(p_new_state, i);
}
}
}
}
void *input_driver_get_data(void)