Bug 4551 - 360 Gamepad support
Status: RESOLVED FIXED
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Misc
Version: GIT MASTER
Hardware: PC Windows XP
: P3 enhancement
Assignee: Zachary J. Slater
QA Contact: ioquake3 bugzilla mailing list
URL:
Depends on:
Blocks:
 
Reported: 2010-02-19 00:38 EST by James Canete
Modified: 2011-04-19 09:26:24 EDT
1 user (show)

See Also:


Attachments
360 Gamepad support (3.69 KB, patch)
2010-02-19 00:38 EST, James Canete
Enable analog joystick support. (2.61 KB, patch)
2010-02-19 04:21 EST, James Canete
Add customizable joystick axes (3.27 KB, patch)
2010-02-19 04:24 EST, James Canete

Description James Canete 2010-02-19 00:38:54 EST
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.
Comment 1 James Canete 2010-02-19 04:21:34 EST
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.
Comment 2 James Canete 2010-02-19 04:24:22 EST
Created attachment 2306 [details]
Add customizable joystick axes
Comment 3 James Canete 2010-02-19 04:27:12 EST
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 4 Zachary J. Slater 2010-10-19 02:42:24 EDT
Cool, will look at this later.
Comment 5 Thilo Schulz 2011-04-19 09:26:24 EDT
Applied r1946