Big thread of gamepad testing

Do you know if this is an issue on multiple platforms? And which platform have you tested on? Windows?

Both testers in this case are on Windows. I don’t have any data on other platforms.

Found this in an RPS article:

"As is so often the case with hardware worries, the underlying reason for the PS5 controller’s PC bother is driver software. Sony hasn’t produced official PC drivers themselves, and although the DualSense can interface with Windows’ DirectInput driver, a lot of modern games don’t recognise this. They may instead use the newer XInput driver, which was created by Microsoft with Xbox controllers in mind. Unless a game recognises both driver types, your PS5 controller won’t work – unless, that is, Steam steps in to bridge the gap.

As hard as the Steam Controller flopped, it has left a legacy of some very extensive controller support across Valve’s platform. You can even connect a pad with no official Windows drivers – like the PS5 DualSense – and Steam will translate inputs so that games can understand them. It’s basically emulating an Xbox controller, which is why some games will keep showing Xbox button prompts when you have a PlayStation controller connected."

(How to use a PS5 DualSense controller on PC | Rock Paper Shotgun)

We’re using XInput for which there is apparently no driver. We have no immediate plans to add DirectInput support. And it seems like Steam does exactly what that DS4 tool does and detects and translates the Dual Shock 5 input.

3 Likes

The crash should be fixed by latest dev, you can try the binary from here:
https://d.defold.com/archive/alpha/1f35a0be292ff1ab7c7ded49c870ba201c2d5623/engine/x86_64-win32/gdc.exe

1 Like

Just want to add that the PlayerX PCB by pimoroni or a raspberry pi Pico using my macro keyboard file, available here is probably the easiest/cheapest way to build a controller yourself (i.e. for something like an arcade machine).

The Player X PCB is detected automatically as a gamepad, though you will have some raw input to deal with for one of the joysticks.

The raspberry pi pico works like a keyboard so therefore works automatically very easily, and has 22 buttons, which are by default assigned to space bar, numbers 1 to 9, then 0, then the keys A, B C… L. It’s very easy to reprogramme and several can be connected at the same time.

Both of these costs around €10, so with a few cute arcade buttons, you can make something that works well for pretty low cost.

3 Likes

Here’s a binding that works for Steam Deck.

4 Likes

The 1.4.4 release of Defold brought an improved support for gamepads on Windows. Would you guys be able to retest your controllers on Windows and provide updated gamepads bindings?

Looks like the GDC links are dead, can you change it to the GitHub releases page?

I’ve updated the original post to link to GitHub Releases instead.

2 Likes

Here’s a mapping for PlayStation controllers. Confirmed working for Dualshock 4 and Dualshock 5. Not sure if it captures all of the available variants, so if you have a PlayStation controller please try it out and let us know if it works or not.

driver
{
    device: "Wireless Controller"
    platform: "windows"
    dead_zone: 0.2
    map { input: GAMEPAD_LSTICK_LEFT type: GAMEPAD_TYPE_AXIS index: 0 mod { mod: GAMEPAD_MODIFIER_NEGATE } mod { mod: GAMEPAD_MODIFIER_CLAMP } }
    map { input: GAMEPAD_LSTICK_RIGHT type: GAMEPAD_TYPE_AXIS index: 0 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
    map { input: GAMEPAD_LSTICK_DOWN type: GAMEPAD_TYPE_AXIS index: 1 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
    map { input: GAMEPAD_LSTICK_UP type: GAMEPAD_TYPE_AXIS index: 1 mod { mod: GAMEPAD_MODIFIER_NEGATE } mod { mod: GAMEPAD_MODIFIER_CLAMP } }
    map { input: GAMEPAD_LSTICK_CLICK type: GAMEPAD_TYPE_BUTTON index: 14 }
    map { input: GAMEPAD_LTRIGGER type: GAMEPAD_TYPE_BUTTON index: 10 }
    map { input: GAMEPAD_LSHOULDER type: GAMEPAD_TYPE_BUTTON index: 8 }
    map { input: GAMEPAD_LPAD_LEFT type: GAMEPAD_TYPE_BUTTON index: 2 }
    map { input: GAMEPAD_LPAD_RIGHT type: GAMEPAD_TYPE_BUTTON index: 3 }
    map { input: GAMEPAD_LPAD_DOWN type: GAMEPAD_TYPE_BUTTON index: 1 }
    map { input: GAMEPAD_LPAD_UP type: GAMEPAD_TYPE_BUTTON index: 0 }
    map { input: GAMEPAD_RSTICK_LEFT type: GAMEPAD_TYPE_AXIS index: 2 mod { mod: GAMEPAD_MODIFIER_NEGATE } mod { mod: GAMEPAD_MODIFIER_CLAMP } }
    map { input: GAMEPAD_RSTICK_RIGHT type: GAMEPAD_TYPE_AXIS index: 2 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
    map { input: GAMEPAD_RSTICK_DOWN type: GAMEPAD_TYPE_AXIS index: 5 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
    map { input: GAMEPAD_RSTICK_UP type: GAMEPAD_TYPE_AXIS index: 5 mod { mod: GAMEPAD_MODIFIER_NEGATE } mod { mod: GAMEPAD_MODIFIER_CLAMP } }
    map { input: GAMEPAD_RSTICK_CLICK type: GAMEPAD_TYPE_BUTTON index: 15 }
    map { input: GAMEPAD_RTRIGGER type: GAMEPAD_TYPE_BUTTON index: 11 }
    map { input: GAMEPAD_RSHOULDER type: GAMEPAD_TYPE_BUTTON index: 9 }
    map { input: GAMEPAD_RPAD_LEFT type: GAMEPAD_TYPE_BUTTON index: 4 }
    map { input: GAMEPAD_RPAD_RIGHT type: GAMEPAD_TYPE_BUTTON index: 6 }
    map { input: GAMEPAD_RPAD_DOWN type: GAMEPAD_TYPE_BUTTON index: 5 }
    map { input: GAMEPAD_RPAD_UP type: GAMEPAD_TYPE_BUTTON index: 7 }
    map { input: GAMEPAD_START type: GAMEPAD_TYPE_BUTTON index: 13 }
    map { input: GAMEPAD_BACK type: GAMEPAD_TYPE_BUTTON index: 12 }
}
4 Likes

Also here is my Logitech F310 on mac

driver {
  device: "Logitech Dual Action"
  platform: "osx"
  dead_zone: 0.200
  map { input: GAMEPAD_LSTICK_LEFT type: GAMEPAD_TYPE_AXIS index: 0 mod { mod: GAMEPAD_MODIFIER_NEGATE } mod { mod: GAMEPAD_MODIFIER_CLAMP } }
  map { input: GAMEPAD_LSTICK_RIGHT type: GAMEPAD_TYPE_AXIS index: 0 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
  map { input: GAMEPAD_LSTICK_DOWN type: GAMEPAD_TYPE_AXIS index: 1 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
  map { input: GAMEPAD_LSTICK_UP type: GAMEPAD_TYPE_AXIS index: 1 mod { mod: GAMEPAD_MODIFIER_NEGATE } mod { mod: GAMEPAD_MODIFIER_CLAMP } }
  map { input: GAMEPAD_LSTICK_CLICK type: GAMEPAD_TYPE_BUTTON index: 10 }
  map { input: GAMEPAD_LTRIGGER type: GAMEPAD_TYPE_BUTTON index: 6 }
  map { input: GAMEPAD_LSHOULDER type: GAMEPAD_TYPE_BUTTON index: 4 }
  map { input: GAMEPAD_LPAD_LEFT type: GAMEPAD_TYPE_HAT index: 0 hat_mask: 8 }
  map { input: GAMEPAD_LPAD_RIGHT type: GAMEPAD_TYPE_HAT index: 0 hat_mask: 2 }
  map { input: GAMEPAD_LPAD_DOWN type: GAMEPAD_TYPE_HAT index: 0 hat_mask: 4 }
  map { input: GAMEPAD_LPAD_UP type: GAMEPAD_TYPE_HAT index: 0 hat_mask: 1 }
  map { input: GAMEPAD_RSTICK_LEFT type: GAMEPAD_TYPE_AXIS index: 2 mod { mod: GAMEPAD_MODIFIER_NEGATE } mod { mod: GAMEPAD_MODIFIER_CLAMP } }
  map { input: GAMEPAD_RSTICK_RIGHT type: GAMEPAD_TYPE_AXIS index: 2 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
  map { input: GAMEPAD_RSTICK_DOWN type: GAMEPAD_TYPE_AXIS index: 3 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
  map { input: GAMEPAD_RSTICK_UP type: GAMEPAD_TYPE_AXIS index: 3 mod { mod: GAMEPAD_MODIFIER_NEGATE } mod { mod: GAMEPAD_MODIFIER_CLAMP } }
  map { input: GAMEPAD_RSTICK_CLICK type: GAMEPAD_TYPE_BUTTON index: 11 }
  map { input: GAMEPAD_RTRIGGER type: GAMEPAD_TYPE_BUTTON index: 7 }
  map { input: GAMEPAD_RSHOULDER type: GAMEPAD_TYPE_BUTTON index: 5 }
  map { input: GAMEPAD_RPAD_LEFT type: GAMEPAD_TYPE_BUTTON index: 0 }
  map { input: GAMEPAD_RPAD_RIGHT type: GAMEPAD_TYPE_BUTTON index: 2 }
  map { input: GAMEPAD_RPAD_DOWN type: GAMEPAD_TYPE_BUTTON index: 1 }
  map { input: GAMEPAD_RPAD_UP type: GAMEPAD_TYPE_BUTTON index: 3 }
  map { input: GAMEPAD_START type: GAMEPAD_TYPE_BUTTON index: 9 }
  map { input: GAMEPAD_BACK type: GAMEPAD_TYPE_BUTTON index: 8 }
}

:thinking: This is almost identical (it is missing GAMEPAD_GUIDE on index 17) to the one that already exists in the default .gamepads file.

2 Likes

Thanks. Added: https://github.com/defold/defold/commit/6f688e4862b3e0b76b9585b88ffc755fe48b41bf

1 Like

Yeah. You’re right. Didn’t even cross my mind that it was already mapped, just that it couldn’t be detected before 1.4.4 :man_facepalming:

1 Like

Is it possible to proxy or inhert a gamepad mapping? I’ve just created one for the Gamesir X2 (Expandable controller) and the only difference between it and the Android Xbox Wireless mapping is the device name

Defold doesn’t capture R2 & L2 inputs from Xbox X Controller S. I had this issue when I was playing @Alex_8BitSkull 's Bore Blast. I thought it was because the miss configuration, but I just test is with latest (1.7.0) buildins-default.gamepads and there is no action triggered (even raw). I would like to test it with gdc but it has a issue on MacOS.
Gamepad buttons are working with online gamepad testers and I’m already using it while playing games. Anyone has this issue?

1 Like

Yeah, it seems we introduced a new concept of worker threads in our graphics backend, and the gdc tool was left out of that update. I’m fixing now.
We have a PR for it now.

4 Likes

I can confirm that even gdc(macos) tool doesn’t capture L and R triggers for latest Xbox X Controller

Issue: Defold doesn't capture L & R triggers for latest Xbox Controller · Issue #8736 · defold/defold · GitHub

2 Likes

Here’s a mapping for my 8BitDo Pro 2 gamepad (android + windows):

driver {
device: "8BitDo Pro 2"
platform: "android"
dead_zone: 0.2
map { input: GAMEPAD_LSTICK_LEFT type: GAMEPAD_TYPE_AXIS index: 0 mod { mod: GAMEPAD_MODIFIER_NEGATE } mod { mod: GAMEPAD_MODIFIER_CLAMP } }
map { input: GAMEPAD_LSTICK_RIGHT type: GAMEPAD_TYPE_AXIS index: 0 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
map { input: GAMEPAD_LSTICK_DOWN type: GAMEPAD_TYPE_AXIS index: 1 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
map { input: GAMEPAD_LSTICK_UP type: GAMEPAD_TYPE_AXIS index: 1 mod { mod: GAMEPAD_MODIFIER_NEGATE } mod { mod: GAMEPAD_MODIFIER_CLAMP } }
map { input: GAMEPAD_LSTICK_CLICK type: GAMEPAD_TYPE_BUTTON index: 17 }
map { input: GAMEPAD_RSTICK_LEFT type: GAMEPAD_TYPE_AXIS index: 2 mod { mod: GAMEPAD_MODIFIER_NEGATE } mod { mod: GAMEPAD_MODIFIER_CLAMP } }
map { input: GAMEPAD_RSTICK_RIGHT type: GAMEPAD_TYPE_AXIS index: 2 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
map { input: GAMEPAD_RSTICK_DOWN type: GAMEPAD_TYPE_AXIS index: 3 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
map { input: GAMEPAD_RSTICK_UP type: GAMEPAD_TYPE_AXIS index: 3 mod { mod: GAMEPAD_MODIFIER_NEGATE } mod { mod: GAMEPAD_MODIFIER_CLAMP } }
map { input: GAMEPAD_RSTICK_CLICK type: GAMEPAD_TYPE_BUTTON index: 18 }
map { input: GAMEPAD_LPAD_LEFT type: GAMEPAD_TYPE_HAT index: 0 hat_mask: 8 }
map { input: GAMEPAD_LPAD_RIGHT type: GAMEPAD_TYPE_HAT index: 0 hat_mask: 2 }
map { input: GAMEPAD_LPAD_DOWN type: GAMEPAD_TYPE_HAT index: 0 hat_mask: 4 }
map { input: GAMEPAD_LPAD_UP type: GAMEPAD_TYPE_HAT index: 0 hat_mask: 1 }
map { input: GAMEPAD_RPAD_UP type: GAMEPAD_TYPE_BUTTON index: 3 }
map { input: GAMEPAD_RPAD_DOWN type: GAMEPAD_TYPE_BUTTON index: 1 }
map { input: GAMEPAD_RPAD_RIGHT type: GAMEPAD_TYPE_BUTTON index: 0 }
map { input: GAMEPAD_RPAD_LEFT type: GAMEPAD_TYPE_BUTTON index: 6 }
map { input: GAMEPAD_LSHOULDER type: GAMEPAD_TYPE_BUTTON index: 4 }
map { input: GAMEPAD_RSHOULDER type: GAMEPAD_TYPE_BUTTON index: 5 }
map { input: GAMEPAD_LTRIGGER type: GAMEPAD_TYPE_BUTTON index: 8 }
map { input: GAMEPAD_RTRIGGER type: GAMEPAD_TYPE_BUTTON index: 9 }
map { input: GAMEPAD_START type: GAMEPAD_TYPE_BUTTON index: 15 }
map { input: GAMEPAD_BACK type: GAMEPAD_TYPE_BUTTON index: 16 }
map { input: GAMEPAD_GUIDE type: GAMEPAD_TYPE_BUTTON index: 19 }
}

driver {
device: "8BitDo Pro 2"
platform: "windows"
dead_zone: 0.2
map { input: GAMEPAD_LPAD_LEFT type: GAMEPAD_TYPE_HAT index: 0 hat_mask: 8 }
map { input: GAMEPAD_LPAD_RIGHT type: GAMEPAD_TYPE_HAT index: 0 hat_mask: 2 }
map { input: GAMEPAD_LPAD_DOWN type: GAMEPAD_TYPE_HAT index: 0 hat_mask: 4 }
map { input: GAMEPAD_LPAD_UP type: GAMEPAD_TYPE_HAT index: 0 hat_mask: 1 }
map { input: GAMEPAD_START type: GAMEPAD_TYPE_BUTTON index: 15 }
map { input: GAMEPAD_BACK type: GAMEPAD_TYPE_BUTTON index: 14 }
map { input: GAMEPAD_RPAD_UP type: GAMEPAD_TYPE_BUTTON index: 7 }
map { input: GAMEPAD_RPAD_DOWN type: GAMEPAD_TYPE_BUTTON index: 5 }
map { input: GAMEPAD_RPAD_RIGHT type: GAMEPAD_TYPE_BUTTON index: 4 }
map { input: GAMEPAD_RPAD_LEFT type: GAMEPAD_TYPE_BUTTON index: 8 }
map { input: GAMEPAD_LSHOULDER type: GAMEPAD_TYPE_BUTTON index: 10 }
map { input: GAMEPAD_RSHOULDER type: GAMEPAD_TYPE_BUTTON index: 11 }
map { input: GAMEPAD_LTRIGGER type: GAMEPAD_TYPE_BUTTON index: 12 }
map { input: GAMEPAD_RTRIGGER type: GAMEPAD_TYPE_BUTTON index: 13 }
map { input: GAMEPAD_GUIDE type: GAMEPAD_TYPE_BUTTON index: 16 }
map { input: GAMEPAD_LSTICK_LEFT type: GAMEPAD_TYPE_AXIS index: 0 mod { mod: GAMEPAD_MODIFIER_NEGATE } mod { mod: GAMEPAD_MODIFIER_CLAMP } }
map { input: GAMEPAD_LSTICK_RIGHT type: GAMEPAD_TYPE_AXIS index: 0 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
map { input: GAMEPAD_LSTICK_DOWN type: GAMEPAD_TYPE_AXIS index: 1 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
map { input: GAMEPAD_LSTICK_UP type: GAMEPAD_TYPE_AXIS index: 1 mod { mod: GAMEPAD_MODIFIER_NEGATE } mod { mod: GAMEPAD_MODIFIER_CLAMP } }
map { input: GAMEPAD_LSTICK_CLICK type: GAMEPAD_TYPE_BUTTON index: 17 }
map { input: GAMEPAD_RSTICK_LEFT type: GAMEPAD_TYPE_AXIS index: 3 mod { mod: GAMEPAD_MODIFIER_NEGATE } mod { mod: GAMEPAD_MODIFIER_CLAMP } }
map { input: GAMEPAD_RSTICK_RIGHT type: GAMEPAD_TYPE_AXIS index: 3 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
map { input: GAMEPAD_RSTICK_DOWN type: GAMEPAD_TYPE_AXIS index: 4 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
map { input: GAMEPAD_RSTICK_UP type: GAMEPAD_TYPE_AXIS index: 4 mod { mod: GAMEPAD_MODIFIER_NEGATE } mod { mod: GAMEPAD_MODIFIER_CLAMP } }
map { input: GAMEPAD_RSTICK_CLICK type: GAMEPAD_TYPE_BUTTON index: 18 }
}

This defold project is another variation of mapping for gamepads:
GAMEPAD_TESTER.zip (92.3 KB)

It’s assembled from two projects:

6 Likes