[SDL] Joystick behaviour seriously flawed?

T. Joseph Carter tjcarter at spiritsubstance.com
Sat Oct 19 18:19:45 PDT 2013


On Sat, Oct 19, 2013 at 05:41:35PM -0700, Mason Wheeler wrote:
>...such as an XBox controller clone, which is what was originally mentioned.
>
>It has 6 axes (2 for left stick, 2 for right stick, 1 for each trigger) and so if it
>was trying to represent it as a system with 5 axes, that's a bug.

Actually, Windows XP lacks XInput entirely.  That means the 
XInput/DirectInput driver uses DirectInput mode for the XBox 360 
controller on Windows XP.

And on DirectInput, the XBox 360 controller reports having 5 axes.  
Microsoft insists that this is "correct" behavior:

http://msdn.microsoft.com/en-us/library/windows/desktop/ee417014(v=vs.85).aspx

Basically, under DirectInput (but not XInput), the XBox 360 
controller reports both triggers as the 5th axis.  You cannot 
determine their values independently since the left trigger is a 
negative offset from center and the right is a positive offset.

The only two realistic explanations for this behavior I can think of 
are:

1. Microsoft wanted to intentionally cripple the very common XBox 360 
controller for DirectInput in order to force everyone to migrate to 
XInput, an API for which Microsoft makes makes a royalty fee for 
controller makers to support.

2. Whoever made the decision is actually a moron.  The explanation 
that it had to be done this way so that sticks always appear to be 
centerd when not being manipulated by the user is complete horse 
crap, as evidenced by SDL's simple and obvious solution to the 
problem.  Moreover, the XBox 360 controller's centering is so 
pathetically dismal as-is that I found it necessary to specify a dead 
zone of ±4096 in order _usually_ have the joystick report as centered 
when it wasn't being moved.  And I say usually, because even that 
value fails.  The triggers require no dead zone at all.


I have strong views on this subject.  :)

Joseph




More information about the SDL mailing list