add win64 D3D9 headers
[xonotic/xonotic.git] / misc / builddeps / dp.win64 / include / dinput.h
1 /****************************************************************************
2  *
3  *  Copyright (C) 1996-1997 Microsoft Corporation.  All Rights Reserved.
4  *
5  *  File:       dinput.h
6  *  Content:    DirectInput include file
7  *
8  ****************************************************************************/
9
10 #ifndef __DINPUT_INCLUDED__
11 #define __DINPUT_INCLUDED__
12
13 #ifndef DIJ_RINGZERO
14
15 #ifdef _WIN32
16 #define COM_NO_WINDOWS_H
17 #include <objbase.h>
18 #endif
19
20 #endif /* DIJ_RINGZERO */
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 #ifndef DIRECTINPUT_VERSION
27 #define DIRECTINPUT_VERSION         0x0500
28 #endif
29
30 #ifndef DIJ_RINGZERO
31 /****************************************************************************
32  *
33  *      Class IDs
34  *
35  ****************************************************************************/
36
37 DEFINE_GUID(CLSID_DirectInput,      0x25E609E0,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
38 DEFINE_GUID(CLSID_DirectInputDevice,0x25E609E1,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
39
40 /****************************************************************************
41  *
42  *      Interfaces
43  *
44  ****************************************************************************/
45
46 DEFINE_GUID(IID_IDirectInputA,     0x89521360,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
47 DEFINE_GUID(IID_IDirectInputW,     0x89521361,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
48 DEFINE_GUID(IID_IDirectInput2A,    0x5944E662,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
49 DEFINE_GUID(IID_IDirectInput2W,    0x5944E663,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
50
51 DEFINE_GUID(IID_IDirectInputDeviceA, 0x5944E680,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
52 DEFINE_GUID(IID_IDirectInputDeviceW, 0x5944E681,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
53 DEFINE_GUID(IID_IDirectInputDevice2A,0x5944E682,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
54 DEFINE_GUID(IID_IDirectInputDevice2W,0x5944E683,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
55
56 DEFINE_GUID(IID_IDirectInputEffect,  0xE7E1F7C0,0x88D2,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
57
58 /****************************************************************************
59  *
60  *      Predefined object types
61  *
62  ****************************************************************************/
63
64 DEFINE_GUID(GUID_XAxis,   0xA36D02E0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
65 DEFINE_GUID(GUID_YAxis,   0xA36D02E1,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
66 DEFINE_GUID(GUID_ZAxis,   0xA36D02E2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
67 DEFINE_GUID(GUID_RxAxis,  0xA36D02F4,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
68 DEFINE_GUID(GUID_RyAxis,  0xA36D02F5,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
69 DEFINE_GUID(GUID_RzAxis,  0xA36D02E3,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
70 DEFINE_GUID(GUID_Slider,  0xA36D02E4,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
71
72 DEFINE_GUID(GUID_Button,  0xA36D02F0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
73 DEFINE_GUID(GUID_Key,     0x55728220,0xD33C,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
74
75 DEFINE_GUID(GUID_POV,     0xA36D02F2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
76
77 DEFINE_GUID(GUID_Unknown, 0xA36D02F3,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
78
79 /****************************************************************************
80  *
81  *      Predefined product GUIDs
82  *
83  ****************************************************************************/
84
85 DEFINE_GUID(GUID_SysMouse,   0x6F1D2B60,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
86 DEFINE_GUID(GUID_SysKeyboard,0x6F1D2B61,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
87 DEFINE_GUID(GUID_Joystick   ,0x6F1D2B70,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00);
88
89 /****************************************************************************
90  *
91  *      Predefined force feedback effects
92  *
93  ****************************************************************************/
94
95 DEFINE_GUID(GUID_ConstantForce,0x13541C20,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
96 DEFINE_GUID(GUID_RampForce,    0x13541C21,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
97 DEFINE_GUID(GUID_Square,       0x13541C22,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
98 DEFINE_GUID(GUID_Sine,         0x13541C23,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
99 DEFINE_GUID(GUID_Triangle,     0x13541C24,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
100 DEFINE_GUID(GUID_SawtoothUp,   0x13541C25,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
101 DEFINE_GUID(GUID_SawtoothDown, 0x13541C26,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
102 DEFINE_GUID(GUID_Spring,       0x13541C27,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
103 DEFINE_GUID(GUID_Damper,       0x13541C28,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
104 DEFINE_GUID(GUID_Inertia,      0x13541C29,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
105 DEFINE_GUID(GUID_Friction,     0x13541C2A,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
106 DEFINE_GUID(GUID_CustomForce,  0x13541C2B,0x8E33,0x11D0,0x9A,0xD0,0x00,0xA0,0xC9,0xA0,0x6E,0x35);
107
108
109 #endif /* DIJ_RINGZERO */
110
111 /****************************************************************************
112  *
113  *      Interfaces and Structures...
114  *
115  ****************************************************************************/
116
117 #if(DIRECTINPUT_VERSION >= 0x0500)
118
119 /****************************************************************************
120  *
121  *      IDirectInputEffect
122  *
123  ****************************************************************************/
124
125 #define DIEFT_ALL                   0x00000000
126
127 #define DIEFT_CONSTANTFORCE         0x00000001
128 #define DIEFT_RAMPFORCE             0x00000002
129 #define DIEFT_PERIODIC              0x00000003
130 #define DIEFT_CONDITION             0x00000004
131 #define DIEFT_CUSTOMFORCE           0x00000005
132 #define DIEFT_HARDWARE              0x000000FF
133
134 #define DIEFT_FFATTACK              0x00000200
135 #define DIEFT_FFFADE                0x00000400
136 #define DIEFT_SATURATION            0x00000800
137 #define DIEFT_POSNEGCOEFFICIENTS    0x00001000
138 #define DIEFT_POSNEGSATURATION      0x00002000
139 #define DIEFT_DEADBAND              0x00004000
140
141 #define DIEFT_GETTYPE(n)            LOBYTE(n)
142
143 #define DI_DEGREES                  100
144 #define DI_FFNOMINALMAX             10000
145 #define DI_SECONDS                  1000000
146
147 typedef struct DICONSTANTFORCE {
148     LONG  lMagnitude;
149 } DICONSTANTFORCE, *LPDICONSTANTFORCE;
150 typedef const DICONSTANTFORCE *LPCDICONSTANTFORCE;
151
152 typedef struct DIRAMPFORCE {
153     LONG  lStart;
154     LONG  lEnd;
155 } DIRAMPFORCE, *LPDIRAMPFORCE;
156 typedef const DIRAMPFORCE *LPCDIRAMPFORCE;
157
158 typedef struct DIPERIODIC {
159     DWORD dwMagnitude;
160     LONG  lOffset;
161     DWORD dwPhase;
162     DWORD dwPeriod;
163 } DIPERIODIC, *LPDIPERIODIC;
164 typedef const DIPERIODIC *LPCDIPERIODIC;
165
166 typedef struct DICONDITION {
167     LONG  lOffset;
168     LONG  lPositiveCoefficient;
169     LONG  lNegativeCoefficient;
170     DWORD dwPositiveSaturation;
171     DWORD dwNegativeSaturation;
172     LONG  lDeadBand;
173 } DICONDITION, *LPDICONDITION;
174 typedef const DICONDITION *LPCDICONDITION;
175
176 typedef struct DICUSTOMFORCE {
177     DWORD cChannels;
178     DWORD dwSamplePeriod;
179     DWORD cSamples;
180     LPLONG rglForceData;
181 } DICUSTOMFORCE, *LPDICUSTOMFORCE;
182 typedef const DICUSTOMFORCE *LPCDICUSTOMFORCE;
183
184 typedef struct DIENVELOPE {
185     DWORD dwSize;                   /* sizeof(DIENVELOPE)   */
186     DWORD dwAttackLevel;
187     DWORD dwAttackTime;             /* Microseconds         */
188     DWORD dwFadeLevel;
189     DWORD dwFadeTime;               /* Microseconds         */
190 } DIENVELOPE, *LPDIENVELOPE;
191 typedef const DIENVELOPE *LPCDIENVELOPE;
192
193 typedef struct DIEFFECT {
194     DWORD dwSize;                   /* sizeof(DIEFFECT)     */
195     DWORD dwFlags;                  /* DIEFF_*              */
196     DWORD dwDuration;               /* Microseconds         */
197     DWORD dwSamplePeriod;           /* Microseconds         */
198     DWORD dwGain;
199     DWORD dwTriggerButton;          /* or DIEB_NOTRIGGER    */
200     DWORD dwTriggerRepeatInterval;  /* Microseconds         */
201     DWORD cAxes;                    /* Number of axes       */
202     LPDWORD rgdwAxes;               /* Array of axes        */
203     LPLONG rglDirection;            /* Array of directions  */
204     LPDIENVELOPE lpEnvelope;        /* Optional             */
205     DWORD cbTypeSpecificParams;     /* Size of params       */
206     LPVOID lpvTypeSpecificParams;   /* Pointer to params    */
207 } DIEFFECT, *LPDIEFFECT;
208 typedef const DIEFFECT *LPCDIEFFECT;
209
210 #define DIEFF_OBJECTIDS             0x00000001
211 #define DIEFF_OBJECTOFFSETS         0x00000002
212 #define DIEFF_CARTESIAN             0x00000010
213 #define DIEFF_POLAR                 0x00000020
214 #define DIEFF_SPHERICAL             0x00000040
215
216 #define DIEP_DURATION               0x00000001
217 #define DIEP_SAMPLEPERIOD           0x00000002
218 #define DIEP_GAIN                   0x00000004
219 #define DIEP_TRIGGERBUTTON          0x00000008
220 #define DIEP_TRIGGERREPEATINTERVAL  0x00000010
221 #define DIEP_AXES                   0x00000020
222 #define DIEP_DIRECTION              0x00000040
223 #define DIEP_ENVELOPE               0x00000080
224 #define DIEP_TYPESPECIFICPARAMS     0x00000100
225 #define DIEP_ALLPARAMS              0x000001FF
226 #define DIEP_START                  0x20000000
227 #define DIEP_NORESTART              0x40000000
228 #define DIEP_NODOWNLOAD             0x80000000
229 #define DIEB_NOTRIGGER              0xFFFFFFFF
230
231 #define DIES_SOLO                   0x00000001
232 #define DIES_NODOWNLOAD             0x80000000
233
234 #define DIEGES_PLAYING              0x00000001
235 #define DIEGES_EMULATED             0x00000002
236
237 typedef struct DIEFFESCAPE {
238     DWORD   dwSize;
239     DWORD   dwCommand;
240     LPVOID  lpvInBuffer;
241     DWORD   cbInBuffer;
242     LPVOID  lpvOutBuffer;
243     DWORD   cbOutBuffer;
244 } DIEFFESCAPE, *LPDIEFFESCAPE;
245
246 #ifndef DIJ_RINGZERO
247
248 #undef INTERFACE
249 #define INTERFACE IDirectInputEffect
250
251 DECLARE_INTERFACE_(IDirectInputEffect, IUnknown)
252 {
253     /*** IUnknown methods ***/
254     STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
255     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
256     STDMETHOD_(ULONG,Release)(THIS) PURE;
257
258     /*** IDirectInputEffect methods ***/
259     STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE;
260     STDMETHOD(GetEffectGuid)(THIS_ LPGUID) PURE;
261     STDMETHOD(GetParameters)(THIS_ LPDIEFFECT,DWORD) PURE;
262     STDMETHOD(SetParameters)(THIS_ LPCDIEFFECT,DWORD) PURE;
263     STDMETHOD(Start)(THIS_ DWORD,DWORD) PURE;
264     STDMETHOD(Stop)(THIS) PURE;
265     STDMETHOD(GetEffectStatus)(THIS_ LPDWORD) PURE;
266     STDMETHOD(Download)(THIS) PURE;
267     STDMETHOD(Unload)(THIS) PURE;
268     STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE;
269 };
270
271 typedef struct IDirectInputEffect *LPDIRECTINPUTEFFECT;
272
273 #if !defined(__cplusplus) || defined(CINTERFACE)
274 #define IDirectInputEffect_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
275 #define IDirectInputEffect_AddRef(p) (p)->lpVtbl->AddRef(p)
276 #define IDirectInputEffect_Release(p) (p)->lpVtbl->Release(p)
277 #define IDirectInputEffect_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c)
278 #define IDirectInputEffect_GetEffectGuid(p,a) (p)->lpVtbl->GetEffectGuid(p,a)
279 #define IDirectInputEffect_GetParameters(p,a,b) (p)->lpVtbl->GetParameters(p,a,b)
280 #define IDirectInputEffect_SetParameters(p,a,b) (p)->lpVtbl->SetParameters(p,a,b)
281 #define IDirectInputEffect_Start(p,a,b) (p)->lpVtbl->Start(p,a,b)
282 #define IDirectInputEffect_Stop(p) (p)->lpVtbl->Stop(p)
283 #define IDirectInputEffect_GetEffectStatus(p,a) (p)->lpVtbl->GetEffectStatus(p,a)
284 #define IDirectInputEffect_Download(p) (p)->lpVtbl->Download(p)
285 #define IDirectInputEffect_Unload(p) (p)->lpVtbl->Unload(p)
286 #define IDirectInputEffect_Escape(p,a) (p)->lpVtbl->Escape(p,a)
287 #else
288 #define IDirectInputEffect_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
289 #define IDirectInputEffect_AddRef(p) (p)->AddRef()
290 #define IDirectInputEffect_Release(p) (p)->Release()
291 #define IDirectInputEffect_Initialize(p,a,b,c) (p)->Initialize(a,b,c)
292 #define IDirectInputEffect_GetEffectGuid(p,a) (p)->GetEffectGuid(a)
293 #define IDirectInputEffect_GetParameters(p,a,b) (p)->GetParameters(a,b)
294 #define IDirectInputEffect_SetParameters(p,a,b) (p)->SetParameters(a,b)
295 #define IDirectInputEffect_Start(p,a,b) (p)->Start(a,b)
296 #define IDirectInputEffect_Stop(p) (p)->Stop()
297 #define IDirectInputEffect_GetEffectStatus(p,a) (p)->GetEffectStatus(a)
298 #define IDirectInputEffect_Download(p) (p)->Download()
299 #define IDirectInputEffect_Unload(p) (p)->Unload()
300 #define IDirectInputEffect_Escape(p,a) (p)->Escape(a)
301 #endif
302
303 #endif /* DIJ_RINGZERO */
304
305 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
306
307 /****************************************************************************
308  *
309  *      IDirectInputDevice
310  *
311  ****************************************************************************/
312
313 #define DIDEVTYPE_DEVICE    1
314 #define DIDEVTYPE_MOUSE     2
315 #define DIDEVTYPE_KEYBOARD  3
316 #define DIDEVTYPE_JOYSTICK  4
317 #define DIDEVTYPE_HID       0x00010000
318
319 #define DIDEVTYPEMOUSE_UNKNOWN          1
320 #define DIDEVTYPEMOUSE_TRADITIONAL      2
321 #define DIDEVTYPEMOUSE_FINGERSTICK      3
322 #define DIDEVTYPEMOUSE_TOUCHPAD         4
323 #define DIDEVTYPEMOUSE_TRACKBALL        5
324
325 #define DIDEVTYPEKEYBOARD_UNKNOWN       0
326 #define DIDEVTYPEKEYBOARD_PCXT          1
327 #define DIDEVTYPEKEYBOARD_OLIVETTI      2
328 #define DIDEVTYPEKEYBOARD_PCAT          3
329 #define DIDEVTYPEKEYBOARD_PCENH         4
330 #define DIDEVTYPEKEYBOARD_NOKIA1050     5
331 #define DIDEVTYPEKEYBOARD_NOKIA9140     6
332 #define DIDEVTYPEKEYBOARD_NEC98         7
333 #define DIDEVTYPEKEYBOARD_NEC98LAPTOP   8
334 #define DIDEVTYPEKEYBOARD_NEC98106      9
335 #define DIDEVTYPEKEYBOARD_JAPAN106     10
336 #define DIDEVTYPEKEYBOARD_JAPANAX      11
337 #define DIDEVTYPEKEYBOARD_J3100        12
338
339 #define DIDEVTYPEJOYSTICK_UNKNOWN       1
340 #define DIDEVTYPEJOYSTICK_TRADITIONAL   2
341 #define DIDEVTYPEJOYSTICK_FLIGHTSTICK   3
342 #define DIDEVTYPEJOYSTICK_GAMEPAD       4
343 #define DIDEVTYPEJOYSTICK_RUDDER        5
344 #define DIDEVTYPEJOYSTICK_WHEEL         6
345 #define DIDEVTYPEJOYSTICK_HEADTRACKER   7
346
347 #define GET_DIDEVICE_TYPE(dwDevType)    LOBYTE(dwDevType)
348 #define GET_DIDEVICE_SUBTYPE(dwDevType) HIBYTE(dwDevType)
349
350 #if(DIRECTINPUT_VERSION >= 0x0500)
351 /* This structure is defined for DirectX 3.0 compatibility */
352
353 typedef struct DIDEVCAPS_DX3 {
354     DWORD   dwSize;
355     DWORD   dwFlags;
356     DWORD   dwDevType;
357     DWORD   dwAxes;
358     DWORD   dwButtons;
359     DWORD   dwPOVs;
360 } DIDEVCAPS_DX3, *LPDIDEVCAPS_DX3;
361 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
362
363 typedef struct DIDEVCAPS {
364     DWORD   dwSize;
365     DWORD   dwFlags;
366     DWORD   dwDevType;
367     DWORD   dwAxes;
368     DWORD   dwButtons;
369     DWORD   dwPOVs;
370 #if(DIRECTINPUT_VERSION >= 0x0500)
371     DWORD   dwFFSamplePeriod;
372     DWORD   dwFFMinTimeResolution;
373     DWORD   dwFirmwareRevision;
374     DWORD   dwHardwareRevision;
375     DWORD   dwFFDriverVersion;
376 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
377 } DIDEVCAPS, *LPDIDEVCAPS;
378
379 #define DIDC_ATTACHED           0x00000001
380 #define DIDC_POLLEDDEVICE       0x00000002
381 #define DIDC_EMULATED           0x00000004
382 #define DIDC_POLLEDDATAFORMAT   0x00000008
383 #if(DIRECTINPUT_VERSION >= 0x0500)
384 #define DIDC_FORCEFEEDBACK      0x00000100
385 #define DIDC_FFATTACK           0x00000200
386 #define DIDC_FFFADE             0x00000400
387 #define DIDC_SATURATION         0x00000800
388 #define DIDC_POSNEGCOEFFICIENTS 0x00001000
389 #define DIDC_POSNEGSATURATION   0x00002000
390 #define DIDC_DEADBAND           0x00004000
391 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
392
393 #define DIDFT_ALL           0x00000000
394
395 #define DIDFT_RELAXIS       0x00000001
396 #define DIDFT_ABSAXIS       0x00000002
397 #define DIDFT_AXIS          0x00000003
398
399 #define DIDFT_PSHBUTTON     0x00000004
400 #define DIDFT_TGLBUTTON     0x00000008
401 #define DIDFT_BUTTON        0x0000000C
402
403 #define DIDFT_POV           0x00000010
404
405 #define DIDFT_COLLECTION    0x00000040
406 #define DIDFT_NODATA        0x00000080
407
408 #define DIDFT_ANYINSTANCE   0x00FFFF00
409 #define DIDFT_INSTANCEMASK  DIDFT_ANYINSTANCE
410 #define DIDFT_MAKEINSTANCE(n) ((WORD)(n) << 8)
411 #define DIDFT_GETTYPE(n)     LOBYTE(n)
412 #define DIDFT_GETINSTANCE(n) LOWORD((n) >> 8)
413 #define DIDFT_FFACTUATOR        0x01000000
414 #define DIDFT_FFEFFECTTRIGGER   0x02000000
415
416 #define DIDFT_ENUMCOLLECTION(n) ((WORD)(n) << 8)
417 #define DIDFT_NOCOLLECTION      0x00FFFF00
418
419
420 #ifndef DIJ_RINGZERO
421
422 typedef struct _DIOBJECTDATAFORMAT {
423     const GUID *pguid;
424     DWORD   dwOfs;
425     DWORD   dwType;
426     DWORD   dwFlags;
427 } DIOBJECTDATAFORMAT, *LPDIOBJECTDATAFORMAT;
428 typedef const DIOBJECTDATAFORMAT *LPCDIOBJECTDATAFORMAT;
429
430 typedef struct _DIDATAFORMAT {
431     DWORD   dwSize;
432     DWORD   dwObjSize;
433     DWORD   dwFlags;
434     DWORD   dwDataSize;
435     DWORD   dwNumObjs;
436     LPDIOBJECTDATAFORMAT rgodf;
437 } DIDATAFORMAT, *LPDIDATAFORMAT;
438 typedef const DIDATAFORMAT *LPCDIDATAFORMAT;
439
440 #define DIDF_ABSAXIS            0x00000001
441 #define DIDF_RELAXIS            0x00000002
442
443 extern const DIDATAFORMAT c_dfDIMouse;
444 extern const DIDATAFORMAT c_dfDIKeyboard;
445 extern const DIDATAFORMAT c_dfDIJoystick;
446 extern const DIDATAFORMAT c_dfDIJoystick2;
447
448 #if(DIRECTINPUT_VERSION >= 0x0500)
449 /* These structures are defined for DirectX 3.0 compatibility */
450
451 typedef struct DIDEVICEOBJECTINSTANCE_DX3A {
452     DWORD   dwSize;
453     GUID    guidType;
454     DWORD   dwOfs;
455     DWORD   dwType;
456     DWORD   dwFlags;
457     CHAR    tszName[MAX_PATH];
458 } DIDEVICEOBJECTINSTANCE_DX3A, *LPDIDEVICEOBJECTINSTANCE_DX3A;
459 typedef struct DIDEVICEOBJECTINSTANCE_DX3W {
460     DWORD   dwSize;
461     GUID    guidType;
462     DWORD   dwOfs;
463     DWORD   dwType;
464     DWORD   dwFlags;
465     WCHAR   tszName[MAX_PATH];
466 } DIDEVICEOBJECTINSTANCE_DX3W, *LPDIDEVICEOBJECTINSTANCE_DX3W;
467 #ifdef UNICODE
468 typedef DIDEVICEOBJECTINSTANCE_DX3W DIDEVICEOBJECTINSTANCE_DX3;
469 typedef LPDIDEVICEOBJECTINSTANCE_DX3W LPDIDEVICEOBJECTINSTANCE_DX3;
470 #else
471 typedef DIDEVICEOBJECTINSTANCE_DX3A DIDEVICEOBJECTINSTANCE_DX3;
472 typedef LPDIDEVICEOBJECTINSTANCE_DX3A LPDIDEVICEOBJECTINSTANCE_DX3;
473 #endif // UNICODE
474 typedef const DIDEVICEOBJECTINSTANCE_DX3A *LPCDIDEVICEOBJECTINSTANCE_DX3A;
475 typedef const DIDEVICEOBJECTINSTANCE_DX3W *LPCDIDEVICEOBJECTINSTANCE_DX3W;
476 typedef const DIDEVICEOBJECTINSTANCE_DX3  *LPCDIDEVICEOBJECTINSTANCE_DX3;
477 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
478
479 typedef struct DIDEVICEOBJECTINSTANCEA {
480     DWORD   dwSize;
481     GUID    guidType;
482     DWORD   dwOfs;
483     DWORD   dwType;
484     DWORD   dwFlags;
485     CHAR    tszName[MAX_PATH];
486 #if(DIRECTINPUT_VERSION >= 0x0500)
487     DWORD   dwFFMaxForce;
488     DWORD   dwFFForceResolution;
489     WORD    wCollectionNumber;
490     WORD    wDesignatorIndex;
491     WORD    wUsagePage;
492     WORD    wUsage;
493     DWORD   dwDimension;
494     WORD    wExponent;
495     WORD    wReserved;
496 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
497 } DIDEVICEOBJECTINSTANCEA, *LPDIDEVICEOBJECTINSTANCEA;
498 typedef struct DIDEVICEOBJECTINSTANCEW {
499     DWORD   dwSize;
500     GUID    guidType;
501     DWORD   dwOfs;
502     DWORD   dwType;
503     DWORD   dwFlags;
504     WCHAR   tszName[MAX_PATH];
505 #if(DIRECTINPUT_VERSION >= 0x0500)
506     DWORD   dwFFMaxForce;
507     DWORD   dwFFForceResolution;
508     WORD    wCollectionNumber;
509     WORD    wDesignatorIndex;
510     WORD    wUsagePage;
511     WORD    wUsage;
512     DWORD   dwDimension;
513     WORD    wExponent;
514     WORD    wReserved;
515 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
516 } DIDEVICEOBJECTINSTANCEW, *LPDIDEVICEOBJECTINSTANCEW;
517 #ifdef UNICODE
518 typedef DIDEVICEOBJECTINSTANCEW DIDEVICEOBJECTINSTANCE;
519 typedef LPDIDEVICEOBJECTINSTANCEW LPDIDEVICEOBJECTINSTANCE;
520 #else
521 typedef DIDEVICEOBJECTINSTANCEA DIDEVICEOBJECTINSTANCE;
522 typedef LPDIDEVICEOBJECTINSTANCEA LPDIDEVICEOBJECTINSTANCE;
523 #endif // UNICODE
524 typedef const DIDEVICEOBJECTINSTANCEA *LPCDIDEVICEOBJECTINSTANCEA;
525 typedef const DIDEVICEOBJECTINSTANCEW *LPCDIDEVICEOBJECTINSTANCEW;
526 typedef const DIDEVICEOBJECTINSTANCE  *LPCDIDEVICEOBJECTINSTANCE;
527
528 typedef BOOL (FAR PASCAL * LPDIENUMDEVICEOBJECTSCALLBACKA)(LPCDIDEVICEOBJECTINSTANCEA, LPVOID);
529 typedef BOOL (FAR PASCAL * LPDIENUMDEVICEOBJECTSCALLBACKW)(LPCDIDEVICEOBJECTINSTANCEW, LPVOID);
530 #ifdef UNICODE
531 #define LPDIENUMDEVICEOBJECTSCALLBACK  LPDIENUMDEVICEOBJECTSCALLBACKW
532 #else
533 #define LPDIENUMDEVICEOBJECTSCALLBACK  LPDIENUMDEVICEOBJECTSCALLBACKA
534 #endif // !UNICODE
535
536 #if(DIRECTINPUT_VERSION >= 0x0500)
537 #define DIDOI_FFACTUATOR        0x00000001
538 #define DIDOI_FFEFFECTTRIGGER   0x00000002
539 #define DIDOI_POLLED            0x00008000
540 #define DIDOI_ASPECTPOSITION    0x00000100
541 #define DIDOI_ASPECTVELOCITY    0x00000200
542 #define DIDOI_ASPECTACCEL       0x00000300
543 #define DIDOI_ASPECTFORCE       0x00000400
544 #define DIDOI_ASPECTMASK        0x00000F00
545 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
546
547 typedef struct DIPROPHEADER {
548     DWORD   dwSize;
549     DWORD   dwHeaderSize;
550     DWORD   dwObj;
551     DWORD   dwHow;
552 } DIPROPHEADER, *LPDIPROPHEADER;
553 typedef const DIPROPHEADER *LPCDIPROPHEADER;
554
555 #define DIPH_DEVICE             0
556 #define DIPH_BYOFFSET           1
557 #define DIPH_BYID               2
558
559 typedef struct DIPROPDWORD {
560     DIPROPHEADER diph;
561     DWORD   dwData;
562 } DIPROPDWORD, *LPDIPROPDWORD;
563 typedef const DIPROPDWORD *LPCDIPROPDWORD;
564
565 typedef struct DIPROPRANGE {
566     DIPROPHEADER diph;
567     LONG    lMin;
568     LONG    lMax;
569 } DIPROPRANGE, *LPDIPROPRANGE;
570 typedef const DIPROPRANGE *LPCDIPROPRANGE;
571
572 #define DIPROPRANGE_NOMIN       ((LONG)0x80000000)
573 #define DIPROPRANGE_NOMAX       ((LONG)0x7FFFFFFF)
574
575 #ifdef __cplusplus
576 #define MAKEDIPROP(prop)    (*(const GUID *)(prop))
577 #else
578 #define MAKEDIPROP(prop)    ((REFGUID)(prop))
579 #endif
580
581 #define DIPROP_BUFFERSIZE       MAKEDIPROP(1)
582
583 #define DIPROP_AXISMODE         MAKEDIPROP(2)
584
585 #define DIPROPAXISMODE_ABS      0
586 #define DIPROPAXISMODE_REL      1
587
588 #define DIPROP_GRANULARITY      MAKEDIPROP(3)
589
590 #define DIPROP_RANGE            MAKEDIPROP(4)
591
592 #define DIPROP_DEADZONE         MAKEDIPROP(5)
593
594 #define DIPROP_SATURATION       MAKEDIPROP(6)
595
596 #define DIPROP_FFGAIN           MAKEDIPROP(7)
597
598 #define DIPROP_FFLOAD           MAKEDIPROP(8)
599
600 #define DIPROP_AUTOCENTER       MAKEDIPROP(9)
601
602 #define DIPROPAUTOCENTER_OFF    0
603 #define DIPROPAUTOCENTER_ON     1
604
605 #define DIPROP_CALIBRATIONMODE  MAKEDIPROP(10)
606
607 #define DIPROPCALIBRATIONMODE_COOKED    0
608 #define DIPROPCALIBRATIONMODE_RAW       1
609
610 typedef struct DIDEVICEOBJECTDATA {
611     DWORD   dwOfs;
612     DWORD   dwData;
613     DWORD   dwTimeStamp;
614     DWORD   dwSequence;
615 } DIDEVICEOBJECTDATA, *LPDIDEVICEOBJECTDATA;
616 typedef const DIDEVICEOBJECTDATA *LPCDIDEVICEOBJECTDATA;
617
618 #define DIGDD_PEEK          0x00000001
619
620 #define DISEQUENCE_COMPARE(dwSequence1, cmp, dwSequence2) \
621                         ((int)((dwSequence1) - (dwSequence2)) cmp 0)
622 #define DISCL_EXCLUSIVE     0x00000001
623 #define DISCL_NONEXCLUSIVE  0x00000002
624 #define DISCL_FOREGROUND    0x00000004
625 #define DISCL_BACKGROUND    0x00000008
626
627 #if(DIRECTINPUT_VERSION >= 0x0500)
628 /* These structures are defined for DirectX 3.0 compatibility */
629
630 typedef struct DIDEVICEINSTANCE_DX3A {
631     DWORD   dwSize;
632     GUID    guidInstance;
633     GUID    guidProduct;
634     DWORD   dwDevType;
635     CHAR    tszInstanceName[MAX_PATH];
636     CHAR    tszProductName[MAX_PATH];
637 } DIDEVICEINSTANCE_DX3A, *LPDIDEVICEINSTANCE_DX3A;
638 typedef struct DIDEVICEINSTANCE_DX3W {
639     DWORD   dwSize;
640     GUID    guidInstance;
641     GUID    guidProduct;
642     DWORD   dwDevType;
643     WCHAR   tszInstanceName[MAX_PATH];
644     WCHAR   tszProductName[MAX_PATH];
645 } DIDEVICEINSTANCE_DX3W, *LPDIDEVICEINSTANCE_DX3W;
646 #ifdef UNICODE
647 typedef DIDEVICEINSTANCE_DX3W DIDEVICEINSTANCE_DX3;
648 typedef LPDIDEVICEINSTANCE_DX3W LPDIDEVICEINSTANCE_DX3;
649 #else
650 typedef DIDEVICEINSTANCE_DX3A DIDEVICEINSTANCE_DX3;
651 typedef LPDIDEVICEINSTANCE_DX3A LPDIDEVICEINSTANCE_DX3;
652 #endif // UNICODE
653 typedef const DIDEVICEINSTANCE_DX3A *LPCDIDEVICEINSTANCE_DX3A;
654 typedef const DIDEVICEINSTANCE_DX3W *LPCDIDEVICEINSTANCE_DX3W;
655 typedef const DIDEVICEINSTANCE_DX3  *LPCDIDEVICEINSTANCE_DX3;
656 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
657
658 typedef struct DIDEVICEINSTANCEA {
659     DWORD   dwSize;
660     GUID    guidInstance;
661     GUID    guidProduct;
662     DWORD   dwDevType;
663     CHAR    tszInstanceName[MAX_PATH];
664     CHAR    tszProductName[MAX_PATH];
665 #if(DIRECTINPUT_VERSION >= 0x0500)
666     GUID    guidFFDriver;
667     WORD    wUsagePage;
668     WORD    wUsage;
669 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
670 } DIDEVICEINSTANCEA, *LPDIDEVICEINSTANCEA;
671 typedef struct DIDEVICEINSTANCEW {
672     DWORD   dwSize;
673     GUID    guidInstance;
674     GUID    guidProduct;
675     DWORD   dwDevType;
676     WCHAR   tszInstanceName[MAX_PATH];
677     WCHAR   tszProductName[MAX_PATH];
678 #if(DIRECTINPUT_VERSION >= 0x0500)
679     GUID    guidFFDriver;
680     WORD    wUsagePage;
681     WORD    wUsage;
682 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
683 } DIDEVICEINSTANCEW, *LPDIDEVICEINSTANCEW;
684 #ifdef UNICODE
685 typedef DIDEVICEINSTANCEW DIDEVICEINSTANCE;
686 typedef LPDIDEVICEINSTANCEW LPDIDEVICEINSTANCE;
687 #else
688 typedef DIDEVICEINSTANCEA DIDEVICEINSTANCE;
689 typedef LPDIDEVICEINSTANCEA LPDIDEVICEINSTANCE;
690 #endif // UNICODE
691 typedef const DIDEVICEINSTANCEA *LPCDIDEVICEINSTANCEA;
692 typedef const DIDEVICEINSTANCEW *LPCDIDEVICEINSTANCEW;
693 typedef const DIDEVICEINSTANCE  *LPCDIDEVICEINSTANCE;
694
695 #undef INTERFACE
696 #define INTERFACE IDirectInputDeviceW
697
698 DECLARE_INTERFACE_(IDirectInputDeviceW, IUnknown)
699 {
700     /*** IUnknown methods ***/
701     STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
702     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
703     STDMETHOD_(ULONG,Release)(THIS) PURE;
704
705     /*** IDirectInputDeviceW methods ***/
706     STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE;
707     STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE;
708     STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE;
709     STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE;
710     STDMETHOD(Acquire)(THIS) PURE;
711     STDMETHOD(Unacquire)(THIS) PURE;
712     STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE;
713     STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE;
714     STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE;
715     STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE;
716     STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE;
717     STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE;
718     STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE;
719     STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE;
720     STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE;
721 };
722
723 typedef struct IDirectInputDeviceW *LPDIRECTINPUTDEVICEW;
724
725 #undef INTERFACE
726 #define INTERFACE IDirectInputDeviceA
727
728 DECLARE_INTERFACE_(IDirectInputDeviceA, IUnknown)
729 {
730     /*** IUnknown methods ***/
731     STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
732     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
733     STDMETHOD_(ULONG,Release)(THIS) PURE;
734
735     /*** IDirectInputDeviceA methods ***/
736     STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE;
737     STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE;
738     STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE;
739     STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE;
740     STDMETHOD(Acquire)(THIS) PURE;
741     STDMETHOD(Unacquire)(THIS) PURE;
742     STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE;
743     STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE;
744     STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE;
745     STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE;
746     STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE;
747     STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE;
748     STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE;
749     STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE;
750     STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE;
751 };
752
753 typedef struct IDirectInputDeviceA *LPDIRECTINPUTDEVICEA;
754
755 #ifdef UNICODE
756 #define IID_IDirectInputDevice IID_IDirectInputDeviceW
757 #define IDirectInputDevice IDirectInputDeviceW
758 #define IDirectInputDeviceVtbl IDirectInputDeviceWVtbl
759 #else
760 #define IID_IDirectInputDevice IID_IDirectInputDeviceA
761 #define IDirectInputDevice IDirectInputDeviceA
762 #define IDirectInputDeviceVtbl IDirectInputDeviceAVtbl
763 #endif
764 typedef struct IDirectInputDevice *LPDIRECTINPUTDEVICE;
765
766 #if !defined(__cplusplus) || defined(CINTERFACE)
767 #define IDirectInputDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
768 #define IDirectInputDevice_AddRef(p) (p)->lpVtbl->AddRef(p)
769 #define IDirectInputDevice_Release(p) (p)->lpVtbl->Release(p)
770 #define IDirectInputDevice_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a)
771 #define IDirectInputDevice_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c)
772 #define IDirectInputDevice_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b)
773 #define IDirectInputDevice_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b)
774 #define IDirectInputDevice_Acquire(p) (p)->lpVtbl->Acquire(p)
775 #define IDirectInputDevice_Unacquire(p) (p)->lpVtbl->Unacquire(p)
776 #define IDirectInputDevice_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b)
777 #define IDirectInputDevice_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d)
778 #define IDirectInputDevice_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a)
779 #define IDirectInputDevice_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a)
780 #define IDirectInputDevice_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b)
781 #define IDirectInputDevice_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c)
782 #define IDirectInputDevice_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a)
783 #define IDirectInputDevice_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b)
784 #define IDirectInputDevice_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c)
785 #else
786 #define IDirectInputDevice_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
787 #define IDirectInputDevice_AddRef(p) (p)->AddRef()
788 #define IDirectInputDevice_Release(p) (p)->Release()
789 #define IDirectInputDevice_GetCapabilities(p,a) (p)->GetCapabilities(a)
790 #define IDirectInputDevice_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c)
791 #define IDirectInputDevice_GetProperty(p,a,b) (p)->GetProperty(a,b)
792 #define IDirectInputDevice_SetProperty(p,a,b) (p)->SetProperty(a,b)
793 #define IDirectInputDevice_Acquire(p) (p)->Acquire()
794 #define IDirectInputDevice_Unacquire(p) (p)->Unacquire()
795 #define IDirectInputDevice_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b)
796 #define IDirectInputDevice_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d)
797 #define IDirectInputDevice_SetDataFormat(p,a) (p)->SetDataFormat(a)
798 #define IDirectInputDevice_SetEventNotification(p,a) (p)->SetEventNotification(a)
799 #define IDirectInputDevice_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b)
800 #define IDirectInputDevice_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c)
801 #define IDirectInputDevice_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a)
802 #define IDirectInputDevice_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b)
803 #define IDirectInputDevice_Initialize(p,a,b,c) (p)->Initialize(a,b,c)
804 #endif
805
806 #endif /* DIJ_RINGZERO */
807
808
809 #if(DIRECTINPUT_VERSION >= 0x0500)
810
811 #define DISFFC_RESET            0x00000001
812 #define DISFFC_STOPALL          0x00000002
813 #define DISFFC_PAUSE            0x00000004
814 #define DISFFC_CONTINUE         0x00000008
815 #define DISFFC_SETACTUATORSON   0x00000010
816 #define DISFFC_SETACTUATORSOFF  0x00000020
817
818 #define DIGFFS_EMPTY            0x00000001
819 #define DIGFFS_STOPPED          0x00000002
820 #define DIGFFS_PAUSED           0x00000004
821 #define DIGFFS_ACTUATORSON      0x00000010
822 #define DIGFFS_ACTUATORSOFF     0x00000020
823 #define DIGFFS_POWERON          0x00000040
824 #define DIGFFS_POWEROFF         0x00000080
825 #define DIGFFS_SAFETYSWITCHON   0x00000100
826 #define DIGFFS_SAFETYSWITCHOFF  0x00000200
827 #define DIGFFS_USERFFSWITCHON   0x00000400
828 #define DIGFFS_USERFFSWITCHOFF  0x00000800
829 #define DIGFFS_DEVICELOST       0x80000000
830
831 #ifndef DIJ_RINGZERO
832
833 typedef struct DIEFFECTINFOA {
834     DWORD   dwSize;
835     GUID    guid;
836     DWORD   dwEffType;
837     DWORD   dwStaticParams;
838     DWORD   dwDynamicParams;
839     CHAR    tszName[MAX_PATH];
840 } DIEFFECTINFOA, *LPDIEFFECTINFOA;
841 typedef struct DIEFFECTINFOW {
842     DWORD   dwSize;
843     GUID    guid;
844     DWORD   dwEffType;
845     DWORD   dwStaticParams;
846     DWORD   dwDynamicParams;
847     WCHAR   tszName[MAX_PATH];
848 } DIEFFECTINFOW, *LPDIEFFECTINFOW;
849 #ifdef UNICODE
850 typedef DIEFFECTINFOW DIEFFECTINFO;
851 typedef LPDIEFFECTINFOW LPDIEFFECTINFO;
852 #else
853 typedef DIEFFECTINFOA DIEFFECTINFO;
854 typedef LPDIEFFECTINFOA LPDIEFFECTINFO;
855 #endif // UNICODE
856 typedef const DIEFFECTINFOA *LPCDIEFFECTINFOA;
857 typedef const DIEFFECTINFOW *LPCDIEFFECTINFOW;
858 typedef const DIEFFECTINFO  *LPCDIEFFECTINFO;
859
860 typedef BOOL (FAR PASCAL * LPDIENUMEFFECTSCALLBACKA)(LPCDIEFFECTINFOA, LPVOID);
861 typedef BOOL (FAR PASCAL * LPDIENUMEFFECTSCALLBACKW)(LPCDIEFFECTINFOW, LPVOID);
862 #ifdef UNICODE
863 #define LPDIENUMEFFECTSCALLBACK  LPDIENUMEFFECTSCALLBACKW
864 #else
865 #define LPDIENUMEFFECTSCALLBACK  LPDIENUMEFFECTSCALLBACKA
866 #endif // !UNICODE
867 typedef BOOL (FAR PASCAL * LPDIENUMCREATEDEFFECTOBJECTSCALLBACK)(LPDIRECTINPUTEFFECT, LPVOID);
868
869 #undef INTERFACE
870 #define INTERFACE IDirectInputDevice2W
871
872 DECLARE_INTERFACE_(IDirectInputDevice2W, IDirectInputDeviceW)
873 {
874     /*** IUnknown methods ***/
875     STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
876     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
877     STDMETHOD_(ULONG,Release)(THIS) PURE;
878
879     /*** IDirectInputDeviceW methods ***/
880     STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE;
881     STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE;
882     STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE;
883     STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE;
884     STDMETHOD(Acquire)(THIS) PURE;
885     STDMETHOD(Unacquire)(THIS) PURE;
886     STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE;
887     STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE;
888     STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE;
889     STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE;
890     STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE;
891     STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE;
892     STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE;
893     STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE;
894     STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE;
895
896     /*** IDirectInputDevice2W methods ***/
897     STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE;
898     STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKW,LPVOID,DWORD) PURE;
899     STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOW,REFGUID) PURE;
900     STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE;
901     STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE;
902     STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE;
903     STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE;
904     STDMETHOD(Poll)(THIS) PURE;
905     STDMETHOD(SendDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE;
906 };
907
908 typedef struct IDirectInputDevice2W *LPDIRECTINPUTDEVICE2W;
909
910 #undef INTERFACE
911 #define INTERFACE IDirectInputDevice2A
912
913 DECLARE_INTERFACE_(IDirectInputDevice2A, IDirectInputDeviceA)
914 {
915     /*** IUnknown methods ***/
916     STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
917     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
918     STDMETHOD_(ULONG,Release)(THIS) PURE;
919
920     /*** IDirectInputDeviceA methods ***/
921     STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE;
922     STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE;
923     STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE;
924     STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE;
925     STDMETHOD(Acquire)(THIS) PURE;
926     STDMETHOD(Unacquire)(THIS) PURE;
927     STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE;
928     STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE;
929     STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE;
930     STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE;
931     STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE;
932     STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE;
933     STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE;
934     STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE;
935     STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE;
936
937     /*** IDirectInputDevice2A methods ***/
938     STDMETHOD(CreateEffect)(THIS_ REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN) PURE;
939     STDMETHOD(EnumEffects)(THIS_ LPDIENUMEFFECTSCALLBACKA,LPVOID,DWORD) PURE;
940     STDMETHOD(GetEffectInfo)(THIS_ LPDIEFFECTINFOA,REFGUID) PURE;
941     STDMETHOD(GetForceFeedbackState)(THIS_ LPDWORD) PURE;
942     STDMETHOD(SendForceFeedbackCommand)(THIS_ DWORD) PURE;
943     STDMETHOD(EnumCreatedEffectObjects)(THIS_ LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD) PURE;
944     STDMETHOD(Escape)(THIS_ LPDIEFFESCAPE) PURE;
945     STDMETHOD(Poll)(THIS) PURE;
946     STDMETHOD(SendDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE;
947 };
948
949 typedef struct IDirectInputDevice2A *LPDIRECTINPUTDEVICE2A;
950
951 #ifdef UNICODE
952 #define IID_IDirectInputDevice2 IID_IDirectInputDevice2W
953 #define IDirectInputDevice2 IDirectInputDevice2W
954 #define IDirectInputDevice2Vtbl IDirectInputDevice2WVtbl
955 #else
956 #define IID_IDirectInputDevice2 IID_IDirectInputDevice2A
957 #define IDirectInputDevice2 IDirectInputDevice2A
958 #define IDirectInputDevice2Vtbl IDirectInputDevice2AVtbl
959 #endif
960 typedef struct IDirectInputDevice2 *LPDIRECTINPUTDEVICE2;
961
962 #if !defined(__cplusplus) || defined(CINTERFACE)
963 #define IDirectInputDevice2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
964 #define IDirectInputDevice2_AddRef(p) (p)->lpVtbl->AddRef(p)
965 #define IDirectInputDevice2_Release(p) (p)->lpVtbl->Release(p)
966 #define IDirectInputDevice2_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a)
967 #define IDirectInputDevice2_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c)
968 #define IDirectInputDevice2_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b)
969 #define IDirectInputDevice2_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b)
970 #define IDirectInputDevice2_Acquire(p) (p)->lpVtbl->Acquire(p)
971 #define IDirectInputDevice2_Unacquire(p) (p)->lpVtbl->Unacquire(p)
972 #define IDirectInputDevice2_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b)
973 #define IDirectInputDevice2_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d)
974 #define IDirectInputDevice2_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a)
975 #define IDirectInputDevice2_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a)
976 #define IDirectInputDevice2_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b)
977 #define IDirectInputDevice2_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c)
978 #define IDirectInputDevice2_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a)
979 #define IDirectInputDevice2_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b)
980 #define IDirectInputDevice2_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c)
981 #define IDirectInputDevice2_CreateEffect(p,a,b,c,d) (p)->lpVtbl->CreateEffect(p,a,b,c,d)
982 #define IDirectInputDevice2_EnumEffects(p,a,b,c) (p)->lpVtbl->EnumEffects(p,a,b,c)
983 #define IDirectInputDevice2_GetEffectInfo(p,a,b) (p)->lpVtbl->GetEffectInfo(p,a,b)
984 #define IDirectInputDevice2_GetForceFeedbackState(p,a) (p)->lpVtbl->GetForceFeedbackState(p,a)
985 #define IDirectInputDevice2_SendForceFeedbackCommand(p,a) (p)->lpVtbl->SendForceFeedbackCommand(p,a)
986 #define IDirectInputDevice2_EnumCreatedEffectObjects(p,a,b,c) (p)->lpVtbl->EnumCreatedEffectObjects(p,a,b,c)
987 #define IDirectInputDevice2_Escape(p,a) (p)->lpVtbl->Escape(p,a)
988 #define IDirectInputDevice2_Poll(p) (p)->lpVtbl->Poll(p)
989 #define IDirectInputDevice2_SendDeviceData(p,a,b,c,d) (p)->lpVtbl->SendDeviceData(p,a,b,c,d)
990 #else
991 #define IDirectInputDevice2_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
992 #define IDirectInputDevice2_AddRef(p) (p)->AddRef()
993 #define IDirectInputDevice2_Release(p) (p)->Release()
994 #define IDirectInputDevice2_GetCapabilities(p,a) (p)->GetCapabilities(a)
995 #define IDirectInputDevice2_EnumObjects(p,a,b,c) (p)->EnumObjects(a,b,c)
996 #define IDirectInputDevice2_GetProperty(p,a,b) (p)->GetProperty(a,b)
997 #define IDirectInputDevice2_SetProperty(p,a,b) (p)->SetProperty(a,b)
998 #define IDirectInputDevice2_Acquire(p) (p)->Acquire()
999 #define IDirectInputDevice2_Unacquire(p) (p)->Unacquire()
1000 #define IDirectInputDevice2_GetDeviceState(p,a,b) (p)->GetDeviceState(a,b)
1001 #define IDirectInputDevice2_GetDeviceData(p,a,b,c,d) (p)->GetDeviceData(a,b,c,d)
1002 #define IDirectInputDevice2_SetDataFormat(p,a) (p)->SetDataFormat(a)
1003 #define IDirectInputDevice2_SetEventNotification(p,a) (p)->SetEventNotification(a)
1004 #define IDirectInputDevice2_SetCooperativeLevel(p,a,b) (p)->SetCooperativeLevel(a,b)
1005 #define IDirectInputDevice2_GetObjectInfo(p,a,b,c) (p)->GetObjectInfo(a,b,c)
1006 #define IDirectInputDevice2_GetDeviceInfo(p,a) (p)->GetDeviceInfo(a)
1007 #define IDirectInputDevice2_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b)
1008 #define IDirectInputDevice2_Initialize(p,a,b,c) (p)->Initialize(a,b,c)
1009 #define IDirectInputDevice2_CreateEffect(p,a,b,c,d) (p)->CreateEffect(a,b,c,d)
1010 #define IDirectInputDevice2_EnumEffects(p,a,b,c) (p)->EnumEffects(a,b,c)
1011 #define IDirectInputDevice2_GetEffectInfo(p,a,b) (p)->GetEffectInfo(a,b)
1012 #define IDirectInputDevice2_GetForceFeedbackState(p,a) (p)->GetForceFeedbackState(a)
1013 #define IDirectInputDevice2_SendForceFeedbackCommand(p,a) (p)->SendForceFeedbackCommand(a)
1014 #define IDirectInputDevice2_EnumCreatedEffectObjects(p,a,b,c) (p)->EnumCreatedEffectObjects(a,b,c)
1015 #define IDirectInputDevice2_Escape(p,a) (p)->Escape(a)
1016 #define IDirectInputDevice2_Poll(p) (p)->Poll()
1017 #define IDirectInputDevice2_SendDeviceData(p,a,b,c,d) (p)->SendDeviceData(a,b,c,d)
1018 #endif
1019
1020 #endif /* DIJ_RINGZERO */
1021
1022 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
1023
1024 /****************************************************************************
1025  *
1026  *      Mouse
1027  *
1028  ****************************************************************************/
1029
1030 #ifndef DIJ_RINGZERO
1031
1032 typedef struct _DIMOUSESTATE {
1033     LONG    lX;
1034     LONG    lY;
1035     LONG    lZ;
1036     BYTE    rgbButtons[4];
1037 } DIMOUSESTATE, *LPDIMOUSESTATE;
1038
1039 #define DIMOFS_X        FIELD_OFFSET(DIMOUSESTATE, lX)
1040 #define DIMOFS_Y        FIELD_OFFSET(DIMOUSESTATE, lY)
1041 #define DIMOFS_Z        FIELD_OFFSET(DIMOUSESTATE, lZ)
1042 #define DIMOFS_BUTTON0 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 0)
1043 #define DIMOFS_BUTTON1 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 1)
1044 #define DIMOFS_BUTTON2 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 2)
1045 #define DIMOFS_BUTTON3 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 3)
1046
1047 #endif /* DIJ_RINGZERO */
1048
1049 /****************************************************************************
1050  *
1051  *      Keyboard
1052  *
1053  ****************************************************************************/
1054
1055 #ifndef DIJ_RINGZERO
1056
1057 /****************************************************************************
1058  *
1059  *      DirectInput keyboard scan codes
1060  *
1061  ****************************************************************************/
1062
1063 #define DIK_ESCAPE          0x01
1064 #define DIK_1               0x02
1065 #define DIK_2               0x03
1066 #define DIK_3               0x04
1067 #define DIK_4               0x05
1068 #define DIK_5               0x06
1069 #define DIK_6               0x07
1070 #define DIK_7               0x08
1071 #define DIK_8               0x09
1072 #define DIK_9               0x0A
1073 #define DIK_0               0x0B
1074 #define DIK_MINUS           0x0C    /* - on main keyboard */
1075 #define DIK_EQUALS          0x0D
1076 #define DIK_BACK            0x0E    /* backspace */
1077 #define DIK_TAB             0x0F
1078 #define DIK_Q               0x10
1079 #define DIK_W               0x11
1080 #define DIK_E               0x12
1081 #define DIK_R               0x13
1082 #define DIK_T               0x14
1083 #define DIK_Y               0x15
1084 #define DIK_U               0x16
1085 #define DIK_I               0x17
1086 #define DIK_O               0x18
1087 #define DIK_P               0x19
1088 #define DIK_LBRACKET        0x1A
1089 #define DIK_RBRACKET        0x1B
1090 #define DIK_RETURN          0x1C    /* Enter on main keyboard */
1091 #define DIK_LCONTROL        0x1D
1092 #define DIK_A               0x1E
1093 #define DIK_S               0x1F
1094 #define DIK_D               0x20
1095 #define DIK_F               0x21
1096 #define DIK_G               0x22
1097 #define DIK_H               0x23
1098 #define DIK_J               0x24
1099 #define DIK_K               0x25
1100 #define DIK_L               0x26
1101 #define DIK_SEMICOLON       0x27
1102 #define DIK_APOSTROPHE      0x28
1103 #define DIK_GRAVE           0x29    /* accent grave */
1104 #define DIK_LSHIFT          0x2A
1105 #define DIK_BACKSLASH       0x2B
1106 #define DIK_Z               0x2C
1107 #define DIK_X               0x2D
1108 #define DIK_C               0x2E
1109 #define DIK_V               0x2F
1110 #define DIK_B               0x30
1111 #define DIK_N               0x31
1112 #define DIK_M               0x32
1113 #define DIK_COMMA           0x33
1114 #define DIK_PERIOD          0x34    /* . on main keyboard */
1115 #define DIK_SLASH           0x35    /* / on main keyboard */
1116 #define DIK_RSHIFT          0x36
1117 #define DIK_MULTIPLY        0x37    /* * on numeric keypad */
1118 #define DIK_LMENU           0x38    /* left Alt */
1119 #define DIK_SPACE           0x39
1120 #define DIK_CAPITAL         0x3A
1121 #define DIK_F1              0x3B
1122 #define DIK_F2              0x3C
1123 #define DIK_F3              0x3D
1124 #define DIK_F4              0x3E
1125 #define DIK_F5              0x3F
1126 #define DIK_F6              0x40
1127 #define DIK_F7              0x41
1128 #define DIK_F8              0x42
1129 #define DIK_F9              0x43
1130 #define DIK_F10             0x44
1131 #define DIK_NUMLOCK         0x45
1132 #define DIK_SCROLL          0x46    /* Scroll Lock */
1133 #define DIK_NUMPAD7         0x47
1134 #define DIK_NUMPAD8         0x48
1135 #define DIK_NUMPAD9         0x49
1136 #define DIK_SUBTRACT        0x4A    /* - on numeric keypad */
1137 #define DIK_NUMPAD4         0x4B
1138 #define DIK_NUMPAD5         0x4C
1139 #define DIK_NUMPAD6         0x4D
1140 #define DIK_ADD             0x4E    /* + on numeric keypad */
1141 #define DIK_NUMPAD1         0x4F
1142 #define DIK_NUMPAD2         0x50
1143 #define DIK_NUMPAD3         0x51
1144 #define DIK_NUMPAD0         0x52
1145 #define DIK_DECIMAL         0x53    /* . on numeric keypad */
1146 #define DIK_F11             0x57
1147 #define DIK_F12             0x58
1148
1149 #define DIK_F13             0x64    /*                     (NEC PC98) */
1150 #define DIK_F14             0x65    /*                     (NEC PC98) */
1151 #define DIK_F15             0x66    /*                     (NEC PC98) */
1152
1153 #define DIK_KANA            0x70    /* (Japanese keyboard)            */
1154 #define DIK_CONVERT         0x79    /* (Japanese keyboard)            */
1155 #define DIK_NOCONVERT       0x7B    /* (Japanese keyboard)            */
1156 #define DIK_YEN             0x7D    /* (Japanese keyboard)            */
1157 #define DIK_NUMPADEQUALS    0x8D    /* = on numeric keypad (NEC PC98) */
1158 #define DIK_CIRCUMFLEX      0x90    /* (Japanese keyboard)            */
1159 #define DIK_AT              0x91    /*                     (NEC PC98) */
1160 #define DIK_COLON           0x92    /*                     (NEC PC98) */
1161 #define DIK_UNDERLINE       0x93    /*                     (NEC PC98) */
1162 #define DIK_KANJI           0x94    /* (Japanese keyboard)            */
1163 #define DIK_STOP            0x95    /*                     (NEC PC98) */
1164 #define DIK_AX              0x96    /*                     (Japan AX) */
1165 #define DIK_UNLABELED       0x97    /*                        (J3100) */
1166 #define DIK_NUMPADENTER     0x9C    /* Enter on numeric keypad */
1167 #define DIK_RCONTROL        0x9D
1168 #define DIK_NUMPADCOMMA     0xB3    /* , on numeric keypad (NEC PC98) */
1169 #define DIK_DIVIDE          0xB5    /* / on numeric keypad */
1170 #define DIK_SYSRQ           0xB7
1171 #define DIK_RMENU           0xB8    /* right Alt */
1172 #define DIK_HOME            0xC7    /* Home on arrow keypad */
1173 #define DIK_UP              0xC8    /* UpArrow on arrow keypad */
1174 #define DIK_PRIOR           0xC9    /* PgUp on arrow keypad */
1175 #define DIK_LEFT            0xCB    /* LeftArrow on arrow keypad */
1176 #define DIK_RIGHT           0xCD    /* RightArrow on arrow keypad */
1177 #define DIK_END             0xCF    /* End on arrow keypad */
1178 #define DIK_DOWN            0xD0    /* DownArrow on arrow keypad */
1179 #define DIK_NEXT            0xD1    /* PgDn on arrow keypad */
1180 #define DIK_INSERT          0xD2    /* Insert on arrow keypad */
1181 #define DIK_DELETE          0xD3    /* Delete on arrow keypad */
1182 #define DIK_LWIN            0xDB    /* Left Windows key */
1183 #define DIK_RWIN            0xDC    /* Right Windows key */
1184 #define DIK_APPS            0xDD    /* AppMenu key */
1185
1186 /*
1187  *  Alternate names for keys, to facilitate transition from DOS.
1188  */
1189 #define DIK_BACKSPACE       DIK_BACK            /* backspace */
1190 #define DIK_NUMPADSTAR      DIK_MULTIPLY        /* * on numeric keypad */
1191 #define DIK_LALT            DIK_LMENU           /* left Alt */
1192 #define DIK_CAPSLOCK        DIK_CAPITAL         /* CapsLock */
1193 #define DIK_NUMPADMINUS     DIK_SUBTRACT        /* - on numeric keypad */
1194 #define DIK_NUMPADPLUS      DIK_ADD             /* + on numeric keypad */
1195 #define DIK_NUMPADPERIOD    DIK_DECIMAL         /* . on numeric keypad */
1196 #define DIK_NUMPADSLASH     DIK_DIVIDE          /* / on numeric keypad */
1197 #define DIK_RALT            DIK_RMENU           /* right Alt */
1198 #define DIK_UPARROW         DIK_UP              /* UpArrow on arrow keypad */
1199 #define DIK_PGUP            DIK_PRIOR           /* PgUp on arrow keypad */
1200 #define DIK_LEFTARROW       DIK_LEFT            /* LeftArrow on arrow keypad */
1201 #define DIK_RIGHTARROW      DIK_RIGHT           /* RightArrow on arrow keypad */
1202 #define DIK_DOWNARROW       DIK_DOWN            /* DownArrow on arrow keypad */
1203 #define DIK_PGDN            DIK_NEXT            /* PgDn on arrow keypad */
1204
1205 #endif /* DIJ_RINGZERO */
1206
1207 /****************************************************************************
1208  *
1209  *      Joystick
1210  *
1211  ****************************************************************************/
1212
1213 #ifndef DIJ_RINGZERO
1214
1215 typedef struct DIJOYSTATE {
1216     LONG    lX;                     /* x-axis position              */
1217     LONG    lY;                     /* y-axis position              */
1218     LONG    lZ;                     /* z-axis position              */
1219     LONG    lRx;                    /* x-axis rotation              */
1220     LONG    lRy;                    /* y-axis rotation              */
1221     LONG    lRz;                    /* z-axis rotation              */
1222     LONG    rglSlider[2];           /* extra axes positions         */
1223     DWORD   rgdwPOV[4];             /* POV directions               */
1224     BYTE    rgbButtons[32];         /* 32 buttons                   */
1225 } DIJOYSTATE, *LPDIJOYSTATE;
1226
1227 typedef struct DIJOYSTATE2 {
1228     LONG    lX;                     /* x-axis position              */
1229     LONG    lY;                     /* y-axis position              */
1230     LONG    lZ;                     /* z-axis position              */
1231     LONG    lRx;                    /* x-axis rotation              */
1232     LONG    lRy;                    /* y-axis rotation              */
1233     LONG    lRz;                    /* z-axis rotation              */
1234     LONG    rglSlider[2];           /* extra axes positions         */
1235     DWORD   rgdwPOV[4];             /* POV directions               */
1236     BYTE    rgbButtons[128];        /* 128 buttons                  */
1237     LONG    lVX;                    /* x-axis velocity              */
1238     LONG    lVY;                    /* y-axis velocity              */
1239     LONG    lVZ;                    /* z-axis velocity              */
1240     LONG    lVRx;                   /* x-axis angular velocity      */
1241     LONG    lVRy;                   /* y-axis angular velocity      */
1242     LONG    lVRz;                   /* z-axis angular velocity      */
1243     LONG    rglVSlider[2];          /* extra axes velocities        */
1244     LONG    lAX;                    /* x-axis acceleration          */
1245     LONG    lAY;                    /* y-axis acceleration          */
1246     LONG    lAZ;                    /* z-axis acceleration          */
1247     LONG    lARx;                   /* x-axis angular acceleration  */
1248     LONG    lARy;                   /* y-axis angular acceleration  */
1249     LONG    lARz;                   /* z-axis angular acceleration  */
1250     LONG    rglASlider[2];          /* extra axes accelerations     */
1251     LONG    lFX;                    /* x-axis force                 */
1252     LONG    lFY;                    /* y-axis force                 */
1253     LONG    lFZ;                    /* z-axis force                 */
1254     LONG    lFRx;                   /* x-axis torque                */
1255     LONG    lFRy;                   /* y-axis torque                */
1256     LONG    lFRz;                   /* z-axis torque                */
1257     LONG    rglFSlider[2];          /* extra axes forces            */
1258 } DIJOYSTATE2, *LPDIJOYSTATE2;
1259
1260 #define DIJOFS_X            FIELD_OFFSET(DIJOYSTATE, lX)
1261 #define DIJOFS_Y            FIELD_OFFSET(DIJOYSTATE, lY)
1262 #define DIJOFS_Z            FIELD_OFFSET(DIJOYSTATE, lZ)
1263 #define DIJOFS_RX           FIELD_OFFSET(DIJOYSTATE, lRx)
1264 #define DIJOFS_RY           FIELD_OFFSET(DIJOYSTATE, lRy)
1265 #define DIJOFS_RZ           FIELD_OFFSET(DIJOYSTATE, lRz)
1266 #define DIJOFS_SLIDER(n)   (FIELD_OFFSET(DIJOYSTATE, rglSlider) + \
1267                                                         (n) * sizeof(LONG))
1268 #define DIJOFS_POV(n)      (FIELD_OFFSET(DIJOYSTATE, rgdwPOV) + \
1269                                                         (n) * sizeof(DWORD))
1270 #define DIJOFS_BUTTON(n)   (FIELD_OFFSET(DIJOYSTATE, rgbButtons) + (n))
1271 #define DIJOFS_BUTTON0      DIJOFS_BUTTON(0)
1272 #define DIJOFS_BUTTON1      DIJOFS_BUTTON(1)
1273 #define DIJOFS_BUTTON2      DIJOFS_BUTTON(2)
1274 #define DIJOFS_BUTTON3      DIJOFS_BUTTON(3)
1275 #define DIJOFS_BUTTON4      DIJOFS_BUTTON(4)
1276 #define DIJOFS_BUTTON5      DIJOFS_BUTTON(5)
1277 #define DIJOFS_BUTTON6      DIJOFS_BUTTON(6)
1278 #define DIJOFS_BUTTON7      DIJOFS_BUTTON(7)
1279 #define DIJOFS_BUTTON8      DIJOFS_BUTTON(8)
1280 #define DIJOFS_BUTTON9      DIJOFS_BUTTON(9)
1281 #define DIJOFS_BUTTON10     DIJOFS_BUTTON(10)
1282 #define DIJOFS_BUTTON11     DIJOFS_BUTTON(11)
1283 #define DIJOFS_BUTTON12     DIJOFS_BUTTON(12)
1284 #define DIJOFS_BUTTON13     DIJOFS_BUTTON(13)
1285 #define DIJOFS_BUTTON14     DIJOFS_BUTTON(14)
1286 #define DIJOFS_BUTTON15     DIJOFS_BUTTON(15)
1287 #define DIJOFS_BUTTON16     DIJOFS_BUTTON(16)
1288 #define DIJOFS_BUTTON17     DIJOFS_BUTTON(17)
1289 #define DIJOFS_BUTTON18     DIJOFS_BUTTON(18)
1290 #define DIJOFS_BUTTON19     DIJOFS_BUTTON(19)
1291 #define DIJOFS_BUTTON20     DIJOFS_BUTTON(20)
1292 #define DIJOFS_BUTTON21     DIJOFS_BUTTON(21)
1293 #define DIJOFS_BUTTON22     DIJOFS_BUTTON(22)
1294 #define DIJOFS_BUTTON23     DIJOFS_BUTTON(23)
1295 #define DIJOFS_BUTTON24     DIJOFS_BUTTON(24)
1296 #define DIJOFS_BUTTON25     DIJOFS_BUTTON(25)
1297 #define DIJOFS_BUTTON26     DIJOFS_BUTTON(26)
1298 #define DIJOFS_BUTTON27     DIJOFS_BUTTON(27)
1299 #define DIJOFS_BUTTON28     DIJOFS_BUTTON(28)
1300 #define DIJOFS_BUTTON29     DIJOFS_BUTTON(29)
1301 #define DIJOFS_BUTTON30     DIJOFS_BUTTON(30)
1302 #define DIJOFS_BUTTON31     DIJOFS_BUTTON(31)
1303
1304
1305 #endif /* DIJ_RINGZERO */
1306
1307 /****************************************************************************
1308  *
1309  *  IDirectInput
1310  *
1311  ****************************************************************************/
1312
1313 #ifndef DIJ_RINGZERO
1314
1315 #define DIENUM_STOP             0
1316 #define DIENUM_CONTINUE         1
1317
1318 typedef BOOL (FAR PASCAL * LPDIENUMDEVICESCALLBACKA)(LPCDIDEVICEINSTANCEA, LPVOID);
1319 typedef BOOL (FAR PASCAL * LPDIENUMDEVICESCALLBACKW)(LPCDIDEVICEINSTANCEW, LPVOID);
1320 #ifdef UNICODE
1321 #define LPDIENUMDEVICESCALLBACK  LPDIENUMDEVICESCALLBACKW
1322 #else
1323 #define LPDIENUMDEVICESCALLBACK  LPDIENUMDEVICESCALLBACKA
1324 #endif // !UNICODE
1325
1326 #define DIEDFL_ALLDEVICES       0x00000000
1327 #define DIEDFL_ATTACHEDONLY     0x00000001
1328 #if(DIRECTINPUT_VERSION >= 0x0500)
1329 #define DIEDFL_FORCEFEEDBACK    0x00000100
1330 #endif /* DIRECTINPUT_VERSION >= 0x0500 */
1331
1332 #undef INTERFACE
1333 #define INTERFACE IDirectInputW
1334
1335 DECLARE_INTERFACE_(IDirectInputW, IUnknown)
1336 {
1337     /*** IUnknown methods ***/
1338     STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
1339     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
1340     STDMETHOD_(ULONG,Release)(THIS) PURE;
1341
1342     /*** IDirectInputW methods ***/
1343     STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEW *,LPUNKNOWN) PURE;
1344     STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE;
1345     STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE;
1346     STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE;
1347     STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE;
1348 };
1349
1350 typedef struct IDirectInputW *LPDIRECTINPUTW;
1351
1352 #undef INTERFACE
1353 #define INTERFACE IDirectInputA
1354
1355 DECLARE_INTERFACE_(IDirectInputA, IUnknown)
1356 {
1357     /*** IUnknown methods ***/
1358     STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
1359     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
1360     STDMETHOD_(ULONG,Release)(THIS) PURE;
1361
1362     /*** IDirectInputA methods ***/
1363     STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEA *,LPUNKNOWN) PURE;
1364     STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE;
1365     STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE;
1366     STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE;
1367     STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE;
1368 };
1369
1370 typedef struct IDirectInputA *LPDIRECTINPUTA;
1371
1372 #ifdef UNICODE
1373 #define IID_IDirectInput IID_IDirectInputW
1374 #define IDirectInput IDirectInputW
1375 #define IDirectInputVtbl IDirectInputWVtbl
1376 #else
1377 #define IID_IDirectInput IID_IDirectInputA
1378 #define IDirectInput IDirectInputA
1379 #define IDirectInputVtbl IDirectInputAVtbl
1380 #endif
1381 typedef struct IDirectInput *LPDIRECTINPUT;
1382
1383 #if !defined(__cplusplus) || defined(CINTERFACE)
1384 #define IDirectInput_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
1385 #define IDirectInput_AddRef(p) (p)->lpVtbl->AddRef(p)
1386 #define IDirectInput_Release(p) (p)->lpVtbl->Release(p)
1387 #define IDirectInput_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c)
1388 #define IDirectInput_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d)
1389 #define IDirectInput_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a)
1390 #define IDirectInput_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b)
1391 #define IDirectInput_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b)
1392 #else
1393 #define IDirectInput_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
1394 #define IDirectInput_AddRef(p) (p)->AddRef()
1395 #define IDirectInput_Release(p) (p)->Release()
1396 #define IDirectInput_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c)
1397 #define IDirectInput_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d)
1398 #define IDirectInput_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a)
1399 #define IDirectInput_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b)
1400 #define IDirectInput_Initialize(p,a,b) (p)->Initialize(a,b)
1401 #endif
1402
1403 #undef INTERFACE
1404 #define INTERFACE IDirectInput2W
1405
1406 DECLARE_INTERFACE_(IDirectInput2W, IDirectInputW)
1407 {
1408     /*** IUnknown methods ***/
1409     STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
1410     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
1411     STDMETHOD_(ULONG,Release)(THIS) PURE;
1412
1413     /*** IDirectInputW methods ***/
1414     STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEW *,LPUNKNOWN) PURE;
1415     STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE;
1416     STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE;
1417     STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE;
1418     STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE;
1419
1420     /*** IDirectInput2W methods ***/
1421     STDMETHOD(FindDevice)(THIS_ REFGUID,LPCWSTR,LPGUID) PURE;
1422 };
1423
1424 typedef struct IDirectInput2W *LPDIRECTINPUT2W;
1425
1426 #undef INTERFACE
1427 #define INTERFACE IDirectInput2A
1428
1429 DECLARE_INTERFACE_(IDirectInput2A, IDirectInputA)
1430 {
1431     /*** IUnknown methods ***/
1432     STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
1433     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
1434     STDMETHOD_(ULONG,Release)(THIS) PURE;
1435
1436     /*** IDirectInputA methods ***/
1437     STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEA *,LPUNKNOWN) PURE;
1438     STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE;
1439     STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE;
1440     STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE;
1441     STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE;
1442
1443     /*** IDirectInput2A methods ***/
1444     STDMETHOD(FindDevice)(THIS_ REFGUID,LPCSTR,LPGUID) PURE;
1445 };
1446
1447 typedef struct IDirectInput2A *LPDIRECTINPUT2A;
1448
1449 #ifdef UNICODE
1450 #define IID_IDirectInput2 IID_IDirectInput2W
1451 #define IDirectInput2 IDirectInput2W
1452 #define IDirectInput2Vtbl IDirectInput2WVtbl
1453 #else
1454 #define IID_IDirectInput2 IID_IDirectInput2A
1455 #define IDirectInput2 IDirectInput2A
1456 #define IDirectInput2Vtbl IDirectInput2AVtbl
1457 #endif
1458 typedef struct IDirectInput2 *LPDIRECTINPUT2;
1459
1460 #if !defined(__cplusplus) || defined(CINTERFACE)
1461 #define IDirectInput2_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
1462 #define IDirectInput2_AddRef(p) (p)->lpVtbl->AddRef(p)
1463 #define IDirectInput2_Release(p) (p)->lpVtbl->Release(p)
1464 #define IDirectInput2_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c)
1465 #define IDirectInput2_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d)
1466 #define IDirectInput2_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a)
1467 #define IDirectInput2_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b)
1468 #define IDirectInput2_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b)
1469 #define IDirectInput2_FindDevice(p,a,b,c) (p)->lpVtbl->FindDevice(p,a,b,c)
1470 #else
1471 #define IDirectInput2_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
1472 #define IDirectInput2_AddRef(p) (p)->AddRef()
1473 #define IDirectInput2_Release(p) (p)->Release()
1474 #define IDirectInput2_CreateDevice(p,a,b,c) (p)->CreateDevice(a,b,c)
1475 #define IDirectInput2_EnumDevices(p,a,b,c,d) (p)->EnumDevices(a,b,c,d)
1476 #define IDirectInput2_GetDeviceStatus(p,a) (p)->GetDeviceStatus(a)
1477 #define IDirectInput2_RunControlPanel(p,a,b) (p)->RunControlPanel(a,b)
1478 #define IDirectInput2_Initialize(p,a,b) (p)->Initialize(a,b)
1479 #define IDirectInput2_FindDevice(p,a,b,c) (p)->FindDevice(a,b,c)
1480 #endif
1481
1482 extern HRESULT WINAPI DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter);
1483 extern HRESULT WINAPI DirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW *ppDI, LPUNKNOWN punkOuter);
1484 #ifdef UNICODE
1485 #define DirectInputCreate  DirectInputCreateW
1486 #else
1487 #define DirectInputCreate  DirectInputCreateA
1488 #endif // !UNICODE
1489
1490 #endif /* DIJ_RINGZERO */
1491
1492
1493 /****************************************************************************
1494  *
1495  *  Return Codes
1496  *
1497  ****************************************************************************/
1498
1499 /*
1500  *  The operation completed successfully.
1501  */
1502 #define DI_OK                           S_OK
1503
1504 /*
1505  *  The device exists but is not currently attached.
1506  */
1507 #define DI_NOTATTACHED                  S_FALSE
1508
1509 /*
1510  *  The device buffer overflowed.  Some input was lost.
1511  */
1512 #define DI_BUFFEROVERFLOW               S_FALSE
1513
1514 /*
1515  *  The change in device properties had no effect.
1516  */
1517 #define DI_PROPNOEFFECT                 S_FALSE
1518
1519 /*
1520  *  The operation had no effect.
1521  */
1522 #define DI_NOEFFECT                     S_FALSE
1523
1524 /*
1525  *  The device is a polled device.  As a result, device buffering
1526  *  will not collect any data and event notifications will not be
1527  *  signalled until GetDeviceState is called.
1528  */
1529 #define DI_POLLEDDEVICE                 ((HRESULT)0x00000002L)
1530
1531 /*
1532  *  The parameters of the effect were successfully updated by
1533  *  IDirectInputEffect::SetParameters, but the effect was not
1534  *  downloaded because the device is not exclusively acquired
1535  *  or because the DIEP_NODOWNLOAD flag was passed.
1536  */
1537 #define DI_DOWNLOADSKIPPED              ((HRESULT)0x00000003L)
1538
1539 /*
1540  *  The parameters of the effect were successfully updated by
1541  *  IDirectInputEffect::SetParameters, but in order to change
1542  *  the parameters, the effect needed to be restarted.
1543  */
1544 #define DI_EFFECTRESTARTED              ((HRESULT)0x00000004L)
1545
1546 /*
1547  *  The parameters of the effect were successfully updated by
1548  *  IDirectInputEffect::SetParameters, but some of them were
1549  *  beyond the capabilities of the device and were truncated.
1550  */
1551 #define DI_TRUNCATED                    ((HRESULT)0x00000008L)
1552
1553 /*
1554  *  Equal to DI_EFFECTRESTARTED | DI_TRUNCATED.
1555  */
1556 #define DI_TRUNCATEDANDRESTARTED        ((HRESULT)0x0000000CL)
1557
1558 /*
1559  *  The application requires a newer version of DirectInput.
1560  */
1561 #define DIERR_OLDDIRECTINPUTVERSION     \
1562     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_OLD_WIN_VERSION)
1563
1564 /*
1565  *  The application was written for an unsupported prerelease version
1566  *  of DirectInput.
1567  */
1568 #define DIERR_BETADIRECTINPUTVERSION    \
1569     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_RMODE_APP)
1570
1571 /*
1572  *  The object could not be created due to an incompatible driver version
1573  *  or mismatched or incomplete driver components.
1574  */
1575 #define DIERR_BADDRIVERVER              \
1576     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BAD_DRIVER_LEVEL)
1577
1578 /*
1579  * The device or device instance or effect is not registered with DirectInput.
1580  */
1581 #define DIERR_DEVICENOTREG              REGDB_E_CLASSNOTREG
1582
1583 /*
1584  * The requested object does not exist.
1585  */
1586 #define DIERR_NOTFOUND                  \
1587     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND)
1588
1589 /*
1590  * The requested object does not exist.
1591  */
1592 #define DIERR_OBJECTNOTFOUND            \
1593     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND)
1594
1595 /*
1596  * An invalid parameter was passed to the returning function,
1597  * or the object was not in a state that admitted the function
1598  * to be called.
1599  */
1600 #define DIERR_INVALIDPARAM              E_INVALIDARG
1601
1602 /*
1603  * The specified interface is not supported by the object
1604  */
1605 #define DIERR_NOINTERFACE               E_NOINTERFACE
1606
1607 /*
1608  * An undetermined error occured inside the DInput subsystem
1609  */
1610 #define DIERR_GENERIC                   E_FAIL
1611
1612 /*
1613  * The DInput subsystem couldn't allocate sufficient memory to complete the
1614  * caller's request.
1615  */
1616 #define DIERR_OUTOFMEMORY               E_OUTOFMEMORY
1617
1618 /*
1619  * The function called is not supported at this time
1620  */
1621 #define DIERR_UNSUPPORTED               E_NOTIMPL
1622
1623 /*
1624  * This object has not been initialized
1625  */
1626 #define DIERR_NOTINITIALIZED            \
1627     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_READY)
1628
1629 /*
1630  * This object is already initialized
1631  */
1632 #define DIERR_ALREADYINITIALIZED        \
1633     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_ALREADY_INITIALIZED)
1634
1635 /*
1636  * This object does not support aggregation
1637  */
1638 #define DIERR_NOAGGREGATION             CLASS_E_NOAGGREGATION
1639
1640 /*
1641  * Another app has a higher priority level, preventing this call from
1642  * succeeding.
1643  */
1644 #define DIERR_OTHERAPPHASPRIO           E_ACCESSDENIED
1645
1646 /*
1647  * Access to the device has been lost.  It must be re-acquired.
1648  */
1649 #define DIERR_INPUTLOST                 \
1650     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_READ_FAULT)
1651
1652 /*
1653  * The operation cannot be performed while the device is acquired.
1654  */
1655 #define DIERR_ACQUIRED                  \
1656     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BUSY)
1657
1658 /*
1659  * The operation cannot be performed unless the device is acquired.
1660  */
1661 #define DIERR_NOTACQUIRED               \
1662     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_INVALID_ACCESS)
1663
1664 /*
1665  * The specified property cannot be changed.
1666  */
1667 #define DIERR_READONLY                  E_ACCESSDENIED
1668
1669 /*
1670  * The device already has an event notification associated with it.
1671  */
1672 #define DIERR_HANDLEEXISTS              E_ACCESSDENIED
1673
1674 /*
1675  * Data is not yet available.
1676  */
1677 #ifndef E_PENDING
1678 #define E_PENDING                       0x80070007L
1679 #endif
1680
1681 /*
1682  * Unable to IDirectInputJoyConfig_Acquire because the user
1683  * does not have sufficient privileges to change the joystick
1684  * configuration.
1685  */
1686 #define DIERR_INSUFFICIENTPRIVS         0x80040200L
1687
1688 /*
1689  * The device is full.
1690  */
1691 #define DIERR_DEVICEFULL                0x80040201L
1692
1693 /*
1694  * Not all the requested information fit into the buffer.
1695  */
1696 #define DIERR_MOREDATA                  0x80040202L
1697
1698 /*
1699  * The effect is not downloaded.
1700  */
1701 #define DIERR_NOTDOWNLOADED             0x80040203L
1702
1703 /*
1704  *  The device cannot be reinitialized because there are still effects
1705  *  attached to it.
1706  */
1707 #define DIERR_HASEFFECTS                0x80040204L
1708
1709 /*
1710  *  The operation cannot be performed unless the device is acquired
1711  *  in DISCL_EXCLUSIVE mode.
1712  */
1713 #define DIERR_NOTEXCLUSIVEACQUIRED      0x80040205L
1714
1715 /*
1716  *  The effect could not be downloaded because essential information
1717  *  is missing.  For example, no axes have been associated with the
1718  *  effect, or no type-specific information has been created.
1719  */
1720 #define DIERR_INCOMPLETEEFFECT          0x80040206L
1721
1722 /*
1723  *  Attempted to read buffered device data from a device that is
1724  *  not buffered.
1725  */
1726 #define DIERR_NOTBUFFERED               0x80040207L
1727
1728 /*
1729  *  An attempt was made to modify parameters of an effect while it is
1730  *  playing.  Not all hardware devices support altering the parameters
1731  *  of an effect while it is playing.
1732  */
1733 #define DIERR_EFFECTPLAYING             0x80040208L
1734
1735 #ifdef __cplusplus
1736 };
1737 #endif
1738
1739 #endif  /* __DINPUT_INCLUDED__ */
1740
1741 /****************************************************************************
1742  *
1743  *  Definitions for non-IDirectInput (VJoyD) features defined more recently
1744  *  than the current sdk files
1745  *
1746  ****************************************************************************/
1747
1748 #ifdef _INC_MMSYSTEM
1749 #ifndef MMNOJOY
1750
1751 #ifndef __VJOYDX_INCLUDED__
1752 #define __VJOYDX_INCLUDED__
1753
1754 #ifdef __cplusplus
1755 extern "C" {
1756 #endif
1757
1758 /*
1759  * Flag to indicate that the dwReserved2 field of the JOYINFOEX structure
1760  * contains mini-driver specific data to be passed by VJoyD to the mini-
1761  * driver instead of doing a poll.
1762  */
1763 #define JOY_PASSDRIVERDATA          0x10000000l
1764
1765 /*
1766  * Informs the joystick driver that the configuration has been changed
1767  * and should be reloaded from the registery.
1768  * dwFlags is reserved and should be set to zero
1769  */
1770 WINMMAPI MMRESULT WINAPI joyConfigChanged( DWORD dwFlags );
1771
1772 /*
1773  * Hardware Setting indicating that the device is a headtracker
1774  */
1775 #define JOY_HWS_ISHEADTRACKER       0x02000000l
1776
1777 /*
1778  * Hardware Setting indicating that the VxD is used to replace
1779  * the standard analog polling
1780  */
1781 #define JOY_HWS_ISGAMEPORTDRIVER    0x04000000l
1782
1783 /*
1784  * Hardware Setting indicating that the driver needs a standard
1785  * gameport in order to communicate with the device.
1786  */
1787 #define JOY_HWS_ISANALOGPORTDRIVER  0x08000000l 
1788
1789 /*
1790  * Hardware Setting indicating that VJoyD should not load this 
1791  * driver, it will be loaded externally and will register with
1792  * VJoyD of it's own accord.
1793  */
1794 #define JOY_HWS_AUTOLOAD            0x10000000l
1795
1796 /*
1797  * Hardware Setting indicating that the driver acquires any 
1798  * resources needed without needing a devnode through VJoyD.
1799  */
1800 #define JOY_HWS_NODEVNODE           0x20000000l
1801
1802 /*
1803  * Hardware Setting indicating that the VxD can be used as
1804  * a port 201h emulator.
1805  */
1806 #define JOY_HWS_ISGAMEPORTEMULATOR  0x40000000l
1807
1808
1809 /*
1810  * Usage Setting indicating that the settings are volatile and
1811  * should be removed if still present on a reboot.
1812  */
1813 #define JOY_US_VOLATILE             0x00000008L
1814
1815 #ifdef __cplusplus
1816 };
1817 #endif
1818
1819 #endif  /* __VJOYDX_INCLUDED__ */
1820
1821 #endif  /* not MMNOJOY */
1822 #endif  /* _INC_MMSYSTEM */
1823
1824 /****************************************************************************
1825  *
1826  *  Definitions for non-IDirectInput (VJoyD) features defined more recently
1827  *  than the current ddk files
1828  *
1829  ****************************************************************************/
1830
1831 #ifndef DIJ_RINGZERO
1832
1833 #ifdef _INC_MMDDK
1834 #ifndef MMNOJOYDEV
1835
1836 #ifndef __VJOYDXD_INCLUDED__
1837 #define __VJOYDXD_INCLUDED__
1838 /*
1839  * Poll type in which the do_other field of the JOYOEMPOLLDATA
1840  * structure contains mini-driver specific data passed from an app.
1841  */
1842 #define JOY_OEMPOLL_PASSDRIVERDATA  7
1843
1844 #endif  /* __VJOYDXD_INCLUDED__ */
1845
1846 #endif  /* not MMNOJOYDEV */
1847 #endif  /* _INC_MMDDK */
1848
1849 #endif /* DIJ_RINGZERO */