mdqinc / SDL_GameControllerDB

A community sourced database of game controller mappings to be used with SDL2 Game Controller functionality
http://libsdl.org
zlib License
1.38k stars 520 forks source link

Add missing GUIDs for 8BitDo Pro 2 Controller in XInput mode #779

Closed Zekromaster closed 3 months ago

Zekromaster commented 3 months ago

These two are the GUIDs that the 8Bit Do Pro 2 wireless gamepad uses in wireless and wired mode when using XInput. The first one got misidentified as 8Bit Do Zero 2 by some software using the DB, which led me to realise there was some ambiguity which led me to realise this meant the DB didn't contain these specific mappings.

offalynne commented 3 months ago

The GUID format is wrong. You need to remove the CRC, by zeroing chars 5-8 inclusive so for example 050095ac5e040000e002000003090000 becomes 050000005e040000e002000003090000. When correctly formatted, these GUIDs are duplicates and match existing maps in the db, making this PR redundant.

The mappings in this PR do not correlate to mappings for the 8BitDo Zero 2. The closest is 050000005e040000e002000030110000, but since you have not produced that GUID yourself with whatever method you have authored these maps, I have no confidence this matches your issue.

This is the third of three bad PRs I have closed regarding this. Please do not open another unless you have confirmed what is wrong and tested that your change does in fact correct the problem. If the issue is downstream software, take it up with maintainers of that software.

Zekromaster commented 3 months ago

Oh, didn't realise that. The change did in fact correct the problem, but I assume this just means that the downstream software is not using the mappings correctly.

offalynne commented 3 months ago

Try removing your changes, test, replace the mapping entry linked above with yours, leaving the original GUID (050000005e040000e002000030110000) alone, test again to confirm if that fixes.

Zekromaster commented 3 months ago

Can confirm this also resolves the issue

Somehow SDL tool gives me a GUID of 050000005e040000e002000003090000, but other software is giving me the mappings for 050000005e040000e002000030110000 instead. Some truncation going on, maybe?

Gonna report the issue to downstream, sorry for the PR.

Zekromaster commented 3 months ago

I seem to only be able to actually reproduce any issue when the file contains the following three mappings, all coming from the current db:

050000005e040000e002000030110000,8BitDo Zero 2,a:b0,b:b1,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b2,y:b3,platform:Linux,
050000005e040000e002000003090000,Xbox One Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,
050082795e040000e002000003090000,Xbox One S Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,

This could very well be an issue with SDL, but might be worth asking here before opening an issue there. There seem to be two mappings that are the same GUID, differing only in CRC. It is my understanding from this PR's closing message that this isn't supposed to happen, but maybe it is in certain circumstances?

offalynne commented 3 months ago

Correct, the 050082795e040000e002000003090000 entry is in error and will be removed.

the following three

This is indeed most likely a downstream issue.

If you remove only the first and last mappings does it resolve the issue ?

Zekromaster commented 3 months ago

Yes, it does. But the downstream software is only setting the SDL hint pointing to the mappings file, so if this is unexpected behaviour the problematic downstream producing it is SDL itself.