mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-25 09:17:12 +01:00
Added SDL_GameControllerType enumerations for the Amazon Luna and Google Stadia controllers
Fixes bug https://github.com/libsdl-org/SDL/issues/4019
This commit is contained in:
parent
6956f4aa19
commit
94b7a87645
@ -67,7 +67,9 @@ typedef enum
|
||||
SDL_CONTROLLER_TYPE_PS4,
|
||||
SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO,
|
||||
SDL_CONTROLLER_TYPE_VIRTUAL,
|
||||
SDL_CONTROLLER_TYPE_PS5
|
||||
SDL_CONTROLLER_TYPE_PS5,
|
||||
SDL_CONTROLLER_TYPE_AMAZON_LUNA,
|
||||
SDL_CONTROLLER_TYPE_GOOGLE_STADIA
|
||||
} SDL_GameControllerType;
|
||||
|
||||
typedef enum
|
||||
|
@ -1898,6 +1898,13 @@ SDL_GetJoystickGameControllerType(const char *name, Uint16 vendor, Uint16 produc
|
||||
} else if (vendor == 0x0001 && product == 0x0001) {
|
||||
type = SDL_CONTROLLER_TYPE_UNKNOWN;
|
||||
|
||||
} else if ((vendor == USB_VENDOR_AMAZON && product == USB_PRODUCT_AMAZON_LUNA_CONTROLLER) ||
|
||||
(vendor == BLUETOOTH_VENDOR_AMAZON && product == BLUETOOTH_PRODUCT_LUNA_CONTROLLER)) {
|
||||
type = SDL_CONTROLLER_TYPE_AMAZON_LUNA;
|
||||
|
||||
} else if (vendor == USB_VENDOR_GOOGLE && product == USB_PRODUCT_GOOGLE_STADIA_CONTROLLER) {
|
||||
type = SDL_CONTROLLER_TYPE_GOOGLE_STADIA;
|
||||
|
||||
} else {
|
||||
switch (GuessControllerType(vendor, product)) {
|
||||
case k_eControllerType_XBox360Controller:
|
||||
|
@ -50,11 +50,7 @@ typedef struct {
|
||||
static SDL_bool
|
||||
HIDAPI_DriverLuna_IsSupportedDevice(const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
if ((vendor_id == USB_VENDOR_AMAZON && product_id == USB_PRODUCT_AMAZON_LUNA_CONTROLLER) ||
|
||||
(vendor_id == BLUETOOTH_VENDOR_AMAZON && product_id == BLUETOOTH_PRODUCT_LUNA_CONTROLLER)) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
return SDL_FALSE;
|
||||
return (type == SDL_CONTROLLER_TYPE_AMAZON_LUNA) ? SDL_TRUE : SDL_FALSE;
|
||||
}
|
||||
|
||||
static const char *
|
||||
|
@ -51,10 +51,7 @@ typedef struct {
|
||||
static SDL_bool
|
||||
HIDAPI_DriverStadia_IsSupportedDevice(const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
if (vendor_id == USB_VENDOR_GOOGLE && product_id == USB_PRODUCT_GOOGLE_STADIA_CONTROLLER) {
|
||||
return SDL_TRUE;
|
||||
}
|
||||
return SDL_FALSE;
|
||||
return (type == SDL_CONTROLLER_TYPE_GOOGLE_STADIA) ? SDL_TRUE : SDL_FALSE;
|
||||
}
|
||||
|
||||
static const char *
|
||||
|
@ -554,11 +554,14 @@ main(int argc, char *argv[])
|
||||
controller_count++;
|
||||
name = SDL_GameControllerNameForIndex(i);
|
||||
switch (SDL_GameControllerTypeForIndex(i)) {
|
||||
case SDL_CONTROLLER_TYPE_XBOX360:
|
||||
description = "XBox 360 Controller";
|
||||
case SDL_CONTROLLER_TYPE_AMAZON_LUNA:
|
||||
description = "Amazon Luna Controller";
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_XBOXONE:
|
||||
description = "XBox One Controller";
|
||||
case SDL_CONTROLLER_TYPE_GOOGLE_STADIA:
|
||||
description = "Google Stadia Controller";
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO:
|
||||
description = "Nintendo Switch Pro Controller";
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_PS3:
|
||||
description = "PS3 Controller";
|
||||
@ -566,8 +569,14 @@ main(int argc, char *argv[])
|
||||
case SDL_CONTROLLER_TYPE_PS4:
|
||||
description = "PS4 Controller";
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO:
|
||||
description = "Nintendo Switch Pro Controller";
|
||||
case SDL_CONTROLLER_TYPE_PS5:
|
||||
description = "PS5 Controller";
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_XBOX360:
|
||||
description = "XBox 360 Controller";
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_XBOXONE:
|
||||
description = "XBox One Controller";
|
||||
break;
|
||||
case SDL_CONTROLLER_TYPE_VIRTUAL:
|
||||
description = "Virtual Game Controller";
|
||||
|
Loading…
Reference in New Issue
Block a user