Skip to content

Conversation

@Nintorch
Copy link
Contributor

@Nintorch Nintorch commented Dec 24, 2025

Follow-up to #106218

Fixes #96985

I decided to split #109645 into several smaller PRs, this PR is one of them.
This PR adds support for SDL3 joystick input driver for the web platform, as well as adding support for Input.get_joy_info() on that platform.

TODO:

This commit also adds joystick vibration feature to the web platform in browsers that support this feature.
Comment on lines +335 to +338
- 'weakMagnitude': $1 / 0xFFFF,
- 'strongMagnitude': $2 / 0xFFFF,
+ 'weakMagnitude': $2 / 0xFFFF,
+ 'strongMagnitude': $1 / 0xFFFF,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +9 to +10
- "default,Standard Gamepad,a:b0,b:b1,back:b8,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b16,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
+ "default,*,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static SDL_joylist_item *SDL_joylist_tail = NULL;
static int numjoysticks = 0;

+EM_JS(int, SDL_GetEmscriptenJoystickVendor, (int device_index), {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nintorch
Copy link
Contributor Author

Although now that I think about it, I'm not sure if this PR is necessary since it doesn't fix a lot of issues, and the vibration issue I linked can easily be fixed without integrating SDL.
What are your thoughts?

@Nintorch
Copy link
Contributor Author

I decided it's not really worth it to integrate SDL's Android and web joystick drivers since that wouldn't fix a lot of issues and it might introduce regressions, and the only benefit might be that we'll be able to port small fixes from/to SDL more easily, unless I'm misunderstanding something, so I'll close this PR for now.
If that integration later proves to be worth it, I will reopen this PR.

@Nintorch Nintorch closed this Dec 26, 2025
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.

Controller vibration not working in HTML5

1 participant