mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-02 17:53:40 +00:00
Add input_menu_keys_pressed
This commit is contained in:
parent
5a70656746
commit
a9a2749af9
@ -660,6 +660,77 @@ uint64_t input_keys_pressed(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* input_menu_keys_pressed:
|
||||
*
|
||||
* Grab an input sample for this frame. We exclude
|
||||
* keyboard input here.
|
||||
*
|
||||
* TODO: In case RARCH_BIND_LIST_END starts exceeding 64,
|
||||
* and you need a bitmask of more than 64 entries, reimplement
|
||||
* it to use something like rarch_bits_t.
|
||||
*
|
||||
* Returns: Input sample containg a mask of all pressed keys.
|
||||
*/
|
||||
uint64_t input_menu_keys_pressed(void)
|
||||
{
|
||||
unsigned i;
|
||||
uint64_t ret = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!current_input || !current_input_data)
|
||||
return ret;
|
||||
|
||||
if (current_input->key_pressed &&
|
||||
check_input_driver_block_hotkey(
|
||||
current_input->key_pressed(current_input_data, RARCH_ENABLE_HOTKEY)))
|
||||
input_driver_block_libretro_input = true;
|
||||
else
|
||||
input_driver_block_libretro_input = false;
|
||||
|
||||
for (i = 0; i < RARCH_BIND_LIST_END; i++)
|
||||
{
|
||||
bool state = false;
|
||||
if (((((!input_driver_block_libretro_input && ((i < RARCH_FIRST_META_KEY)))
|
||||
|| !input_driver_block_hotkey) && current_input->key_pressed))
|
||||
&& settings->input.binds[0][i].valid)
|
||||
{
|
||||
state = input_joypad_pressed(input_driver_get_joypad_driver(),
|
||||
0, settings->input.binds[0], i);
|
||||
}
|
||||
|
||||
if (i >= RARCH_FIRST_META_KEY && settings->input.binds[0][i].valid)
|
||||
state |= input_joypad_pressed(input_driver_get_joypad_driver(),
|
||||
0, settings->input.binds[0], i);
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
state |= input_overlay_key_pressed(i);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_COMMAND
|
||||
if (input_driver_command)
|
||||
{
|
||||
command_handle_t handle;
|
||||
|
||||
handle.handle = input_driver_command;
|
||||
handle.id = i;
|
||||
|
||||
state |= command_get(&handle);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETWORKGAMEPAD
|
||||
if (input_driver_remote)
|
||||
state |= input_remote_key_pressed(i, 0);
|
||||
#endif
|
||||
|
||||
if (state)
|
||||
ret |= (UINT64_C(1) << i);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void *input_driver_get_data(void)
|
||||
{
|
||||
return current_input_data;
|
||||
|
@ -224,6 +224,8 @@ int16_t input_state(unsigned port, unsigned device,
|
||||
|
||||
uint64_t input_keys_pressed(void);
|
||||
|
||||
uint64_t input_menu_keys_pressed(void);
|
||||
|
||||
void *input_driver_get_data(void);
|
||||
|
||||
const input_driver_t *input_get_ptr(void);
|
||||
|
@ -221,8 +221,19 @@ static void menu_input_key_event(bool down, unsigned keycode,
|
||||
(void)keycode;
|
||||
(void)mod;
|
||||
|
||||
if (character == '/')
|
||||
menu_entry_action(NULL, 0, MENU_ACTION_SEARCH);
|
||||
#if 0
|
||||
RARCH_LOG("down: %d, keycode: %d, mod: %d\n", down, keycode, mod);
|
||||
#endif
|
||||
|
||||
switch (character)
|
||||
{
|
||||
case RETROK_SLASH:
|
||||
menu_entry_action(NULL, 0, MENU_ACTION_SEARCH);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void menu_driver_toggle(bool latch)
|
||||
|
@ -1126,7 +1126,7 @@ int runloop_iterate(unsigned *sleep_ms)
|
||||
static retro_time_t frame_limit_minimum_time = 0.0;
|
||||
static retro_time_t frame_limit_last_time = 0.0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
uint64_t current_input = input_keys_pressed();
|
||||
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;
|
||||
|
||||
last_input = current_input;
|
||||
|
Loading…
x
Reference in New Issue
Block a user