mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Attempt to fix https://github.com/libretro/RetroArch/issues/10276
This commit is contained in:
parent
c4a98a62d3
commit
a33353399f
@ -101,8 +101,9 @@ static bool input_joypad_hat_raw(const input_device_driver_t *drv,
|
||||
static bool menu_input_key_bind_custom_bind_keyboard_cb(
|
||||
void *data, unsigned code)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
uint64_t timeout_end_us = settings->uints.input_bind_hold * 1000000;
|
||||
settings_t *settings = config_get_ptr();
|
||||
uint64_t input_bind_hold_us = settings->uints.input_bind_hold * 1000000;
|
||||
uint64_t input_bind_timeout_us = settings->uints.input_bind_timeout * 1000000;
|
||||
|
||||
/* store key in bind */
|
||||
menu_input_binds.buffer.key = (enum retro_key)code;
|
||||
@ -115,9 +116,9 @@ static bool menu_input_key_bind_custom_bind_keyboard_cb(
|
||||
menu_input_binds.output++;
|
||||
menu_input_binds.buffer=*(menu_input_binds.output);
|
||||
rarch_timer_begin_new_time_us(
|
||||
&menu_input_binds.timer_hold, timeout_end_us);
|
||||
&menu_input_binds.timer_hold, input_bind_hold_us);
|
||||
rarch_timer_begin_new_time_us(
|
||||
&menu_input_binds.timer_timeout, timeout_end_us);
|
||||
&menu_input_binds.timer_timeout, input_bind_timeout_us);
|
||||
|
||||
return (menu_input_binds.begin <= menu_input_binds.last);
|
||||
}
|
||||
@ -294,7 +295,8 @@ bool menu_input_key_bind_set_mode(
|
||||
rarch_setting_t *setting = (rarch_setting_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
uint64_t timeout_end_us = settings->uints.input_bind_hold * 1000000;
|
||||
uint64_t input_bind_hold_us = settings->uints.input_bind_hold * 1000000;
|
||||
uint64_t input_bind_timeout_us = settings->uints.input_bind_timeout * 1000000;
|
||||
|
||||
if (!setting || !menu)
|
||||
return false;
|
||||
@ -309,8 +311,8 @@ bool menu_input_key_bind_set_mode(
|
||||
menu_input_key_bind_poll_bind_state(
|
||||
&menu_input_binds, false);
|
||||
|
||||
rarch_timer_begin_new_time_us(&menu_input_binds.timer_hold, timeout_end_us);
|
||||
rarch_timer_begin_new_time_us(&menu_input_binds.timer_timeout, timeout_end_us);
|
||||
rarch_timer_begin_new_time_us(&menu_input_binds.timer_hold, input_bind_hold_us);
|
||||
rarch_timer_begin_new_time_us(&menu_input_binds.timer_timeout, input_bind_timeout_us);
|
||||
|
||||
keys.userdata = menu;
|
||||
keys.cb = menu_input_key_bind_custom_bind_keyboard_cb;
|
||||
@ -571,9 +573,10 @@ bool menu_input_key_bind_set_min_max(menu_input_ctx_bind_limits_t *lim)
|
||||
bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind,
|
||||
retro_time_t current_time)
|
||||
{
|
||||
bool timed_out = false;
|
||||
settings_t * settings = config_get_ptr();
|
||||
uint64_t timeout_end_us = settings->uints.input_bind_hold * 1000000;
|
||||
bool timed_out = false;
|
||||
settings_t * settings = config_get_ptr();
|
||||
uint64_t input_bind_hold_us = settings->uints.input_bind_hold * 1000000;
|
||||
uint64_t input_bind_timeout_us = settings->uints.input_bind_timeout * 1000000;
|
||||
|
||||
if (!bind)
|
||||
return false;
|
||||
@ -599,8 +602,10 @@ bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind,
|
||||
/*skip to next bind*/
|
||||
menu_input_binds.begin++;
|
||||
menu_input_binds.output++;
|
||||
rarch_timer_begin_new_time_us(&menu_input_binds.timer_hold, timeout_end_us);
|
||||
rarch_timer_begin_new_time_us(&menu_input_binds.timer_timeout, timeout_end_us);
|
||||
rarch_timer_begin_new_time_us(&menu_input_binds.timer_hold,
|
||||
input_bind_hold_us);
|
||||
rarch_timer_begin_new_time_us(&menu_input_binds.timer_timeout,
|
||||
input_bind_timeout_us);
|
||||
timed_out = true;
|
||||
}
|
||||
|
||||
@ -635,7 +640,7 @@ bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind,
|
||||
if (menu_input_key_bind_poll_find_hold(&binds, &binds.buffer))
|
||||
{
|
||||
/*inhibit timeout*/
|
||||
rarch_timer_begin_new_time_us( &binds.timer_timeout, timeout_end_us);
|
||||
rarch_timer_begin_new_time_us( &binds.timer_timeout, input_bind_timeout);
|
||||
|
||||
/*run hold timer*/
|
||||
rarch_timer_tick( &binds.timer_hold, current_time);
|
||||
@ -652,7 +657,7 @@ bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind,
|
||||
else
|
||||
{
|
||||
/*reset hold countdown*/
|
||||
rarch_timer_begin_new_time_us(&binds.timer_hold, timeout_end_us);
|
||||
rarch_timer_begin_new_time_us(&binds.timer_hold, input_bind_hold_us);
|
||||
}
|
||||
|
||||
#else
|
||||
@ -689,8 +694,8 @@ bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind,
|
||||
/*next bind*/
|
||||
binds.output++;
|
||||
binds.buffer = *( binds.output );
|
||||
rarch_timer_begin_new_time_us(&binds.timer_hold, timeout_end_us);
|
||||
rarch_timer_begin_new_time_us(&binds.timer_timeout, timeout_end_us);
|
||||
rarch_timer_begin_new_time_us(&binds.timer_hold, input_bind_hold_us);
|
||||
rarch_timer_begin_new_time_us(&binds.timer_timeout, input_bind_timeout_us);
|
||||
}
|
||||
|
||||
menu_input_binds = binds;
|
||||
|
Loading…
x
Reference in New Issue
Block a user