00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _XINPUT_H_
00011 #define _XINPUT_H_
00012
00013 #include <windef.h>
00014
00015
00016
00017 #ifndef XINPUT_USE_9_1_0
00018 #define XINPUT_DLL_A "xinput1_3.dll"
00019 #define XINPUT_DLL_W L"xinput1_3.dll"
00020 #else
00021 #define XINPUT_DLL_A "xinput9_1_0.dll"
00022 #define XINPUT_DLL_W L"xinput9_1_0.dll"
00023 #endif
00024 #ifdef UNICODE
00025 #define XINPUT_DLL XINPUT_DLL_W
00026 #else
00027 #define XINPUT_DLL XINPUT_DLL_A
00028 #endif
00029
00030
00031
00032
00033 #define XINPUT_DEVTYPE_GAMEPAD 0x01
00034
00035
00036
00037
00038 #define XINPUT_DEVSUBTYPE_GAMEPAD 0x01
00039
00040 #ifndef XINPUT_USE_9_1_0
00041
00042 #define XINPUT_DEVSUBTYPE_WHEEL 0x02
00043 #define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03
00044 #define XINPUT_DEVSUBTYPE_FLIGHT_SICK 0x04
00045 #define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05
00046 #define XINPUT_DEVSUBTYPE_GUITAR 0x06
00047 #define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08
00048
00049 #endif // !XINPUT_USE_9_1_0
00050
00051
00052
00053
00054
00055
00056 #define XINPUT_CAPS_VOICE_SUPPORTED 0x0004
00057
00058
00059
00060
00061 #define XINPUT_GAMEPAD_DPAD_UP 0x0001
00062 #define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
00063 #define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
00064 #define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
00065 #define XINPUT_GAMEPAD_START 0x0010
00066 #define XINPUT_GAMEPAD_BACK 0x0020
00067 #define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
00068 #define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
00069 #define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100
00070 #define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
00071 #define XINPUT_GAMEPAD_A 0x1000
00072 #define XINPUT_GAMEPAD_B 0x2000
00073 #define XINPUT_GAMEPAD_X 0x4000
00074 #define XINPUT_GAMEPAD_Y 0x8000
00075
00076
00077
00078
00079
00080 #define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849
00081 #define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689
00082 #define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30
00083
00084
00085
00086
00087 #define XINPUT_FLAG_GAMEPAD 0x00000001
00088
00089
00090 #ifndef XINPUT_USE_9_1_0
00091
00092
00093
00094
00095 #define BATTERY_DEVTYPE_GAMEPAD 0x00
00096 #define BATTERY_DEVTYPE_HEADSET 0x01
00097
00098
00099
00100
00101 #define BATTERY_TYPE_DISCONNECTED 0x00 // This device is not connected
00102 #define BATTERY_TYPE_WIRED 0x01 // Wired device, no battery
00103 #define BATTERY_TYPE_ALKALINE 0x02 // Alkaline battery source
00104 #define BATTERY_TYPE_NIMH 0x03 // Nickel Metal Hydride battery source
00105 #define BATTERY_TYPE_UNKNOWN 0xFF // Cannot determine the battery type
00106
00107
00108
00109 #define BATTERY_LEVEL_EMPTY 0x00
00110 #define BATTERY_LEVEL_LOW 0x01
00111 #define BATTERY_LEVEL_MEDIUM 0x02
00112 #define BATTERY_LEVEL_FULL 0x03
00113
00114
00115 #define XUSER_MAX_COUNT 4
00116
00117 #define XUSER_INDEX_ANY 0x000000FF
00118
00119
00120
00121
00122
00123
00124 #define VK_PAD_A 0x5800
00125 #define VK_PAD_B 0x5801
00126 #define VK_PAD_X 0x5802
00127 #define VK_PAD_Y 0x5803
00128 #define VK_PAD_RSHOULDER 0x5804
00129 #define VK_PAD_LSHOULDER 0x5805
00130 #define VK_PAD_LTRIGGER 0x5806
00131 #define VK_PAD_RTRIGGER 0x5807
00132
00133 #define VK_PAD_DPAD_UP 0x5810
00134 #define VK_PAD_DPAD_DOWN 0x5811
00135 #define VK_PAD_DPAD_LEFT 0x5812
00136 #define VK_PAD_DPAD_RIGHT 0x5813
00137 #define VK_PAD_START 0x5814
00138 #define VK_PAD_BACK 0x5815
00139 #define VK_PAD_LTHUMB_PRESS 0x5816
00140 #define VK_PAD_RTHUMB_PRESS 0x5817
00141
00142 #define VK_PAD_LTHUMB_UP 0x5820
00143 #define VK_PAD_LTHUMB_DOWN 0x5821
00144 #define VK_PAD_LTHUMB_RIGHT 0x5822
00145 #define VK_PAD_LTHUMB_LEFT 0x5823
00146 #define VK_PAD_LTHUMB_UPLEFT 0x5824
00147 #define VK_PAD_LTHUMB_UPRIGHT 0x5825
00148 #define VK_PAD_LTHUMB_DOWNRIGHT 0x5826
00149 #define VK_PAD_LTHUMB_DOWNLEFT 0x5827
00150
00151 #define VK_PAD_RTHUMB_UP 0x5830
00152 #define VK_PAD_RTHUMB_DOWN 0x5831
00153 #define VK_PAD_RTHUMB_RIGHT 0x5832
00154 #define VK_PAD_RTHUMB_LEFT 0x5833
00155 #define VK_PAD_RTHUMB_UPLEFT 0x5834
00156 #define VK_PAD_RTHUMB_UPRIGHT 0x5835
00157 #define VK_PAD_RTHUMB_DOWNRIGHT 0x5836
00158 #define VK_PAD_RTHUMB_DOWNLEFT 0x5837
00159
00160
00161
00162
00163 #define XINPUT_KEYSTROKE_KEYDOWN 0x0001
00164 #define XINPUT_KEYSTROKE_KEYUP 0x0002
00165 #define XINPUT_KEYSTROKE_REPEAT 0x0004
00166
00167 #endif //!XINPUT_USE_9_1_0
00168
00169
00170
00171
00172 typedef struct _XINPUT_GAMEPAD
00173 {
00174 WORD wButtons;
00175 BYTE bLeftTrigger;
00176 BYTE bRightTrigger;
00177 SHORT sThumbLX;
00178 SHORT sThumbLY;
00179 SHORT sThumbRX;
00180 SHORT sThumbRY;
00181 } XINPUT_GAMEPAD, *PXINPUT_GAMEPAD;
00182
00183 typedef struct _XINPUT_STATE
00184 {
00185 DWORD dwPacketNumber;
00186 XINPUT_GAMEPAD Gamepad;
00187 } XINPUT_STATE, *PXINPUT_STATE;
00188
00189 typedef struct _XINPUT_VIBRATION
00190 {
00191 WORD wLeftMotorSpeed;
00192 WORD wRightMotorSpeed;
00193 } XINPUT_VIBRATION, *PXINPUT_VIBRATION;
00194
00195 typedef struct _XINPUT_CAPABILITIES
00196 {
00197 BYTE Type;
00198 BYTE SubType;
00199 WORD Flags;
00200 XINPUT_GAMEPAD Gamepad;
00201 XINPUT_VIBRATION Vibration;
00202 } XINPUT_CAPABILITIES, *PXINPUT_CAPABILITIES;
00203
00204 #ifndef XINPUT_USE_9_1_0
00205
00206 typedef struct _XINPUT_BATTERY_INFORMATION
00207 {
00208 BYTE BatteryType;
00209 BYTE BatteryLevel;
00210 } XINPUT_BATTERY_INFORMATION, *PXINPUT_BATTERY_INFORMATION;
00211
00212 typedef struct _XINPUT_KEYSTROKE
00213 {
00214 WORD VirtualKey;
00215 WCHAR Unicode;
00216 WORD Flags;
00217 BYTE UserIndex;
00218 BYTE HidCode;
00219 } XINPUT_KEYSTROKE, *PXINPUT_KEYSTROKE;
00220
00221 #endif // !XINPUT_USE_9_1_0
00222
00223
00224
00225
00226
00227
00228
00229 #endif //_XINPUT_H_