-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deps: Update to SDL3 #12311
base: master
Are you sure you want to change the base?
Deps: Update to SDL3 #12311
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A look through the code comparing some of the basic stuff with the SDL3 migration manual seems good, but somebody more qualified is going to need to take a look at more complex migration stuff like SDLInputSource.cpp lines 732 to 755 to see if they track. Testing for about 20 minutes revealed no obvious errors introduced or fixed in the audio or controller.
Co-authored-by: TheTechnician27 <[email protected]>
Migrates build system to use SDL3 Run automated rename scripts, along with additional manual fixups
Rebased to include the SDL audio hint I'm now using Regarding TellowKrinkle's comments, I think I will go with the approach of breaking old binds |
Except for our own ControllerData structure, which retains its name
I had missed that SDL3 added additional buttons to the standard gamepad (asserts have been added to catch this in future) Adding support for these buttons required adjusting how unmapped* joystick bindings where done, as internally we offset these to after the standard gamepad buttons. The following steps will be performed *unmapped refers to SDL not having gamepad mappings for its standard layout, instead having numbered buttons and axes. |
Added generating more readable text for UI, for SDL this will also reflect the label on the buttons for PS controllers (and the ABXY labels for Nintendo controllers as per SDL2) Add migration from SDL2's label based assignment to SDL3's positional based assignment |
Also rename these bindings to avoid conflicts with binds
83783ea
to
f553a6e
Compare
I think this is ready for review and further testing |
Also add asserts to ensure name arrays match the length of the SDL enums
Keyboard keys are still not spaced, but otherwise matches the same format
Just tested FSUI with a switch controller and A is back and B is forwards. Also minor nitpick: If you shift-click a binding and add that way, the internal button name is used instead of the display name until you close and reopen the interface. |
Description of Changes
Rationale behind Changes
SDL3 is the hip new thing in town!
Single motor haptic feedback logic seemed incorrect
SDL allows us to fetch information about the connected controller, allowing us to display a name matching its buttons.
The above put in place infrastructure that then allows us to display more readable text for binds, and other sources got the same treatment for consistency.
RFC
SDL3 provides a default value for output latency (Sample frames in SDL terms) and recommends that we use that
I've opted instead to specify the user set value (via
SDL_HINT_AUDIO_DEVICE_SAMPLE_FRAMES
)Do we want to offer UI for the default rate? or always use the default value, or keep what I've done?
Note: This value gets ignored on Windows (matching SDL2 here) so this would only effect Linux (and Mac?).
SDL3's audio system requires us to call a function to put data, instead of copying into a memory buffer like with SDL2/Cubeb.
Currently a temporary buffer is used, rather then adapting
AudioStream::ReadFrames()
to be able to use a function.Is this suitable? or would we want
ReadFrames()
to be able to use a Put function?SDL3 renamed the face buttons to compass directions (with a function to get the label).
I, however, have retained the old names in our
ConvertKeyToString()
as this is what gets saved to our config file, in addition to what is displayed in the config screen.How are we wanting the commits squashed? given both me and Tech worked on this?
Suggested Testing Steps
Note that the new or migrated binds may not work on SDL2 builds after testing with this PR
SDL_HAPTIC_LEFTRIGHT
, and those that don't.