static int16_t apple_joypad_axis(unsigned port, uint32_t joyaxis) { apple_input_data_t *apple = (apple_input_data_t*)driver.input_data; int16_t val = 0; if (!apple || joyaxis == AXIS_NONE) return 0; if (AXIS_NEG_GET(joyaxis) < 4) { val = apple->axes[port][AXIS_NEG_GET(joyaxis)]; val += pad_connection_get_axis(&slots[port], port, AXIS_NEG_GET(joyaxis)); if (val >= 0) val = 0; } else if(AXIS_POS_GET(joyaxis) < 4) { val = apple->axes[port][AXIS_POS_GET(joyaxis)]; val += pad_connection_get_axis(&slots[port], port, AXIS_POS_GET(joyaxis)); if (val <= 0) val = 0; } return val; }
static int16_t libusb_hid_joypad_axis(void *data, unsigned port, uint32_t joyaxis) { libusb_hid_t *hid = (libusb_hid_t*)data; int16_t val = 0; if (joyaxis == AXIS_NONE) return 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 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 (joyaxis == AXIS_NONE) return 0; if (AXIS_NEG_GET(joyaxis) < 6) { 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) < 6) { 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; }