Merge pull request #1066 from CyberShadow/pull-20140930-083313

Refactor old_state out of meta_input_keys_pressed into rarch_main_iterate
This commit is contained in:
Twinaphex 2014-09-30 10:40:43 +02:00
commit 9f5031188b
3 changed files with 7 additions and 11 deletions

View File

@ -1604,22 +1604,16 @@ void input_pop_analog_dpad(struct retro_keybind *binds)
* 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
@ -1661,8 +1655,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

@ -213,7 +213,7 @@ void input_push_analog_dpad(struct retro_keybind *binds, unsigned mode);
void input_pop_analog_dpad(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

@ -3243,9 +3243,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)
{