VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/shaderlib/wine/include/xinput.h

Last change on this file was 53206, checked in by vboxsync, 10 years ago

Devices/vmsvga: header fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.2 KB
Line 
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/*
21 * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
22 * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
23 * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
24 * a choice of LGPL license versions is made available with the language indicating
25 * that LGPLv2 or any later version may be used, or where a choice of which version
26 * of the LGPL is applied is otherwise unspecified.
27 */
28
29#ifndef __WINE_XINPUT_H
30#define __WINE_XINPUT_H
31
32#include <windef.h>
33
34/*
35 * Bitmasks for the joysticks buttons, determines what has
36 * been pressed on the joystick, these need to be mapped
37 * to whatever device you're using instead of an xbox 360
38 * joystick
39 */
40
41#define XINPUT_GAMEPAD_DPAD_UP 0x0001
42#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
43#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
44#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
45#define XINPUT_GAMEPAD_START 0x0010
46#define XINPUT_GAMEPAD_BACK 0x0020
47#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
48#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
49#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100
50#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
51#define XINPUT_GAMEPAD_A 0x1000
52#define XINPUT_GAMEPAD_B 0x2000
53#define XINPUT_GAMEPAD_X 0x4000
54#define XINPUT_GAMEPAD_Y 0x8000
55
56/*
57 * Defines the flags used to determine if the user is pushing
58 * down on a button, not holding a button, etc
59 */
60
61#define XINPUT_KEYSTROKE_KEYDOWN 0x0001
62#define XINPUT_KEYSTROKE_KEYUP 0x0002
63#define XINPUT_KEYSTROKE_REPEAT 0x0004
64
65/*
66 * Defines the codes which are returned by XInputGetKeystroke
67 */
68
69#define VK_PAD_A 0x5800
70#define VK_PAD_B 0x5801
71#define VK_PAD_X 0x5802
72#define VK_PAD_Y 0x5803
73#define VK_PAD_RSHOULDER 0x5804
74#define VK_PAD_LSHOULDER 0x5805
75#define VK_PAD_LTRIGGER 0x5806
76#define VK_PAD_RTRIGGER 0x5807
77#define VK_PAD_DPAD_UP 0x5810
78#define VK_PAD_DPAD_DOWN 0x5811
79#define VK_PAD_DPAD_LEFT 0x5812
80#define VK_PAD_DPAD_RIGHT 0x5813
81#define VK_PAD_START 0x5814
82#define VK_PAD_BACK 0x5815
83#define VK_PAD_LTHUMB_PRESS 0x5816
84#define VK_PAD_RTHUMB_PRESS 0x5817
85#define VK_PAD_LTHUMB_UP 0x5820
86#define VK_PAD_LTHUMB_DOWN 0x5821
87#define VK_PAD_LTHUMB_RIGHT 0x5822
88#define VK_PAD_LTHUMB_LEFT 0x5823
89#define VK_PAD_LTHUMB_UPLEFT 0x5824
90#define VK_PAD_LTHUMB_UPRIGHT 0x5825
91#define VK_PAD_LTHUMB_DOWNRIGHT 0x5826
92#define VK_PAD_LTHUMB_DOWNLEFT 0x5827
93#define VK_PAD_RTHUMB_UP 0x5830
94#define VK_PAD_RTHUMB_DOWN 0x5831
95#define VK_PAD_RTHUMB_RIGHT 0x5832
96#define VK_PAD_RTHUMB_LEFT 0x5833
97#define VK_PAD_RTHUMB_UPLEFT 0x5834
98#define VK_PAD_RTHUMB_UPRIGHT 0x5835
99#define VK_PAD_RTHUMB_DOWNRIGHT 0x5836
100#define VK_PAD_RTHUMB_DOWNLEFT 0x5837
101
102/*
103 * Deadzones are for analogue joystick controls on the joypad
104 * which determine when input should be assumed to be in the
105 * middle of the pad. This is a threshold to stop a joypad
106 * controlling the game when the player isn't touching the
107 * controls.
108 */
109
110#define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849
111#define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689
112#define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30
113
114
115/*
116 * Defines what type of abilities the type of joystick has
117 * DEVTYPE_GAMEPAD is available for all joysticks, however
118 * there may be more specific identifiers for other joysticks
119 * which are being used.
120 */
121
122#define XINPUT_DEVTYPE_GAMEPAD 0x01
123#define XINPUT_DEVSUBTYPE_GAMEPAD 0x01
124#define XINPUT_DEVSUBTYPE_WHEEL 0x02
125#define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03
126#define XINPUT_DEVSUBTYPE_FLIGHT_SICK 0x04
127#define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05
128#define XINPUT_DEVSUBTYPE_GUITAR 0x06
129#define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08
130
131/*
132 * These are used with the XInputGetCapabilities function to
133 * determine the abilities to the joystick which has been
134 * plugged in.
135 */
136
137#define XINPUT_CAPS_VOICE_SUPPORTED 0x0004
138#define XINPUT_FLAG_GAMEPAD 0x00000001
139
140/*
141 * Defines the status of the battery if one is used in the
142 * attached joystick. The first two define if the joystick
143 * supports a battery. Disconnected means that the joystick
144 * isn't connected. Wired shows that the joystick is a wired
145 * joystick.
146 */
147
148#define BATTERY_DEVTYPE_GAMEPAD 0x00
149#define BATTERY_DEVTYPE_HEADSET 0x01
150#define BATTERY_TYPE_DISCONNECTED 0x00
151#define BATTERY_TYPE_WIRED 0x01
152#define BATTERY_TYPE_ALKALINE 0x02
153#define BATTERY_TYPE_NIMH 0x03
154#define BATTERY_TYPE_UNKNOWN 0xFF
155#define BATTERY_LEVEL_EMPTY 0x00
156#define BATTERY_LEVEL_LOW 0x01
157#define BATTERY_LEVEL_MEDIUM 0x02
158#define BATTERY_LEVEL_FULL 0x03
159
160/*
161 * How many joysticks can be used with this library. Games that
162 * use the xinput library will not go over this number.
163 */
164
165#define XUSER_MAX_COUNT 4
166#define XUSER_INDEX_ANY 0x000000FF
167
168/*
169 * Defines the structure of an xbox 360 joystick.
170 */
171
172typedef struct _XINPUT_GAMEPAD {
173 WORD wButtons;
174 BYTE bLeftTrigger;
175 BYTE bRightTrigger;
176 SHORT sThumbLX;
177 SHORT sThumbLY;
178 SHORT sThumbRX;
179 SHORT sThumbRY;
180} XINPUT_GAMEPAD, *PXINPUT_GAMEPAD;
181
182typedef struct _XINPUT_STATE {
183 DWORD dwPacketNumber;
184 XINPUT_GAMEPAD Gamepad;
185} XINPUT_STATE, *PXINPUT_STATE;
186
187/*
188 * Defines the structure of how much vibration is set on both the
189 * right and left motors in a joystick. If you're not using a 360
190 * joystick you will have to map these to your device.
191 */
192
193typedef struct _XINPUT_VIBRATION {
194 WORD wLeftMotorSpeed;
195 WORD wRightMotorSpeed;
196} XINPUT_VIBRATION, *PXINPUT_VIBRATION;
197
198/*
199 * Defines the structure for what kind of abilities the joystick has
200 * such abilities are things such as if the joystick has the ability
201 * to send and receive audio, if the joystick is in fact a driving
202 * wheel or perhaps if the joystick is some kind of dance pad or
203 * guitar.
204 */
205
206typedef struct _XINPUT_CAPABILITIES {
207 BYTE Type;
208 BYTE SubType;
209 WORD Flags;
210 XINPUT_GAMEPAD Gamepad;
211 XINPUT_VIBRATION Vibration;
212} XINPUT_CAPABILITIES, *PXINPUT_CAPABILITIES;
213
214/*
215 * Defines the structure for a joystick input event which is
216 * retrieved using the function XInputGetKeystroke
217 */
218typedef struct _XINPUT_KEYSTROKE {
219 WORD VirtualKey;
220 WCHAR Unicode;
221 WORD Flags;
222 BYTE UserIndex;
223 BYTE HidCode;
224} XINPUT_KEYSTROKE, *PXINPUT_KEYSTROKE;
225
226typedef struct _XINPUT_BATTERY_INFORMATION
227{
228 BYTE BatteryType;
229 BYTE BatteryLevel;
230} XINPUT_BATTERY_INFORMATION, *PXINPUT_BATTERY_INFORMATION;
231
232#ifdef __cplusplus
233extern "C" {
234#endif
235
236void WINAPI XInputEnable(BOOL);
237DWORD WINAPI XInputSetState(DWORD, XINPUT_VIBRATION*);
238DWORD WINAPI XInputGetState(DWORD, XINPUT_STATE*);
239DWORD WINAPI XInputGetKeystroke(DWORD, DWORD, PXINPUT_KEYSTROKE);
240DWORD WINAPI XInputGetCapabilities(DWORD, DWORD, XINPUT_CAPABILITIES*);
241DWORD WINAPI XInputGetDSoundAudioDeviceGuids(DWORD, GUID*, GUID*);
242DWORD WINAPI XInputGetBatteryInformation(DWORD, BYTE, XINPUT_BATTERY_INFORMATION*);
243
244#ifdef __cplusplus
245}
246#endif
247
248#endif /* __WINE_XINPUT_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette