TerryCavanagh / VVVVVV

The source code to VVVVVV! http://thelettervsixtim.es/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Game incorrectly displays Switch button icons for 8bitdo Ultimate Controller

Fussmatte opened this issue · comments

Supposedly the game currently recognises 8bitdo controllers and automatically applies a Nintendo Switch pro controller layout for them, and that's well and good, but it also applies it to the Ultimate Controller, which actually has an Xbox layout (so A/B and X/Y are swapped). My controller specifically is recognised as 8BitDo Ultimate Wireless / Pro 2 Wired Controller, which seems correct otherwise. This could affect other 8bitdo controllers with Xbox/non-nintendo layouts as well.

Huh, I didn't know they did both layouts - I think we have more layout info in gamecontrollerdb.txt, maybe we should add the specific product IDs to pick between Switch or Xbox.

Should be fixed by c44e8d0, feel free to reopen if there's another product ID I've missed!

I wasn't able to test this morning since I was going to work, but now I'm home and unfortunately as I suspected c44e8d0 doesn't actually fix my problem specifically. My model of the controller is the Ultimate 2.4G Wireless Controller while the commit seems to be targeting the Ultimate Wired Controller for Xbox. Both of them have the Xbox layout regardless of the "for Xbox" designation. Other 8bitdo pads with Xbox layouts include the Pro 2 Wired Controller for Xbox, SN30 Pro for Xbox Cloud, and all of the other Ultimate models except for the Bluetooth ones, which do have the Nintendo layout.

I believe these should all be listed in the database - if we can get a list of the ones with Xbox layouts I can add them (I believe SDL will want these too, I don't see logic for these in the detector):

https://github.com/libsdl-org/SDL/blob/main/src/joystick/SDL_gamepad_db.h

I don't know about the other gamepads since I don't own them myself, but the one I have (this one) has the product ID 0x3106.

Took a look and I couldn't even find this one in SDL's database...

https://github.com/libsdl-org/SDL/blob/main/src/joystick/SDL_gamepad_db.h

I would definitely submit a config line so that it's a known device... you may want to add it here too:

https://github.com/libsdl-org/SDL/blob/main/src/joystick/SDL_joystick.c#L2487

It is in gamecontrollerdb.txt (I think this is the one at least?):

03000000c82d00000631000014010000,8BitDo Pro 2 Wired 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,

Also, quote from Discord:

apparently you can find the SDL2 gamepad mapping string with antimicro, so here's mine:

030002afc82d000006310000100100001172012550,8BitDo Ultimate Wireless / Pro 2 Wired Controller,platform:Linux,a:b0,b:b1,x:b2,y:b3,back:b6,start:b7,guide:b8,leftshoulder:b4,rightshoulder:b5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,

Not sure why my browser didn't find that... these can be added/merged whenever anyone is able to push a commit.

Pushed 68b6bd0 to cover for the known IDs, filed libsdl-org/SDL#8174 to centralize this issue to SDL. I'll make sure to keep VVV's Xbox check sync'd with SDL's.