- better support for ExecuteBuffers
[wine] / include / dinput.h
1 #ifndef _WINE_DINPUT_H
2 #define _WINE_DINPUT_H
3
4 #include "unknwn.h"
5
6 #define STDMETHOD(xfn) HRESULT (CALLBACK *fn##xfn)
7 #define STDMETHOD_(ret,xfn) ret (CALLBACK *fn##xfn)
8 #define PURE
9 #define FAR
10 #define THIS_ THIS,
11
12 #define DIRECTINPUT_VERSION     0x0500
13
14 /* Classes */
15 DEFINE_GUID(CLSID_DirectInput,          0x25E609E0,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
16 DEFINE_GUID(CLSID_DirectInputDevice,    0x25E609E1,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
17
18 /* Interfaces */
19 DEFINE_GUID(IID_IDirectInputA,          0x89521360,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
20 DEFINE_GUID(IID_IDirectInputW,          0x89521361,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
21 DEFINE_GUID(IID_IDirectInput2A,         0x5944E662,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
22 DEFINE_GUID(IID_IDirectInput2W,         0x5944E663,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
23 DEFINE_GUID(IID_IDirectInputDeviceA,    0x5944E680,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
24 DEFINE_GUID(IID_IDirectInputDeviceW,    0x5944E681,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
25 DEFINE_GUID(IID_IDirectInputDevice2A,   0x5944E682,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
26 DEFINE_GUID(IID_IDirectInputDevice2W,   0x5944E683,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
27 DEFINE_GUID(IID_IDirectInputEffect,     0xE7E1F7C0,0x88D2,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
28
29 /* Predefined object types */
30 DEFINE_GUID(GUID_XAxis, 0xA36D02E0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
31 DEFINE_GUID(GUID_YAxis, 0xA36D02E1,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
32 DEFINE_GUID(GUID_ZAxis, 0xA36D02E2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
33 DEFINE_GUID(GUID_RxAxis,0xA36D02F4,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
34 DEFINE_GUID(GUID_RyAxis,0xA36D02F5,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
35 DEFINE_GUID(GUID_RzAxis,0xA36D02E3,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
36 DEFINE_GUID(GUID_Slider,0xA36D02E4,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
37 DEFINE_GUID(GUID_Button,0xA36D02F0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
38 DEFINE_GUID(GUID_Key,   0x55728220,0xD33C,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
39 DEFINE_GUID(GUID_POV,   0xA36D02F2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
40 DEFINE_GUID(GUID_Unknown,0xA36D02F3,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
41
42 /* Predefined product GUIDs */
43 DEFINE_GUID(GUID_SysMouse,      0x6F1D2B60,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
44 DEFINE_GUID(GUID_SysKeyboard,   0x6F1D2B61,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
45 DEFINE_GUID(GUID_Joystick,      0x6F1D2B70,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
46
47 /* predefined forcefeedback effects */
48 DEFINE_GUID(GUID_ConstantForce, 0x13541C20,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
49 DEFINE_GUID(GUID_RampForce,     0x13541C21,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
50 DEFINE_GUID(GUID_Square,        0x13541C22,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
51 DEFINE_GUID(GUID_Sine,          0x13541C23,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
52 DEFINE_GUID(GUID_Triangle,      0x13541C24,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
53 DEFINE_GUID(GUID_SawtoothUp,    0x13541C25,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
54 DEFINE_GUID(GUID_SawtoothDown,  0x13541C26,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
55 DEFINE_GUID(GUID_Spring,        0x13541C27,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
56 DEFINE_GUID(GUID_Damper,        0x13541C28,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
57 DEFINE_GUID(GUID_Inertia,       0x13541C29,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
58 DEFINE_GUID(GUID_Friction,      0x13541C2A,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
59 DEFINE_GUID(GUID_CustomForce,   0x13541C2B,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
60
61 typedef struct IDirectInput32A IDirectInput32A,*LPDIRECTINPUT32A;
62 typedef struct IDirectInputDevice32A IDirectInputDevice32A,*LPDIRECTINPUTDEVICE32A;
63 typedef struct IDirectInputEffect IDirectInputEffect,*LPDIRECTINPUTEFFECT;
64 typedef struct SysKeyboard32A SysKeyboard32A,*LPSYSKEYBOARD32A;
65 typedef struct SysMouse32A SysMouse32A,*LPSYSMOUSE32A;
66
67 #define DI_OK                           S_OK
68 #define DI_NOTATTACHED                  S_FALSE
69 #define DI_BUFFEROVERFLOW               S_FALSE
70 #define DI_PROPNOEFFECT                 S_FALSE
71 #define DI_NOEFFECT                     S_FALSE
72 #define DI_POLLEDDEVICE                 ((HRESULT)0x00000002L)
73 #define DI_DOWNLOADSKIPPED              ((HRESULT)0x00000003L)
74 #define DI_EFFECTRESTARTED              ((HRESULT)0x00000004L)
75 #define DI_TRUNCATED                    ((HRESULT)0x00000008L)
76 #define DI_TRUNCATEDANDRESTARTED        ((HRESULT)0x0000000CL)
77
78 #define DIERR_OLDDIRECTINPUTVERSION     \
79     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_OLD_WIN_VERSION)
80 #define DIERR_BETADIRECTINPUTVERSION    \
81     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_RMODE_APP)
82 #define DIERR_BADDRIVERVER              \
83     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BAD_DRIVER_LEVEL)
84 #define DIERR_DEVICENOTREG              REGDB_E_CLASSNOTREG
85 #define DIERR_NOTFOUND                  \
86     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND)
87 #define DIERR_OBJECTNOTFOUND            \
88     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND)
89 #define DIERR_INVALIDPARAM              E_INVALIDARG
90 #define DIERR_NOINTERFACE               E_NOINTERFACE
91 #define DIERR_GENERIC                   E_FAIL
92 #define DIERR_OUTOFMEMORY               E_OUTOFMEMORY
93 #define DIERR_UNSUPPORTED               E_NOTIMPL
94 #define DIERR_NOTINITIALIZED            \
95     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_READY)
96 #define DIERR_ALREADYINITIALIZED        \
97     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_ALREADY_INITIALIZED)
98 #define DIERR_NOAGGREGATION             CLASS_E_NOAGGREGATION
99 #define DIERR_OTHERAPPHASPRIO           E_ACCESSDENIED
100 #define DIERR_INPUTLOST                 \
101     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_READ_FAULT)
102 #define DIERR_ACQUIRED                  \
103     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BUSY)
104 #define DIERR_NOTACQUIRED               \
105     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_INVALID_ACCESS)
106 #define DIERR_READONLY                  E_ACCESSDENIED
107 #define DIERR_HANDLEEXISTS              E_ACCESSDENIED
108 #ifndef E_PENDING
109 #define E_PENDING                       0x8000000AL
110 #endif
111 #define DIERR_INSUFFICIENTPRIVS         0x80040200L
112 #define DIERR_DEVICEFULL                0x80040201L
113 #define DIERR_MOREDATA                  0x80040202L
114 #define DIERR_NOTDOWNLOADED             0x80040203L
115 #define DIERR_HASEFFECTS                0x80040204L
116 #define DIERR_NOTEXCLUSIVEACQUIRED      0x80040205L
117 #define DIERR_INCOMPLETEEFFECT          0x80040206L
118 #define DIERR_NOTBUFFERED               0x80040207L
119 #define DIERR_EFFECTPLAYING             0x80040208L
120 #define DIERR_UNPLUGGED                 0x80040209L
121 #define DIERR_REPORTFULL                0x8004020AL
122
123 #define DIENUM_STOP                     0
124 #define DIENUM_CONTINUE                 1
125
126 #define DIDEVTYPE_DEVICE                1
127 #define DIDEVTYPE_MOUSE                 2
128 #define DIDEVTYPE_KEYBOARD              3
129 #define DIDEVTYPE_JOYSTICK              4
130 #define DIDEVTYPE_HID                   0x00010000
131
132 #define DIDEVTYPEMOUSE_UNKNOWN          1
133 #define DIDEVTYPEMOUSE_TRADITIONAL      2
134 #define DIDEVTYPEMOUSE_FINGERSTICK      3
135 #define DIDEVTYPEMOUSE_TOUCHPAD         4
136 #define DIDEVTYPEMOUSE_TRACKBALL        5
137
138 #define DIDEVTYPEKEYBOARD_UNKNOWN       0
139 #define DIDEVTYPEKEYBOARD_PCXT          1
140 #define DIDEVTYPEKEYBOARD_OLIVETTI      2
141 #define DIDEVTYPEKEYBOARD_PCAT          3
142 #define DIDEVTYPEKEYBOARD_PCENH         4
143 #define DIDEVTYPEKEYBOARD_NOKIA1050     5
144 #define DIDEVTYPEKEYBOARD_NOKIA9140     6
145 #define DIDEVTYPEKEYBOARD_NEC98         7
146 #define DIDEVTYPEKEYBOARD_NEC98LAPTOP   8
147 #define DIDEVTYPEKEYBOARD_NEC98106      9
148 #define DIDEVTYPEKEYBOARD_JAPAN106     10
149 #define DIDEVTYPEKEYBOARD_JAPANAX      11
150 #define DIDEVTYPEKEYBOARD_J3100        12
151
152 #define DIDEVTYPEJOYSTICK_UNKNOWN       1
153 #define DIDEVTYPEJOYSTICK_TRADITIONAL   2
154 #define DIDEVTYPEJOYSTICK_FLIGHTSTICK   3
155 #define DIDEVTYPEJOYSTICK_GAMEPAD       4
156 #define DIDEVTYPEJOYSTICK_RUDDER        5
157 #define DIDEVTYPEJOYSTICK_WHEEL         6
158 #define DIDEVTYPEJOYSTICK_HEADTRACKER   7
159
160 typedef struct {
161     DWORD       dwSize;
162     GUID        guidType;
163     DWORD       dwOfs;
164     DWORD       dwType;
165     DWORD       dwFlags;
166     CHAR        tszName[MAX_PATH];
167 #if(DIRECTINPUT_VERSION >= 0x0500)
168     DWORD       dwFFMaxForce;
169     DWORD       dwFFForceResolution;
170     WORD        wCollectionNumber;
171     WORD        wDesignatorIndex;
172     WORD        wUsagePage;
173     WORD        wUsage;
174     DWORD       dwDimension;
175     WORD        wExponent;
176     WORD        wReserved;
177 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
178 } DIDEVICEOBJECTINSTANCE32A, *LPDIDEVICEOBJECTINSTANCE32A,*LPCDIDEVICEOBJECTINSTANCE32A;
179
180 typedef struct {
181     DWORD       dwSize;
182     GUID        guidType;
183     DWORD       dwOfs;
184     DWORD       dwType;
185     DWORD       dwFlags;
186     WCHAR       tszName[MAX_PATH];
187 #if(DIRECTINPUT_VERSION >= 0x0500)
188     DWORD       dwFFMaxForce;
189     DWORD       dwFFForceResolution;
190     WORD        wCollectionNumber;
191     WORD        wDesignatorIndex;
192     WORD        wUsagePage;
193     WORD        wUsage;
194     DWORD       dwDimension;
195     WORD        wExponent;
196     WORD        wReserved;
197 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
198 } DIDEVICEOBJECTINSTANCE32W, *LPDIDEVICEOBJECTINSTANCE32W,*LPCDIDEVICEOBJECTINSTANCE32W;
199 DECL_WINELIB_TYPE_AW(LPDIDEVICEOBJECTINSTANCE)
200 DECL_WINELIB_TYPE_AW(DIDEVICEOBJECTINSTANCE)
201
202
203 typedef struct {
204     DWORD       dwSize;
205     GUID        guidInstance;
206     GUID        guidProduct;
207     DWORD       dwDevType;
208     CHAR        tszInstanceName[MAX_PATH];
209     CHAR        tszProductName[MAX_PATH];
210 #if(DIRECTINPUT_VERSION >= 0x0500)
211     GUID        guidFFDriver;
212     WORD        wUsagePage;
213     WORD        wUsage;
214 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
215 } DIDEVICEINSTANCE32A, *LPDIDEVICEINSTANCE32A, *LPCDIDEVICEINSTANCE32A;
216
217 typedef struct {
218     DWORD       dwSize;
219     GUID        guidInstance;
220     GUID        guidProduct;
221     DWORD       dwDevType;
222     WCHAR       tszInstanceName[MAX_PATH];
223     WCHAR       tszProductName[MAX_PATH];
224 #if(DIRECTINPUT_VERSION >= 0x0500)
225     GUID        guidFFDriver;
226     WORD        wUsagePage;
227     WORD        wUsage;
228 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
229 } DIDEVICEINSTANCE32W, *LPDIDEVICEINSTANCE32W, *LPCDIDEVICEINSTANCE32W;
230 DECL_WINELIB_TYPE_AW(DIDEVICEINSTANCE)
231 DECL_WINELIB_TYPE_AW(LPDIDEVICEINSTANCE)
232 DECL_WINELIB_TYPE_AW(LPCDIDEVICEINSTANCE)
233
234 typedef BOOL32 (CALLBACK * LPDIENUMDEVICESCALLBACK32A)(LPCDIDEVICEINSTANCE32A,LPVOID);
235 typedef BOOL32 (CALLBACK * LPDIENUMDEVICESCALLBACK32W)(LPCDIDEVICEINSTANCE32W,LPVOID);
236 DECL_WINELIB_TYPE_AW(LPDIENUMDEVICESCALLBACK)
237
238 typedef BOOL32 (CALLBACK * LPDIENUMDEVICEOBJECTSCALLBACK32A)(LPCDIDEVICEOBJECTINSTANCE32A, LPVOID);
239 typedef BOOL32 (CALLBACK * LPDIENUMDEVICEOBJECTSCALLBACK32W)(LPCDIDEVICEOBJECTINSTANCE32W,LPVOID);
240 DECL_WINELIB_TYPE_AW(LPDIENUMDEVICEOBJECTSCALLBACK)
241
242 typedef BOOL32 (CALLBACK * LPDIENUMCREATEDEFFECTOBJECTSCALLBACK)(LPDIRECTINPUTEFFECT, LPVOID);
243
244 #define DIK_ESCAPE          0x01
245 #define DIK_1               0x02
246 #define DIK_2               0x03
247 #define DIK_3               0x04
248 #define DIK_4               0x05
249 #define DIK_5               0x06
250 #define DIK_6               0x07
251 #define DIK_7               0x08
252 #define DIK_8               0x09
253 #define DIK_9               0x0A
254 #define DIK_0               0x0B
255 #define DIK_MINUS           0x0C    /* - on main keyboard */
256 #define DIK_EQUALS          0x0D
257 #define DIK_BACK            0x0E    /* backspace */
258 #define DIK_TAB             0x0F
259 #define DIK_Q               0x10
260 #define DIK_W               0x11
261 #define DIK_E               0x12
262 #define DIK_R               0x13
263 #define DIK_T               0x14
264 #define DIK_Y               0x15
265 #define DIK_U               0x16
266 #define DIK_I               0x17
267 #define DIK_O               0x18
268 #define DIK_P               0x19
269 #define DIK_LBRACKET        0x1A
270 #define DIK_RBRACKET        0x1B
271 #define DIK_RETURN          0x1C    /* Enter on main keyboard */
272 #define DIK_LCONTROL        0x1D
273 #define DIK_A               0x1E
274 #define DIK_S               0x1F
275 #define DIK_D               0x20
276 #define DIK_F               0x21
277 #define DIK_G               0x22
278 #define DIK_H               0x23
279 #define DIK_J               0x24
280 #define DIK_K               0x25
281 #define DIK_L               0x26
282 #define DIK_SEMICOLON       0x27
283 #define DIK_APOSTROPHE      0x28
284 #define DIK_GRAVE           0x29    /* accent grave */
285 #define DIK_LSHIFT          0x2A
286 #define DIK_BACKSLASH       0x2B
287 #define DIK_Z               0x2C
288 #define DIK_X               0x2D
289 #define DIK_C               0x2E
290 #define DIK_V               0x2F
291 #define DIK_B               0x30
292 #define DIK_N               0x31
293 #define DIK_M               0x32
294 #define DIK_COMMA           0x33
295 #define DIK_PERIOD          0x34    /* . on main keyboard */
296 #define DIK_SLASH           0x35    /* / on main keyboard */
297 #define DIK_RSHIFT          0x36
298 #define DIK_MULTIPLY        0x37    /* * on numeric keypad */
299 #define DIK_LMENU           0x38    /* left Alt */
300 #define DIK_SPACE           0x39
301 #define DIK_CAPITAL         0x3A
302 #define DIK_F1              0x3B
303 #define DIK_F2              0x3C
304 #define DIK_F3              0x3D
305 #define DIK_F4              0x3E
306 #define DIK_F5              0x3F
307 #define DIK_F6              0x40
308 #define DIK_F7              0x41
309 #define DIK_F8              0x42
310 #define DIK_F9              0x43
311 #define DIK_F10             0x44
312 #define DIK_NUMLOCK         0x45
313 #define DIK_SCROLL          0x46    /* Scroll Lock */
314 #define DIK_NUMPAD7         0x47
315 #define DIK_NUMPAD8         0x48
316 #define DIK_NUMPAD9         0x49
317 #define DIK_SUBTRACT        0x4A    /* - on numeric keypad */
318 #define DIK_NUMPAD4         0x4B
319 #define DIK_NUMPAD5         0x4C
320 #define DIK_NUMPAD6         0x4D
321 #define DIK_ADD             0x4E    /* + on numeric keypad */
322 #define DIK_NUMPAD1         0x4F
323 #define DIK_NUMPAD2         0x50
324 #define DIK_NUMPAD3         0x51
325 #define DIK_NUMPAD0         0x52
326 #define DIK_DECIMAL         0x53    /* . on numeric keypad */
327 #define DIK_F11             0x57
328 #define DIK_F12             0x58
329 #define DIK_F13             0x64    /*                     (NEC PC98) */
330 #define DIK_F14             0x65    /*                     (NEC PC98) */
331 #define DIK_F15             0x66    /*                     (NEC PC98) */
332 #define DIK_KANA            0x70    /* (Japanese keyboard)            */
333 #define DIK_CONVERT         0x79    /* (Japanese keyboard)            */
334 #define DIK_NOCONVERT       0x7B    /* (Japanese keyboard)            */
335 #define DIK_YEN             0x7D    /* (Japanese keyboard)            */
336 #define DIK_NUMPADEQUALS    0x8D    /* = on numeric keypad (NEC PC98) */
337 #define DIK_CIRCUMFLEX      0x90    /* (Japanese keyboard)            */
338 #define DIK_AT              0x91    /*                     (NEC PC98) */
339 #define DIK_COLON           0x92    /*                     (NEC PC98) */
340 #define DIK_UNDERLINE       0x93    /*                     (NEC PC98) */
341 #define DIK_KANJI           0x94    /* (Japanese keyboard)            */
342 #define DIK_STOP            0x95    /*                     (NEC PC98) */
343 #define DIK_AX              0x96    /*                     (Japan AX) */
344 #define DIK_UNLABELED       0x97    /*                        (J3100) */
345 #define DIK_NUMPADENTER     0x9C    /* Enter on numeric keypad */
346 #define DIK_RCONTROL        0x9D
347 #define DIK_NUMPADCOMMA     0xB3    /* , on numeric keypad (NEC PC98) */
348 #define DIK_DIVIDE          0xB5    /* / on numeric keypad */
349 #define DIK_SYSRQ           0xB7
350 #define DIK_RMENU           0xB8    /* right Alt */
351 #define DIK_PAUSE           0xC5    /* Pause */
352 #define DIK_HOME            0xC7    /* Home on arrow keypad */
353 #define DIK_UP              0xC8    /* UpArrow on arrow keypad */
354 #define DIK_PRIOR           0xC9    /* PgUp on arrow keypad */
355 #define DIK_LEFT            0xCB    /* LeftArrow on arrow keypad */
356 #define DIK_RIGHT           0xCD    /* RightArrow on arrow keypad */
357 #define DIK_END             0xCF    /* End on arrow keypad */
358 #define DIK_DOWN            0xD0    /* DownArrow on arrow keypad */
359 #define DIK_NEXT            0xD1    /* PgDn on arrow keypad */
360 #define DIK_INSERT          0xD2    /* Insert on arrow keypad */
361 #define DIK_DELETE          0xD3    /* Delete on arrow keypad */
362 #define DIK_LWIN            0xDB    /* Left Windows key */
363 #define DIK_RWIN            0xDC    /* Right Windows key */
364 #define DIK_APPS            0xDD    /* AppMenu key */
365 #define DIK_POWER           0xDE
366 #define DIK_SLEEP           0xDF
367 #define DIK_BACKSPACE       DIK_BACK            /* backspace */
368 #define DIK_NUMPADSTAR      DIK_MULTIPLY        /* * on numeric keypad */
369 #define DIK_LALT            DIK_LMENU           /* left Alt */
370 #define DIK_CAPSLOCK        DIK_CAPITAL         /* CapsLock */
371 #define DIK_NUMPADMINUS     DIK_SUBTRACT        /* - on numeric keypad */
372 #define DIK_NUMPADPLUS      DIK_ADD             /* + on numeric keypad */
373 #define DIK_NUMPADPERIOD    DIK_DECIMAL         /* . on numeric keypad */
374 #define DIK_NUMPADSLASH     DIK_DIVIDE          /* / on numeric keypad */
375 #define DIK_RALT            DIK_RMENU           /* right Alt */
376 #define DIK_UPARROW         DIK_UP              /* UpArrow on arrow keypad */
377 #define DIK_PGUP            DIK_PRIOR           /* PgUp on arrow keypad */
378 #define DIK_LEFTARROW       DIK_LEFT            /* LeftArrow on arrow keypad */
379 #define DIK_RIGHTARROW      DIK_RIGHT           /* RightArrow on arrow keypad */
380 #define DIK_DOWNARROW       DIK_DOWN            /* DownArrow on arrow keypad */
381 #define DIK_PGDN            DIK_NEXT            /* PgDn on arrow keypad */
382
383 #define DIDFT_ALL               0x00000000
384 #define DIDFT_RELAXIS           0x00000001
385 #define DIDFT_ABSAXIS           0x00000002
386 #define DIDFT_AXIS              0x00000003
387 #define DIDFT_PSHBUTTON         0x00000004
388 #define DIDFT_TGLBUTTON         0x00000008
389 #define DIDFT_BUTTON            0x0000000C
390 #define DIDFT_POV               0x00000010
391 #define DIDFT_COLLECTION        0x00000040
392 #define DIDFT_NODATA            0x00000080
393 #define DIDFT_ANYINSTANCE       0x00FFFF00
394 #define DIDFT_INSTANCEMASK      DIDFT_ANYINSTANCE
395 #define DIDFT_MAKEINSTANCE(n)   ((WORD)(n) << 8)
396 #define DIDFT_GETTYPE(n)        LOBYTE(n)
397 #define DIDFT_GETINSTANCE(n)    LOWORD((n) >> 8)
398 #define DIDFT_FFACTUATOR        0x01000000
399 #define DIDFT_FFEFFECTTRIGGER   0x02000000
400 #define DIDFT_OUTPUT            0x10000000
401 #define DIDFT_ENUMCOLLECTION(n) ((WORD)(n) << 8)
402 #define DIDFT_NOCOLLECTION      0x00FFFF00
403 #define DIDF_ABSAXIS            0x00000001
404 #define DIDF_RELAXIS            0x00000002
405
406 #define DIGDD_PEEK              0x00000001
407
408 typedef struct {
409     DWORD       dwOfs;
410     DWORD       dwData;
411     DWORD       dwTimeStamp;
412     DWORD       dwSequence;
413 } DIDEVICEOBJECTDATA,*LPDIDEVICEOBJECTDATA,*LPCDIDEVICEOBJECTDATA;
414
415 typedef struct _DIOBJECTDATAFORMAT {
416     const GUID *pguid;
417     DWORD       dwOfs;
418     DWORD       dwType;
419     DWORD       dwFlags;
420 } DIOBJECTDATAFORMAT, *LPDIOBJECTDATAFORMAT;
421
422 typedef struct {
423     DWORD                       dwSize;
424     DWORD                       dwObjSize;
425     DWORD                       dwFlags;
426     DWORD                       dwDataSize;
427     DWORD                       dwNumObjs;
428     LPDIOBJECTDATAFORMAT        rgodf;
429 } DIDATAFORMAT, *LPDIDATAFORMAT,*LPCDIDATAFORMAT;
430
431 typedef struct {
432     DWORD       dwSize;
433     DWORD       dwHeaderSize;
434     DWORD       dwObj;
435     DWORD       dwHow;
436 } DIPROPHEADER,*LPDIPROPHEADER,*LPCDIPROPHEADER;
437
438 #define DIPH_DEVICE     0
439 #define DIPH_BYOFFSET   1
440 #define DIPH_BYID       2
441 #define DIPH_BYUSAGE    3
442
443 #define DIMAKEUSAGEDWORD(UsagePage, Usage) (DWORD)MAKELONG(Usage, UsagePage)
444
445 typedef struct DIPROPDWORD {
446         DIPROPHEADER    diph;
447         DWORD           dwData;
448 } DIPROPDWORD, *LPDIPROPDWORD;
449 typedef const DIPROPDWORD *LPCDIPROPDWORD;
450
451 typedef struct DIPROPRANGE {
452         DIPROPHEADER    diph;
453         LONG            lMin;
454         LONG            lMax;
455 } DIPROPRANGE, *LPDIPROPRANGE;
456 typedef const DIPROPRANGE *LPCDIPROPRANGE;
457
458 #define DIPROPRANGE_NOMIN       ((LONG)0x80000000)
459 #define DIPROPRANGE_NOMAX       ((LONG)0x7FFFFFFF)
460
461 typedef struct DIPROPCAL {
462         DIPROPHEADER diph;
463         LONG    lMin;
464         LONG    lCenter;
465         LONG    lMax;
466 } DIPROPCAL, *LPDIPROPCAL;
467 typedef const DIPROPCAL *LPCDIPROPCAL;
468
469 typedef struct DIPROPGUIDANDPATH {
470         DIPROPHEADER diph;
471         GUID    guidClass;
472         WCHAR   wszPath[MAX_PATH];
473 } DIPROPGUIDANDPATH, *LPDIPROPGUIDANDPATH,*LPCDIPROPGUIDANDPATH;
474
475 /* special property GUIDs */
476 #define MAKEDIPROP(prop)        ((REFGUID)(prop))
477 #define DIPROP_BUFFERSIZE       MAKEDIPROP(1)
478 #define DIPROP_AXISMODE         MAKEDIPROP(2)
479
480 #define DIPROPAXISMODE_ABS      0
481 #define DIPROPAXISMODE_REL      1
482
483 #define DIPROP_GRANULARITY      MAKEDIPROP(3)
484 #define DIPROP_RANGE            MAKEDIPROP(4)
485 #define DIPROP_DEADZONE         MAKEDIPROP(5)
486 #define DIPROP_SATURATION       MAKEDIPROP(6)
487 #define DIPROP_FFGAIN           MAKEDIPROP(7)
488 #define DIPROP_FFLOAD           MAKEDIPROP(8)
489 #define DIPROP_AUTOCENTER       MAKEDIPROP(9)
490
491 #define DIPROPAUTOCENTER_OFF    0
492 #define DIPROPAUTOCENTER_ON     1
493
494 #define DIPROP_CALIBRATIONMODE  MAKEDIPROP(10)
495
496 #define DIPROPCALIBRATIONMODE_COOKED    0
497 #define DIPROPCALIBRATIONMODE_RAW       1
498
499 #define DIPROP_CALIBRATION      MAKEDIPROP(11)
500 #define DIPROP_GUIDANDPATH      MAKEDIPROP(12)
501
502
503 typedef struct DIDEVCAPS {
504     DWORD       dwSize;
505     DWORD       dwFlags;
506     DWORD       dwDevType;
507     DWORD       dwAxes;
508     DWORD       dwButtons;
509     DWORD       dwPOVs;
510 #if(DIRECTINPUT_VERSION >= 0x0500)
511     DWORD       dwFFSamplePeriod;
512     DWORD       dwFFMinTimeResolution;
513     DWORD       dwFirmwareRevision;
514     DWORD       dwHardwareRevision;
515     DWORD       dwFFDriverVersion;
516 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
517 } DIDEVCAPS,*LPDIDEVCAPS;
518
519 #define DIDC_ATTACHED           0x00000001
520 #define DIDC_POLLEDDEVICE       0x00000002
521 #define DIDC_EMULATED           0x00000004
522 #define DIDC_POLLEDDATAFORMAT   0x00000008
523 #define DIDC_FORCEFEEDBACK      0x00000100
524 #define DIDC_FFATTACK           0x00000200
525 #define DIDC_FFFADE             0x00000400
526 #define DIDC_SATURATION         0x00000800
527 #define DIDC_POSNEGCOEFFICIENTS 0x00001000
528 #define DIDC_POSNEGSATURATION   0x00002000
529 #define DIDC_DEADBAND           0x00004000
530
531 /* SetCooperativeLevel dwFlags */
532 #define DISCL_EXCLUSIVE         0x00000001
533 #define DISCL_NONEXCLUSIVE      0x00000002
534 #define DISCL_FOREGROUND        0x00000004
535 #define DISCL_BACKGROUND        0x00000008
536
537 typedef struct DICONSTANTFORCE {
538         LONG                    lMagnitude;
539 } DICONSTANTFORCE, *LPDICONSTANTFORCE;
540
541 typedef const DICONSTANTFORCE *LPCDICONSTANTFORCE;
542
543 typedef struct DIRAMPFORCE {
544         LONG                    lStart;
545         LONG                    lEnd;
546 } DIRAMPFORCE, *LPDIRAMPFORCE;
547
548 typedef const DIRAMPFORCE *LPCDIRAMPFORCE;
549
550 typedef struct DIPERIODIC {
551         DWORD                   dwMagnitude;
552         LONG                    lOffset;
553         DWORD                   dwPhase;
554         DWORD                   dwPeriod;
555 } DIPERIODIC, *LPDIPERIODIC;
556
557 typedef const DIPERIODIC *LPCDIPERIODIC;
558
559 typedef struct DICONDITION {
560         LONG                    lOffset;
561         LONG                    lPositiveCoefficient;
562         LONG                    lNegativeCoefficient;
563         DWORD                   dwPositiveSaturation;
564         DWORD                   dwNegativeSaturation;
565         LONG                    lDeadBand;
566 } DICONDITION, *LPDICONDITION;
567
568 typedef const DICONDITION *LPCDICONDITION;
569
570 typedef struct DICUSTOMFORCE {
571         DWORD                   cChannels;
572         DWORD                   dwSamplePeriod;
573         DWORD                   cSamples;
574         LPLONG                  rglForceData;
575 } DICUSTOMFORCE, *LPDICUSTOMFORCE;
576
577 typedef const DICUSTOMFORCE *LPCDICUSTOMFORCE;
578
579 typedef struct DIENVELOPE {
580         DWORD                   dwSize;
581         DWORD                   dwAttackLevel;
582         DWORD                   dwAttackTime;
583         DWORD                   dwFadeLevel;
584         DWORD                   dwFadeTime;
585 } DIENVELOPE, *LPDIENVELOPE;
586
587 typedef const DIENVELOPE *LPCDIENVELOPE;
588
589 typedef struct DIEFFECT {
590         DWORD                   dwSize;
591         DWORD                   dwFlags;
592         DWORD                   dwDuration;
593         DWORD                   dwSamplePeriod;
594         DWORD                   dwGain;
595         DWORD                   dwTriggerButton;
596         DWORD                   dwTriggerRepeatInterval;
597         DWORD                   cAxes;
598         LPDWORD                 rgdwAxes;
599         LPLONG                  rglDirection;
600         LPDIENVELOPE            lpEnvelope;
601         DWORD                   cbTypeSpecificParams;
602         LPVOID                  lpvTypeSpecificParams;
603 } DIEFFECT, *LPDIEFFECT;
604
605 typedef const DIEFFECT *LPCDIEFFECT;
606
607 typedef struct DIEFFECTINFOA {
608         DWORD                   dwSize;
609         GUID                    guid;
610         DWORD                   dwEffType;
611         DWORD                   dwStaticParams;
612         DWORD                   dwDynamicParams;
613         CHAR                    tszName[MAX_PATH];
614 } DIEFFECTINFOA, *LPDIEFFECTINFOA;
615
616 typedef struct DIEFFECTINFOW {
617         DWORD                   dwSize;
618         GUID                    guid;
619         DWORD                   dwEffType;
620         DWORD                   dwStaticParams;
621         DWORD                   dwDynamicParams;
622         WCHAR                   tszName[MAX_PATH];
623 } DIEFFECTINFOW, *LPDIEFFECTINFOW;
624
625 #ifdef UNICODE
626 typedef DIEFFECTINFOW DIEFFECTINFO;
627 typedef LPDIEFFECTINFOW LPDIEFFECTINFO;
628 #else
629 typedef DIEFFECTINFOA DIEFFECTINFO;
630 typedef LPDIEFFECTINFOA LPDIEFFECTINFO;
631 #endif
632
633 typedef const DIEFFECTINFOA *LPCDIEFFECTINFOA;
634 typedef const DIEFFECTINFOW *LPCDIEFFECTINFOW;
635 typedef const DIEFFECTINFO  *LPCDIEFFECTINFO;
636
637 typedef BOOL32 (CALLBACK * LPDIENUMEFFECTSCALLBACKA)(LPCDIEFFECTINFOA, LPVOID);
638 typedef BOOL32 (CALLBACK * LPDIENUMEFFECTSCALLBACKW)(LPCDIEFFECTINFOW, LPVOID);
639
640 typedef struct DIEFFESCAPE {
641         DWORD                   dwSize;
642         DWORD                   dwCommand;
643         LPVOID                  lpvInBuffer;
644         DWORD                   cbInBuffer;
645         LPVOID                  lpvOutBuffer;
646         DWORD                   cbOutBuffer;
647 } DIEFFESCAPE, *LPDIEFFESCAPE;
648
649 #define THIS LPDIRECTINPUTEFFECT this
650 typedef struct IDirectInputEffect_VTable {
651     /*** IUnknown methods ***/
652     STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
653     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
654     STDMETHOD_(ULONG,Release)(THIS) PURE;
655     /*** IDirectInputEffect methods ***/
656     STDMETHOD(Initialize)(THIS_ HINSTANCE32,DWORD,REFGUID) PURE;
657     STDMETHOD(GetEffectGuid)(THIS_ LPGUID) PURE;
658     STDMETHOD(GetParameters)(THIS_ LPDIEFFECT,DWORD) PURE;
659     STDMETHOD(SetParameters)(THIS_ LPCDIEFFECT,DWORD) PURE;
660     STDMETHOD(Start)(THIS_ DWORD,DWORD) PURE;
661     STDMETHOD(Stop)(THIS) PURE;
662     STDMETHOD(GetEffectStatus)(THIS_ LPDWORD) PURE;
663     STDMETHOD(Download)(THIS) PURE;
664     STDMETHOD(Unload)(THIS) PURE;
665     STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE;
666 } IDirectInputEffect_VTable,*LPDIRECTINPUTEFFECT_VTABLE;
667 #undef THIS
668
669 struct IDirectInputEffect {
670         LPDIRECTINPUTEFFECT_VTABLE      lpvtbl;
671         DWORD                           ref;
672         GUID                            guid;
673 };
674
675 #define THIS LPDIRECTINPUTDEVICE32A this
676 typedef struct IDirectInputDeviceA_VTable {
677     /*** IUnknown methods ***/
678     STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
679     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
680     STDMETHOD_(ULONG,Release)(THIS) PURE;
681
682     /*** IDirectInputDeviceA methods ***/
683     STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE;
684     STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACK32A,LPVOID,DWORD) PURE;
685     STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE;
686     STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE;
687     STDMETHOD(Acquire)(THIS) PURE;
688     STDMETHOD(Unacquire)(THIS) PURE;
689     STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE;
690     STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE;
691     STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE;
692     STDMETHOD(SetEventNotification)(THIS_ HANDLE32) PURE;
693     STDMETHOD(SetCooperativeLevel)(THIS_ HWND32,DWORD) PURE;
694     STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCE32A,DWORD,DWORD) PURE;
695     STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCE32A) PURE;
696     STDMETHOD(RunControlPanel)(THIS_ HWND32,DWORD) PURE;
697     STDMETHOD(Initialize)(THIS_ HINSTANCE32,DWORD,REFGUID) PURE;
698     /*** IDirectInputDevice2A methods ***/
699     STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE;
700     STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA,LPVOID,DWORD) PURE;
701     STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA,REFGUID) PURE;
702     STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE;
703     STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE;
704     STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE;
705     STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE;
706     STDMETHOD(Poll)(THIS) PURE;
707     STDMETHOD(SendDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE;
708
709 } IDirectInputDeviceA_VTable,*LPDIRECTINPUTDEVICEA_VTABLE,
710   IDirectInputDevice2A_VTable,*LPDIRECTINPUTDEVICE2A_VTABLE;
711
712 struct IDirectInputDevice32A {
713         LPDIRECTINPUTDEVICEA_VTABLE     lpvtbl;
714         DWORD                           ref;
715         GUID                            guid;
716 };
717
718 /* "Standard" Mouse report... */
719 struct DIMOUSESTATE {
720   LONG lX;
721   LONG lY;
722   LONG lZ;
723   BYTE rgbButtons[4];
724 };
725 struct SysMouse32A {
726         LPDIRECTINPUTDEVICEA_VTABLE     lpvtbl;
727         DWORD                           ref;
728         GUID                            guid;
729         BYTE                            absolute;
730         /* Previous position for relative moves */
731         LONG prevX;
732         LONG prevY;
733 };
734
735 struct SysKeyboard32A {
736         LPDIRECTINPUTDEVICEA_VTABLE     lpvtbl;
737         DWORD                           ref;
738         GUID                            guid;
739         BYTE                            keystate[256];
740 };
741 #undef THIS
742
743 #define THIS LPDIRECTINPUT32A this
744 typedef struct IDirectInputA_VTable {
745         /*** IUnknown methods ***/
746         STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
747         STDMETHOD_(ULONG,AddRef)(THIS) PURE;
748         STDMETHOD_(ULONG,Release)(THIS) PURE;
749
750         /*** IDirectInputA methods ***/
751         STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICE32A*,LPUNKNOWN) PURE;
752         STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACK32A,LPVOID,DWORD) PURE;
753         STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE;
754         STDMETHOD(RunControlPanel)(THIS_ HWND32,DWORD) PURE;
755         STDMETHOD(Initialize)(THIS_ HINSTANCE32,DWORD) PURE;
756 } IDirectInputA_VTable,*LPDIRECTINPUTA_VTABLE;
757
758 struct IDirectInput32A {
759         LPDIRECTINPUTA_VTABLE   lpvtbl;
760         DWORD                   ref;
761 };
762 #undef THIS
763 #undef THIS_
764 #undef STDMETHOD(xfn) HRESULT (CALLBACK *fn##xfn)
765 #undef STDMETHOD_(ret,xfn) ret (CALLBACK *fn##xfn)
766 #undef PURE
767 #undef FAR
768 #endif