Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fixed bug #478
Take the min and max values into account.
- Loading branch information
Showing
with
8 additions
and
4 deletions.
-
+3
−0
docs.html
-
+5
−4
src/joystick/darwin/SDL_sysjoystick.c
|
@@ -79,6 +79,9 @@ <H3> Mac OS X Notes </H3> |
|
|
<P> |
|
|
Improved trackpad scrolling support. |
|
|
</P> |
|
|
<P> |
|
|
Fixed joystick hat reporting for certain joysticks. |
|
|
</P> |
|
|
</BLOCKQUOTE> |
|
|
|
|
|
<IMG SRC="docs/images/rainbow.gif" ALT="[separator]" WIDTH="100%"> |
|
|
|
@@ -727,7 +727,7 @@ void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick) |
|
|
{ |
|
|
recDevice *device = joystick->hwdata; |
|
|
recElement *element; |
|
|
SInt32 value; |
|
|
SInt32 value, range; |
|
|
int i; |
|
|
|
|
|
if (device->removed) /* device was unplugged; ignore it. */ |
|
@@ -780,10 +780,11 @@ void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick) |
|
|
{ |
|
|
Uint8 pos = 0; |
|
|
|
|
|
value = HIDGetElementValue(device, element); |
|
|
if (element->max == 3) /* 4 position hatswitch - scale up value */ |
|
|
range = (element->max - element->min + 1); |
|
|
value = HIDGetElementValue(device, element) - element->min; |
|
|
if (range == 4) /* 4 position hatswitch - scale up value */ |
|
|
value *= 2; |
|
|
else if (element->max != 7) /* Neither a 4 nor 8 positions - fall back to default position (centered) */ |
|
|
else if (range != 8) /* Neither a 4 nor 8 positions - fall back to default position (centered) */ |
|
|
value = -1; |
|
|
switch(value) |
|
|
{ |
|
|
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.