Joystick centering and games

SDL 1.1.8 works great now with joysticks on at least Windows and
Linux. I love it, fantastic job everyone!

I’ve got a problem with stick centering (it’s not an SDL bug though).
I’ve got a USB stick here and the damn thing doesn’t report values all
the way to the edges of 2^16, and the center values aren’t ever properly
2^16/2 (at least on win32 – winmm reports the same off-center values).

Zero/center/max values for all axes are:

min=0, center=32512, max=65280

(These values are 0, 1272^8 and 2552^8. I assume the stick only has
127 discrete positions and something is simply scaling them by 2^8 to
report the values. Obviously this is not quite working, but it’s late
and I can’t think of what it should be doing right now.)

The problem is that OTHER sticks report the values properly centered in
the 0 to 2^16-1 range. I’d rather not have to have the user 'calibrate’
the stick before playing the game, and other games seem to be able to
get it right so there must be something I’m missing.

So the question is, how do I detect and deal with this? Anyone? I could
scale to 0 to 2^8-1, but it seems a shame to waste the proper analogue
values on sticks that do that.

  • Mike