mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
input_joypad_pressed - small opts
This commit is contained in:
parent
1cb2822013
commit
2f12d8982c
@ -243,31 +243,24 @@ bool input_joypad_pressed(
|
|||||||
int16_t axis;
|
int16_t axis;
|
||||||
uint32_t joyaxis;
|
uint32_t joyaxis;
|
||||||
uint64_t joykey;
|
uint64_t joykey;
|
||||||
const struct retro_keybind *auto_binds = NULL;
|
settings_t *settings = config_get_ptr();
|
||||||
const struct retro_keybind *binds = (const struct retro_keybind*)
|
const struct retro_keybind *binds = (const struct retro_keybind*)
|
||||||
binds_data;
|
binds_data;
|
||||||
settings_t *settings = config_get_ptr();
|
unsigned joy_idx = settings->input.joypad_map[port];
|
||||||
unsigned joy_idx = settings->input.joypad_map[port];
|
/* Auto-binds are per joypad, not per user. */
|
||||||
|
const struct retro_keybind *auto_binds = settings->input.autoconf_binds[joy_idx];
|
||||||
|
|
||||||
if (joy_idx >= MAX_USERS)
|
|
||||||
return false;
|
|
||||||
if (!drv || !binds[key].valid)
|
if (!drv || !binds[key].valid)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Auto-binds are per joypad, not per user. */
|
joykey = (binds[key].joykey != NO_BTN)
|
||||||
auto_binds = settings->input.autoconf_binds[joy_idx];
|
? binds[key].joykey : auto_binds[key].joykey;
|
||||||
|
|
||||||
joykey = binds[key].joykey;
|
|
||||||
if (joykey == NO_BTN)
|
|
||||||
joykey = auto_binds[key].joykey;
|
|
||||||
|
|
||||||
if (drv->button(joy_idx, (uint16_t)joykey))
|
if (drv->button(joy_idx, (uint16_t)joykey))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
joyaxis = binds[key].joyaxis;
|
joyaxis = (binds[key].joyaxis != AXIS_NONE)
|
||||||
if (joyaxis == AXIS_NONE)
|
? binds[key].joyaxis : auto_binds[key].joyaxis;
|
||||||
joyaxis = auto_binds[key].joyaxis;
|
|
||||||
|
|
||||||
axis = drv->axis(joy_idx, joyaxis);
|
axis = drv->axis(joy_idx, joyaxis);
|
||||||
scaled_axis = (float)abs(axis) / 0x8000;
|
scaled_axis = (float)abs(axis) / 0x8000;
|
||||||
return scaled_axis > settings->input.axis_threshold;
|
return scaled_axis > settings->input.axis_threshold;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user