feat: Adds the 8BitDo layout to for proper GamePad support.#2790
feat: Adds the 8BitDo layout to for proper GamePad support.#2790Doprez wants to merge 1 commit intostride3d:masterfrom
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.
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.
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 |
ab329f3 to
482bd28
Compare
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