-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Supporting Joystick Colors (Joycons + Pro Controller) #12167
Comments
I believe |
For reference this is the opposite of the LED interface - this would expose the color of the physical device itself (i.e. "is this the standard grey joycon or the red/blue ones"). I thought Sony did this too but it looks like they went all-in with the light bar as a unique identifier. Maybe future Steam Deck/Controller revisions can make use of this? I'd like to have this too but I don't know what other devices do here. |
This isn't about the LED (although I think a getter there would be nice too). This is specifically about the color of the physical controller. |
Yeah, this kind of functionality isn't available for any other controller, so I wouldn't add a bespoke API function for it. Instead I'd probably go with something like the SendEffect() API which sends a raw HID packet to the controller, but maybe call it QueryFeature() and returns back data? |
Another weird idea: could it be an optional Property within the GameController handle? That would at least make the raw color data accessible until other devices expose a similar feature. |
Oh, that's an interesting idea... we always query it when those controllers connect? We could store it as a 32-bit RGBA value? |
That's what I'm thinking - hidapi backends can specify whatever properties they want, and any dev that's savvy enough to know of any particular device quirks can grab them if they want to, without having export a whole function to do so. |
Hi, whilst working on my game (for desktop + nintendo switch) I wanted to get the controller colors from the Joycon controllers. Via the SDL-switch port it is possible, but I'd like to be able to support this on desktop too.
Via the HID API, combined with the amazing work done on reverse engineering of the joycons. It can be done by using the subcommand to read (part of) the flash memory of the joycon. Using this it was rather easy to read the colors from the indiviual joycons.
Proof of concept
In
SDL_hidapi_switch.c
I made a small proof of concept:Additional defines for the memory addresses to read from the flash memory.
Additional struct in the
SwitchSubcommandInputPacket_t
data union.And finally, reading the color data:
Support
I'd love to implement this into the SDL codebase fully, but I'm running into some issues with the design for it.
Something like would be nice:
The problem I'm running into is that we need some unified way of looking at controller colors for other types of controllers too. I heard (but haven't confirmed) that PS5 controllers also support this, for example.
Should we implement this into SDL? If so, what should the public api look like and how do we address the multiple colors in different formats?
The text was updated successfully, but these errors were encountered: