From ad26769cd7645639d0846d16bb53a8b273f15302 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 22 Dec 2016 18:43:00 -0700 Subject: [PATCH] Fixed compile errors on various platforms --- src/joystick/bsd/SDL_sysjoystick.c | 2 +- src/joystick/darwin/SDL_sysjoystick.c | 4 +++- src/joystick/haiku/SDL_haikujoystick.cc | 2 +- src/joystick/iphoneos/SDL_sysjoystick.m | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/joystick/bsd/SDL_sysjoystick.c b/src/joystick/bsd/SDL_sysjoystick.c index d72d22d6b4db8..a816569a0cbdb 100644 --- a/src/joystick/bsd/SDL_sysjoystick.c +++ b/src/joystick/bsd/SDL_sysjoystick.c @@ -563,7 +563,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joy) v *= 32768 / ((hitem.logical_maximum - hitem.logical_minimum + 1) / 2); - if (v != joy->axes[naxe]) { + if (v != joy->axes[naxe].value) { SDL_PrivateJoystickAxis(joy, naxe, v); } } else if (usage == HUG_HAT_SWITCH) { diff --git a/src/joystick/darwin/SDL_sysjoystick.c b/src/joystick/darwin/SDL_sysjoystick.c index b4a824bd7efd1..5b5e2bfa3fb09 100644 --- a/src/joystick/darwin/SDL_sysjoystick.c +++ b/src/joystick/darwin/SDL_sysjoystick.c @@ -134,6 +134,7 @@ GetHIDScaledCalibratedState(recDevice * pDevice, recElement * pElement, SInt32 m const float deviceScale = max - min; const float readScale = pElement->maxReport - pElement->minReport; const SInt32 value = GetHIDElementState(pDevice, pElement); +printf("MIN/MAX = %d/%d, value = %d\n", pElement->minReport, pElement->maxReport, value); if (readScale == 0) { return value; /* no scaling at all */ } @@ -691,8 +692,9 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) element = device->firstAxis; i = 0; while (element) { +printf("Getting axis %d ", i); value = GetHIDScaledCalibratedState(device, element, -32768, 32767); - if (value != joystick->axes[i]) { + if (value != joystick->axes[i].value) { SDL_PrivateJoystickAxis(joystick, i, value); } element = element->pNext; diff --git a/src/joystick/haiku/SDL_haikujoystick.cc b/src/joystick/haiku/SDL_haikujoystick.cc index 13bc6c62cd7af..c8d236290ea4d 100644 --- a/src/joystick/haiku/SDL_haikujoystick.cc +++ b/src/joystick/haiku/SDL_haikujoystick.cc @@ -197,7 +197,7 @@ extern "C" /* Generate axis motion events */ for (i = 0; i < joystick->naxes; ++i) { - change = ((int32) axes[i] - joystick->axes[i]); + change = ((int32) axes[i] - joystick->axes[i].value); if ((change > JITTER) || (change < -JITTER)) { SDL_PrivateJoystickAxis(joystick, i, axes[i]); } diff --git a/src/joystick/iphoneos/SDL_sysjoystick.m b/src/joystick/iphoneos/SDL_sysjoystick.m index 893f627361c98..7d03ca4080781 100644 --- a/src/joystick/iphoneos/SDL_sysjoystick.m +++ b/src/joystick/iphoneos/SDL_sysjoystick.m @@ -516,7 +516,7 @@ SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) * initializes its values to 0. We only want to make sure the * player index is up to date if the user actually moves an axis. */ if ((i != 2 && i != 5) || axes[i] != -32768) { - updateplayerindex |= (joystick->axes[i] != axes[i]); + updateplayerindex |= (joystick->axes[i].value != axes[i]); } SDL_PrivateJoystickAxis(joystick, i, axes[i]); }