Skip to content
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

fix: Replace SDL controller calls with joystick ones in Joystick. #665

Merged

Conversation

nitz
Copy link
Contributor

@nitz nitz commented Dec 17, 2022

Closes #632

Proposed changes

This is enough of a fix to resolve the issue in #632, but there are a few other edge cases that investigation brought up that may cause a similar issue in the future.

Joystick was using calls to SDK_GameController(*) functions. On Windows 11 at least, the SDK_Controller* returned from SDL_GameControllerOpen in Joystick's constructor was null, causing the unique ID building to be quite sparse. Thus, the Joystick's guid would match it's unique ID, causing profiles to fail to load automatically on startup. These changes resolve that, though some other oddities outlined in my comment in #632 do still persist.

src/joystick.cpp Outdated Show resolved Hide resolved
Copy link
Member

@pktiuk pktiuk left a comment

Choose a reason for hiding this comment

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

Everything looks very good, only these version checks for SDL should be removed in my opinion.

This is enough of a fix to resolve the issue in AntiMicroX#632, but there are a few other edge cases that investigation brought up that may cause a similar issue in the future.
@nitz nitz force-pushed the fix-joystick-unique-id-generation-win11 branch from 551ea6d to 1841e37 Compare December 17, 2022 22:26
@nitz
Copy link
Contributor Author

nitz commented Dec 17, 2022

Ah! I didn't catch the minimum version in cmakelists; perfect. I amended that commit to remove the 2.0.6 checks!

@pktiuk pktiuk merged commit c5299c0 into AntiMicroX:master Dec 17, 2022
@pktiuk
Copy link
Member

pktiuk commented Dec 17, 2022

Thank you for your contribution and feel free to create new PR-s :)

@nitz nitz deleted the fix-joystick-unique-id-generation-win11 branch December 17, 2022 22:37
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.

Refuses to load the last used profiles (Windows 11 only)
2 participants