We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5453 - Possible backwards compatibility impact caused by SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE
Summary: Possible backwards compatibility impact caused by SDL_HINT_JOYSTICK_HIDAPI_PS...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: HG 2.0
Hardware: All All
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-09 03:21 UTC by Cameron Gutman
Modified: 2021-01-20 04:07 UTC (History)
0 users

See Also:


Attachments
PoC Patch implementing solution 1 (2.71 KB, patch)
2021-01-09 03:22 UTC, Cameron Gutman
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron Gutman 2021-01-09 03:21:12 UTC
I fear https://hg.libsdl.org/SDL/rev/c1fc7661aa29 introduces some backwards compatibility problems for applications built for earlier versions of SDL2. While most of the time developers will be explicitly testing their apps with SDL updates, this may not always be the case for scenarios like open-source games that run with whatever the Linux distro's packaged SDL version is.

If nothing else happens, updating from SDL 2.0.14 to 2.0.16 will change the default behavior of PS5 extended reports from enabled to disabled. This will introduce a regression for games built against SDL 2.0.14 that assume that no hint is required to get PS5 rumble support.

Consider the case of an existing game where force feedback is crucial for the user experience that sets SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE=1 to ensure that PS4 controller users will get working haptics. This game was built before the introduction of SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, so it does not know that it needs to set this to get rumble behavior on PS5 controllers.

If this hypothetical game was upgrading from 2.0.14 to 2.0.16, it would see PS5 rumble break across the update due to the change in default behavior.

If it was upgrading from 2.0.12 to 2.0.16, there wouldn't strictly be a regression (since 2.0.12 didn't support PS5 controllers at all), but I still think we could do a better job handling this case by inferring that it intends to enable rumble on all PlayStation controllers when they set SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE=1.

Some possible solutions:
 - Make SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE default to the value of SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE
 - Remove SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE and use SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE as the one and only control of extended reports for PS5 and future controllers
 - Make SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE default to 1 to match the behavior of SDL 2.0.14

Thoughts?
Comment 1 Cameron Gutman 2021-01-09 03:22:50 UTC
Created attachment 4646 [details]
PoC Patch implementing solution 1

Here is a RFC patch 

I don't own a PS5 controller, so I can't test this. It at least builds though.
Comment 2 Sam Lantinga 2021-01-10 17:03:45 UTC
This was an intentional change because the 2.0.14 behavior caused PS5 controllers to no longer work with other DirectInput programs. This change puts the PS5 controller in line with how PS4 controllers behave, where they are compatible with other programs by default.

SDL hints can be set in the environment so users can change the behavior if needed separately from the application being aware of them.

One thing we could do is use the PS4 hint for both, if only one of the hints is set. That would ensure the same behavior for applications that enabled advanced reports for PS4 controllers.

Thoughts?
Comment 3 Cameron Gutman 2021-01-13 03:15:19 UTC
(In reply to Sam Lantinga from comment #2)
> This was an intentional change because the 2.0.14 behavior caused PS5
> controllers to no longer work with other DirectInput programs. This change
> puts the PS5 controller in line with how PS4 controllers behave, where they
> are compatible with other programs by default.

Yep, the change itself makes sense.

> 
> SDL hints can be set in the environment so users can change the behavior if
> needed separately from the application being aware of them.
> 
> One thing we could do is use the PS4 hint for both, if only one of the hints
> is set. That would ensure the same behavior for applications that enabled
> advanced reports for PS4 controllers.
> 
> Thoughts?

That sounds like what I implemented in my PoC patch, or are you thinking of something different?
Comment 4 Sam Lantinga 2021-01-20 04:07:53 UTC
Yep, something exactly like that. :)
https://hg.libsdl.org/SDL/rev/d4c15ecfcf62