Skip to content

wip: emulate steam_input through sdl3#242

Open
f8ith wants to merge 5 commits into
Detanup01:devfrom
f8ith:dev
Open

wip: emulate steam_input through sdl3#242
f8ith wants to merge 5 commits into
Detanup01:devfrom
f8ith:dev

Conversation

@f8ith

@f8ith f8ith commented Jun 3, 2025

Copy link
Copy Markdown

Very WIP PR, currently handles most of the major controller types. Tested to work on Elden Ring Nightreign with a stock Dualsense.

Implements

  • Querying controller types and connected controllers
  • Rumble
  • Action set layers
  • GetActionOrigins, GetGlyphForActionOrigin, GetActionOriginFromXboxOrigin....

Note on XInput Emulation

Real steam emulates Xinput for non-Xinput gamepads on windows. We could attempt to do the same by hooking Xinput same way that Steam does, but it's tricky and would only work well on experimental builds most likely

TODO

  • Fix reconnecting controllers
  • Implement action layers -> fixes gamepad detection
  • Loading action set layers
  • Test rumble
  • Customizable deadzone, layers, etc.

- steam_input emulation with sdl3 instead of gamepad.c
- implemented ActionSetLayers
- added configurable deadzone under main::gamepad
@f8ith

f8ith commented Jun 8, 2025

Copy link
Copy Markdown
Author

Not sure why protoc is failing on github actions but builds fine locally

@universal963

Copy link
Copy Markdown
Collaborator

Not sure why protoc is failing on github actions but builds fine locally

The deps cache in Github Actions has now been regenerated, and PR #249 builds successfully.

@ilcheese2

Copy link
Copy Markdown

Is this still being worked on? I was trying to build for Mac but I'd have to port the gamepad library.

@f8ith

f8ith commented Jan 21, 2026

Copy link
Copy Markdown
Author

Is this still being worked on? I was trying to build for Mac but I'd have to port the gamepad library.

in terms of emulating the basic steam input api itself, the code should be relatively complete though a little messy but rumble + multiple controller still hasn't been tested because I do not have access to those things/a game with rumble myself right now.

What do you mean by porting the gamepad library? sdl3 should be crossplatform though you may need to edit the build script

@ilcheese2

Copy link
Copy Markdown

I was talking about the library that is currently used. I ended up implementing the functions with Apple's Game Controller Framework, and it built, but I haven't verified whether it works.

@f8ith

f8ith commented Jan 21, 2026

Copy link
Copy Markdown
Author

This PR should remove the need for libgamepad. With SDL iirc there shouldn't be any relevant code that references libgamepad anymore.

@utkarshdalal

utkarshdalal commented Jan 23, 2026

Copy link
Copy Markdown

Curious about this one, would it fix issues where games aren't detecting the gamepad? I just opened an issue for this for No Man's Sky. If it's complete and we're only waiting to see if rumble works, I could request someone to test for you, or we could put the new implementation behind a flag like sdl3_input=1 (0 by default, legacy input)

@utkarshdalal

Copy link
Copy Markdown

@f8ith sorry for the ping, but would love your thoughts on the message above! ^

@f8ith

f8ith commented Jan 27, 2026

Copy link
Copy Markdown
Author

would it fix issues where games aren't detecting the gamepad?

It should enable controller functionality, this PR stubs/implements most steam input function calls. You could try using the compiled dlls

add a flag like sdl3_input=1

Since I already have added a couple settings for other functionality I could add this in probably within this week

@utkarshdalal

utkarshdalal commented Jan 27, 2026

Copy link
Copy Markdown

Where could I get the compiled DLLs?

I'd also love to learn more about what the changes do if you're open to sharing, so I can contribute too.

@Detanup01

Copy link
Copy Markdown
Owner

Hey If you add rumble (AND IF Works with Xbox controllers) I can test them with a new test "game" that just start rambling your controller for X sec if has one & etc.

No DLLs being made since the PR is in Draft mode. (Made by author)

@f8ith f8ith marked this pull request as ready for review February 4, 2026 23:50
@f8ith

f8ith commented Feb 5, 2026

Copy link
Copy Markdown
Author

@Detanup01 the rumble should already work theoretically. My branch should now build correctly

About action_set_layers

Right now the action_set_layers is essentially stubbed. I don't see a point in implementing this fully since games seems to work fine now

@utkarshdalal

Copy link
Copy Markdown

@f8ith i think there are conflicts that would need to be resolved.

If you want to send me over the dlls (preferably for the experimental steamclient) I can test on a few games that aren't working currently!

@Detanup01

Copy link
Copy Markdown
Owner

well need to fix conflicts but if you build in your end to windows x64 debug i appricite if you upload to anywhere currently MS suck ass with not supporting vs26 build yet so all my things on-hold and current dev env is fucked cus of it.

tlrd:
If you upload your build to anywhere i can download and test your stuff via custom script

@f8ith

f8ith commented Feb 8, 2026

Copy link
Copy Markdown
Author

Published a debug x64 build at https://github.com/f8ith/gbe_fork/releases/tag/2026-02-08

@Detanup01

Copy link
Copy Markdown
Owner

Real steam
image
vs
your gbe build
image

Basicly this, it isnt getting my controller whatever I do.

Code / call is basicly this
// steam ini & runcallback before calling any steam function.
Steam_Controller::Init() 1
Steam_Controller::GetConnectedControllers()
Steam_Controller::TriggerHapticPulse() // TODO
Steam_Controller::TriggerVibration() 10000 10000
Steam_Controller::Shutdown()

@f8ith

f8ith commented Feb 9, 2026

Copy link
Copy Markdown
Author

Perhaps I unintentionally changed something when making the build after so long. Are the test scripts in the repo so that I can test it myself

@utkarshdalal

Copy link
Copy Markdown

Hi @f8ith any update here? happy to help out if needed. Just noticed you said it works with Elden Ring Nightreign which would be a big win for me!

@f8ith

f8ith commented Feb 21, 2026

Copy link
Copy Markdown
Author

After rebasing again I'm getting errors from protobuf externs. Once I get it to build I can make my own tests, but fyi my build at June 2025 worked completely fine for me in Elden Ring: Nightreign on a stock Dualsense over USB + BT, not sure what changed between then and now or if it's an issue related to Xbox controllers.

@utkarshdalal

Copy link
Copy Markdown

Can I help somehow?

@f8ith

f8ith commented Feb 24, 2026

Copy link
Copy Markdown
Author

Controller glyphs are entirely game dependent. Forcing a certain controller type is an entirely separate issue from what this PR is trying to achieve and generally requires mods

你需要的东西是游戏普丁,展示什么图案不关这软件的事

@jesstech

jesstech commented Apr 29, 2026

Copy link
Copy Markdown

Would love to see this get merged soon as the impending steam controller release should dramatically bump the number of users who will be relying on steam input, with the recognition that Valve is likely going to be making changes to the SIAPI related to things like haptic feedback (something they've acknowledged they're "looking into" for the steam controller which currently just transcribes basic/classic xinput rumble)

@Detanup01

Copy link
Copy Markdown
Owner

I will be updating dependency and stuff for vs26 and stuff so i will include your changed deps too to be easier.
Will look into more the unimplemented / broken stuff .
Recommend resolving (again) this or next week be moving deps!

@f8ith

f8ith commented May 12, 2026

Copy link
Copy Markdown
Author

Sorry for the lack of updates as I've been away from my main setup for a while, will be back to working on this next week hopefully

@Detanup01

Copy link
Copy Markdown
Owner

SDL3 now on main!

@utkarshdalal

Copy link
Copy Markdown

Woohoo! Was this merged? Or implemented another way?

@Detanup01

Copy link
Copy Markdown
Owner

No, i just added the dependency of sdl3 that this pr has into main to easier transition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants