Steam Deck input (SOLVED)

Lua, love it or hate it, you’re gonna have to use it.

2 Likes

Yep. That’s it. We’ve done it!!! Thanks for the help.

Here’s a working Steam Deck mapping:

driver
{
    device: "Microsoft X-Box 360 pad 0"
    platform: "linux"
    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_NEGATE } mod { mod: GAMEPAD_MODIFIER_CLAMP } }
    map { input: GAMEPAD_LSTICK_UP type: GAMEPAD_TYPE_AXIS index: 1 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
    map { input: GAMEPAD_LSTICK_CLICK type: GAMEPAD_TYPE_BUTTON index: 9 }
    map { input: GAMEPAD_LTRIGGER type: GAMEPAD_TYPE_AXIS index: 2 mod { mod: GAMEPAD_MODIFIER_SCALE } }
    map { input: GAMEPAD_LSHOULDER type: GAMEPAD_TYPE_BUTTON index: 4 }
    map { input: GAMEPAD_LPAD_LEFT type: GAMEPAD_TYPE_AXIS index: 6 mod { mod: GAMEPAD_MODIFIER_NEGATE } mod { mod: GAMEPAD_MODIFIER_CLAMP } }
    map { input: GAMEPAD_LPAD_RIGHT type: GAMEPAD_TYPE_AXIS index: 6 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
    map { input: GAMEPAD_LPAD_DOWN type: GAMEPAD_TYPE_AXIS index: 7 mod { mod: GAMEPAD_MODIFIER_NEGATE } mod { mod: GAMEPAD_MODIFIER_CLAMP } }
    map { input: GAMEPAD_LPAD_UP type: GAMEPAD_TYPE_AXIS index: 7 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
    map { input: GAMEPAD_RSTICK_LEFT type: GAMEPAD_TYPE_AXIS index: 3 mod { mod: GAMEPAD_MODIFIER_CLAMP } }
    map { input: GAMEPAD_RSTICK_RIGHT type: GAMEPAD_TYPE_AXIS index: 3 mod { mod: GAMEPAD_MODIFIER_NEGATE } 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: 10 }
    map { input: GAMEPAD_RTRIGGER type: GAMEPAD_TYPE_AXIS index: 5 mod { mod: GAMEPAD_MODIFIER_NEGATE } mod { mod: GAMEPAD_MODIFIER_SCALE } }
    map { input: GAMEPAD_RSHOULDER type: GAMEPAD_TYPE_BUTTON index: 5 }
    map { input: GAMEPAD_RPAD_LEFT type: GAMEPAD_TYPE_BUTTON index: 2 }
    map { input: GAMEPAD_RPAD_RIGHT type: GAMEPAD_TYPE_BUTTON index: 1 }
    map { input: GAMEPAD_RPAD_DOWN type: GAMEPAD_TYPE_BUTTON index: 0 }
    map { input: GAMEPAD_RPAD_UP type: GAMEPAD_TYPE_BUTTON index: 3 }
    map { input: GAMEPAD_START type: GAMEPAD_TYPE_BUTTON index: 7 }
    map { input: GAMEPAD_BACK type: GAMEPAD_TYPE_BUTTON index: 6 }
}

Can it be included in the default project bindings somehow? If yes, perhaps a good idea to wait a bit just in case there’s something wrong with it.

As far as I’m concerned, Lua is right and everyone else is wrong.

6 Likes

Yes, we should definitely include it! I’m prepare a pull request.

3 Likes

I am having some issues with Steam Deck when external input is being used, for example when the Deck is in a dock or an external controller is connected. The core of the issue is that input is duplicated.

One user found a similar issue on a Linux desktop. They found that disabling SteamInput solved the issue in that context. The same user then tried to reproduce the issue on the Steam Deck, and provided me with this:

I tried on the Steam Deck to see how it behaves.

I don’t have a “dock”, but I have a basic usb-c hub with an hdmi output which should be similar enough. And indeed, I have the same behaviour when I use a controller instead of the embedded controls : the menu skips a step, and the screens turns black when I try to enter any menu. However, I didn’t see any option to disable SteamInput on the Deck… so I don’t think it’s possible to use the same workaround as on desktop.

It doesn’t happen with the Deck embedded controls, even when using an external monitor. In that case, it works fine.

For SteamInput, I think Steam sets environment variables so SDL will ignore controllers except the virtual one created for SteamInput. I don’t know which engine your game is built on, does it rely on SDL for controller input ? If so, maybe it ignores the environment variables Steam sets, and we get one input for the “real” controller, and one for the virtual one.

The key here seems to be the last paragraph, and something about SDL. I am not familiar with it - seems to be a low level library for handling multiple things, including input. https://wiki.libsdl.org/

Ping @britzl - does any of this make sense to you? Thanks for any help!

Let me take a look, perhaps tomorrow! I also have the other steam input issue we’ve discussed in the past.

1 Like

I was going to post this issue on the steamworks repo, but of course it’s not actually related to the steamworks extension, so I’m bumping here instead. I’m still getting bug reports from my players about this. My game is not playable when docked on the Steam Deck.

Yeah, I’m not sure this is related to the Steamworks SDK to be honest. It’s more likely related to our controller implementation. Please create a ticket in the main Defold repo!

1 Like

Duh, of course that’s what I should have done!

Issue here:

2 Likes