Refactor old_state out of meta_input_keys_pressed into rarch_main_iterate

This commit is contained in:
Vladimir Panteleev 2014-09-30 08:35:41 +00:00
parent 043cfdbb43
commit 0c104ffef8
3 changed files with 7 additions and 11 deletions

View File

@ -1625,22 +1625,16 @@ retro_input_t input_keys_pressed(unsigned key,
* from the specified key up until the last queryable key
* (key_end).
*
* Because this function keeps a copy of the old input state,
* it should only be called once per frame (currently in
* rarch_main_iterate);
*
* TODO: In case RARCH_BIND_LIST_END starts exceeding 64,
* and you need a bitmask of more than 64 entries, don't
* use this function.
*/
retro_input_t meta_input_keys_pressed(unsigned key,
unsigned key_end, retro_input_t *old_state)
unsigned key_end)
{
static retro_input_t old_ret = 0;
static const struct retro_keybind *binds[] = { g_settings.input.binds[0] };
retro_input_t ret = 0;
*old_state = old_ret;
int i;
#ifdef RARCH_INTERNAL
@ -1680,8 +1674,6 @@ retro_input_t meta_input_keys_pressed(unsigned key,
for (i = 0; i < MAX_PLAYERS; i++)
input_pop_analog_dpad(g_settings.input.autoconf_binds[i]);
old_ret = ret;
return ret;
}
#endif

View File

@ -216,7 +216,7 @@ retro_input_t input_keys_pressed(unsigned key,
unsigned key_end, const struct retro_keybind **binds);
retro_input_t meta_input_keys_pressed(unsigned key,
unsigned key_end, retro_input_t *old_state);
unsigned key_end);
#ifdef __cplusplus
}

View File

@ -3229,9 +3229,13 @@ static bool do_menu_oneshot(
bool rarch_main_iterate(void)
{
unsigned i;
static retro_input_t last_input = 0;
retro_input_t old_input, trigger_input;
retro_input_t input = meta_input_keys_pressed(0,
RARCH_BIND_LIST_END, &old_input);
RARCH_BIND_LIST_END);
old_input = last_input;
last_input = input;
if (driver.flushing_input)
{