Is gamepad right trigger inverted on Linux or is it just me?

Hello, have been porting a game to Defold from another engine, mostly to see the differences, but have been on Windows until today. I’m pretty sure my inputs worked fine on Windows, maybe even on Steam Deck building from Windows (not real sure about that one.)

However I switched to a Linux desktop today. Do not have access to Windows at the moment to verify. But for some reason my gamepad’s right trigger is inverted. Like holding down the button is sending a ‘released’ signal and 0 value. Not pressing it is sending 1 value constantly.

My left trigger seems to be working fine.

function on_input(self, action_id, action)
  if action_id == hashes.INPUT_PRIMARY_ABILITY then
    print(action_id)
    pprint(action)
  end
end

Outputs

DEBUG:SCRIPT: hash: [primary]
DEBUG:SCRIPT: 
{ --[[0x797fea980ea0]]
  gamepad = 2,
  value = 1,
  userid = 0,
  gamepad_unknown = false,
  released = false,
  pressed = false,
  repeated = false
}
DEBUG:SCRIPT: hash: [primary]
DEBUG:SCRIPT: 
{ --[[0x797fea996770]]
  gamepad = 2,
  value = 0,
  userid = 0,
  gamepad_unknown = false,
  released = true,
  pressed = false,
  repeated = false
}

Where the top block is spammed while NOT pressed. The bottom is printed as soon as I press the right trigger and the spamming stops.

I’m using an 8bitdo that is registered as an xbox 360 controller. Also tried with a PS4 controller, same thing. And built it to my Steam Deck and saw the same thing. My version is up to date. I also tried on other game engines, web browser testing, and just in steam games and the trigger functioned fine everywhere else.

I could put up a bug if needed but figured I’d see if anyone else has seen this? Or if maybe it is just me? Sanity check? :sweat_smile:

Also, it seems to detect my keyboard and mouse as unidentified gamepads and makes my gamepad #2… also kind of weird but maybe expected since Linux can be weird?

Which version of Defold are you using?

Managed to fix it. In default.gamepads the RTRIGGER has mod { mod: GAMEPAD_MODIFIER_NEGATE } so I copied default.gamepads, found the linux entry for ‘Microsoft X-Box 360 pad’ and deleted it from the RTRIGGER, which fixed it for my 8bitdo. And ‘Microsoft X-Box 360 pad 0’ linux for Steam Deck.

1.10.2 is my Defold version. I also tried as far back as 1.9.8. Also had it. Kind of strange that the left trigger doesn’t have the negate but the right does. But it was a relatively easy fix in the default.gamepads file. :man_shrugging:

The fix will be included in 1.10.3:

You can test it in the alpha already Release v1.10.3 - alpha · defold/defold · GitHub

1 Like

Nice! I had searched github issues and didn’t see anything except a request to use, I think it was SDL’s mappings, guess I was only looking at open issues. Cool that its already being looked at though, thanks for replying!