SDL_GameControllerDB icon indicating copy to clipboard operation
SDL_GameControllerDB copied to clipboard

New mappings for SDL 2.26

Open slouken opened this issue 3 years ago • 9 comments

This is here just as an FYI, SDL 2.26 is adding hashing of some additional data to help reduce collisions between mappings for difference devices that share the same USB VID/PID. The exact algorithm is still in flux, but once finalized, you should be able to use controllermap from the new SDL to create mappings that can more easily be upstreamed in the future.

slouken avatar Aug 24 '22 18:08 slouken

@slouken would you please consider reaching out to GeneralArcade to see if they can update their graphical tool or distribute the source, since their tool is what the majority of our contributors use ?

A heads up if/when Steam’s mapper gets this change as well would be appreciated.

offalynne avatar Aug 24 '22 22:08 offalynne

@slouken would you please considering reaching out to GeneralArcade to see if they can update their graphical tool or at least release the source since that’s what the vast majority of our contributors use ?

A heads up when Steam’s mapper gets this change as well would be appreciated.

It isn't going to happen. Tool hasn't even been updated in 4 years. I haven't worked on it in a long time but I got a similar tool that does the job equally well. The AppImage should still work.

https://gitlab.com/ryochan7/sdl2-gamepad-mapper

SDL2_Gamepad_Mapper-0.0.3-x86_64.AppImage https://drive.google.com/file/d/12CtYjPbP8YLN7dCIJiKX5EcNdf4PIz4g/view?usp=sharing

Ryochan7 avatar Aug 25 '22 00:08 Ryochan7

@Ryochan7 https://bit.ly/3QSkrgK

Great for Linux, but the QT project doesn't build on Windows or Mac OS #476

offalynne avatar Aug 25 '22 00:08 offalynne

It looks like at least on Windows you can drop in the new SDL2.dll into GeneralArcade and get the new format GUID and mapping:

030024c8a306000022f6000000000000,Cyborg V.3 Rumble Pad,platform:Windows,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a4,lefttrigger:+a3,righttrigger:-a3,

slouken avatar Aug 25 '22 01:08 slouken

https://gitlab.com/ryochan7/sdl2-gamepad-mapper

SDL2_Gamepad_Mapper-0.0.3-x86_64.AppImage https://drive.google.com/file/d/12CtYjPbP8YLN7dCIJiKX5EcNdf4PIz4g/view?usp=sharing

@Ryochan7, how do you update the version of SDL in this AppImage? We need SDL2 2.25.0 or newer to get the new GUID format.

slouken avatar Aug 26 '22 16:08 slouken

We have to be careful with when and how we use the new GUID format.

I think we want to prefer the older format (which is still compatible with SDL 2.25+) for the vast majority of game controllers that don't have VID/PID conflicts.

If we start using the new format exclusively, games using older versions of SDL (which is all games today, since 2.26 isn't out yet) will not be able to use newly added mappings.

Maybe we want to have contributors use a tool that generates both GUIDs and we add the least specific one that doesn't conflict?

cgutman avatar Aug 26 '22 17:08 cgutman

would be especially nice if Valve were to make anonymous device usage data public to help prioritize the highest market share devices when picking the “wildcard” mapping for GUIDs that otherwise collide

offalynne avatar Aug 26 '22 17:08 offalynne

@Ryochan7 There is no license for your gamepad mapper. Please add one so we can use it.

kimimaru4000 avatar Aug 27 '22 07:08 kimimaru4000

We have to be careful with when and how we use the new GUID format.

I think we want to prefer the older format (which is still compatible with SDL 2.25+) for the vast majority of game controllers that don't have VID/PID conflicts.

If we start using the new format exclusively, games using older versions of SDL (which is all games today, since 2.26 isn't out yet) will not be able to use newly added mappings.

I changed the format in https://github.com/libsdl-org/SDL/commit/3cbfd75d0fb00c8816d2a2523a0be0a86757aff3 so mappings are backwards and forwards compatible.

slouken avatar Aug 28 '22 04:08 slouken

Now that SDL 2.26 is out, got around to updating my old mapper app. Got a couple of bugs fixed in the process. AppImage has been tested on Ubuntu 20.04, Fedora 36, and the latest Manjaro. It was compiled against SDL 2.26.0.

SDL2_Gamepad_Mapper-0.0.4-x86_64.AppImage https://drive.google.com/file/d/1qOFrJlnzKHMDeR9eiaGUNBFonLwVy3dE/view?usp=sharing

https://gitlab.com/ryochan7/sdl2-gamepad-mapper/-/releases/v0.0.4

Ryochan7 avatar Dec 03 '22 22:12 Ryochan7

If I understand correctly, the new process for adding DB entries for 2.26 format should be:

  • in case of duplicate GUID, add CRC to GUID
  • in case of non-duplicate GUID, add CRC to mapping

Does this match your intentions @slouken ?

offalynne avatar Dec 04 '22 14:12 offalynne

No, always clear the CRC from the GUID, and always add the CRC to the mapping. That should future proof the mapping.

I tend to omit the CRC from official mappings, but only for well known vendors like Microsoft, PowerA, etc, where I know they always set a unique VID/PID.

slouken avatar Dec 04 '22 14:12 slouken

~~Consolidated SDL 2.26 format mappings into a branch, for now~~

Edit: No support has been provided from the SDL project to determine whether the name-based CRC is actually a measurable improvement so I'm no longer maintaining a branch with the CRC fields.

offalynne avatar Dec 31 '22 11:12 offalynne