8000 add 8BitDo Controller by 8BitDo · Pull Request #12964 · libsdl-org/SDL · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

add 8BitDo Controller #12964

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

Merged
merged 7 commits into from
May 7, 2025
Merged

add 8BitDo Controller #12964

merged 7 commits into from
May 7, 2025

Conversation

8BitDo
Copy link
Contributor
@8BitDo 8BitDo commented May 6, 2025

add SN30 Pro, SF30 Pro, Pro 2.
Supported versions:
Pro 2 v3.06 and above
SF30 Pro/SN30 Pro v2.05 and above

add SN30 Pro, SF30 Pro, Pro 2.
Supported versions:
Pro 2 v3.06  above
SF30 Pro/SN30 Pro v2.05 above
device->product_id == USB_PRODUCT_8BITDO_SF30_Pro || device->product_id == USB_PRODUCT_8BITDO_Pro_2 ||
device->product_id == USB_PRODUCT_8BITDO_Pro_2_BT) {
Uint8 data[USB_PACKET_LENGTH];
int size = ReadFeatureReport(device->dev, 0x06, data, sizeof(data));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe make a define at the top of the file instead of hard-coding the number here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK.

@@ -236,7 +256,7 @@ static void HIDAPI_Driver8BitDo_HandleStatePacket(SDL_Joystick *joystick, SDL_Dr
{
Sint16 axis;
Uint64 timestamp = SDL_GetTicksNS();
if (data[0] != 0x03 && data[0] != 0x01) {
if (data[0] != 0x03 && data[0] != 0x01 && data[0] != 0x04) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does the first byte vary depending on controller type? Maybe we should add the report ID as part of the SDL_Driver8BitDo_Context structure and validate that the packet matches the expected value for the current controller?

Copy link
Contributor Author
@8BitDo 8BitDo May 7, 2025

Choose a reason for hiding this comment

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

It is not the type of controller, but the 0x04 report Id created for SN30 PRO/SF30 PRO/PRO 2 compatibility with previous versions of the report Id.
In the future, products that are compatible with SDL will be adapted using the 0x04 report Id.

8BitDo and others added 6 commits May 7, 2025 09:22
Co-authored-by: Sam Lantinga <slouken@libsdl.org>
Co-authored-by: Sam Lantinga <slouken@libsdl.org>
Co-authored-by: Sam Lantinga <slouken@libsdl.org>
@slouken slouken merged commit 2b3c481 into libsdl-org:main May 7, 2025
39 checks passed
@slouken
Copy link
Collaborator
slouken commented May 7, 2025

Merged, thanks!

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.

2 participants
0