Rebase input_key_pressed/input_menu_keys_pressed

This commit is contained in:
twinaphex 2016-12-06 18:12:35 +01:00
parent 44324ec62f
commit 77df0ef3ae
3 changed files with 28 additions and 11 deletions

View File

@ -663,7 +663,10 @@ static INLINE bool input_keys_pressed_internal(unsigned i,
*
* Returns: Input sample containg a mask of all pressed keys.
*/
uint64_t input_keys_pressed(void)
uint64_t input_keys_pressed(
uint64_t old_input,
uint64_t *last_input,
uint64_t *trigger_input)
{
unsigned i;
uint64_t ret = 0;
@ -707,6 +710,8 @@ uint64_t input_keys_pressed(void)
ret |= (UINT64_C(1) << i);
}
*trigger_input = ret & ~old_input;
*last_input = ret;
return ret;
}
@ -723,7 +728,10 @@ uint64_t input_keys_pressed(void)
*
* Returns: Input sample containg a mask of all pressed keys.
*/
uint64_t input_menu_keys_pressed(void)
uint64_t input_menu_keys_pressed(
uint64_t old_input,
uint64_t *last_input,
uint64_t *trigger_input)
{
unsigned i;
uint64_t ret = 0;
@ -733,7 +741,7 @@ uint64_t input_menu_keys_pressed(void)
const struct retro_keybind *binds_auto = NULL;
if (!current_input || !current_input_data)
return ret;
goto end;
for (i = 0; i < settings->input.max_users; i++)
{
@ -776,7 +784,7 @@ uint64_t input_menu_keys_pressed(void)
}
if (menu_input_dialog_get_display_kb())
return ret;
goto end;
if (current_input->input_state(current_input_data, binds, 0,
RETRO_DEVICE_KEYBOARD, 0, RETROK_RETURN))
@ -840,6 +848,9 @@ uint64_t input_menu_keys_pressed(void)
RETRO_DEVICE_KEYBOARD, 0, settings->input.binds[0][RARCH_FULLSCREEN_TOGGLE_KEY].key ))
BIT64_SET(ret, RARCH_FULLSCREEN_TOGGLE_KEY);
end:
*trigger_input = ret & ~old_input;
*last_input = ret;
return ret;
}

View File

@ -256,9 +256,15 @@ void input_poll(void);
int16_t input_state(unsigned port, unsigned device,
unsigned idx, unsigned id);
uint64_t input_keys_pressed(void);
uint64_t input_keys_pressed(
uint64_t old_input,
uint64_t *last_input,
uint64_t *trigger_input);
uint64_t input_menu_keys_pressed(void);
uint64_t input_menu_keys_pressed(
uint64_t old_input,
uint64_t *last_input,
uint64_t *trigger_input);
void *input_driver_get_data(void);

View File

@ -1107,14 +1107,14 @@ int runloop_iterate(unsigned *sleep_ms)
{
unsigned i;
retro_time_t current, target, to_sleep_ms;
uint64_t trigger_input = 0;
static uint64_t last_input = 0;
settings_t *settings = config_get_ptr();
uint64_t current_input = menu_driver_ctl(
RARCH_MENU_CTL_IS_ALIVE, NULL) ?
input_menu_keys_pressed() : input_keys_pressed();
uint64_t old_input = last_input;
uint64_t trigger_input = current_input & ~old_input;
last_input = current_input;
uint64_t current_input =
menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL) ?
input_menu_keys_pressed(old_input, &last_input, &trigger_input) :
input_keys_pressed (old_input, &last_input, &trigger_input);
if (runloop_frame_time.callback)
{