Configuring a Joystick or Gamepad for Source
How do I configure my joystick to work with Source games?
Important:
Gamepads, joysticks, and 360 controllers are currently not supported on Mac versions of Valve games.
To properly configuring your joystick you must:
- Define how Source should interpret the various axes available from your joystick (adding a joystick.cfg).
- Assign individual controls within your game (editing the config.cfg).
Most joysticks and gamepads come with a joystick.cfg you can use with source games out of the package. If your controller did not, you can create one with just the information found here.
The joystick.cfg file is saved in different places for different games. Here is a list of the locations to save the file for most Source games:
-
Counter-Strike: Source
..\Steam\steamapps\[USER NAME]\counter-strike source\cstrike\cfg
-
Day of Defeat: Source
..\Steam\steamapps\[USER NAME]\day of defeat source\dod\cfg
-
Half-Life: Source
..\Steam\steamapps\[USER NAME]\half-life source\hl1\cfg
-
Half-Life 2
..\Steam\steamapps\[USER NAME]\half-life 2\hl2\cfg
-
Half-Life 2 Deathmatch
..\Steam\steamapps\[USER NAME]\half-life 2 deathmatch\hl2mp\cfg
-
Half-Life 2: Episode One
..\Steam\steamapps\[USER NAME]\half-life 2 episode one\episodic\cfg
-
Half-Life 2: Episode Two
..\Steam\steamapps\[USER NAME]\half-life 2 episode two\ep2\cfg
-
Half-Life 2: Lost Coast
..\Steam\steamapps\[USER NAME]\half-life 2 lostcoast\lostcoast\cfg
-
Half-Life Deathmatch: Source
..\Steam\steamapps\[USER NAME]\half-life deathmatch source\hl1mp\cfg
-
Left 4 Dead
..\Steam\steamapps\common\left 4 dead\left4dead\cfg
-
Portal
..\Steam\steamapps\[USER NAME]\portal\portal\cfg
-
Team Fortress 2
..\Steam\steamapps\[USER NAME]\team fortress source\tf\cfg
The joystick.cfg is built in this manner:
joy_name “Joystick Name”
joy_advanced 1
mapping commands
sensitivity commands
threshold commands
joyadvancedupdate
Activating your Joystick
The configurations you made in your joystick.cfg will determine what the analog controls are used for in your Source game. Other controls can be assigned in a different manner.
- Go to Options-->Mouse and check the Joystick and Joystick Look checkboxes.
- Click on the Keyboard tab.
- For each action you wish to assign to a button, double click on the control and press the button you wish to activate it. You will see the control's name appear in the KEY/BUTTON section. This will allow you to quickly make assignments to your controller. The assignments are saved in your config.cfg .
Alternatively, you can edit the config.cfg directly using this syntax:
bind “button” “action”
For example:
bind “JOY1” “+jump”
This would bind button number 1 on your joystick to jump.
In addition to assigning joystick axes to specific directional controls, you may also specify how these actions respond using sensitivity and threshold controls.
Joystick Console Variables
- joy_accelmax
- Default: 2.0
- joy_accelscale*
- Default: 0.6
- joy_advanced
- Required in joystick.cfg before setting mapping, sensitivity, and threshold commands. Default 0
- joy_advaxisr
- Axis R: typically, this axis is a joystick rudder (rotation) control.
0 = Axis not used
1 = Axis used for movement forward and back (forward)
2 = Axis used for looking up and down(pitch)
3 = Axis used for strafing(side)
4 = Axis used for turning(yaw)
(Xbox 360 Controller: right analog stick Y-axis)
- joy_advaxisu
- Axis U: typically
0 = Axis not used
1 = Axis used for movement forward and back (forward)
2 = Axis used for looking up and down(pitch)
3 = Axis used for strafing(side)
4 = Axis used for turning(yaw)
(Xbox 360 Controller: right analog stick X-axis)
- joy_advaxisv
- Axis V:
0 = Axis not used
1 = Axis used for movement forward and back (forward)
2 = Axis used for looking up and down(pitch)
3 = Axis used for strafing(side)
4 = Axis used for turning(yaw)
- joy_advaxisx
- Axis X: typically this is the primary X-axis of the controller.
0 = Axis not used
1 = Axis used for movement forward and back (forward)
2 = Axis used for looking up and down(pitch)
3 = Axis used for strafing(side)
4 = Axis used for turning(yaw)
(Xbox 360 Controller: left analog stick X-axis)
- joy_advaxisy
- Axis Y: typically this is the primary Y-axis of the controller.
0 = Axis not used
1 = Axis used for movement forward and back (forward)
2 = Axis used for looking up and down(pitch)
3 = Axis used for strafing(side)
4 = Axis used for turning(yaw)
(Xbox 360 Controller: left analog stick Y-axis)
- joy_advaxisz
- Axis Z: typically this is the primary Z-axis or throttle of the controller.
0 = Axis not used
1 = Axis used for movement forward and back (forward)
2 = Axis used for looking up and down(pitch)
3 = Axis used for strafing(side)
4 = Axis used for turning(yaw)
(Xbox 360 Controller: left (negative) and right (positive) trigger buttons)
- joy_autoaimdampen*
- Specifies how much to scale user stick input when the gun is pointed at a valid target
Default “0”
- joy_autoaimdampenrange*
- The stick range where autoaimdampen is applied
Default “0”
- joy_autosprint*
- Automatically sprint when moving with an analog joystick
Default “0”
- joy_axisbutton_threshold*
- Analog axis range before a button press is registered. For example, when using the analog trigger on the Xbox 360 Controller to fire a weapon, the default setting requires that you pull the trigger 30% of the full trigger range before the weapon will fire.
Default: “0.3”
- joy_diagonalpov
- POV manipulator operates on diagonal axes, too
Default: “0”
- joy_display_input*
- Write joystick control information to the console log.
Default: “0”
- joy_forwardsensitivity
- Specifies the amount of joystick movement required for maximum movement speed forward and back.
Default: -1
- joy_forwardthreshold
- Specifies the dead-zone for movement forward and back.
Default: “0.15”
- joy_inverty
- Inverts Y axis
Default: 0
- joy_lowend*
- Specifies the amount of the controller’s physical range you wish to section off as the “inner zone”.
Default: 1
- joy_lowmap*
- Specifies the amount of the controller’s true range is mapped to the “inner zone”.
Default: 1
- joy_movement_stick
- Swap left and right stick.
Default: 0
- joy_name
- Value: Text
Name your joystick. Example: joy_name “Xbox 360 Controller”
- joy_pitchsensitivity
- Specifies the speed or ratio used when looking up and down.
Default: 1
- joy_pitchthreshold
- Specifies the dead-zone for looking up and down.
Default: “0.15”
- joy_response_look*
- Look stick response mode:
0=Linear
1=quadratic
2=cubic
3=quadratic extreme
4=custom
- joy_response_move*
- Movement' stick response mode:
0=Linear
1=quadratic
2=cubic
3=quadratic extreme
4=power function (i.e., pow(x,1/sensitivity))
- joy_sidesensitivity
- Specifies the amount of joystick movement required for maximum movement speed side to side.
Default: 1
- joy_sidethreshold
- Specifies the dead-zone for movement side to side.
Default: “0.15”
- joy_wingmanwarrior_centerhack
- Fixes a centering problem with the Wingman Warrior joystick.
Default: 0
- joy_wingmanwarrior_turnhack
- Fixes a spin problem with the Wingman Warrior joystick.
Default: 0
- joy_yawsensitivity
- Specifies the speed or ratio used when looking left or right.
Default: 1
- joy_yawthreshold
- Specifies the dead-zone for looking left or right.
Default: 0.15
- joy_xcontroller_cfg_loaded
- Default: 1
- Joyadvancedupdate
- Updates current joystick settings.
Takes no value.
- joystick
- Value: 0,1
Disable/Enable joystick
* Not available for all Source games.