Index: src/hid/platform/Linux/OFGameController.m ================================================================== --- src/hid/platform/Linux/OFGameController.m +++ src/hid/platform/Linux/OFGameController.m @@ -45,10 +45,11 @@ * Microsoft X-Box 360 pad [045E:028E] * Joy-Con (L) [057E:2006] * Joy-Con (R) [057E:2007] * N64 Controller [057E:2019] * Sony Interactive Entertainment DualSense Wireless Controller [054C:0CE6] + * 8BitDo Pro 2 Wired Controller [2DC8:3106] */ static const uint16_t vendorIDMicrosoft = 0x045E; static const uint16_t vendorIDNintendo = 0x057E; static const uint16_t vendorIDSony = 0x054C; @@ -75,18 +76,11 @@ }; static OFGameControllerButton buttonToName(uint16_t button, uint16_t vendorID, uint16_t productID) { - if (vendorID == vendorIDMicrosoft && productID == productIDXbox360) { - switch (button) { - case BTN_Y: - return OFGameControllerNorthButton; - case BTN_X: - return OFGameControllerWestButton; - } - } else if (vendorID == vendorIDNintendo && + if (vendorID == vendorIDNintendo && productID == productIDLeftJoycon) { switch (button) { case BTN_SELECT: return OFGameControllerMinusButton; case BTN_Z: @@ -97,10 +91,14 @@ return OFGameControllerSRButton; } } else if (vendorID == vendorIDNintendo && productID == productIDRightJoycon) { switch (button) { + case BTN_NORTH: + return OFGameControllerNorthButton; + case BTN_WEST: + return OFGameControllerWestButton; case BTN_START: return OFGameControllerPlusButton; case BTN_TL: return OFGameControllerSLButton; case BTN_TL2: @@ -122,20 +120,28 @@ case BTN_C: return OFGameControllerCPadRightButton; case BTN_Z: return OFGameControllerCaptureButton; } + } else if (vendorID == vendorIDSony && + productID == productIDDualSense) { + switch (button) { + case BTN_NORTH: + return OFGameControllerNorthButton; + case BTN_WEST: + return OFGameControllerWestButton; + } } switch (button) { - case BTN_NORTH: + case BTN_Y: return OFGameControllerNorthButton; - case BTN_SOUTH: + case BTN_A: return OFGameControllerSouthButton; - case BTN_WEST: + case BTN_X: return OFGameControllerWestButton; - case BTN_EAST: + case BTN_B: return OFGameControllerEastButton; case BTN_TL2: return OFGameControllerLeftTriggerButton; case BTN_TR2: return OFGameControllerRightTriggerButton;