Refactor meta_input_keys_pressed

This commit is contained in:
twinaphex 2014-10-03 00:55:44 +02:00
parent 8a1f15c460
commit 532938c5fa
3 changed files with 8 additions and 11 deletions

View File

@ -1486,21 +1486,20 @@ static void check_block_hotkey(bool enable_hotkey)
driver.block_libretro_input = use_hotkey_enable && enable_hotkey; driver.block_libretro_input = use_hotkey_enable && enable_hotkey;
} }
/* Returns a 64-bit mask of all pressed meta keys, starting /* Returns a 64-bit mask of all pressed keys, starting
* from the specified key up until the last queryable key * from bind ID 0 (RARCH_DEVICE_ID_JOYPAD_B) up until
* (key_end). * last bind ID (RARCH_BIND_LIST_END).
* *
* TODO: In case RARCH_BIND_LIST_END starts exceeding 64, * TODO: In case RARCH_BIND_LIST_END starts exceeding 64,
* and you need a bitmask of more than 64 entries, don't * and you need a bitmask of more than 64 entries, don't
* use this function. * use this function.
*/ */
retro_input_t meta_input_keys_pressed(unsigned key, retro_input_t input_keys_pressed(void)
unsigned key_end)
{ {
static const struct retro_keybind *binds[] = { g_settings.input.binds[0] }; static const struct retro_keybind *binds[] = { g_settings.input.binds[0] };
retro_input_t ret = 0; retro_input_t ret = 0;
int i; int i, key;
check_block_hotkey(driver.input->key_pressed(driver.input_data, check_block_hotkey(driver.input->key_pressed(driver.input_data,
RARCH_ENABLE_HOTKEY)); RARCH_ENABLE_HOTKEY));
@ -1513,7 +1512,7 @@ retro_input_t meta_input_keys_pressed(unsigned key,
input_push_analog_dpad(g_settings.input.autoconf_binds[i], input_push_analog_dpad(g_settings.input.autoconf_binds[i],
g_settings.input.analog_dpad_mode[i]); g_settings.input.analog_dpad_mode[i]);
for (; key < key_end; key++) for (key = 0; key < RARCH_BIND_LIST_END; key++)
{ {
bool state = false; bool state = false;

View File

@ -206,8 +206,7 @@ void input_push_analog_dpad(struct retro_keybind *binds, unsigned mode);
void input_pop_analog_dpad(struct retro_keybind *binds); void input_pop_analog_dpad(struct retro_keybind *binds);
retro_input_t meta_input_keys_pressed(unsigned key, retro_input_t input_keys_pressed(void);
unsigned key_end);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -3219,8 +3219,7 @@ bool rarch_main_iterate(void)
unsigned i; unsigned i;
static retro_input_t last_input = 0; static retro_input_t last_input = 0;
retro_input_t old_input, trigger_input; retro_input_t old_input, trigger_input;
retro_input_t input = meta_input_keys_pressed(0, retro_input_t input = input_keys_pressed();
RARCH_BIND_LIST_END);
old_input = last_input; old_input = last_input;
last_input = input; last_input = input;