Further cleanups - aim is to make both of these functions one and the

same
This commit is contained in:
twinaphex 2020-06-09 20:00:24 +02:00
parent 7b879c2a2b
commit c09a3b75ab

View File

@ -23975,28 +23975,13 @@ static void input_menu_keys_pressed(
struct rarch_state *p_rarch,
input_bits_t *p_new_state,
const struct retro_keybind **binds,
const struct retro_keybind *binds_norm,
const struct retro_keybind *binds_auto,
rarch_joypad_info_t *joypad_info)
{
unsigned i;
settings_t *settings = p_rarch->configuration_settings;
uint8_t max_users = (uint8_t)p_rarch->input_driver_max_users;
uint8_t port_max = 1;
const struct retro_keybind *binds_norm = &input_config_binds[port][RARCH_ENABLE_HOTKEY];
const struct retro_keybind *binds_auto = &input_autoconf_binds[port][RARCH_ENABLE_HOTKEY];
joypad_info->joy_idx = settings->uints.input_joypad_map[port];
joypad_info->auto_binds = input_autoconf_binds[joypad_info->joy_idx];
joypad_info->axis_threshold = p_rarch->input_driver_axis_threshold;
for (i = 0; i < max_users; i++)
{
struct retro_keybind *auto_binds = input_autoconf_binds[i];
struct retro_keybind *general_binds = input_config_binds[i];
binds[i] = input_config_binds[i];
INPUT_PUSH_ANALOG_DPAD(auto_binds, ANALOG_DPAD_LSTICK);
INPUT_PUSH_ANALOG_DPAD(general_binds, ANALOG_DPAD_LSTICK);
}
int input_hotkey_block_delay = settings->uints.input_hotkey_block_delay;
if (CHECK_INPUT_DRIVER_BLOCK_HOTKEY(binds_norm, binds_auto))
{
@ -24009,7 +23994,6 @@ static void input_menu_keys_pressed(
&binds[0], port, RETRO_DEVICE_JOYPAD, 0,
RARCH_ENABLE_HOTKEY))
{
int input_hotkey_block_delay = settings->uints.input_hotkey_block_delay;
if (p_rarch->input_hotkey_block_counter < input_hotkey_block_delay)
p_rarch->input_hotkey_block_counter++;
else
@ -24085,13 +24069,6 @@ static void input_menu_keys_pressed(
}
}
for (i = 0; i < max_users; i++)
{
struct retro_keybind *auto_binds = input_autoconf_binds[i];
struct retro_keybind *general_binds = input_config_binds[i];
INPUT_POP_ANALOG_DPAD(auto_binds);
INPUT_POP_ANALOG_DPAD(general_binds);
}
}
#endif
@ -24106,17 +24083,13 @@ static void input_keys_pressed(
unsigned port,
struct rarch_state *p_rarch,
input_bits_t *p_new_state,
const struct retro_keybind *binds_norm,
const struct retro_keybind *binds_auto,
rarch_joypad_info_t *joypad_info)
{
unsigned i;
settings_t *settings = p_rarch->configuration_settings;
const struct retro_keybind *binds = input_config_binds[0];
const struct retro_keybind *binds_norm = &input_config_binds[port][RARCH_ENABLE_HOTKEY];
const struct retro_keybind *binds_auto = &input_autoconf_binds[port][RARCH_ENABLE_HOTKEY];
joypad_info->joy_idx = settings->uints.input_joypad_map[port];
joypad_info->auto_binds = input_autoconf_binds[joypad_info->joy_idx];
joypad_info->axis_threshold = p_rarch->input_driver_axis_threshold;
if (CHECK_INPUT_DRIVER_BLOCK_HOTKEY(binds_norm, binds_auto))
{
@ -36196,7 +36169,6 @@ static enum runloop_state runloop_check_state(
retro_time_t current_time)
{
input_bits_t current_bits;
rarch_joypad_info_t joypad_info;
#ifdef HAVE_MENU
static input_bits_t last_input = {{0}};
#endif
@ -36244,15 +36216,47 @@ static enum runloop_state runloop_check_state(
if (p_rarch->current_input->keyboard_mapping_blocked)
p_rarch->input_driver_block_hotkey = true;
joypad_info.joy_idx = 0;
joypad_info.auto_binds = NULL;
{
rarch_joypad_info_t joypad_info;
#ifdef HAVE_MENU
bool menu_input_active = false;
#endif
unsigned port = 0;
const struct retro_keybind *binds_norm = &input_config_binds[port][RARCH_ENABLE_HOTKEY];
const struct retro_keybind *binds_auto = &input_autoconf_binds[port][RARCH_ENABLE_HOTKEY];
joypad_info.joy_idx = settings->uints.input_joypad_map[port];
joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx];
joypad_info.axis_threshold = p_rarch->input_driver_axis_threshold;
#ifdef HAVE_MENU
if (menu_is_alive && !(settings->bools.menu_unified_controls && !display_kb))
menu_input_active = menu_is_alive && !(settings->bools.menu_unified_controls && !display_kb);
if (menu_input_active)
{
unsigned i;
const struct retro_keybind *binds[MAX_USERS] = {NULL};
input_menu_keys_pressed(0, p_rarch,
&current_bits, &binds[0], &joypad_info);
uint8_t max_users = (uint8_t)p_rarch->input_driver_max_users;
for (i = 0; i < max_users; i++)
{
struct retro_keybind *auto_binds = input_autoconf_binds[i];
struct retro_keybind *general_binds = input_config_binds[i];
binds[i] = input_config_binds[i];
INPUT_PUSH_ANALOG_DPAD(auto_binds, ANALOG_DPAD_LSTICK);
INPUT_PUSH_ANALOG_DPAD(general_binds, ANALOG_DPAD_LSTICK);
}
input_menu_keys_pressed(port, p_rarch,
&current_bits, &binds[0], binds_norm, binds_auto,
&joypad_info);
for (i = 0; i < max_users; i++)
{
struct retro_keybind *auto_binds = input_autoconf_binds[i];
struct retro_keybind *general_binds = input_config_binds[i];
INPUT_POP_ANALOG_DPAD(auto_binds);
INPUT_POP_ANALOG_DPAD(general_binds);
}
if (!display_kb)
{
@ -36307,8 +36311,15 @@ static enum runloop_state runloop_check_state(
else
#endif
{
input_keys_pressed(0, p_rarch,
&current_bits, &joypad_info);
input_keys_pressed(port, p_rarch,
&current_bits, binds_norm, binds_auto,
&joypad_info);
}
#ifdef HAVE_MENU
if (!menu_input_active)
#endif
{
#ifdef HAVE_ACCESSIBILITY
#ifdef HAVE_TRANSLATE
if (settings->bools.ai_service_enable)
@ -36327,6 +36338,7 @@ static enum runloop_state runloop_check_state(
#endif
#endif
}
}
#ifdef HAVE_MENU
last_input = current_bits;