(IOHIDManager) Another buildfix

This commit is contained in:
twinaphex 2020-07-19 03:39:32 +02:00
parent b8f9e38b7e
commit 18dcda09d0

View File

@ -188,6 +188,35 @@ static int16_t iohidmanager_hid_joypad_button(void *data,
return 0;
}
static int16_t iohidmanager_hid_joypad_axis(void *data,
unsigned port, uint32_t joyaxis)
{
iohidmanager_hid_t *hid = (iohidmanager_hid_t*)data;
int16_t val = 0;
if (AXIS_NEG_GET(joyaxis) < 11)
{
val += hid->axes[port][AXIS_NEG_GET(joyaxis)];
val += pad_connection_get_axis(&hid->slots[port],
port, AXIS_NEG_GET(joyaxis));
if (val >= 0)
val = 0;
}
else if (AXIS_POS_GET(joyaxis) < 11)
{
val += hid->axes[port][AXIS_POS_GET(joyaxis)];
val += pad_connection_get_axis(&hid->slots[port],
port, AXIS_POS_GET(joyaxis));
if (val <= 0)
val = 0;
}
return val;
}
static int16_t iohidmanager_hid_joypad_state(
void *data,
rarch_joypad_info_t *joypad_info,
@ -228,34 +257,6 @@ static bool iohidmanager_hid_joypad_rumble(void *data, unsigned pad,
return pad_connection_rumble(&hid->slots[pad], pad, effect, strength);
}
static int16_t iohidmanager_hid_joypad_axis(void *data,
unsigned port, uint32_t joyaxis)
{
iohidmanager_hid_t *hid = (iohidmanager_hid_t*)data;
int16_t val = 0;
if (AXIS_NEG_GET(joyaxis) < 11)
{
val += hid->axes[port][AXIS_NEG_GET(joyaxis)];
val += pad_connection_get_axis(&hid->slots[port],
port, AXIS_NEG_GET(joyaxis));
if (val >= 0)
val = 0;
}
else if (AXIS_POS_GET(joyaxis) < 11)
{
val += hid->axes[port][AXIS_POS_GET(joyaxis)];
val += pad_connection_get_axis(&hid->slots[port],
port, AXIS_POS_GET(joyaxis));
if (val <= 0)
val = 0;
}
return val;
}
static void iohidmanager_hid_device_send_control(void *data,
uint8_t* data_buf, size_t size)
{