diff --git a/input/drivers_hid/wiiusb_hid.c b/input/drivers_hid/wiiusb_hid.c index 279e6b4c38..ec34feb323 100644 --- a/input/drivers_hid/wiiusb_hid.c +++ b/input/drivers_hid/wiiusb_hid.c @@ -553,10 +553,34 @@ static int16_t wiiusb_hid_joypad_button(void *data, return 0; else if (joykey < 32) return (BIT256_GET(buttons, joykey) != 0); - return 0; } +static int16_t wiiusb_hid_joypad_axis(void *data, + unsigned port, uint32_t joyaxis) +{ + wiiusb_hid_t *hid = (wiiusb_hid_t*)data; + + if (AXIS_NEG_GET(joyaxis) < 4) + { + int16_t val = pad_connection_get_axis(&hid->connections[port], + port, AXIS_NEG_GET(joyaxis)); + + if (val < 0) + return val; + } + else if (AXIS_POS_GET(joyaxis) < 4) + { + int16_t val = pad_connection_get_axis(&hid->connections[port], + port, AXIS_POS_GET(joyaxis)); + + if (val > 0) + return val; + } + return 0; +} + + static int16_t wiiusb_hid_joypad_state( void *data, rarch_joypad_info_t *joypad_info, @@ -600,32 +624,6 @@ static bool wiiusb_hid_joypad_rumble(void *data, unsigned pad, return pad_connection_rumble(&hid->connections[pad], pad, effect, strength); } -static int16_t wiiusb_hid_joypad_axis(void *data, - unsigned port, uint32_t joyaxis) -{ - int16_t val = 0; - wiiusb_hid_t *hid = (wiiusb_hid_t*)data; - - if (AXIS_NEG_GET(joyaxis) < 4) - { - val = pad_connection_get_axis(&hid->connections[port], - port, AXIS_NEG_GET(joyaxis)); - - if (val >= 0) - val = 0; - } - else if (AXIS_POS_GET(joyaxis) < 4) - { - val = pad_connection_get_axis(&hid->connections[port], - port, AXIS_POS_GET(joyaxis)); - - if (val <= 0) - val = 0; - } - - return val; -} - static void wiiusb_hid_free(const void *data) { struct wiiusb_adapter *adapter = NULL;