ReactOS 0.4.15-dev-8076-g06e89b2
xinput.h
Go to the documentation of this file.
1/*
2 * The Wine project - Xinput Joystick Library
3 * Copyright 2008 Andrew Fenn
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20#ifndef __WINE_XINPUT_H
21#define __WINE_XINPUT_H
22
23#include <windef.h>
24
25/*
26 * Bitmasks for the joysticks buttons, determines what has
27 * been pressed on the joystick, these need to be mapped
28 * to whatever device you're using instead of an xbox 360
29 * joystick
30 */
31
32#define XINPUT_GAMEPAD_DPAD_UP 0x0001
33#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
34#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
35#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
36#define XINPUT_GAMEPAD_START 0x0010
37#define XINPUT_GAMEPAD_BACK 0x0020
38#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
39#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
40#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100
41#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
42#define XINPUT_GAMEPAD_A 0x1000
43#define XINPUT_GAMEPAD_B 0x2000
44#define XINPUT_GAMEPAD_X 0x4000
45#define XINPUT_GAMEPAD_Y 0x8000
46
47/*
48 * Defines the flags used to determine if the user is pushing
49 * down on a button, not holding a button, etc
50 */
51
52#define XINPUT_KEYSTROKE_KEYDOWN 0x0001
53#define XINPUT_KEYSTROKE_KEYUP 0x0002
54#define XINPUT_KEYSTROKE_REPEAT 0x0004
55
56/*
57 * Defines the codes which are returned by XInputGetKeystroke
58 */
59
60#define VK_PAD_A 0x5800
61#define VK_PAD_B 0x5801
62#define VK_PAD_X 0x5802
63#define VK_PAD_Y 0x5803
64#define VK_PAD_RSHOULDER 0x5804
65#define VK_PAD_LSHOULDER 0x5805
66#define VK_PAD_LTRIGGER 0x5806
67#define VK_PAD_RTRIGGER 0x5807
68#define VK_PAD_DPAD_UP 0x5810
69#define VK_PAD_DPAD_DOWN 0x5811
70#define VK_PAD_DPAD_LEFT 0x5812
71#define VK_PAD_DPAD_RIGHT 0x5813
72#define VK_PAD_START 0x5814
73#define VK_PAD_BACK 0x5815
74#define VK_PAD_LTHUMB_PRESS 0x5816
75#define VK_PAD_RTHUMB_PRESS 0x5817
76#define VK_PAD_LTHUMB_UP 0x5820
77#define VK_PAD_LTHUMB_DOWN 0x5821
78#define VK_PAD_LTHUMB_RIGHT 0x5822
79#define VK_PAD_LTHUMB_LEFT 0x5823
80#define VK_PAD_LTHUMB_UPLEFT 0x5824
81#define VK_PAD_LTHUMB_UPRIGHT 0x5825
82#define VK_PAD_LTHUMB_DOWNRIGHT 0x5826
83#define VK_PAD_LTHUMB_DOWNLEFT 0x5827
84#define VK_PAD_RTHUMB_UP 0x5830
85#define VK_PAD_RTHUMB_DOWN 0x5831
86#define VK_PAD_RTHUMB_RIGHT 0x5832
87#define VK_PAD_RTHUMB_LEFT 0x5833
88#define VK_PAD_RTHUMB_UPLEFT 0x5834
89#define VK_PAD_RTHUMB_UPRIGHT 0x5835
90#define VK_PAD_RTHUMB_DOWNRIGHT 0x5836
91#define VK_PAD_RTHUMB_DOWNLEFT 0x5837
92
93/*
94 * Deadzones are for analogue joystick controls on the joypad
95 * which determine when input should be assumed to be in the
96 * middle of the pad. This is a threshold to stop a joypad
97 * controlling the game when the player isn't touching the
98 * controls.
99 */
100
101#define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849
102#define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689
103#define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30
104
105
106/*
107 * Defines what type of abilities the type of joystick has
108 * DEVTYPE_GAMEPAD is available for all joysticks, however
109 * there may be more specific identifiers for other joysticks
110 * which are being used.
111 */
112
113#define XINPUT_DEVTYPE_GAMEPAD 0x01
114#define XINPUT_DEVSUBTYPE_GAMEPAD 0x01
115#define XINPUT_DEVSUBTYPE_WHEEL 0x02
116#define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03
117#define XINPUT_DEVSUBTYPE_FLIGHT_SICK 0x04
118#define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05
119#define XINPUT_DEVSUBTYPE_GUITAR 0x06
120#define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08
121
122/*
123 * These are used with the XInputGetCapabilities function to
124 * determine the abilities to the joystick which has been
125 * plugged in.
126 */
127
128#define XINPUT_CAPS_VOICE_SUPPORTED 0x0004
129#define XINPUT_FLAG_GAMEPAD 0x00000001
130
131/*
132 * Defines the status of the battery if one is used in the
133 * attached joystick. The first two define if the joystick
134 * supports a battery. Disconnected means that the joystick
135 * isn't connected. Wired shows that the joystick is a wired
136 * joystick.
137 */
138
139#define BATTERY_DEVTYPE_GAMEPAD 0x00
140#define BATTERY_DEVTYPE_HEADSET 0x01
141#define BATTERY_TYPE_DISCONNECTED 0x00
142#define BATTERY_TYPE_WIRED 0x01
143#define BATTERY_TYPE_ALKALINE 0x02
144#define BATTERY_TYPE_NIMH 0x03
145#define BATTERY_TYPE_UNKNOWN 0xFF
146#define BATTERY_LEVEL_EMPTY 0x00
147#define BATTERY_LEVEL_LOW 0x01
148#define BATTERY_LEVEL_MEDIUM 0x02
149#define BATTERY_LEVEL_FULL 0x03
150
151/*
152 * How many joysticks can be used with this library. Games that
153 * use the xinput library will not go over this number.
154 */
155
156#define XUSER_MAX_COUNT 4
157#define XUSER_INDEX_ANY 0x000000FF
158
159/*
160 * Defines the structure of an xbox 360 joystick.
161 */
162
163typedef struct _XINPUT_GAMEPAD {
172
173typedef struct _XINPUT_GAMEPAD_EX {
183
184typedef struct _XINPUT_STATE {
188
189typedef struct _XINPUT_STATE_EX {
193
194/*
195 * Defines the structure of how much vibration is set on both the
196 * right and left motors in a joystick. If you're not using a 360
197 * joystick you will have to map these to your device.
198 */
199
200typedef struct _XINPUT_VIBRATION {
204
205/*
206 * Defines the structure for what kind of abilities the joystick has
207 * such abilities are things such as if the joystick has the ability
208 * to send and receive audio, if the joystick is in fact a driving
209 * wheel or perhaps if the joystick is some kind of dance pad or
210 * guitar.
211 */
212
213typedef struct _XINPUT_CAPABILITIES {
220
221/*
222 * Defines the structure for a joystick input event which is
223 * retrieved using the function XInputGetKeystroke
224 */
225typedef struct _XINPUT_KEYSTROKE {
232
234{
238
239#ifdef __cplusplus
240extern "C" {
241#endif
242
250
252
253#ifdef __cplusplus
254}
255#endif
256
257#endif /* __WINE_XINPUT_H */
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
short SHORT
Definition: pedump.c:59
XINPUT_VIBRATION Vibration
Definition: xinput.h:218
XINPUT_GAMEPAD Gamepad
Definition: xinput.h:217
BYTE bRightTrigger
Definition: xinput.h:176
DWORD dwPaddingReserved
Definition: xinput.h:181
BYTE bRightTrigger
Definition: xinput.h:166
BYTE bLeftTrigger
Definition: xinput.h:165
SHORT sThumbRY
Definition: xinput.h:170
WORD wButtons
Definition: xinput.h:164
SHORT sThumbLX
Definition: xinput.h:167
SHORT sThumbLY
Definition: xinput.h:168
SHORT sThumbRX
Definition: xinput.h:169
XINPUT_GAMEPAD_EX Gamepad
Definition: xinput.h:191
DWORD dwPacketNumber
Definition: xinput.h:190
XINPUT_GAMEPAD Gamepad
Definition: xinput.h:186
DWORD dwPacketNumber
Definition: xinput.h:185
WORD wRightMotorSpeed
Definition: xinput.h:202
WORD wLeftMotorSpeed
Definition: xinput.h:201
#define WINAPI
Definition: msvc.h:6
struct _XINPUT_CAPABILITIES * PXINPUT_CAPABILITIES
struct _XINPUT_STATE XINPUT_STATE
struct _XINPUT_VIBRATION XINPUT_VIBRATION
struct _XINPUT_GAMEPAD XINPUT_GAMEPAD
struct _XINPUT_KEYSTROKE * PXINPUT_KEYSTROKE
DWORD WINAPI XInputSetState(DWORD, XINPUT_VIBRATION *)
struct _XINPUT_VIBRATION * PXINPUT_VIBRATION
DWORD WINAPI XInputGetCapabilities(DWORD, DWORD, XINPUT_CAPABILITIES *)
struct _XINPUT_GAMEPAD * PXINPUT_GAMEPAD
struct _XINPUT_STATE * PXINPUT_STATE
DWORD WINAPI XInputGetKeystroke(DWORD, DWORD, PXINPUT_KEYSTROKE)
struct _XINPUT_STATE_EX XINPUT_STATE_EX
struct _XINPUT_BATTERY_INFORMATION XINPUT_BATTERY_INFORMATION
DWORD WINAPI XInputGetBatteryInformation(DWORD, BYTE, XINPUT_BATTERY_INFORMATION *)
DWORD WINAPI XInputGetDSoundAudioDeviceGuids(DWORD, GUID *, GUID *)
DWORD WINAPI XInputGetStateEx(DWORD, XINPUT_STATE_EX *)
struct _XINPUT_GAMEPAD_EX XINPUT_GAMEPAD_EX
DWORD WINAPI XInputGetState(DWORD, XINPUT_STATE *)
struct _XINPUT_BATTERY_INFORMATION * PXINPUT_BATTERY_INFORMATION
struct _XINPUT_GAMEPAD_EX * PXINPUT_GAMEPAD_EX
struct _XINPUT_CAPABILITIES XINPUT_CAPABILITIES
void WINAPI XInputEnable(BOOL)
struct _XINPUT_KEYSTROKE XINPUT_KEYSTROKE
struct _XINPUT_STATE_EX * PXINPUT_STATE_EX
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char BYTE
Definition: xxhash.c:193