mirror of
https://github.com/libretro/RetroArch
synced 2025-02-11 15:40:28 +00:00
(BTStack) Cleanup
This commit is contained in:
parent
005a9c005e
commit
2efb1600a8
@ -1377,6 +1377,31 @@ static int16_t btstack_hid_joypad_button(void *data,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int16_t btstack_hid_joypad_axis(void *data,
|
||||||
|
unsigned port, uint32_t joyaxis)
|
||||||
|
{
|
||||||
|
btstack_hid_t *hid = (btstack_hid_t*)data;
|
||||||
|
|
||||||
|
if (AXIS_NEG_GET(joyaxis) < 4)
|
||||||
|
{
|
||||||
|
int16_t val = pad_connection_get_axis(
|
||||||
|
&hid->slots[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->slots[port], port, AXIS_POS_GET(joyaxis));
|
||||||
|
|
||||||
|
if (val > 0)
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int16_t btstack_hid_joypad_state(
|
static int16_t btstack_hid_joypad_state(
|
||||||
void *data,
|
void *data,
|
||||||
rarch_joypad_info_t *joypad_info,
|
rarch_joypad_info_t *joypad_info,
|
||||||
@ -1421,29 +1446,6 @@ static bool btstack_hid_joypad_rumble(void *data, unsigned pad,
|
|||||||
return pad_connection_rumble(&hid->slots[pad], pad, effect, strength);
|
return pad_connection_rumble(&hid->slots[pad], pad, effect, strength);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int16_t btstack_hid_joypad_axis(void *data, unsigned port, uint32_t joyaxis)
|
|
||||||
{
|
|
||||||
btstack_hid_t *hid = (btstack_hid_t*)data;
|
|
||||||
int16_t val = 0;
|
|
||||||
|
|
||||||
if (AXIS_NEG_GET(joyaxis) < 4)
|
|
||||||
{
|
|
||||||
val += pad_connection_get_axis(&hid->slots[port], port, AXIS_NEG_GET(joyaxis));
|
|
||||||
|
|
||||||
if (val >= 0)
|
|
||||||
val = 0;
|
|
||||||
}
|
|
||||||
else if(AXIS_POS_GET(joyaxis) < 4)
|
|
||||||
{
|
|
||||||
val += pad_connection_get_axis(&hid->slots[port], port, AXIS_POS_GET(joyaxis));
|
|
||||||
|
|
||||||
if (val <= 0)
|
|
||||||
val = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void btstack_hid_free(const void *data)
|
static void btstack_hid_free(const void *data)
|
||||||
{
|
{
|
||||||
btstack_hid_t *hid = (btstack_hid_t*)data;
|
btstack_hid_t *hid = (btstack_hid_t*)data;
|
||||||
|
@ -484,26 +484,24 @@ static int16_t libusb_hid_joypad_axis(void *data,
|
|||||||
unsigned port, uint32_t joyaxis)
|
unsigned port, uint32_t joyaxis)
|
||||||
{
|
{
|
||||||
libusb_hid_t *hid = (libusb_hid_t*)data;
|
libusb_hid_t *hid = (libusb_hid_t*)data;
|
||||||
int16_t val = 0;
|
|
||||||
|
|
||||||
if (AXIS_NEG_GET(joyaxis) < 4)
|
if (AXIS_NEG_GET(joyaxis) < 4)
|
||||||
{
|
{
|
||||||
val = pad_connection_get_axis(&hid->slots[port],
|
int16_t val = pad_connection_get_axis(&hid->slots[port],
|
||||||
port, AXIS_NEG_GET(joyaxis));
|
port, AXIS_NEG_GET(joyaxis));
|
||||||
|
|
||||||
if (val >= 0)
|
if (val < 0)
|
||||||
val = 0;
|
return val;
|
||||||
}
|
}
|
||||||
else if(AXIS_POS_GET(joyaxis) < 4)
|
else if(AXIS_POS_GET(joyaxis) < 4)
|
||||||
{
|
{
|
||||||
val = pad_connection_get_axis(&hid->slots[port],
|
int16_t val = pad_connection_get_axis(&hid->slots[port],
|
||||||
port, AXIS_POS_GET(joyaxis));
|
port, AXIS_POS_GET(joyaxis));
|
||||||
|
|
||||||
if (val <= 0)
|
if (val > 0)
|
||||||
val = 0;
|
return val;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
return val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int16_t libusb_hid_joypad_state(
|
static int16_t libusb_hid_joypad_state(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user