controller_type.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | ControllerDescription_t

## Macros

#define | inline SDL_INLINE
#define | MAKE_CONTROLLER_ID(nVID, nPID) (unsigned int)( nVID << 16 | nPID )

## Enumerations

enum

EControllerType {
k_eControllerType_None = -1,
k_eControllerType_Unknown = 0,
k_eControllerType_UnknownSteamController = 1,
k_eControllerType_SteamController = 2,
k_eControllerType_SteamControllerV2 = 3,
k_eControllerType_UnknownNonSteamController = 30,
k_eControllerType_XBox360Controller = 31,
k_eControllerType_XBoxOneController = 32,
k_eControllerType_PS3Controller = 33,
k_eControllerType_PS4Controller = 34,
k_eControllerType_WiiController = 35,
k_eControllerType_AppleController = 36,
k_eControllerType_AndroidController = 37,
k_eControllerType_SwitchProController = 38,
k_eControllerType_SwitchJoyConLeft = 39,
k_eControllerType_SwitchJoyConRight = 40,
k_eControllerType_SwitchJoyConPair = 41,
k_eControllerType_SwitchInputOnlyController = 42,
k_eControllerType_MobileTouch = 43,
k_eControllerType_XInputSwitchController = 44,
k_eControllerType_LastController,
k_eControllertype_GenericKeyboard = 400,
k_eControllertype_GenericMouse = 800
}

## Functions

static EControllerType | GuessControllerType (int nVID, int nPID)

## Variables

static const ControllerDescription_t | arrControllers []

## Macro Definition Documentation

## inline

#define inline SDL_INLINE

Definition at line 28 of file controller_type.h.

## MAKE_CONTROLLER_ID

#define MAKE_CONTROLLER_ID | ( |  | nVID,
|  |  | nPID
| ) |  | (unsigned int)( nVID << 16 | nPID )

Definition at line 68 of file controller_type.h.

## Enumeration Type Documentation

## EControllerType

enum EControllerType

Enumerator
k_eControllerType_None |
k_eControllerType_Unknown |
k_eControllerType_UnknownSteamController |
k_eControllerType_SteamController |
k_eControllerType_SteamControllerV2 |
k_eControllerType_UnknownNonSteamController |
k_eControllerType_XBox360Controller |
k_eControllerType_XBoxOneController |
k_eControllerType_PS3Controller |
k_eControllerType_PS4Controller |
k_eControllerType_WiiController |
k_eControllerType_AppleController |
k_eControllerType_AndroidController |
k_eControllerType_SwitchProController |
k_eControllerType_SwitchJoyConLeft |
k_eControllerType_SwitchJoyConRight |
k_eControllerType_SwitchJoyConPair |
k_eControllerType_SwitchInputOnlyController |
k_eControllerType_MobileTouch |
k_eControllerType_XInputSwitchController |
k_eControllerType_LastController |
k_eControllertype_GenericKeyboard |
k_eControllertype_GenericMouse |

Definition at line 35 of file controller_type.h.

{
k_eControllerType_None = -1,
k_eControllerType_Unknown = 0,
// Steam Controllers
k_eControllerType_UnknownSteamController = 1,
k_eControllerType_SteamController = 2,
k_eControllerType_SteamControllerV2 = 3,
// Other Controllers
k_eControllerType_UnknownNonSteamController = 30,
k_eControllerType_XBox360Controller = 31,
k_eControllerType_XBoxOneController = 32,
k_eControllerType_PS3Controller = 33,
k_eControllerType_PS4Controller = 34,
k_eControllerType_WiiController = 35,
k_eControllerType_AppleController = 36,
k_eControllerType_AndroidController = 37,
k_eControllerType_SwitchProController = 38,
k_eControllerType_SwitchJoyConLeft = 39,
k_eControllerType_SwitchJoyConRight = 40,
k_eControllerType_SwitchJoyConPair = 41,
k_eControllerType_SwitchInputOnlyController = 42,
k_eControllerType_MobileTouch = 43,
k_eControllerType_XInputSwitchController = 44, // Client-side only, used to mark Switch-compatible controllers as not supporting Switch controller protocol
k_eControllerType_LastController, // Don't add game controllers below this enumeration - this enumeration can change value
// Keyboards and Mice
k_eControllertype_GenericKeyboard = 400,
k_eControllertype_GenericMouse = 800,
} EControllerType;

## Function Documentation

## GuessControllerType()

static EControllerType GuessControllerType | ( | int | nVID,
|  | int | nPID
| ) |  |

inline static

Definition at line 427 of file controller_type.h.

{
unsigned int unDeviceID = MAKE_CONTROLLER_ID( nVID, nPID );
int iIndex;
for ( iIndex = 0; iIndex < sizeof( arrControllers ) / sizeof( arrControllers[0] ); ++iIndex )
{
if ( unDeviceID == arrControllers[ iIndex ].m_unDeviceID )
{
return arrControllers[ iIndex ].m_eControllerType;
}
}
return k_eControllerType_UnknownNonSteamController;
}

References arrControllers, k_eControllerType_UnknownNonSteamController, ControllerDescription_t::m_eControllerType, and MAKE_CONTROLLER_ID.

Referenced by SDL_GetJoystickGUIDType(), SDL_IsJoystickNintendoSwitchPro(), SDL_IsJoystickPS4(), SDL_IsJoystickSteamController(), SDL_IsJoystickXbox360(), and SDL_IsJoystickXboxOne().

## Variable Documentation

## arrControllers

const ControllerDescription_t arrControllers[]

static

Definition at line 75 of file controller_type.h.

Referenced by GuessControllerType().

k_eControllerType_SteamController
@ k_eControllerType_SteamController
Definition: controller_type.h:42
k_eControllerType_SwitchInputOnlyController
@ k_eControllerType_SwitchInputOnlyController
Definition: controller_type.h:58
ControllerDescription_t::m_eControllerType
EControllerType m_eControllerType
Definition: controller_type.h:72
k_eControllertype_GenericKeyboard
@ k_eControllertype_GenericKeyboard
Definition: controller_type.h:64
k_eControllerType_MobileTouch
@ k_eControllerType_MobileTouch
Definition: controller_type.h:59
k_eControllerType_None
@ k_eControllerType_None
Definition: controller_type.h:37
k_eControllerType_SwitchJoyConRight
@ k_eControllerType_SwitchJoyConRight
Definition: controller_type.h:56
k_eControllerType_SwitchProController
@ k_eControllerType_SwitchProController
Definition: controller_type.h:54
k_eControllerType_WiiController
@ k_eControllerType_WiiController
Definition: controller_type.h:51
arrControllers
static const ControllerDescription_t arrControllers[]
Definition: controller_type.h:75
k_eControllerType_SwitchJoyConPair
@ k_eControllerType_SwitchJoyConPair
Definition: controller_type.h:57
MAKE_CONTROLLER_ID
#define MAKE_CONTROLLER_ID(nVID, nPID)
Definition: controller_type.h:68
k_eControllerType_LastController
@ k_eControllerType_LastController
Definition: controller_type.h:61
k_eControllerType_AndroidController
@ k_eControllerType_AndroidController
Definition: controller_type.h:53
k_eControllerType_PS4Controller
@ k_eControllerType_PS4Controller
Definition: controller_type.h:50
k_eControllerType_XBox360Controller
@ k_eControllerType_XBox360Controller
Definition: controller_type.h:47
k_eControllerType_SteamControllerV2
@ k_eControllerType_SteamControllerV2
Definition: controller_type.h:43
k_eControllerType_UnknownNonSteamController
@ k_eControllerType_UnknownNonSteamController
Definition: controller_type.h:46
k_eControllerType_Unknown
@ k_eControllerType_Unknown
Definition: controller_type.h:38
k_eControllertype_GenericMouse
@ k_eControllertype_GenericMouse
Definition: controller_type.h:65
k_eControllerType_SwitchJoyConLeft
@ k_eControllerType_SwitchJoyConLeft
Definition: controller_type.h:55
k_eControllerType_AppleController
@ k_eControllerType_AppleController
Definition: controller_type.h:52
k_eControllerType_PS3Controller
@ k_eControllerType_PS3Controller
Definition: controller_type.h:49
k_eControllerType_XInputSwitchController
@ k_eControllerType_XInputSwitchController
Definition: controller_type.h:60
EControllerType
EControllerType
Definition: controller_type.h:35
k_eControllerType_UnknownSteamController
@ k_eControllerType_UnknownSteamController
Definition: controller_type.h:41
k_eControllerType_XBoxOneController
@ k_eControllerType_XBoxOneController
Definition: controller_type.h:48