mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-05 08:36:07 +02:00
Add support for Oklick W-2 racing wheel controller
This PR adds the proper mapping for this racing wheel controller to comply with XInput documentation (mostly to treat the pedals as the trigger axes).
This commit is contained in:
@@ -1087,7 +1087,7 @@ static GamepadMapping_t *SDL_CreateMappingForHIDAPIGamepad(SDL_GUID guid)
|
||||
|
||||
SDL_GetJoystickGUIDInfo(guid, &vendor, &product, &version, NULL);
|
||||
|
||||
if (SDL_IsJoystickWheel(vendor, product)) {
|
||||
if (SDL_IsJoystickWheel(vendor, product, 0)) {
|
||||
// We don't want to pick up Logitech FFB wheels here
|
||||
// Some versions of WINE will also not treat devices that show up as gamepads as wheels
|
||||
return NULL;
|
||||
|
||||
@@ -212,6 +212,7 @@ static const char *s_GamepadMappings[] = {
|
||||
"03000000bd12000015d0000000000000,Nintendo Retrolink USB Super SNES Classic Controller,a:b2,b:b1,back:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,x:b3,y:b0,",
|
||||
"030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
|
||||
"030000000d0500000308000000000000,Nostromo N45,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b12,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b2,y:b3,",
|
||||
"03000000ff1100003133000000000000,Oklick W-2,crc:faf6,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:+a1,leftx:a0,rightshoulder:b5,rightstick:b11,righttrigger:-a1,start:b9,x:b0,y:b1,",
|
||||
"03000000d62000006d57000000000000,OPP PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
|
||||
"03000000362800000100000000000000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a3,righty:a4,x:b1,y:b2,",
|
||||
"03000000782300000a10000000000000,Onlive Wireless Controller,a:b15,b:b14,back:b7,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b11,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b13,y:b12,",
|
||||
|
||||
@@ -3425,8 +3425,12 @@ bool SDL_IsJoystickVIRTUAL(SDL_GUID guid)
|
||||
return (guid.data[14] == 'v') ? true : false;
|
||||
}
|
||||
|
||||
bool SDL_IsJoystickWheel(Uint16 vendor_id, Uint16 product_id)
|
||||
bool SDL_IsJoystickWheel(Uint16 vendor_id, Uint16 product_id, Uint16 crc)
|
||||
{
|
||||
if (vendor_id == 0x11FF && product_id == 0x3331 && crc == 0xFAF6) {
|
||||
// Oklick W-2 racing wheel controller (on Windows via DirectInput).
|
||||
return true;
|
||||
}
|
||||
return SDL_VIDPIDInList(vendor_id, product_id, &wheel_devices);
|
||||
}
|
||||
|
||||
@@ -3459,10 +3463,11 @@ static SDL_JoystickType SDL_GetJoystickGUIDType(SDL_GUID guid)
|
||||
{
|
||||
Uint16 vendor;
|
||||
Uint16 product;
|
||||
Uint16 crc;
|
||||
|
||||
SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL, NULL);
|
||||
SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL, &crc);
|
||||
|
||||
if (SDL_IsJoystickWheel(vendor, product)) {
|
||||
if (SDL_IsJoystickWheel(vendor, product, crc)) {
|
||||
return SDL_JOYSTICK_TYPE_WHEEL;
|
||||
}
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ extern bool SDL_IsJoystickRAWINPUT(SDL_GUID guid);
|
||||
extern bool SDL_IsJoystickVIRTUAL(SDL_GUID guid);
|
||||
|
||||
// Function to return whether a joystick is a wheel
|
||||
extern bool SDL_IsJoystickWheel(Uint16 vendor_id, Uint16 product_id);
|
||||
extern bool SDL_IsJoystickWheel(Uint16 vendor_id, Uint16 product_id, Uint16 crc);
|
||||
|
||||
// Function to return whether a joystick should be ignored
|
||||
extern bool SDL_ShouldIgnoreJoystick(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name);
|
||||
|
||||
Reference in New Issue
Block a user