Controller Config

From Serious Sam Wiki
Jump to: navigation, search

This document describes gamepad config xml files for OSX and Linux versions of Serious Sam 3.

Contents

Summary

Every config file has a single gamepad tag. Gamepad tag contains a single name tag, a single icons tag and multiple control tags. Control numbers, values and ranges can be determined by using tools such as jstest on linux, or in Sam3 by typing

inp_bLogGamepadEvents=1

into the game console.

Config file name

Expected file name will be written in the game log when detecting controllers if the config file is not found.

Linux

Config files are placed in Content/Config/Input/Linux directory. File should be named NAME.xml where NAME is the name returned by JSIOCGNAME ioctl, with all non-alphanumeric characters replaced by underscores. (e.g. Logitech_Logitech_Cordless_RumblePad_2.xml)

OSX

Config files are placed in Content/Config/Input/OSX directory. File should be named VENDORID-DEVICEID.xml, as returned by system_profiler SPUSBDataType (without 0x and separated by "-", e.g. 036D-C219.xml).

Icons tag

Each controller config file must specify its icon set by name. Icons supported by default are XBox360 and PS3.

  <icons>XBox360</icons>
  <icons>PS3</icons>

Attributes for control tags

id

This value represents a logical control on an XBox 360 controller. Control IDs from the driver need to be mapped to these controls. Positive and negative values on a single axis are considered as separate controls.

Possible values: LX+, LX-, LY+, LY-, RX+, RX-, RY+, RY-, LeftTrigger, RightTrigger, ButtonA, ButtonB, ButtonX, ButtonY, LeftShoulder, RightShoulder, LeftThumb, RightThumb, ButtonStart, ButtonBack, ButtonUp, ButtonDown, ButtonLeft, ButtonRight.


type

Specifies how the input from the driver will be interpreted by the game.

Possible values:

  • button - nonzero input is considered a pressed, and zero a depressed state.
  • axis - input is normalized using "idle", "max", and "deadzone" attributes (see below).
  • hat - is considered pressed if hat value is one of the values specified in the attribute "values".

number

Driver side numerical id of the control (js_event.number on linux or value returned by IOHIDElementGetUsage on OSX).


idle (only for axis controls)

This is the value returned by the driver when the control is in its idle state.


max (only for axis controls)

This is the max value for this control, it can be smaller than the idle value if control is negative. Idle and max values are used to separate a single axis into two controls. No more than two controls can be mapped to a single axis number.

Example 1: An analog stick that returns values in an interval [0, 255] and its value is 127 when idle:

  <control id="LX+" type="axis" number="48" idle="127" max="255"/>
  <control id="LX-" type="axis" number="48" idle="127" max="0"/>

values greater than 127 would be interpreted as movement for control LX+ and values smaller than 127 as movement for control LX-.


Example 2: A trigger that returns values in an interval [-32767, 32767] and its value is -32767 when idle:

  <control id="LeftTrigger"  type="axis" number="2" idle="-32767" max="32767"/>

deadzone (only for axis controls)

This is the deadzone value for the control. Difference from idle smaller than the deadzone value will be ignored.


digital (only for axis controls)

Some linux drivers (e.g. xpad driver on linux) return D-pad inputs as axis values instead of button values, but their value is either 0 or max. Setting this parameter to "true" makes it possible to smooth out such controls in game for more precise movement.

values (only for hat controls)

A list of 3 or less comma separated hat values that correspond to this control being set.

Example: An up control for a hat with value 0 for up, value 7 for up+left and value 1 for up+right.

  <control id="ButtonUp"      type="hat" number="57" values="0,1,7"/>


Examples

Here are some config files made for the Logitech F710 controller.

Mac OS X Logitech F710 (switch in D mode)

Filename: 046D-C219.xml

<?xml version="1.0" encoding="UTF-8"?>
<gamepad>
  <name>Logitech F710</name>
  <icons>XBox360</icons>
  <control id="LX+"           type="axis" number="48" idle="127" max="255" deadzone="20"/>
  <control id="LX-"           type="axis" number="48" idle="127" max="0"   deadzone="20"/>
  <control id="LY+"           type="axis" number="49" idle="127" max="0"   deadzone="20"/>
  <control id="LY-"           type="axis" number="49" idle="127" max="255" deadzone="20"/>
  <control id="RX+"           type="axis" number="50" idle="127" max="255" deadzone="20"/>
  <control id="RX-"           type="axis" number="50" idle="127" max="0"   deadzone="20"/>
  <control id="RY+"           type="axis" number="53" idle="127" max="0"   deadzone="20"/>
  <control id="RY-"           type="axis" number="53" idle="127" max="255" deadzone="20"/>

  <control id="LeftTrigger"   type="button" number="7"/>
  <control id="RightTrigger"  type="button" number="8"/>
  <control id="ButtonA"       type="button" number="2"/>
  <control id="ButtonB"       type="button" number="3"/>
  <control id="ButtonX"       type="button" number="1"/>
  <control id="ButtonY"       type="button" number="4"/>
  <control id="LeftShoulder"  type="button" number="5"/>
  <control id="RightShoulder" type="button" number="6"/>
  <control id="LeftThumb"     type="button" number="11"/>
  <control id="RightThumb"    type="button" number="12"/>
  <control id="ButtonStart"   type="button" number="10"/>
  <control id="ButtonBack"    type="button" number="9"/>

  <control id="ButtonUp"      type="hat" number="57" values="0,1,7"/>
  <control id="ButtonDown"    type="hat" number="57" values="3,4,5"/>
  <control id="ButtonLeft"    type="hat" number="57" values="5,6,7"/>
  <control id="ButtonRight"   type="hat" number="57" values="1,2,3"/>
</gamepad>


Linux Logitech F710 (Switch in D-Mode)

Filename: Logitech_Logitech_Cordless_RumblePad_2.xml

<?xml version="1.0" encoding="UTF-8"?>
<gamepad>
  <name>Logitech Cordless RumblePad 2</name>
  <icons>XBox360</icons>
  <control id="LX+"         type="axis" number="0" idle="0" max="32767"  deadzone="7849"/>
  <control id="LX-"         type="axis" number="0" idle="0" max="-32767" deadzone="7849"/>
  <control id="LY+"         type="axis" number="1" idle="0" max="-32767" deadzone="7849"/>
  <control id="LY-"         type="axis" number="1" idle="0" max="32767"  deadzone="7849"/>
  <control id="RX+"         type="axis" number="2" idle="0" max="32767"  deadzone="8689"/>
  <control id="RX-"         type="axis" number="2" idle="0" max="-32767" deadzone="8689"/>
  <control id="RY+"         type="axis" number="3" idle="0" max="-32767" deadzone="8689"/>
  <control id="RY-"         type="axis" number="3" idle="0" max="32767"  deadzone="8689"/>
  <control id="ButtonLeft"  type="axis" number="4" idle="0" max="-32767" digital="true"/>
  <control id="ButtonRight" type="axis" number="4" idle="0" max="32767"  digital="true"/>
  <control id="ButtonUp"    type="axis" number="5" idle="0" max="-32767" digital="true"/>
  <control id="ButtonDown"  type="axis" number="5" idle="0" max="32767"  digital="true"/>

  <control id="LeftTrigger"   type="button" number="6"/>
  <control id="RightTrigger"  type="button" number="7"/>
  <control id="ButtonA"       type="button" number="1"/>
  <control id="ButtonB"       type="button" number="2"/>
  <control id="ButtonX"       type="button" number="0"/>
  <control id="ButtonY"       type="button" number="3"/>
  <control id="LeftShoulder"  type="button" number="4"/>
  <control id="RightShoulder" type="button" number="5"/>
  <control id="ButtonBack"    type="button" number="8"/>
  <control id="ButtonStart"   type="button" number="9"/>
  <control id="LeftThumb"     type="button" number="10"/>
  <control id="RightThumb"    type="button" number="11"/>
</gamepad>


Linux Logitech F710 (Switch in X mode)

Filename: Generic_X_Box_pad.xml

<?xml version="1.0" encoding="UTF-8"?>
<gamepad>
  <name>Generic X-Box pad</name>
  <icons>XBox360</icons>
  <control id="LX+"          type="axis" number="0" idle="0" max="32767"  deadzone="7849"/>
  <control id="LX-"          type="axis" number="0" idle="0" max="-32767" deadzone="7849"/>
  <control id="LY+"          type="axis" number="1" idle="0" max="-32767"  deadzone="7849"/>
  <control id="LY-"          type="axis" number="1" idle="0" max="32767" deadzone="7849"/>
  <control id="RX+"          type="axis" number="3" idle="0" max="32767"  deadzone="8689"/>
  <control id="RX-"          type="axis" number="3" idle="0" max="-32767" deadzone="8689"/>
  <control id="RY+"          type="axis" number="4" idle="0" max="-32767"  deadzone="8689"/>
  <control id="RY-"          type="axis" number="4" idle="0" max="32767" deadzone="8689"/>
  <control id="LeftTrigger"  type="axis" number="2" idle="-32767" max="32767"  deadzone="7650"/>
  <control id="RightTrigger" type="axis" number="5" idle="-32767" max="32767"  deadzone="7650"/>
  <control id="ButtonLeft"   type="axis" number="6" idle="0" max="-32767" digital="true"/>
  <control id="ButtonRight"  type="axis" number="6" idle="0" max="32767"  digital="true"/>
  <control id="ButtonUp"     type="axis" number="7" idle="0" max="-32767" digital="true"/>
  <control id="ButtonDown"   type="axis" number="7" idle="0" max="32767"  digital="true"/>

  <control id="ButtonA"       type="button" number="0"/>
  <control id="ButtonB"       type="button" number="1"/>
  <control id="ButtonX"       type="button" number="2"/>
  <control id="ButtonY"       type="button" number="3"/>
  <control id="LeftShoulder"  type="button" number="4"/>
  <control id="RightShoulder" type="button" number="5"/>
  <control id="ButtonBack"    type="button" number="6"/>
  <control id="ButtonStart"   type="button" number="7"/>
  <control id="LeftThumb"     type="button" number="9"/>
  <control id="RightThumb"    type="button" number="10"/>
</gamepad>

Personal tools