mirror of
				https://github.com/Ryujinx/SDL.git
				synced 2025-11-04 15:14:56 +00:00 
			
		
		
		
	Added support for the ThrustMaster eSwap PRO Controller Xbox
(cherry picked from commit dacdb1c310d97ca3c3e6492cae0611f86b281b34)
This commit is contained in:
		
							parent
							
								
									b8d5fa4aef
								
							
						
					
					
						commit
						2cb7a0a0bb
					
				| 
						 | 
					@ -710,6 +710,7 @@ static int is_xboxone(unsigned short vendor_id, const struct libusb_interface_de
 | 
				
			||||||
	static const int XB1_IFACE_SUBCLASS = 71;
 | 
						static const int XB1_IFACE_SUBCLASS = 71;
 | 
				
			||||||
	static const int XB1_IFACE_PROTOCOL = 208;
 | 
						static const int XB1_IFACE_PROTOCOL = 208;
 | 
				
			||||||
	static const int SUPPORTED_VENDORS[] = {
 | 
						static const int SUPPORTED_VENDORS[] = {
 | 
				
			||||||
 | 
							0x044f, /* Thrustmaster */
 | 
				
			||||||
		0x045e, /* Microsoft */
 | 
							0x045e, /* Microsoft */
 | 
				
			||||||
		0x0738, /* Mad Catz */
 | 
							0x0738, /* Mad Catz */
 | 
				
			||||||
		0x0e6f, /* PDP */
 | 
							0x0e6f, /* PDP */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2315,6 +2315,11 @@ SDL_bool SDL_IsJoystickXboxSeriesX(Uint16 vendor_id, Uint16 product_id)
 | 
				
			||||||
            return SDL_TRUE;
 | 
					            return SDL_TRUE;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if (vendor_id == USB_VENDOR_THRUSTMASTER) {
 | 
				
			||||||
 | 
					        if (product_id == USB_PRODUCT_THRUSTMASTER_ESWAPX_PRO) {
 | 
				
			||||||
 | 
					            return SDL_TRUE;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    if (vendor_id == USB_VENDOR_8BITDO) {
 | 
					    if (vendor_id == USB_VENDOR_8BITDO) {
 | 
				
			||||||
        if (product_id == USB_PRODUCT_8BITDO_XBOX_CONTROLLER) {
 | 
					        if (product_id == USB_PRODUCT_8BITDO_XBOX_CONTROLLER) {
 | 
				
			||||||
            return SDL_TRUE;
 | 
					            return SDL_TRUE;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -297,6 +297,7 @@ static const ControllerDescription_t arrControllers[] = {
 | 
				
			||||||
	{ MAKE_CONTROLLER_ID( 0x24c6, 0xfafd ), k_eControllerType_XBox360Controller, NULL },	// Afterglow Gamepad 3
 | 
						{ MAKE_CONTROLLER_ID( 0x24c6, 0xfafd ), k_eControllerType_XBox360Controller, NULL },	// Afterglow Gamepad 3
 | 
				
			||||||
	{ MAKE_CONTROLLER_ID( 0x24c6, 0xfafe ), k_eControllerType_XBox360Controller, NULL },	// Rock Candy Gamepad for Xbox 360
 | 
						{ MAKE_CONTROLLER_ID( 0x24c6, 0xfafe ), k_eControllerType_XBox360Controller, NULL },	// Rock Candy Gamepad for Xbox 360
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						{ MAKE_CONTROLLER_ID( 0x044f, 0xd012 ), k_eControllerType_XBoxOneController, NULL },	// ThrustMaster eSwap PRO Controller Xbox
 | 
				
			||||||
	{ MAKE_CONTROLLER_ID( 0x045e, 0x02d1 ), k_eControllerType_XBoxOneController, "Xbox One Controller" },	// Microsoft X-Box One pad
 | 
						{ MAKE_CONTROLLER_ID( 0x045e, 0x02d1 ), k_eControllerType_XBoxOneController, "Xbox One Controller" },	// Microsoft X-Box One pad
 | 
				
			||||||
	{ MAKE_CONTROLLER_ID( 0x045e, 0x02dd ), k_eControllerType_XBoxOneController, "Xbox One Controller" },	// Microsoft X-Box One pad (Firmware 2015)
 | 
						{ MAKE_CONTROLLER_ID( 0x045e, 0x02dd ), k_eControllerType_XBoxOneController, "Xbox One Controller" },	// Microsoft X-Box One pad (Firmware 2015)
 | 
				
			||||||
	{ MAKE_CONTROLLER_ID( 0x045e, 0x02e0 ), k_eControllerType_XBoxOneController, "Xbox One S Controller" },	// Microsoft X-Box One S pad (Bluetooth)
 | 
						{ MAKE_CONTROLLER_ID( 0x045e, 0x02e0 ), k_eControllerType_XBoxOneController, "Xbox One S Controller" },	// Microsoft X-Box One S pad (Bluetooth)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -686,6 +686,7 @@ static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_D
 | 
				
			||||||
         * Xbox Series X firmware version 5.1, report is 44 bytes, share button is in byte 18
 | 
					         * Xbox Series X firmware version 5.1, report is 44 bytes, share button is in byte 18
 | 
				
			||||||
         * Xbox Series X firmware version 5.5, report is 48 bytes, share button is in byte 22
 | 
					         * Xbox Series X firmware version 5.5, report is 48 bytes, share button is in byte 22
 | 
				
			||||||
         * Victrix Gambit Tournament Controller, report is 50 bytes, share button is in byte 32
 | 
					         * Victrix Gambit Tournament Controller, report is 50 bytes, share button is in byte 32
 | 
				
			||||||
 | 
					         * ThrustMaster eSwap PRO Controller Xbox, report is 64 bytes, share button is in byte 46
 | 
				
			||||||
         */
 | 
					         */
 | 
				
			||||||
        if (size < 48) {
 | 
					        if (size < 48) {
 | 
				
			||||||
            if (ctx->last_state[18] != data[18]) {
 | 
					            if (ctx->last_state[18] != data[18]) {
 | 
				
			||||||
| 
						 | 
					@ -699,6 +700,10 @@ static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_D
 | 
				
			||||||
            if (ctx->last_state[32] != data[32]) {
 | 
					            if (ctx->last_state[32] != data[32]) {
 | 
				
			||||||
                SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_MISC1, (data[32] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
 | 
					                SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_MISC1, (data[32] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        } else if (size == 64) {
 | 
				
			||||||
 | 
					            if (ctx->last_state[46] != data[46]) {
 | 
				
			||||||
 | 
					                SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_MISC1, (data[46] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -186,6 +186,7 @@ static SDL_GameControllerType SDL_GetJoystickGameControllerProtocol(const char *
 | 
				
			||||||
        interface_protocol == XBONE_IFACE_PROTOCOL) {
 | 
					        interface_protocol == XBONE_IFACE_PROTOCOL) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        static const int SUPPORTED_VENDORS[] = {
 | 
					        static const int SUPPORTED_VENDORS[] = {
 | 
				
			||||||
 | 
					            0x044f, /* Thrustmaster */
 | 
				
			||||||
            0x045e, /* Microsoft */
 | 
					            0x045e, /* Microsoft */
 | 
				
			||||||
            0x0738, /* Mad Catz */
 | 
					            0x0738, /* Mad Catz */
 | 
				
			||||||
            0x0e6f, /* PDP */
 | 
					            0x0e6f, /* PDP */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -107,6 +107,7 @@
 | 
				
			||||||
#define USB_PRODUCT_SONY_DS4_STRIKEPAD                    0x05c5
 | 
					#define USB_PRODUCT_SONY_DS4_STRIKEPAD                    0x05c5
 | 
				
			||||||
#define USB_PRODUCT_SONY_DS5                              0x0ce6
 | 
					#define USB_PRODUCT_SONY_DS5                              0x0ce6
 | 
				
			||||||
#define USB_PRODUCT_SONY_DS5_EDGE                         0x0df2
 | 
					#define USB_PRODUCT_SONY_DS5_EDGE                         0x0df2
 | 
				
			||||||
 | 
					#define USB_PRODUCT_THRUSTMASTER_ESWAPX_PRO               0xd012
 | 
				
			||||||
#define USB_PRODUCT_VICTRIX_FS_PRO_V2                     0x0207
 | 
					#define USB_PRODUCT_VICTRIX_FS_PRO_V2                     0x0207
 | 
				
			||||||
#define USB_PRODUCT_XBOX360_XUSB_CONTROLLER               0x02a1 /* XUSB driver software PID */
 | 
					#define USB_PRODUCT_XBOX360_XUSB_CONTROLLER               0x02a1 /* XUSB driver software PID */
 | 
				
			||||||
#define USB_PRODUCT_XBOX360_WIRED_CONTROLLER              0x028e
 | 
					#define USB_PRODUCT_XBOX360_WIRED_CONTROLLER              0x028e
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue