move input_key_pressed to retroarch.c

This commit is contained in:
twinaphex 2020-08-29 22:09:29 +02:00
parent b3744c3126
commit 2b393e2425
3 changed files with 27 additions and 21 deletions

View File

@ -1312,26 +1312,6 @@ static void android_input_poll_memcpy(android_input_t *android)
}
}
static bool android_input_key_pressed(android_input_t *android, int key)
{
rarch_joypad_info_t joypad_info;
joypad_info.joy_idx = 0;
joypad_info.auto_binds = input_autoconf_binds[0];
joypad_info.axis_threshold = *
(input_driver_get_float(INPUT_ACTION_AXIS_THRESHOLD));
if((key < RARCH_BIND_LIST_END)
&& android_keyboard_port_input_pressed(input_config_binds[0],
key))
return true;
return button_is_pressed(
android->joypad,
&joypad_info,
input_config_binds[0],
joypad_info.joy_idx,
key);
}
/* Handle all events. If our activity is in pause state,
* block until we're unpaused.
*/
@ -1344,7 +1324,9 @@ static void android_input_poll(void *data)
while ((ident =
ALooper_pollAll((input_config_binds[0][RARCH_PAUSE_TOGGLE].valid
&& android_input_key_pressed(android, RARCH_PAUSE_TOGGLE))
&& input_key_pressed(android->joypad, RARCH_PAUSE_TOGGLE,
android_keyboard_port_input_pressed(input_config_binds[0],
key)))
? -1 : settings->uints.input_block_timeout,
NULL, NULL, NULL)) >= 0)
{

View File

@ -26617,6 +26617,27 @@ bool input_joypad_set_rumble(const input_device_driver_t *drv,
return drv->set_rumble(joy_idx, effect, strength);
}
bool input_key_pressed(const void *data, int key, bool keyboard_pressed)
{
rarch_joypad_info_t joypad_info;
struct rarch_state
*p_rarch = &rarch_st;
const input_device_driver_t
*joypad = (const input_device_driver_t*)data;
joypad_info.joy_idx = 0;
joypad_info.auto_binds = input_autoconf_binds[0];
joypad_info.axis_threshold = p_rarch->input_driver_axis_threshold;
if((key < RARCH_BIND_LIST_END)
&& keyboard_pressed)
return true;
return button_is_pressed(
joypad, &joypad_info,
input_config_binds[0],
joypad_info.joy_idx,
key);
}
int16_t button_is_pressed(
const input_device_driver_t *joypad,
rarch_joypad_info_t *joypad_info,

View File

@ -1980,6 +1980,9 @@ void retroarch_init_task_queue(void);
bool is_input_keyboard_display_on(void);
bool input_key_pressed(const void *data,
int key, bool keyboard_pressed);
/* creates folder and core options stub file for subsequent runs */
bool create_folder_and_core_options(void);