os x : add right stick support for xbox 360 gamepad (and others hid gamepad with 6 axes instead of 4)

This commit is contained in:
Arche-san 2015-11-14 18:04:07 +01:00
parent f8247d6f0e
commit c47254e64b
4 changed files with 9 additions and 6 deletions

View File

@ -223,7 +223,7 @@ int32_t cocoa_input_find_any_axis(uint32_t port)
if (apple && apple->joypad)
apple->joypad->poll();
for (i = 0; i < 4; i++)
for (i = 0; i < 6; i++)
{
int16_t value = apple->axes[port][i];

View File

@ -56,7 +56,7 @@ typedef struct
uint32_t buttons[MAX_USERS];
uint32_t mfi_buttons[MAX_USERS];
int16_t axes[MAX_USERS][4];
int16_t axes[MAX_USERS][6];
int8_t hats[NUM_HATS][2];
bool icade_enabled;

View File

@ -112,7 +112,7 @@ static int16_t iohidmanager_hid_joypad_axis(void *data, unsigned port, uint32_t
return 0;
#endif
if (AXIS_NEG_GET(joyaxis) < 4)
if (AXIS_NEG_GET(joyaxis) < 6)
{
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
val += apple->axes[port][AXIS_NEG_GET(joyaxis)];
@ -122,7 +122,7 @@ static int16_t iohidmanager_hid_joypad_axis(void *data, unsigned port, uint32_t
if (val >= 0)
val = 0;
}
else if(AXIS_POS_GET(joyaxis) < 4)
else if(AXIS_POS_GET(joyaxis) < 6)
{
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
val += apple->axes[port][AXIS_POS_GET(joyaxis)];
@ -198,9 +198,9 @@ static void iohidmanager_hid_device_input_callback(void *data, IOReturn result,
default:
{
int i;
static const uint32_t axis_use_ids[4] = { 48, 49, 50, 53 };
static const uint32_t axis_use_ids[6] = { 48, 49, 50, 51, 52, 53 };
for (i = 0; i < 4; i ++)
for (i = 0; i < 6; i ++)
{
#if defined(HAVE_COCOA) || defined(HAVE_COCOATOUCH)
CFIndex min = IOHIDElementGetPhysicalMin(element);

View File

@ -77,6 +77,9 @@ static void apple_gamecontroller_poll(GCController *controller)
apple->axes[slot][1] = gp.leftThumbstick.yAxis.value * 32767.0f;
apple->axes[slot][2] = gp.rightThumbstick.xAxis.value * 32767.0f;
apple->axes[slot][3] = gp.rightThumbstick.yAxis.value * 32767.0f;
apple->axes[slot][4] = gp.rightThumbstick.yAxis.value * 32767.0f;
apple->axes[slot][5] = gp.rightThumbstick.yAxis.value * 32767.0f;
}
else if (controller.gamepad)
{