Merge pull request #2391 from Arche-san/osx-xbox360-gamepad-right-stick-support

os x xbox360 gamepad right stick support (6 axes instead of 4)
This commit is contained in:
Twinaphex 2015-11-14 18:23:08 +01:00
commit 4f77946761
4 changed files with 9 additions and 6 deletions

View File

@ -192,7 +192,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

@ -55,7 +55,7 @@ typedef struct
uint32_t key_state[MAX_KEYS];
uint32_t buttons[MAX_USERS];
int16_t axes[MAX_USERS][4];
int16_t axes[MAX_USERS][6];
int8_t hats[NUM_HATS][2];
#if TARGET_OS_IPHONE

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)
{