The Windows 8 Consumer Preview includes version 1.4 of the XInput API for use with Xbox 360 Common Controller compatible game devices, and this API is fully supported for both Windows Store apps (including x86, x64, and Windows on ARM) and desktop Win32 applications. The full details of the differences compared to XInput 1.3 which shipped in the DirectX SDK (June 2010) release are addressed on Microsoft Docs. The headers and libraries for Xinput 1.4 are included in the Windows SDK 8.0 that is part Visual Studio 11 Beta. Windows 8 also includes an updated driver for these devices,
REDIST: For XInput 1.4 on Windows 8 and Windows RT, no redistribution is required since XInput 1.4 is included with the OS. For XInput 9.1.0 on Windows Vista, Windows 7, or WIndows 8, no redistribution is required since XInput 9.1.0 is included with the OS. For XInput 1.3 on any version of Windows, use the legacy DirectX SDK REDIST.</p>
Since Xinput version 1.4 is not available on Windows 7, Win32 desktop games that support older versions of Windows can use either XInput 1.3 or the still supported older XInput 9.1.0 which is included in Windows Vista, Windows 7, and Windows 8.
- When building an application that is 'down-level' using headers in the Windows 8.0 SDK, be sure to explicitly select the correct 'minimum' ``_WIN32_WINNT`` value. For Windows 8, that is 0x0602 (which is the default when building code with Visual Studio 2012 and for all Windows Store apps). For Windows 7 use 0x0601, and for Windows Vista use 0x0600. Typically this is done as part of the project configuration via Preprocessor Definitions.
xinput.hheader, you will be using XInput 1.4 if set to 0x0602, or XInput 9.1.0 otherwise. If using XInput 1.4, you should link with
XINPUT.LIB. If using XInput 9.1.0, link with
XINPUT9_1_0.LIBinstead. If your usage of XInput is limited to basic gamepad functionality via
XInputSetState, then XInput 9.1.0 may be all the functionailty you require and is supported on a broad range of Windows OSes without the need to use the DirectSetup redistribution package. A few things to note about XInput 9.1.0 are that
XInputGetCapabilitiesreturns a fixed set of values regardless of the attached device (notably including the subtype), and this version of XInput does not support headset audio functionality. The following code will compile using all three versions of XInput: ```cpp #include
DXSDK_DIRfor the headers where you need older versions to support older versions of Windows. (see "Where is the DirectX SDK?"). In a future post, I'll address the details of using XInput 1.4's audio features, and how to implement similiar behavior down-level using XInput 1.3. XInput 9.1.0 doesn't support audio features. Note: The Windows 7.1 SDK includes the
xinput.libimport library for the the Xinput 9.1.0 version as well. XInput 9.1.0 can be deployed on Windows XP using the legacy DirectX SDK's REDIST (aka DirectSetup). Windows Server: Note that XInput is not included in Windows Server 2012. XInput 9.1.0 is also not present on Windows Server 2008 or 2012. Xbox One Controller: The Xbox One controller is not supported by the ``XUSB21.SYS`` (Windows 7) or ``XUSB22.SYS`` (Windows 8.x) driver. There is a ``X1USB1.SYS`` driver now available which does support the Xbox One Controller for XINPUT when using a micro-USB cable--the Xbox One controller is not compatible with the Xbox 360 Wireless Receiver for Windows. Windows 10: To continue to use XInput 1.4 with universal Windows apps, be sure to link with
xinput.lib. Alternatively, you can make direct use of the new Windows.Gaming.Input API or the GamePad class in DirectX Tool Kit. Related: XInput Win32 Samples, Game controller sample