mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 08:37:41 +00:00
input_menu_keys_pressed/keys_pressed optimizations - this time
without breaking hotkey enable
This commit is contained in:
parent
bb4aa82cb3
commit
b19e83aa6d
135
retroarch.c
135
retroarch.c
@ -24029,15 +24029,28 @@ 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];
|
int16_t ret[MAX_USERS];
|
||||||
/* Check the libretro input first */
|
|
||||||
for (port = 0; port < port_max; port++)
|
for (port = 0; port < port_max; port++)
|
||||||
{
|
{
|
||||||
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 = p_rarch->input_driver_axis_threshold;
|
joypad_info->axis_threshold = p_rarch->input_driver_axis_threshold;
|
||||||
ret[port] =
|
ret[port] =
|
||||||
p_rarch->current_input->input_state(
|
p_rarch->current_input->input_state(
|
||||||
p_rarch->current_input_data,
|
p_rarch->current_input_data,
|
||||||
joypad_info, &binds[0], port, RETRO_DEVICE_JOYPAD, 0,
|
joypad_info, &binds[0], port, RETRO_DEVICE_JOYPAD, 0,
|
||||||
@ -24048,15 +24061,12 @@ static void input_menu_keys_pressed(
|
|||||||
{
|
{
|
||||||
bool bit_pressed = false;
|
bool bit_pressed = false;
|
||||||
|
|
||||||
if (!p_rarch->input_driver_block_libretro_input)
|
for (port = 0; port < port_max; port++)
|
||||||
{
|
{
|
||||||
for (port = 0; port < port_max; port++)
|
if (binds[port][i].valid && ret[port] & (UINT64_C(1) << i))
|
||||||
{
|
{
|
||||||
if (binds[port][i].valid && ret[port] & (UINT64_C(1) << i))
|
bit_pressed = true;
|
||||||
{
|
break;
|
||||||
bit_pressed = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24066,30 +24076,42 @@ static void input_menu_keys_pressed(
|
|||||||
BIT256_SET_PTR(p_new_state, i);
|
BIT256_SET_PTR(p_new_state, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Check the hotkeys */
|
/* 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++)
|
for (i = RARCH_FIRST_META_KEY; i < RARCH_BIND_LIST_END; i++)
|
||||||
{
|
{
|
||||||
bool bit_pressed = false;
|
bool bit_pressed = false;
|
||||||
|
|
||||||
if (!p_rarch->input_driver_block_hotkey)
|
for (port = 0; port < port_max; port++)
|
||||||
{
|
{
|
||||||
for (port = 0; port < port_max; port++)
|
const struct retro_keybind *mtkey = &input_config_binds[port][i];
|
||||||
{
|
if (!mtkey->valid)
|
||||||
const struct retro_keybind *mtkey = &input_config_binds[port][i];
|
continue;
|
||||||
if (!mtkey->valid)
|
joypad_info->joy_idx = settings->uints.input_joypad_map[port];
|
||||||
continue;
|
joypad_info->auto_binds = input_autoconf_binds[joypad_info->joy_idx];
|
||||||
joypad_info->joy_idx = settings->uints.input_joypad_map[port];
|
joypad_info->axis_threshold = p_rarch->input_driver_axis_threshold;
|
||||||
joypad_info->auto_binds = input_autoconf_binds[joypad_info->joy_idx];
|
|
||||||
joypad_info->axis_threshold = p_rarch->input_driver_axis_threshold;
|
|
||||||
|
|
||||||
if (p_rarch->current_input->input_state(
|
if (p_rarch->current_input->input_state(
|
||||||
p_rarch->current_input_data, joypad_info,
|
p_rarch->current_input_data, joypad_info,
|
||||||
&binds[0], port, RETRO_DEVICE_JOYPAD, 0, i))
|
&binds[0], port, RETRO_DEVICE_JOYPAD, 0, i))
|
||||||
{
|
{
|
||||||
bit_pressed = true;
|
bit_pressed = true;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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(
|
int16_t ret = p_rarch->current_input->input_state(
|
||||||
p_rarch->current_input_data,
|
p_rarch->current_input_data,
|
||||||
joypad_info, &binds, 0, RETRO_DEVICE_JOYPAD, 0,
|
joypad_info, &binds, 0, RETRO_DEVICE_JOYPAD, 0,
|
||||||
RETRO_DEVICE_ID_JOYPAD_MASK);
|
RETRO_DEVICE_ID_JOYPAD_MASK);
|
||||||
|
|
||||||
for (i = 0; i < RARCH_FIRST_META_KEY; i++)
|
for (i = 0; i < RARCH_FIRST_META_KEY; i++)
|
||||||
{
|
{
|
||||||
bool bit_pressed = !p_rarch->input_driver_block_libretro_input
|
bool bit_pressed = binds[i].valid && (ret & (UINT64_C(1) << i));
|
||||||
&& binds[i].valid && (ret & (UINT64_C(1) << i));
|
|
||||||
if (bit_pressed || input_keys_pressed_other_sources(p_rarch,
|
if (bit_pressed || input_keys_pressed_other_sources(p_rarch,
|
||||||
i, p_new_state))
|
i, p_new_state))
|
||||||
{
|
{
|
||||||
@ -24197,19 +24232,37 @@ static void input_keys_pressed(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check the hotkeys */
|
if (p_rarch->input_driver_block_hotkey)
|
||||||
for (i = RARCH_FIRST_META_KEY; i < RARCH_BIND_LIST_END; i++)
|
|
||||||
{
|
{
|
||||||
bool bit_pressed = !p_rarch->input_driver_block_hotkey && binds[i].valid
|
/* Check the hotkeys */
|
||||||
&& p_rarch->current_input->input_state(p_rarch->current_input_data, joypad_info,
|
for (i = RARCH_FIRST_META_KEY; i < RARCH_BIND_LIST_END; i++)
|
||||||
&binds, 0, RETRO_DEVICE_JOYPAD, 0, i);
|
|
||||||
if ( bit_pressed
|
|
||||||
|| BIT64_GET(lifecycle_state, i)
|
|
||||||
|| input_keys_pressed_other_sources(p_rarch, i, p_new_state))
|
|
||||||
{
|
{
|
||||||
BIT256_SET_PTR(p_new_state, 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
|
||||||
|
{
|
||||||
|
/* 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)
|
||||||
|
|| input_keys_pressed_other_sources(p_rarch, i, p_new_state))
|
||||||
|
{
|
||||||
|
BIT256_SET_PTR(p_new_state, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void *input_driver_get_data(void)
|
void *input_driver_get_data(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user