Make menu toggle binds work again - still latching issues

but same as before so no regression
This commit is contained in:
twinaphex 2017-01-11 11:48:26 +01:00
parent 03ba5b21df
commit 640d7e69f3
2 changed files with 59 additions and 53 deletions

View File

@ -611,6 +611,50 @@ static INLINE bool input_menu_keys_pressed_internal(
return false;
}
static bool runloop_cmd_get_state_menu_toggle_button_combo(
settings_t *settings, uint64_t *trigger_input)
{
switch (settings->input.menu_toggle_gamepad_combo)
{
case INPUT_TOGGLE_NONE:
return false;
case INPUT_TOGGLE_DOWN_Y_L_R:
if (!BIT64_GET(*trigger_input, RETRO_DEVICE_ID_JOYPAD_DOWN))
return false;
if (!BIT64_GET(*trigger_input, RETRO_DEVICE_ID_JOYPAD_Y))
return false;
if (!BIT64_GET(*trigger_input, RETRO_DEVICE_ID_JOYPAD_L))
return false;
if (!BIT64_GET(*trigger_input, RETRO_DEVICE_ID_JOYPAD_R))
return false;
break;
case INPUT_TOGGLE_L3_R3:
if (!BIT64_GET(*trigger_input, RETRO_DEVICE_ID_JOYPAD_L3))
return false;
if (!BIT64_GET(*trigger_input, RETRO_DEVICE_ID_JOYPAD_R3))
return false;
break;
case INPUT_TOGGLE_L1_R1_START_SELECT:
if (!BIT64_GET(*trigger_input, RETRO_DEVICE_ID_JOYPAD_START))
return false;
if (!BIT64_GET(*trigger_input, RETRO_DEVICE_ID_JOYPAD_SELECT))
return false;
if (!BIT64_GET(*trigger_input, RETRO_DEVICE_ID_JOYPAD_L))
return false;
if (!BIT64_GET(*trigger_input, RETRO_DEVICE_ID_JOYPAD_R))
return false;
break;
case INPUT_TOGGLE_START_SELECT:
if (!BIT64_GET(*trigger_input, RETRO_DEVICE_ID_JOYPAD_START))
return false;
if (!BIT64_GET(*trigger_input, RETRO_DEVICE_ID_JOYPAD_SELECT))
return false;
break;
}
return true;
}
/**
* input_menu_keys_pressed:
*
@ -680,15 +724,22 @@ uint64_t input_menu_keys_pressed(
input_driver_block_hotkey = true;
}
if (runloop_cmd_get_state_menu_toggle_button_combo(settings, &old_input)
|| input_menu_keys_pressed_internal(binds, settings, joypad_info, RARCH_MENU_TOGGLE, max_users,
settings->input.binds[0][RARCH_MENU_TOGGLE].valid,
settings->input.all_users_control_menu))
ret |= (UINT64_C(1) << RARCH_MENU_TOGGLE);
for (i = 0; i < RARCH_BIND_LIST_END; i++)
{
unsigned port;
const struct retro_keybind *binds[MAX_USERS] = {NULL};
if (input_menu_keys_pressed_internal(binds, settings, joypad_info, i, max_users,
if (i != RARCH_MENU_TOGGLE &&
input_menu_keys_pressed_internal(binds, settings, joypad_info, i, max_users,
settings->input.binds[0][i].valid,
settings->input.all_users_control_menu))
ret |= (UINT64_C(1) << i);
}
for (i = 0; i < max_users; i++)
@ -868,9 +919,13 @@ uint64_t input_keys_pressed(
input_driver_block_hotkey = false;
}
if (runloop_cmd_get_state_menu_toggle_button_combo(settings, &old_input)
|| input_keys_pressed_internal(settings, joypad_info, RARCH_MENU_TOGGLE, binds))
ret |= (UINT64_C(1) << RARCH_MENU_TOGGLE);
for (i = 0; i < RARCH_BIND_LIST_END; i++)
{
if (input_keys_pressed_internal(settings, joypad_info, i, binds))
if (i != RARCH_MENU_TOGGLE && input_keys_pressed_internal(settings, joypad_info, i, binds))
ret |= (UINT64_C(1) << i);
}

View File

@ -88,7 +88,7 @@
#endif
#ifdef HAVE_MENU
#define runloop_cmd_menu_press(current_input, old_input, trigger_input) (BIT64_GET(trigger_input, RARCH_MENU_TOGGLE) || runloop_cmd_get_state_menu_toggle_button_combo(settings, current_input, old_input, trigger_input))
#define runloop_cmd_menu_press(current_input, old_input, trigger_input) (BIT64_GET(trigger_input, RARCH_MENU_TOGGLE))
#endif
enum runloop_state
@ -178,55 +178,6 @@ void runloop_msg_queue_push(const char *msg,
#endif
}
#ifdef HAVE_MENU
static bool runloop_cmd_get_state_menu_toggle_button_combo(
settings_t *settings,
uint64_t current_input, uint64_t old_input,
uint64_t trigger_input)
{
switch (settings->input.menu_toggle_gamepad_combo)
{
case INPUT_TOGGLE_NONE:
return false;
case INPUT_TOGGLE_DOWN_Y_L_R:
if (!BIT64_GET(current_input, RETRO_DEVICE_ID_JOYPAD_DOWN))
return false;
if (!BIT64_GET(current_input, RETRO_DEVICE_ID_JOYPAD_Y))
return false;
if (!BIT64_GET(current_input, RETRO_DEVICE_ID_JOYPAD_L))
return false;
if (!BIT64_GET(current_input, RETRO_DEVICE_ID_JOYPAD_R))
return false;
break;
case INPUT_TOGGLE_L3_R3:
if (!BIT64_GET(current_input, RETRO_DEVICE_ID_JOYPAD_L3))
return false;
if (!BIT64_GET(current_input, RETRO_DEVICE_ID_JOYPAD_R3))
return false;
break;
case INPUT_TOGGLE_L1_R1_START_SELECT:
if (!BIT64_GET(current_input, RETRO_DEVICE_ID_JOYPAD_START))
return false;
if (!BIT64_GET(current_input, RETRO_DEVICE_ID_JOYPAD_SELECT))
return false;
if (!BIT64_GET(current_input, RETRO_DEVICE_ID_JOYPAD_L))
return false;
if (!BIT64_GET(current_input, RETRO_DEVICE_ID_JOYPAD_R))
return false;
break;
case INPUT_TOGGLE_START_SELECT:
if (!BIT64_GET(current_input, RETRO_DEVICE_ID_JOYPAD_START))
return false;
if (!BIT64_GET(current_input, RETRO_DEVICE_ID_JOYPAD_SELECT))
return false;
break;
}
input_driver_set_flushing_input();
return true;
}
#endif
/**
* rarch_game_specific_options:
*