Mapping Format - Dinir/mini-padder GitHub Wiki

The format is mainly for telling the relations between buttons and their representative indexes.
If a gamepad doesn't have a part for a mapping, the mapping can exclude the related property.


Format

{
  "gamepadId": {
    "name": "",
    "properties": [],
    "sticks": {
      "deadzone": 0.08,
      "left": {
        "x": 0, "y": 1, "button": 10
      },
      "right": {
        "x": 2, "y": 3, "button": 11
      }
    },
    "buttons": {
      "dpad": {
        "up": 12, "down": 13, "left": 14, "right": 15
      },
      "face": {
        "down": 0, "right": 1, "left": 2, "up": 3,
        "select": 8, "start": 9,
        "home": 16, "touchpad": 17
      },
      "shoulder": {
        "l1": 4, "r1": 5, "l2": 6, "r2": 7
      }
    }
  }
}

Part Names

         ┌        l2                                      r2
shoulder │        l1                                      r1
         └ 
         ┌        up        select touchpad  start        up
    face │  left      right                         left      right
         └       down                                    down
           └──────────────┘ left             right
                 dpad         │                │
                            stick            stick

Other Properties

General

gamepadId

Vendor ID and Product ID of your gamepad, stripped and concatenated into an 8-letter long string. My DualShock 4 for example is 054c09cc. If you only leave the vendor ID to this property, you can use this mapping for all products from the same company.

name

I use this property to tell which gamepad this mapping is for.

properties

String array of flags to tell the gamepad has a part that works differently.

  • joystick: This is a joystick. It doesn't have two analog sticks and a dpad.
  • nosticks: This is a simple gamepad with no analog sticks.
  • axisdpad: Dpad is represented as a single axis, instead of four buttons. Usually a behaviour for joysticks, but some gamepads have a dpad working this way.

sticks

deadzone

The threshold under which the stick should be considered inactive. I didn't see a gamepad with an analog stick staying at perfect 0, and even a joystick will stay at a non-zero value when it's in neutral position. I put 0.5 for joysticks.

button

This is the button index for the stick click: l3 and r3.

buttons

dpad

If the gamepad has either joystick or axisdpad, please put one property named axis under it. The number is the axis index dpad is represented.

"dpad": {
  "axis": 9 
}

face

Button indexes for face buttons go here, but for joysticks you can also add indexes for l3 and r3 here, if the joystick has buttons for them. home and touchpad only works for DInput gamepads.

shoulder

Button indexes for shoulder buttons go here.

Example

The default mapping file