Unless I'm doing something stupid, I think I've found a bug. The JOYSTICK_SIGNED / JOYSTICK_UNSIGNED flags seem to be improperly set. All my sticks report that they are signed, while some of them give position between 0 and 255. (Some give -128 to 128 as expected.)
I test for the flag with if (joy[h].stick[c].flags & JOYFLAG_SIGNED) and check the status with joy[h].stick[c].axis[w].pos. That's right, isn't it?
.
Edit: I was doing something stupid. I wasn't considering the JOYFLAG_CALIBRATE flag, which was set.
Edit 2: Correction. It doesn't need to be calibrated. (I did a mistake when checking that flag. Forgot the parentheses.) The original post still stands.
In case it matters, I'm using a Thrustmaster Dual Power 3 gamepad and Allegro 4.2.1.
---
Edit 3: I've been looking at the Allegro sources and, while I haven't tested anything yet, I think I've found the bug. In hidjoy.m in the macosx sources, in hid_joy_init, all axis are given the signed flag, while in hid_joy_poll HID_ELEMENT_STANDALONE_AXIS is given unsigned values. I'll try changing it and report back.
---
Edit 4: Yep, that did it. Now I get values that work.
Send a patch?
How?
diff -wup oldfile newfile > foo.diff
-w to ignore whitespace changes
-u for unified context, which is what I think everyone prefers
-p to show which function the patch is in
Or alternatively, get svn and do:
svn co https://alleg.svn.sourceforge.net/svnroot/alleg/allegro/branches/4.2 svn diff filename > foo.diff
Ok, thanks. I'll do that tomorrow.
Edit: Done.
I assume it's right and committed it.