8BitDo SN30 Pro mapping (USB dinput mode) broken in Windows
0300d640c82d00000160000000000000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,platform:Windows,
The above mapping is wrong. a4 isn't righty, it's supposed to be a2. This even triggers an error code "Joystick only has 4 axis". This has been broken for a long time now. The 8BitDo SN30 Pro needs to be in it's native mode by holding down "b" while it's powering up. This enables "dinput" mode. All the other modes are mapped correctly in Windows (Nintendo, PS4 & Xbox).
I started to open a PR but realised I am not sure how to fix this. I couldn't find the mapping for "0300d640c82d00000160000000000000", and when I look at SDL_gamepad_db.h, there seems to be a correct mapping, but under a different GUID, so I haven't a clue why the mapping comes out this way in my app and where it's coming from? The start button is also unmapped.
Edit: I should mention this is when the controller is plugged in via USB. If it's connected by Bluetooth in dinput mode, there's no mapping at all, GUID "03009761c82d00000161000000000000".
Quite odd how also my M30 pad connects using dinput indeed. It seems to randomly change the mapping under Windows 11. I have to alternate swap the following configs to get the DPAD working with my application.
0300a755c82d00005106000000000000,M30 Custom,a:b0,b:b1,x:b3,y:b4,back:b10,guide:b12,start:b11,leftshoulder:b8,rightshoulder:b9,dpup:-a1,dpleft:-a0,dpdown:+a1,dpright:+a0,lefttrigger:b6,righttrigger:b7,platform:Windows,
0300a755c82d00005106000000000000,M30 Custom,a:b0,b:b1,x:b3,y:b4,back:b10,guide:b12,start:b11,leftshoulder:b8,rightshoulder:b9,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,lefttrigger:b6,righttrigger:b7,platform:Windows,
Quite odd how also my M30 pad connects using dinput indeed. It seems to randomly change the mapping under Windows 11. I have to alternate swap the following configs to get the DPAD working with my application.
0300a755c82d00005106000000000000,M30 Custom,a:b0,b:b1,x:b3,y:b4,back:b10,guide:b12,start:b11,leftshoulder:b8,rightshoulder:b9,dpup:-a1,dpleft:-a0,dpdown:+a1,dpright:+a0,lefttrigger:b6,righttrigger:b7,platform:Windows, 0300a755c82d00005106000000000000,M30 Custom,a:b0,b:b1,x:b3,y:b4,back:b10,guide:b12,start:b11,leftshoulder:b8,rightshoulder:b9,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,lefttrigger:b6,righttrigger:b7,platform:Windows,
I think you can have multiple things mapped in SDL. Does this mapping work in both modes?
0300a755c82d00005106000000000000,M30 Custom,a:b0,b:b1,x:b3,y:b4,back:b10,guide:b12,start:b11,leftshoulder:b8,rightshoulder:b9,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:-a1,dpleft:-a0,dpdown:+a1,dpright:+a0,lefttrigger:b6,righttrigger:b7,platform:Windows,
Thank you for that, it seems to work fine indeed with your provided combined mapping.
@AntTheAlchemist, I figured out what's happening here. The existing mapping works for the original firmware (v1.26) and your firmware (v2.00) has an incompatible mapping.
Unfortunately at the DirectInput level they are identical.
This is a good argument for getting more information from HIDAPI as you suggest in https://github.com/libsdl-org/SDL/issues/10207, since they have different names, and would have different CRC, which could be used to distinguish them.
Thank you for that, it seems to work fine indeed with your provided combined mapping.
I compared this with the mapping in XInput mode and checked with a fighting game expert and the correct mapping is actually:
03000000c82d00005106000000000000,8BitDo M30 Gamepad,+leftx:h0.2,+lefty:h0.4,-leftx:h0.8,-lefty:h0.1,a:b0,b:b1,back:b10,guide:b2,leftshoulder:b8,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,start:b11,x:b3,y:b4,
This matches the layout when the controller is started in XInput mode (Start + X).