Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Bug? Joystick in OSX

This thread is locked; no one can reply to it. rss feed Print
Bug? Joystick in OSX
Trumgottist
Member #95
April 2000
avatar

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.

--
"I always prefer to believe the best of everybody - it saves so much time." - Rudyard Kipling

Play my game: Frasse and the Peas of Kejick

Peter Wang
Member #23
April 2000

Send a patch?

Trumgottist
Member #95
April 2000
avatar

How?

--
"I always prefer to believe the best of everybody - it saves so much time." - Rudyard Kipling

Play my game: Frasse and the Peas of Kejick

Matthew Leverton
Supreme Loser
January 1999
avatar

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

Elias
Member #358
May 2000

Or alternatively, get svn and do:

svn co https://alleg.svn.sourceforge.net/svnroot/alleg/allegro/branches/4.2
svn diff filename > foo.diff

--
"Either help out or stop whining" - Evert

Trumgottist
Member #95
April 2000
avatar

Ok, thanks. I'll do that tomorrow.

Edit: Done.

--
"I always prefer to believe the best of everybody - it saves so much time." - Rudyard Kipling

Play my game: Frasse and the Peas of Kejick

Peter Wang
Member #23
April 2000

I assume it's right and committed it.

Go to: