1
0
mirror of https://github.com/libretro/RetroArch synced 2025-02-24 18:39:59 +00:00

(joypad drivers) xdk_joypad.c - cleanup(joypad drivers) xdk_joypad.c -

cleanup(joypad drivers) xdk_joypad.c - cleanup(joypad drivers)
xdk_joypad.c - cleanup(joypad drivers) xdk_joypad.c - cleanup(joypad
drivers) xdk_joypad.c - cleanup(joypad drivers) xdk_joypad.c -
cleanup(joypad drivers) xdk_joypad.c - cleanup(joypad drivers)
xdk_joypad.c - cleanup
This commit is contained in:
twinaphex 2020-07-20 23:15:19 +02:00
parent 2681991c29
commit caa1145b35

@ -90,10 +90,11 @@ static const uint16_t button_index_to_bitmap_code[] = {
};
#endif
static int16_t xdk_joypad_button_state(XINPUT_GAMEPAD *pad,
static int16_t xdk_joypad_button_state(
XINPUT_GAMEPAD *pad,
uint16_t btn_word,
unsigned port, uint16_t joykey)
{
uint16_t btn_word = pad->wButtons;
unsigned hat_dir = GET_HAT_DIR(joykey);
if (hat_dir)
@ -155,10 +156,13 @@ static int16_t xdk_joypad_button_state(XINPUT_GAMEPAD *pad,
static int16_t xdk_joypad_button(unsigned port, uint16_t joykey)
{
XINPUT_GAMEPAD *pad = &(g_xinput_states[port].xstate.Gamepad);
uint16_t btn_word = 0;
XINPUT_GAMEPAD *pad = NULL;
if (port >= DEFAULT_MAX_PADS)
return 0;
return xdk_joypad_button_state(pad, port, joykey);
pad = &(g_xinput_states[port].xstate.Gamepad);
btn_word = pad->wButtons;
return xdk_joypad_button_state(pad, btn_word, port, joykey);
}
static int16_t xdk_joypad_axis_state(XINPUT_GAMEPAD *pad,
@ -233,11 +237,15 @@ static int16_t xdk_joypad_state(
{
unsigned i;
int16_t ret = 0;
XINPUT_GAMEPAD *pad = &(g_xinput_states[port].xstate.Gamepad);
XINPUT_GAMEPAD *pad = NULL;
uint16_t btn_word = 0;
if (port >= DEFAULT_MAX_PADS)
return 0;
pad = &(g_xinput_states[port].xstate.Gamepad);
btn_word = pad->wButtons;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
/* Auto-binds are per joypad, not per user. */
@ -248,7 +256,7 @@ static int16_t xdk_joypad_state(
if (
(uint16_t)joykey != NO_BTN
&& xdk_joypad_button_state(
pad, port, (uint16_t)joykey))
pad, btn_word, port, (uint16_t)joykey))
ret |= ( 1 << i);
else if (joyaxis != AXIS_NONE &&
((float)abs(xdk_joypad_axis_state(pad, port, joyaxis))