The Ur-Quan Masters Discussion Forum

The Ur-Quan Masters Re-Release => Technical Issues => Topic started by: cast55 on December 04, 2004, 04:27:09 am

Title: keys.cfg joystick settings question
Post by: cast55 on December 04, 2004, 04:27:09 am
Running UQM 0.3 on Debian linux:

I edited the keys.cfg file to enable joystick support, which works fine, and I currently have a MS Sidewinder Force Feedback Pro set up in this capacity; however, after playing for a while I decided that instead of using axis 0 for turning (sideways movement of stick), I would rather use axis 2 (axial rotation of stick).  The problem, verified by examining the output of jstest /dev/js0, is that while the other axes produce values between -32767 and +32767, this particular axis seems to be monopolar.  Reported values are between -32767 and 0, corresponding to full left to full right rotation (center position is -16383).  As such, I don't know what to enter for the joystick axis parameter, as the syntax appears to require a negative or positive declaration.  Is it possible to specify an offset to this value?

Any ideas would be greatly appreciated.

Title: Re: keys.cfg joystick settings question
Post by: meep-eep on December 04, 2004, 05:20:09 am
SDL should map the values of the axis to values in the range  -32768 to 32767. So UQM doesn't get the same values as jstest. Positive and negative specify which end of the scale you want to map to a specific joystick event.

If this doesn't work, it may be that SDL is returning the wrong value. You could put some debug info in src/sc2code/libs/input/vcontrol.c, in the function VControl_ProcessJoyAxis() to check what UQM gets.
This doesn't mean that SDL itself is at fault. I suppose it will need to get the range of the joystick motion from the kernel joystick driver itself, unless the kernel is supposed to always return a value in the same range (I know very little about the kernel joystick interface). It may be that the range that SDL gets is incorrect, or that the kernel returns a value in the wrong range.