libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
9.97k stars 1.84k forks source link

Sanwa Supply JY-P76USV wrong controller mapping #8644

Open pkr-sadx opened 11 months ago

pkr-sadx commented 11 months ago

Hi! I have a Sanwa Supply JY-P76USV controller that SDL identifies as GameShark GS-GP702. However, with SDL's Controller bindings the button locations are all wrong and some of the axes are unusable.

It's been like this for a while. In the last several years, the SDL controller database has had edits for this specific controller's entries, which sometimes made it work better, sometimes not. At the moment it's back to unusable without a custom controller map.

Here's the device GUID as reported by SDL 2.28.5: 0300f020790000000600000000000000 In SDL 2.24.0 it reports a different GUID: 03000000790000000600000000000000

Here's a mapping string that displays all inputs correctly in SDL2 Gamepad Mapper 0.0.5:

0300f020790000000600000000000000,Sanwa Supply JY-P76USV,a:b0,b:b1,x:b2,y:b3,back:b8,start:b9,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,-leftx:-a0,+leftx:+a0,-lefty:-a1,lefty:+a1,-rightx:-a2,+rightx:+a2,-righty:-a4,+righty:a4,lefttrigger:b6,righttrigger:b7,platform:Windows,

Here's what its button layout looks like when mapped to the X360 controller layout: image (triggers as buttons 7-8, shoulder buttons 5-6, axis and button indices are 1-based here)

It is possible to get this controller properly registered in the database? I'll be happy to provide any additional information.

EDIT: Device Manager info Device instance path: HID\VID_0079&PID_0006\6&3B6771A7&2&0000 Hardware IDs:

HID\VID_0079&PID_0006&REV_0107
HID\VID_0079&PID_0006
HID\VID_0079&UP:0001_U:0004
slouken commented 8 months ago

Thank you for the mapping string, this has been added for the next release!

PiKeyAr commented 8 months ago

Hi! Thank you for the update.

Sorry to bump a closed issue. I just tested 2.30.1 with this controller and the mapping of the axes and buttons is now correct, but the centered values for Y axes are off.

If I push Up or Down on the left stick all the way, the Y value goes to -32768 to 32767 respectively, but if I let it go, it stays at -32768. Pushing Up just a little bit from the centered position makes it jump from -32768 to -4800 or so, then it goes towards -32768 again as I push further. Pushing Down makes it go slowly from -32768 (centered) to 32767 (fully down) as I push further.

The right stick does the same thing except the centered value is 16383. Left and Right are fine on both sticks.

I'm not sure if this was happening on the previous version. I could've missed this when I made the mapping, so I apologize.

slouken commented 8 months ago

Yeah, it looks like that mapping string was incorrect.

Try this: "03000000790000000600000000000000,Sanwa Supply JY-P76USV,crc:20f0,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b2,y:b3,",

PiKeyAr commented 8 months ago

Thank you for sharing the mapping string. To test it, I removed the quotation marks and the last comma, appended ,platform:Windows, put it in gamecontrollerdb.txt and loaded it in my test program. Everything worked correctly.

slouken commented 8 months ago

Okay, this mapping has been updated for the next release, thanks!

PiKeyAr commented 3 months ago

Hi @slouken, sorry for the trouble but as of 2.30.6 this controller is no longer recognized as a GameController, at least on Windows. It seems that the GUID of the device reported by SDL has changed? The following mapping works correctly: 03004f02790000000600000000000000,Sanwa Supply JY-P76USV,crc:20f0,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b2,y:b3,platform:Windows,