Created attachment 2303[details]
360 Gamepad support
I wrote a small patch to enable 360 controller support. I've tested it on Windows XP, built with Visual Studio 2008 Express, but haven't tested anything else.
Created attachment 2305[details]
Enable analog joystick support.
I've split and enhanced this patch.
This first one, enableanalogjoy.diff, re-enables using analog axes from the joystick, instead of converting them into keyboard commands. This is tied to a new cvar, in_joystickUseAnalog.
Just applying this patch exposes a couple of bugs. First, the forward and back directions are reversed, and second, the sensitivity is way too high for yaw.
The second patch, customjoyaxes.diff, solves those bugs, uploading after this.
The second patch, customjoyaxes.diff, solves those bugs, by adding additional cvars, since there are no guarantees where and in what direction axes go in SDL.
These cvars are:
-j_forward, analogue to m_forward, for forward movement speed/direction.
-j_side, analogue to m_side, for side movement speed/direction.
-j_pitch, analogue to m_pitch, for pitch rotation speed/direction.
-j_yaw, analogue to m_yaw, for yaw rotation speed/direction.
-j_forward_axis, selects which joystick axis controls forward/back.
-j_side_axis, selects which joystick axis controls left/right.
-j_pitch_axis, selects which joystick axis controls pitch.
-j_yaw_axis, selects which joystick axis controls yaw.
After this, 360 gamepad support is almost complete, except for the weirdness with the left and right triggers being the same axis. That can be fixed by changing one line after applying the first two patches:
sdl_input.c, line 810:
if (!in_joystickUseAnalog->integer)
to:
if (i == AXIS_UP || !in_joystickUseAnalog->integer)
which changes the Z axis into keys.
Comment 4Zachary J. Slater
2010-10-19 02:42:24 EDT
Created attachment 2303 [details] 360 Gamepad support I wrote a small patch to enable 360 controller support. I've tested it on Windows XP, built with Visual Studio 2008 Express, but haven't tested anything else.
Created attachment 2305 [details] Enable analog joystick support. I've split and enhanced this patch. This first one, enableanalogjoy.diff, re-enables using analog axes from the joystick, instead of converting them into keyboard commands. This is tied to a new cvar, in_joystickUseAnalog. Just applying this patch exposes a couple of bugs. First, the forward and back directions are reversed, and second, the sensitivity is way too high for yaw. The second patch, customjoyaxes.diff, solves those bugs, uploading after this.
Created attachment 2306 [details] Add customizable joystick axes