-
-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: Adds the 8BitDo layout to for proper GamePad support. #2790
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
base: master
Are you sure you want to change the base?
Conversation
Do you have a link to the vendor specs? If so can it be added as comment? We might need to do fixes in the future so it's good to have a reference. |
Unfortunately not a full spec sheet I only have the vendor Id and product Id from the mapping on my machine Although its important to note that this mapping is probably only useful for the SDL context since the mappings are coming from the |
byte[] guidBytes = device.ProductId.ToByteArray(); | ||
|
||
ushort vendorId = BitConverter.ToUInt16(guidBytes, 4); | ||
|
||
return vendorId == _vendorId; |
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.
Is there a way to do a non-alloc comparison? Maybe with a Span<byte>
or a similar API.
|
||
namespace Stride.Input; | ||
|
||
public class GamePadLayout8BitDo : GamePadLayout |
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.
If it is not meant to be derived, better seal the class.
Moving this to draft, let us know when you're done working on this one :) |
Makes sense, I think I may replace this with a more generic solution because of the "only useful for the SDL context since the mappings are coming from the JoyStick controller mappings" issue. I did start using the HIDDevice lib from DevDecoder so that the controllers would work consistently between different windowing backends. https://github.com/Doprez/Doprez.Stride.MoreInput/blob/main/src/GameControllerHIDDevice.cs |
PR Details
Currently 8BitDo controllers dont have a registered layout so they will not work as GamePads. This adds the vendor Id and layout so that it will work outside of an XInput context.
Related Issue
No related issues, I found this by trying to use SDL on linux and the GamePad always being null.
Types of changes
Checklist