- Move input flushing hack to input_keys_pressed functions

- Move menu binding state hack to menu_input_keys_pressed
This commit is contained in:
twinaphex 2016-12-06 20:50:29 +01:00
parent 77df0ef3ae
commit 4b1c24adf9
3 changed files with 53 additions and 24 deletions

View File

@ -28,6 +28,10 @@
#include "input_keyboard.h"
#include "input_remapping.h"
#ifdef HAVE_MENU
#include "../menu/menu_driver.h"
#endif
#include "../configuration.h"
#include "../driver.h"
#include "../retroarch.h"
@ -666,7 +670,8 @@ static INLINE bool input_keys_pressed_internal(unsigned i,
uint64_t input_keys_pressed(
uint64_t old_input,
uint64_t *last_input,
uint64_t *trigger_input)
uint64_t *trigger_input,
bool runloop_paused)
{
unsigned i;
uint64_t ret = 0;
@ -712,6 +717,23 @@ uint64_t input_keys_pressed(
*trigger_input = ret & ~old_input;
*last_input = ret;
if (input_driver_flushing_input)
{
input_driver_flushing_input = false;
if (ret)
{
ret = 0;
/* If core was paused before entering menu, evoke
* pause toggle to wake it up. */
if (runloop_paused)
BIT64_SET(ret, RARCH_PAUSE_TOGGLE);
input_driver_flushing_input = true;
}
}
return ret;
}
@ -731,7 +753,8 @@ uint64_t input_keys_pressed(
uint64_t input_menu_keys_pressed(
uint64_t old_input,
uint64_t *last_input,
uint64_t *trigger_input)
uint64_t *trigger_input,
bool runloop_paused)
{
unsigned i;
uint64_t ret = 0;
@ -851,6 +874,28 @@ uint64_t input_menu_keys_pressed(
end:
*trigger_input = ret & ~old_input;
*last_input = ret;
if (input_driver_flushing_input)
{
input_driver_flushing_input = false;
if (ret)
{
ret = 0;
/* If core was paused before entering menu, evoke
* pause toggle to wake it up. */
if (runloop_paused)
BIT64_SET(ret, RARCH_PAUSE_TOGGLE);
input_driver_flushing_input = true;
}
}
#ifdef HAVE_MENU
if (menu_driver_is_binding_state())
*trigger_input = 0;
#endif
return ret;
}

View File

@ -259,12 +259,14 @@ int16_t input_state(unsigned port, unsigned device,
uint64_t input_keys_pressed(
uint64_t old_input,
uint64_t *last_input,
uint64_t *trigger_input);
uint64_t *trigger_input,
bool runloop_paused);
uint64_t input_menu_keys_pressed(
uint64_t old_input,
uint64_t *last_input,
uint64_t *trigger_input);
uint64_t *trigger_input,
bool runloop_paused);
void *input_driver_get_data(void);

View File

@ -759,24 +759,6 @@ static enum runloop_state runloop_check_state(
bool focused = true;
bool pause_pressed = runloop_cmd_triggered(trigger_input, RARCH_PAUSE_TOGGLE);
if (input_driver_is_flushing_input())
{
input_driver_unset_flushing_input();
if (current_input)
{
current_input = 0;
/* If core was paused before entering menu, evoke
* pause toggle to wake it up. */
if (runloop_paused)
BIT64_SET(current_input, RARCH_PAUSE_TOGGLE);
input_driver_set_flushing_input();
}
}
if (menu_driver_is_binding_state())
trigger_input = 0;
if (runloop_cmd_triggered(trigger_input, RARCH_OVERLAY_NEXT))
command_event(CMD_EVENT_OVERLAY_NEXT, NULL);
@ -1113,8 +1095,8 @@ int runloop_iterate(unsigned *sleep_ms)
uint64_t old_input = last_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);
input_menu_keys_pressed(old_input, &last_input, &trigger_input, runloop_paused) :
input_keys_pressed (old_input, &last_input, &trigger_input, runloop_paused);
if (runloop_frame_time.callback)
{