mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 04:20:28 +00:00
Restore generic Mac OS X joypad functionality
This commit is contained in:
parent
593b34c76f
commit
7431529e89
@ -105,7 +105,7 @@ int32_t pad_connection_pad_init(joypad_connection_t *joyconn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return pad;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pad_connection_pad_deinit(joypad_connection_t *joyconn, uint32_t pad)
|
void pad_connection_pad_deinit(joypad_connection_t *joyconn, uint32_t pad)
|
||||||
|
@ -59,9 +59,11 @@ static uint64_t iohidmanager_hid_joypad_get_buttons(void *data, unsigned port)
|
|||||||
|
|
||||||
static bool iohidmanager_hid_joypad_button(void *data, unsigned port, uint16_t joykey)
|
static bool iohidmanager_hid_joypad_button(void *data, unsigned port, uint16_t joykey)
|
||||||
{
|
{
|
||||||
|
driver_t *driver = driver_get_ptr();
|
||||||
|
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
|
||||||
uint64_t buttons = iohidmanager_hid_joypad_get_buttons(data, port);
|
uint64_t buttons = iohidmanager_hid_joypad_get_buttons(data, port);
|
||||||
|
|
||||||
if (joykey == NO_BTN)
|
if (!apple || joykey == NO_BTN)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Check hat. */
|
/* Check hat. */
|
||||||
@ -70,7 +72,8 @@ static bool iohidmanager_hid_joypad_button(void *data, unsigned port, uint16_t j
|
|||||||
|
|
||||||
/* Check the button. */
|
/* Check the button. */
|
||||||
if ((port < MAX_USERS) && (joykey < 32))
|
if ((port < MAX_USERS) && (joykey < 32))
|
||||||
return ((buttons & (1 << joykey)) != 0);
|
return ((apple->buttons[port] & (1 << joykey)) != 0) ||
|
||||||
|
((buttons & (1 << joykey)) != 0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,22 +88,26 @@ static bool iohidmanager_hid_joypad_rumble(void *data, unsigned pad,
|
|||||||
|
|
||||||
static int16_t iohidmanager_hid_joypad_axis(void *data, unsigned port, uint32_t joyaxis)
|
static int16_t iohidmanager_hid_joypad_axis(void *data, unsigned port, uint32_t joyaxis)
|
||||||
{
|
{
|
||||||
|
driver_t *driver = driver_get_ptr();
|
||||||
|
cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data;
|
||||||
iohidmanager_hid_t *hid = (iohidmanager_hid_t*)data;
|
iohidmanager_hid_t *hid = (iohidmanager_hid_t*)data;
|
||||||
int16_t val = 0;
|
int16_t val = 0;
|
||||||
|
|
||||||
if (joyaxis == AXIS_NONE)
|
if (!apple || joyaxis == AXIS_NONE)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (AXIS_NEG_GET(joyaxis) < 4)
|
if (AXIS_NEG_GET(joyaxis) < 4)
|
||||||
{
|
{
|
||||||
val = pad_connection_get_axis(&hid->slots[port], port, AXIS_NEG_GET(joyaxis));
|
val = apple->axes[port][AXIS_NEG_GET(joyaxis)];
|
||||||
|
val += pad_connection_get_axis(&hid->slots[port], port, AXIS_NEG_GET(joyaxis));
|
||||||
|
|
||||||
if (val >= 0)
|
if (val >= 0)
|
||||||
val = 0;
|
val = 0;
|
||||||
}
|
}
|
||||||
else if(AXIS_POS_GET(joyaxis) < 4)
|
else if(AXIS_POS_GET(joyaxis) < 4)
|
||||||
{
|
{
|
||||||
val = pad_connection_get_axis(&hid->slots[port], port, AXIS_POS_GET(joyaxis));
|
val = apple->axes[port][AXIS_POS_GET(joyaxis)];
|
||||||
|
val += pad_connection_get_axis(&hid->slots[port], port, AXIS_POS_GET(joyaxis));
|
||||||
|
|
||||||
if (val <= 0)
|
if (val <= 0)
|
||||||
val = 0;
|
val = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user