mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-25 20:25:42 +00:00
Refactor input_joypad_pressed somewhat
This commit is contained in:
parent
ec9f6272ca
commit
8349ade076
@ -154,12 +154,12 @@ bool input_joypad_set_rumble(const rarch_joypad_driver_t *drv,
|
||||
return drv->set_rumble(joy_idx, effect, strength);
|
||||
}
|
||||
|
||||
bool input_joypad_pressed(const rarch_joypad_driver_t *drv,
|
||||
unsigned port, const struct retro_keybind *binds, unsigned key)
|
||||
static bool input_joypad_is_pressed(
|
||||
const rarch_joypad_driver_t *drv,
|
||||
unsigned port,
|
||||
const struct retro_keybind *binds,
|
||||
unsigned key)
|
||||
{
|
||||
if (!drv)
|
||||
return false;
|
||||
|
||||
unsigned int joy_idx = g_settings.input.joypad_map[port];
|
||||
if (joy_idx >= MAX_PLAYERS)
|
||||
return false;
|
||||
@ -168,9 +168,6 @@ bool input_joypad_pressed(const rarch_joypad_driver_t *drv,
|
||||
const struct retro_keybind *auto_binds =
|
||||
g_settings.input.autoconf_binds[joy_idx];
|
||||
|
||||
if (!binds[key].valid)
|
||||
return false;
|
||||
|
||||
uint64_t joykey = binds[key].joykey;
|
||||
if (joykey == NO_BTN)
|
||||
joykey = auto_binds[key].joykey;
|
||||
@ -187,6 +184,22 @@ bool input_joypad_pressed(const rarch_joypad_driver_t *drv,
|
||||
return scaled_axis > g_settings.input.axis_threshold;
|
||||
}
|
||||
|
||||
bool input_joypad_pressed(const rarch_joypad_driver_t *drv,
|
||||
unsigned port, const struct retro_keybind *binds, unsigned key)
|
||||
{
|
||||
if (!drv)
|
||||
return false;
|
||||
|
||||
|
||||
if (!binds[key].valid)
|
||||
return false;
|
||||
|
||||
if (input_joypad_is_pressed(drv, port, binds, key))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int16_t input_joypad_analog(const rarch_joypad_driver_t *drv,
|
||||
unsigned port, unsigned idx, unsigned ident,
|
||||
const struct retro_keybind *binds)
|
||||
|
Loading…
Reference in New Issue
Block a user