1 /// Partial translation of dinput.h
2 ///
3 /// Assumes direct input version 8, so old versions of interfaces are not included
4 /// Also assumes `UNICODE`, so only the variants that end in W (using wchar) instead of A (using ascii char).
5 module glfw3.directinput8;
6 
7 extern(Windows): @nogc: nothrow: __gshared:
8 
9 import core.sys.windows.windows;
10 import core.sys.windows.objbase;
11 
12 enum DIRECTINPUT_VERSION =	0x0800;
13 
14 // @nogc IUnknown interface
15 // Compiler doesn't care where it's from as long as it's named IUnknown
16 private interface IUnknown {
17 extern(Windows) @nogc nothrow @system:
18 	HRESULT QueryInterface(IID* riid, void** pvObject);
19 	ULONG AddRef();
20 	ULONG Release();
21 }
22 
23 struct _DIDATAFORMAT {
24     DWORD dwSize;
25     DWORD dwObjSize;
26     DWORD dwFlags;
27     DWORD dwDataSize;
28     DWORD dwNumObjs;
29     LPDIOBJECTDATAFORMAT rgodf;
30 }alias _DIDATAFORMAT DIDATAFORMAT;alias _DIDATAFORMAT* LPDIDATAFORMAT;
31 alias const(DIDATAFORMAT)* LPCDIDATAFORMAT;
32 
33 struct DIDEVICEOBJECTINSTANCEW {
34     DWORD dwSize;
35     GUID guidType;
36     DWORD dwOfs;
37     DWORD dwType;
38     DWORD dwFlags;
39     WCHAR[MAX_PATH] tszName;
40     DWORD dwFFMaxForce;
41     DWORD dwFFForceResolution;
42     WORD wCollectionNumber;
43     WORD wDesignatorIndex;
44     WORD wUsagePage;
45     WORD wUsage;
46     DWORD dwDimension;
47     WORD wExponent;
48     WORD wReserved;
49 }
50 alias DIDEVICEOBJECTINSTANCEW* LPDIDEVICEOBJECTINSTANCEW;
51 alias const(DIDEVICEOBJECTINSTANCEW)* LPCDIDEVICEOBJECTINSTANCEW;
52 
53 enum DIDOI_FFACTUATOR =	0x00000001;
54 enum DIDOI_FFEFFECTTRIGGER =	0x00000002;
55 enum DIDOI_POLLED =		0x00008000;
56 enum DIDOI_ASPECTPOSITION =	0x00000100;
57 enum DIDOI_ASPECTVELOCITY =	0x00000200;
58 enum DIDOI_ASPECTACCEL =	0x00000300;
59 enum DIDOI_ASPECTFORCE =	0x00000400;
60 enum DIDOI_ASPECTMASK =	0x00000F00;
61 enum DIDOI_GUIDISUSAGE =	0x00010000;
62 
63 struct DIPROPHEADER {
64     DWORD dwSize;
65     DWORD dwHeaderSize;
66     DWORD dwObj;
67     DWORD dwHow;
68 }
69 alias DIPROPHEADER* LPDIPROPHEADER;
70 alias const(DIPROPHEADER)* LPCDIPROPHEADER;
71 
72 enum DIPH_DEVICE =	0;
73 enum DIPH_BYOFFSET =	1;
74 enum DIPH_BYID =	2;
75 enum DIPH_BYUSAGE =	3;
76 
77 struct DIPROPDWORD {
78 	DIPROPHEADER diph;
79 	DWORD dwData;
80 }
81 alias DIPROPDWORD* LPDIPROPDWORD;
82 alias const(DIPROPDWORD)* LPCDIPROPDWORD;
83 
84 struct DIPROPRANGE {
85 	DIPROPHEADER diph;
86 	LONG lMin;
87 	LONG lMax;
88 }
89 alias DIPROPRANGE* LPDIPROPRANGE;
90 alias const(DIPROPRANGE)* LPCDIPROPRANGE;
91 
92 enum DIPROPRANGE_NOMIN = cast(LONG) 0x80000000;
93 enum DIPROPRANGE_NOMAX = cast(LONG) 0x7FFFFFFF;
94 
95 struct DIPROPCAL {
96 	DIPROPHEADER diph;
97 	LONG lMin;
98 	LONG lCenter;
99 	LONG lMax;
100 }
101 alias DIPROPCAL* LPDIPROPCAL;
102 alias const(DIPROPCAL)* LPCDIPROPCAL;
103 
104 struct DIPROPCALPOV {
105 	DIPROPHEADER diph;
106 	LONG[5] lMin;
107 	LONG[5] lMax;
108 }
109 alias DIPROPCALPOV* LPDIPROPCALPOV;
110 alias const(DIPROPCALPOV)* LPCDIPROPCALPOV;
111 
112 struct DIPROPGUIDANDPATH {
113 	DIPROPHEADER diph;
114 	GUID guidClass;
115 	WCHAR[MAX_PATH] wszPath;
116 }
117 alias DIPROPGUIDANDPATH* LPDIPROPGUIDANDPATH;
118 alias const(DIPROPGUIDANDPATH)* LPCDIPROPGUIDANDPATH;
119 
120 struct DIPROPSTRING {
121         DIPROPHEADER diph;
122         WCHAR[MAX_PATH] wsz;
123 }
124 alias DIPROPSTRING* LPDIPROPSTRING;
125 alias const(DIPROPSTRING)* LPCDIPROPSTRING;
126 
127 struct DIPROPPOINTER {
128 	DIPROPHEADER diph;
129 	UINT_PTR uData;
130 }/+alias DIPROPPOINTER DIPROPPOINTER;+/alias DIPROPPOINTER* LPDIPROPPOINTER;
131 alias const(DIPROPPOINTER)* LPCDIPROPPOINTER;
132 
133 auto MAKEDIPROP(int prop) {return cast(REFGUID) prop;}
134 
135 enum DIPROP_BUFFERSIZE =	MAKEDIPROP(1);
136 enum DIPROP_AXISMODE =		MAKEDIPROP(2);
137 
138 enum DIPROPAXISMODE_ABS =	0;
139 enum DIPROPAXISMODE_REL =	1;
140 
141 enum DIPROP_GRANULARITY =	MAKEDIPROP(3);
142 enum DIPROP_RANGE =		MAKEDIPROP(4);
143 enum DIPROP_DEADZONE =		MAKEDIPROP(5);
144 enum DIPROP_SATURATION =	MAKEDIPROP(6);
145 enum DIPROP_FFGAIN =		MAKEDIPROP(7);
146 enum DIPROP_FFLOAD =		MAKEDIPROP(8);
147 enum DIPROP_AUTOCENTER =	MAKEDIPROP(9);
148 
149 enum DIPROPAUTOCENTER_OFF =	0;
150 enum DIPROPAUTOCENTER_ON =	1;
151 
152 enum DIPROP_CALIBRATIONMODE =	MAKEDIPROP(10);
153 
154 enum DIPROPCALIBRATIONMODE_COOKED =	0;
155 enum DIPROPCALIBRATIONMODE_RAW =	1;
156 
157 enum DIPROP_CALIBRATION =	MAKEDIPROP(11);
158 enum DIPROP_GUIDANDPATH =	MAKEDIPROP(12);
159 enum DIPROP_INSTANCENAME =	MAKEDIPROP(13);
160 enum DIPROP_PRODUCTNAME =	MAKEDIPROP(14);
161 
162 enum DIPROP_JOYSTICKID =	MAKEDIPROP(15);
163 enum DIPROP_GETPORTDISPLAYNAME =	MAKEDIPROP(16);
164 
165 enum DIPROP_PHYSICALRANGE =	MAKEDIPROP(18);
166 enum DIPROP_LOGICALRANGE =	MAKEDIPROP(19);
167 
168 enum DIPROP_KEYNAME =		MAKEDIPROP(20);
169 enum DIPROP_CPOINTS =		MAKEDIPROP(21);
170 enum DIPROP_APPDATA =		MAKEDIPROP(22);
171 enum DIPROP_SCANCODE =		MAKEDIPROP(23);
172 enum DIPROP_VIDPID =		MAKEDIPROP(24);
173 enum DIPROP_USERNAME =		MAKEDIPROP(25);
174 enum DIPROP_TYPENAME =		MAKEDIPROP(26);
175 
176 enum MAXCPOINTSNUM =		8;
177 
178 struct _CPOINT {
179     LONG lP;
180     DWORD dwLog;
181 }alias _CPOINT CPOINT;alias _CPOINT* PCPOINT;
182 
183 struct DIPROPCPOINTS {
184     DIPROPHEADER diph;
185     DWORD dwCPointsNum;
186     CPOINT[MAXCPOINTSNUM] cp;
187 }/+alias DIPROPCPOINTS DIPROPCPOINTS;+/alias DIPROPCPOINTS* LPDIPROPCPOINTS;
188 alias const(DIPROPCPOINTS)* LPCDIPROPCPOINTS;
189 
190 /* Device FF flags */
191 enum DISFFC_RESET =            0x00000001;
192 enum DISFFC_STOPALL =          0x00000002;
193 enum DISFFC_PAUSE =            0x00000004;
194 enum DISFFC_CONTINUE =         0x00000008;
195 enum DISFFC_SETACTUATORSON =   0x00000010;
196 enum DISFFC_SETACTUATORSOFF =  0x00000020;
197 
198 enum DIGFFS_EMPTY =            0x00000001;
199 enum DIGFFS_STOPPED =          0x00000002;
200 enum DIGFFS_PAUSED =           0x00000004;
201 enum DIGFFS_ACTUATORSON =      0x00000010;
202 enum DIGFFS_ACTUATORSOFF =     0x00000020;
203 enum DIGFFS_POWERON =          0x00000040;
204 enum DIGFFS_POWEROFF =         0x00000080;
205 enum DIGFFS_SAFETYSWITCHON =   0x00000100;
206 enum DIGFFS_SAFETYSWITCHOFF =  0x00000200;
207 enum DIGFFS_USERFFSWITCHON =   0x00000400;
208 enum DIGFFS_USERFFSWITCHOFF =  0x00000800;
209 enum DIGFFS_DEVICELOST =       0x80000000;
210 
211 /* Effect flags */
212 enum DIEFT_ALL =		0x00000000;
213 
214 enum DIEFT_CONSTANTFORCE =	0x00000001;
215 enum DIEFT_RAMPFORCE =		0x00000002;
216 enum DIEFT_PERIODIC =		0x00000003;
217 enum DIEFT_CONDITION =		0x00000004;
218 enum DIEFT_CUSTOMFORCE =	0x00000005;
219 enum DIEFT_HARDWARE =		0x000000FF;
220 enum DIEFT_FFATTACK =		0x00000200;
221 enum DIEFT_FFFADE =		0x00000400;
222 enum DIEFT_SATURATION =	0x00000800;
223 enum DIEFT_POSNEGCOEFFICIENTS = 0x00001000;
224 enum DIEFT_POSNEGSATURATION =	0x00002000;
225 enum DIEFT_DEADBAND =		0x00004000;
226 enum DIEFT_STARTDELAY =	0x00008000;
227 alias DIEFT_GETTYPE = LOBYTE; //auto DIEFT_GETTYPE(T)(T n) {return LOBYTE(n);}
228 
229 enum DIEFF_OBJECTIDS =         0x00000001;
230 enum DIEFF_OBJECTOFFSETS =     0x00000002;
231 enum DIEFF_CARTESIAN =         0x00000010;
232 enum DIEFF_POLAR =             0x00000020;
233 enum DIEFF_SPHERICAL =         0x00000040;
234 
235 enum DIEP_DURATION =           0x00000001;
236 enum DIEP_SAMPLEPERIOD =       0x00000002;
237 enum DIEP_GAIN =               0x00000004;
238 enum DIEP_TRIGGERBUTTON =      0x00000008;
239 enum DIEP_TRIGGERREPEATINTERVAL = 0x00000010;
240 enum DIEP_AXES =               0x00000020;
241 enum DIEP_DIRECTION =          0x00000040;
242 enum DIEP_ENVELOPE =           0x00000080;
243 enum DIEP_TYPESPECIFICPARAMS = 0x00000100;
244 enum DIEP_STARTDELAY =         0x00000200;
245 enum DIEP_ALLPARAMS_DX5 =      0x000001FF;
246 enum DIEP_ALLPARAMS =          0x000003FF;
247 enum DIEP_START =              0x20000000;
248 enum DIEP_NORESTART =          0x40000000;
249 enum DIEP_NODOWNLOAD =         0x80000000;
250 enum DIEB_NOTRIGGER =          0xFFFFFFFF;
251 
252 enum DIES_SOLO =               0x00000001;
253 enum DIES_NODOWNLOAD =         0x80000000;
254 
255 enum DIEGES_PLAYING =          0x00000001;
256 enum DIEGES_EMULATED =         0x00000002;
257 
258 enum DI_DEGREES =		100;
259 enum DI_FFNOMINALMAX =		10000;
260 enum DI_SECONDS =		1000000;
261 
262 struct DICONSTANTFORCE {
263 	LONG lMagnitude;
264 }
265 alias DICONSTANTFORCE* LPDICONSTANTFORCE;
266 alias const(DICONSTANTFORCE)* LPCDICONSTANTFORCE;
267 
268 struct DIRAMPFORCE {
269 	LONG lStart;
270 	LONG lEnd;
271 }
272 alias DIRAMPFORCE* LPDIRAMPFORCE;
273 alias const(DIRAMPFORCE)* LPCDIRAMPFORCE;
274 
275 struct DIPERIODIC {
276 	DWORD dwMagnitude;
277 	LONG lOffset;
278 	DWORD dwPhase;
279 	DWORD dwPeriod;
280 }
281 alias DIPERIODIC* LPDIPERIODIC;
282 alias const(DIPERIODIC)* LPCDIPERIODIC;
283 
284 struct DICONDITION {
285 	LONG lOffset;
286 	LONG lPositiveCoefficient;
287 	LONG lNegativeCoefficient;
288 	DWORD dwPositiveSaturation;
289 	DWORD dwNegativeSaturation;
290 	LONG lDeadBand;
291 }
292 alias DICONDITION* LPDICONDITION;
293 alias const(DICONDITION)* LPCDICONDITION;
294 
295 struct DICUSTOMFORCE {
296 	DWORD cChannels;
297 	DWORD dwSamplePeriod;
298 	DWORD cSamples;
299 	LPLONG rglForceData;
300 }
301 alias DICUSTOMFORCE* LPDICUSTOMFORCE;
302 alias const(DICUSTOMFORCE)* LPCDICUSTOMFORCE;
303 
304 struct DIENVELOPE {
305 	DWORD dwSize;
306 	DWORD dwAttackLevel;
307 	DWORD dwAttackTime;
308 	DWORD dwFadeLevel;
309 	DWORD dwFadeTime;
310 }
311 alias DIENVELOPE* LPDIENVELOPE;
312 alias const(DIENVELOPE)* LPCDIENVELOPE;
313 
314 struct DIEFFECT_DX5 {
315 	DWORD dwSize;
316 	DWORD dwFlags;
317 	DWORD dwDuration;
318 	DWORD dwSamplePeriod;
319 	DWORD dwGain;
320 	DWORD dwTriggerButton;
321 	DWORD dwTriggerRepeatInterval;
322 	DWORD cAxes;
323 	LPDWORD rgdwAxes;
324 	LPLONG rglDirection;
325 	LPDIENVELOPE lpEnvelope;
326 	DWORD cbTypeSpecificParams;
327 	LPVOID lpvTypeSpecificParams;
328 }
329 alias DIEFFECT_DX5* LPDIEFFECT_DX5;
330 alias const(DIEFFECT_DX5)* LPCDIEFFECT_DX5;
331 
332 struct DIEFFECT {
333 	DWORD dwSize;
334 	DWORD dwFlags;
335 	DWORD dwDuration;
336 	DWORD dwSamplePeriod;
337 	DWORD dwGain;
338 	DWORD dwTriggerButton;
339 	DWORD dwTriggerRepeatInterval;
340 	DWORD cAxes;
341 	LPDWORD rgdwAxes;
342 	LPLONG rglDirection;
343 	LPDIENVELOPE lpEnvelope;
344 	DWORD cbTypeSpecificParams;
345 	LPVOID lpvTypeSpecificParams;
346 	DWORD dwStartDelay;
347 }
348 alias DIEFFECT* LPDIEFFECT;
349 alias const(DIEFFECT)* LPCDIEFFECT;
350 alias DIEFFECT DIEFFECT_DX6;
351 alias LPDIEFFECT LPDIEFFECT_DX6;
352 
353 struct DIEFFECTINFOA {
354 	DWORD dwSize;
355 	GUID guid;
356 	DWORD dwEffType;
357 	DWORD dwStaticParams;
358 	DWORD dwDynamicParams;
359 	CHAR[MAX_PATH] tszName;
360 }
361 alias DIEFFECTINFOA* LPDIEFFECTINFOA;
362 alias const(DIEFFECTINFOA)* LPCDIEFFECTINFOA;
363 
364 struct DIEFFECTINFOW {
365 	DWORD dwSize;
366 	GUID guid;
367 	DWORD dwEffType;
368 	DWORD dwStaticParams;
369 	DWORD dwDynamicParams;
370 	WCHAR[MAX_PATH] tszName;
371 }
372 alias DIEFFECTINFOW* LPDIEFFECTINFOW;
373 alias const(DIEFFECTINFOW)* LPCDIEFFECTINFOW;
374 
375 struct DIEFFESCAPE {
376 	DWORD dwSize;
377 	DWORD dwCommand;
378 	LPVOID lpvInBuffer;
379 	DWORD cbInBuffer;
380 	LPVOID lpvOutBuffer;
381 	DWORD cbOutBuffer;
382 }
383 alias DIEFFESCAPE* LPDIEFFESCAPE;
384 
385 struct DIJOYSTATE {
386 	LONG lX;
387 	LONG lY;
388 	LONG lZ;
389 	LONG lRx;
390 	LONG lRy;
391 	LONG lRz;
392 	LONG[2] rglSlider;
393 	DWORD[4] rgdwPOV;
394 	BYTE[32] rgbButtons;
395 }
396 alias DIJOYSTATE* LPDIJOYSTATE;
397 
398 struct DIJOYSTATE2 {
399 	LONG lX;
400 	LONG lY;
401 	LONG lZ;
402 	LONG lRx;
403 	LONG lRy;
404 	LONG lRz;
405 	LONG[2] rglSlider;
406 	DWORD[4] rgdwPOV;
407 	BYTE[128] rgbButtons;
408 	LONG lVX;		/* 'v' as in velocity */
409 	LONG lVY;
410 	LONG lVZ;
411 	LONG lVRx;
412 	LONG lVRy;
413 	LONG lVRz;
414 	LONG[2] rglVSlider;
415 	LONG lAX;		/* 'a' as in acceleration */
416 	LONG lAY;
417 	LONG lAZ;
418 	LONG lARx;
419 	LONG lARy;
420 	LONG lARz;
421 	LONG[2] rglASlider;
422 	LONG lFX;		/* 'f' as in force */
423 	LONG lFY;
424 	LONG lFZ;
425 	LONG lFRx;		/* 'fr' as in rotational force aka torque */
426 	LONG lFRy;
427 	LONG lFRz;
428 	LONG[2] rglFSlider;
429 }
430 alias DIJOYSTATE2* LPDIJOYSTATE2;
431 
432 enum DIJOFS_X =		DIJOYSTATE.lX.offsetof;
433 enum DIJOFS_Y =		DIJOYSTATE.lY.offsetof;
434 enum DIJOFS_Z =		DIJOYSTATE.lZ.offsetof;
435 enum DIJOFS_RX =	DIJOYSTATE.lRx.offsetof;
436 enum DIJOFS_RY =	DIJOYSTATE.lRy.offsetof;
437 enum DIJOFS_RZ =	DIJOYSTATE.lRz.offsetof;
438 pragma(inline, true) extern(D) int DIJOFS_SLIDER(int n) {return cast(int) (DIJOYSTATE.rglSlider.offsetof + n * LONG.sizeof);}
439 pragma(inline, true) extern(D) int DIJOFS_POV(int n)    {return cast(int) (DIJOYSTATE.rgdwPOV.offsetof + n * DWORD.sizeof);}
440 pragma(inline, true) extern(D) int DIJOFS_BUTTON(int n) {return cast(int) (DIJOYSTATE.rgbButtons.offsetof + n);}
441 enum DIJOFS_BUTTON0 =		DIJOFS_BUTTON(0);
442 enum DIJOFS_BUTTON1 =		DIJOFS_BUTTON(1);
443 enum DIJOFS_BUTTON2 =		DIJOFS_BUTTON(2);
444 enum DIJOFS_BUTTON3 =		DIJOFS_BUTTON(3);
445 enum DIJOFS_BUTTON4 =		DIJOFS_BUTTON(4);
446 enum DIJOFS_BUTTON5 =		DIJOFS_BUTTON(5);
447 enum DIJOFS_BUTTON6 =		DIJOFS_BUTTON(6);
448 enum DIJOFS_BUTTON7 =		DIJOFS_BUTTON(7);
449 enum DIJOFS_BUTTON8 =		DIJOFS_BUTTON(8);
450 enum DIJOFS_BUTTON9 =		DIJOFS_BUTTON(9);
451 enum DIJOFS_BUTTON10 =		DIJOFS_BUTTON(10);
452 enum DIJOFS_BUTTON11 =		DIJOFS_BUTTON(11);
453 enum DIJOFS_BUTTON12 =		DIJOFS_BUTTON(12);
454 enum DIJOFS_BUTTON13 =		DIJOFS_BUTTON(13);
455 enum DIJOFS_BUTTON14 =		DIJOFS_BUTTON(14);
456 enum DIJOFS_BUTTON15 =		DIJOFS_BUTTON(15);
457 enum DIJOFS_BUTTON16 =		DIJOFS_BUTTON(16);
458 enum DIJOFS_BUTTON17 =		DIJOFS_BUTTON(17);
459 enum DIJOFS_BUTTON18 =		DIJOFS_BUTTON(18);
460 enum DIJOFS_BUTTON19 =		DIJOFS_BUTTON(19);
461 enum DIJOFS_BUTTON20 =		DIJOFS_BUTTON(20);
462 enum DIJOFS_BUTTON21 =		DIJOFS_BUTTON(21);
463 enum DIJOFS_BUTTON22 =		DIJOFS_BUTTON(22);
464 enum DIJOFS_BUTTON23 =		DIJOFS_BUTTON(23);
465 enum DIJOFS_BUTTON24 =		DIJOFS_BUTTON(24);
466 enum DIJOFS_BUTTON25 =		DIJOFS_BUTTON(25);
467 enum DIJOFS_BUTTON26 =		DIJOFS_BUTTON(26);
468 enum DIJOFS_BUTTON27 =		DIJOFS_BUTTON(27);
469 enum DIJOFS_BUTTON28 =		DIJOFS_BUTTON(28);
470 enum DIJOFS_BUTTON29 =		DIJOFS_BUTTON(29);
471 enum DIJOFS_BUTTON30 =		DIJOFS_BUTTON(30);
472 enum DIJOFS_BUTTON31 =		DIJOFS_BUTTON(31);
473 
474 enum DIK_ESCAPE =          0x01;
475 enum DIK_1 =               0x02;
476 enum DIK_2 =               0x03;
477 enum DIK_3 =               0x04;
478 enum DIK_4 =               0x05;
479 enum DIK_5 =               0x06;
480 enum DIK_6 =               0x07;
481 enum DIK_7 =               0x08;
482 enum DIK_8 =               0x09;
483 enum DIK_9 =               0x0A;
484 enum DIK_0 =               0x0B;
485 enum DIK_MINUS =           0x0C    /* - on main keyboard */;
486 enum DIK_EQUALS =          0x0D;
487 enum DIK_BACK =            0x0E    /* backspace */;
488 enum DIK_TAB =             0x0F;
489 enum DIK_Q =               0x10;
490 enum DIK_W =               0x11;
491 enum DIK_E =               0x12;
492 enum DIK_R =               0x13;
493 enum DIK_T =               0x14;
494 enum DIK_Y =               0x15;
495 enum DIK_U =               0x16;
496 enum DIK_I =               0x17;
497 enum DIK_O =               0x18;
498 enum DIK_P =               0x19;
499 enum DIK_LBRACKET =        0x1A;
500 enum DIK_RBRACKET =        0x1B;
501 enum DIK_RETURN =          0x1C    /* Enter on main keyboard */;
502 enum DIK_LCONTROL =        0x1D;
503 enum DIK_A =               0x1E;
504 enum DIK_S =               0x1F;
505 enum DIK_D =               0x20;
506 enum DIK_F =               0x21;
507 enum DIK_G =               0x22;
508 enum DIK_H =               0x23;
509 enum DIK_J =               0x24;
510 enum DIK_K =               0x25;
511 enum DIK_L =               0x26;
512 enum DIK_SEMICOLON =       0x27;
513 enum DIK_APOSTROPHE =      0x28;
514 enum DIK_GRAVE =           0x29    /* accent grave */;
515 enum DIK_LSHIFT =          0x2A;
516 enum DIK_BACKSLASH =       0x2B;
517 enum DIK_Z =               0x2C;
518 enum DIK_X =               0x2D;
519 enum DIK_C =               0x2E;
520 enum DIK_V =               0x2F;
521 enum DIK_B =               0x30;
522 enum DIK_N =               0x31;
523 enum DIK_M =               0x32;
524 enum DIK_COMMA =           0x33;
525 enum DIK_PERIOD =          0x34    /* . on main keyboard */;
526 enum DIK_SLASH =           0x35    /* / on main keyboard */;
527 enum DIK_RSHIFT =          0x36;
528 enum DIK_MULTIPLY =        0x37    /* * on numeric keypad */;
529 enum DIK_LMENU =           0x38    /* left Alt */;
530 enum DIK_SPACE =           0x39;
531 enum DIK_CAPITAL =         0x3A;
532 enum DIK_F1 =              0x3B;
533 enum DIK_F2 =              0x3C;
534 enum DIK_F3 =              0x3D;
535 enum DIK_F4 =              0x3E;
536 enum DIK_F5 =              0x3F;
537 enum DIK_F6 =              0x40;
538 enum DIK_F7 =              0x41;
539 enum DIK_F8 =              0x42;
540 enum DIK_F9 =              0x43;
541 enum DIK_F10 =             0x44;
542 enum DIK_NUMLOCK =         0x45;
543 enum DIK_SCROLL =          0x46    /* Scroll Lock */;
544 enum DIK_NUMPAD7 =         0x47;
545 enum DIK_NUMPAD8 =         0x48;
546 enum DIK_NUMPAD9 =         0x49;
547 enum DIK_SUBTRACT =        0x4A    /* - on numeric keypad */;
548 enum DIK_NUMPAD4 =         0x4B;
549 enum DIK_NUMPAD5 =         0x4C;
550 enum DIK_NUMPAD6 =         0x4D;
551 enum DIK_ADD =             0x4E    /* + on numeric keypad */;
552 enum DIK_NUMPAD1 =         0x4F;
553 enum DIK_NUMPAD2 =         0x50;
554 enum DIK_NUMPAD3 =         0x51;
555 enum DIK_NUMPAD0 =         0x52;
556 enum DIK_DECIMAL =         0x53    /* . on numeric keypad */;
557 enum DIK_OEM_102 =         0x56    /* < > | on UK/Germany keyboards */;
558 enum DIK_F11 =             0x57;
559 enum DIK_F12 =             0x58;
560 enum DIK_F13 =             0x64    /*                     (NEC PC98) */;
561 enum DIK_F14 =             0x65    /*                     (NEC PC98) */;
562 enum DIK_F15 =             0x66    /*                     (NEC PC98) */;
563 enum DIK_KANA =            0x70    /* (Japanese keyboard)            */;
564 enum DIK_ABNT_C1 =         0x73    /* / ? on Portugese (Brazilian) keyboards */;
565 enum DIK_CONVERT =         0x79    /* (Japanese keyboard)            */;
566 enum DIK_NOCONVERT =       0x7B    /* (Japanese keyboard)            */;
567 enum DIK_YEN =             0x7D    /* (Japanese keyboard)            */;
568 enum DIK_ABNT_C2 =         0x7E    /* Numpad . on Portugese (Brazilian) keyboards */;
569 enum DIK_NUMPADEQUALS =    0x8D    /* = on numeric keypad (NEC PC98) */;
570 enum DIK_CIRCUMFLEX =      0x90    /* (Japanese keyboard)            */;
571 enum DIK_AT =              0x91    /*                     (NEC PC98) */;
572 enum DIK_COLON =           0x92    /*                     (NEC PC98) */;
573 enum DIK_UNDERLINE =       0x93    /*                     (NEC PC98) */;
574 enum DIK_KANJI =           0x94    /* (Japanese keyboard)            */;
575 enum DIK_STOP =            0x95    /*                     (NEC PC98) */;
576 enum DIK_AX =              0x96    /*                     (Japan AX) */;
577 enum DIK_UNLABELED =       0x97    /*                        (J3100) */;
578 enum DIK_NEXTTRACK =       0x99    /* Next Track */;
579 enum DIK_NUMPADENTER =     0x9C    /* Enter on numeric keypad */;
580 enum DIK_RCONTROL =        0x9D;
581 enum DIK_MUTE =	    0xA0    /* Mute */;
582 enum DIK_CALCULATOR =      0xA1    /* Calculator */;
583 enum DIK_PLAYPAUSE =       0xA2    /* Play / Pause */;
584 enum DIK_MEDIASTOP =       0xA4    /* Media Stop */;
585 enum DIK_VOLUMEDOWN =      0xAE    /* Volume - */;
586 enum DIK_VOLUMEUP =        0xB0    /* Volume + */;
587 enum DIK_WEBHOME =         0xB2    /* Web home */;
588 enum DIK_NUMPADCOMMA =     0xB3    /* , on numeric keypad (NEC PC98) */;
589 enum DIK_DIVIDE =          0xB5    /* / on numeric keypad */;
590 enum DIK_SYSRQ =           0xB7;
591 enum DIK_RMENU =           0xB8    /* right Alt */;
592 enum DIK_PAUSE =           0xC5    /* Pause */;
593 enum DIK_HOME =            0xC7    /* Home on arrow keypad */;
594 enum DIK_UP =              0xC8    /* UpArrow on arrow keypad */;
595 enum DIK_PRIOR =           0xC9    /* PgUp on arrow keypad */;
596 enum DIK_LEFT =            0xCB    /* LeftArrow on arrow keypad */;
597 enum DIK_RIGHT =           0xCD    /* RightArrow on arrow keypad */;
598 enum DIK_END =             0xCF    /* End on arrow keypad */;
599 enum DIK_DOWN =            0xD0    /* DownArrow on arrow keypad */;
600 enum DIK_NEXT =            0xD1    /* PgDn on arrow keypad */;
601 enum DIK_INSERT =          0xD2    /* Insert on arrow keypad */;
602 enum DIK_DELETE =          0xD3    /* Delete on arrow keypad */;
603 enum DIK_LWIN =            0xDB    /* Left Windows key */;
604 enum DIK_RWIN =            0xDC    /* Right Windows key */;
605 enum DIK_APPS =            0xDD    /* AppMenu key */;
606 enum DIK_POWER =           0xDE;
607 enum DIK_SLEEP =           0xDF;
608 enum DIK_WAKE =            0xE3    /* System Wake */;
609 enum DIK_WEBSEARCH =       0xE5    /* Web Search */;
610 enum DIK_WEBFAVORITES =    0xE6    /* Web Favorites */;
611 enum DIK_WEBREFRESH =      0xE7    /* Web Refresh */;
612 enum DIK_WEBSTOP =         0xE8    /* Web Stop */;
613 enum DIK_WEBFORWARD =      0xE9    /* Web Forward */;
614 enum DIK_WEBBACK =         0xEA    /* Web Back */;
615 enum DIK_MYCOMPUTER =      0xEB    /* My Computer */;
616 enum DIK_MAIL =            0xEC    /* Mail */;
617 enum DIK_MEDIASELECT =     0xED    /* Media Select */;
618 
619 enum DIK_BACKSPACE =       DIK_BACK            /* backspace */;
620 enum DIK_NUMPADSTAR =      DIK_MULTIPLY        /* * on numeric keypad */;
621 enum DIK_LALT =            DIK_LMENU           /* left Alt */;
622 enum DIK_CAPSLOCK =        DIK_CAPITAL         /* CapsLock */;
623 enum DIK_NUMPADMINUS =     DIK_SUBTRACT        /* - on numeric keypad */;
624 enum DIK_NUMPADPLUS =      DIK_ADD             /* + on numeric keypad */;
625 enum DIK_NUMPADPERIOD =    DIK_DECIMAL         /* . on numeric keypad */;
626 enum DIK_NUMPADSLASH =     DIK_DIVIDE          /* / on numeric keypad */;
627 enum DIK_RALT =            DIK_RMENU           /* right Alt */;
628 enum DIK_UPARROW =         DIK_UP              /* UpArrow on arrow keypad */;
629 enum DIK_PGUP =            DIK_PRIOR           /* PgUp on arrow keypad */;
630 enum DIK_LEFTARROW =       DIK_LEFT            /* LeftArrow on arrow keypad */;
631 enum DIK_RIGHTARROW =      DIK_RIGHT           /* RightArrow on arrow keypad */;
632 enum DIK_DOWNARROW =       DIK_DOWN            /* DownArrow on arrow keypad */;
633 enum DIK_PGDN =            DIK_NEXT            /* PgDn on arrow keypad */;
634 
635 enum DIDFT_ALL =		0x00000000;
636 enum DIDFT_RELAXIS =		0x00000001;
637 enum DIDFT_ABSAXIS =		0x00000002;
638 enum DIDFT_AXIS =		0x00000003;
639 enum DIDFT_PSHBUTTON =		0x00000004;
640 enum DIDFT_TGLBUTTON =		0x00000008;
641 enum DIDFT_BUTTON =		0x0000000C;
642 enum DIDFT_POV =		0x00000010;
643 enum DIDFT_COLLECTION =	0x00000040;
644 enum DIDFT_NODATA =		0x00000080;
645 enum DIDFT_ANYINSTANCE =	0x00FFFF00;
646 enum DIDFT_INSTANCEMASK =	DIDFT_ANYINSTANCE;
647 
648 enum DIERR_INSUFFICIENTPRIVS =         0x80040200L;
649 enum DIERR_DEVICEFULL =                0x80040201L;
650 enum DIERR_MOREDATA =                  0x80040202L;
651 enum DIERR_NOTDOWNLOADED =             0x80040203L;
652 enum DIERR_HASEFFECTS =                0x80040204L;
653 enum DIERR_NOTEXCLUSIVEACQUIRED =      0x80040205L;
654 enum DIERR_INCOMPLETEEFFECT =          0x80040206L;
655 enum DIERR_NOTBUFFERED =               0x80040207L;
656 enum DIERR_EFFECTPLAYING =             0x80040208L;
657 enum DIERR_UNPLUGGED =                 0x80040209L;
658 enum DIERR_REPORTFULL =                0x8004020AL;
659 enum DIERR_MAPFILEFAIL =               0x8004020BL;
660 
661 enum DIENUM_STOP =                     0;
662 enum DIENUM_CONTINUE =                 1;
663 
664 enum DIEDFL_ALLDEVICES =               0x00000000;
665 enum DIEDFL_ATTACHEDONLY =             0x00000001;
666 enum DIEDFL_FORCEFEEDBACK =            0x00000100;
667 enum DIEDFL_INCLUDEALIASES =           0x00010000;
668 enum DIEDFL_INCLUDEPHANTOMS =          0x00020000;
669 enum DIEDFL_INCLUDEHIDDEN =		0x00040000;
670 
671 enum DIDEVTYPE_DEVICE =                1;
672 enum DIDEVTYPE_MOUSE =                 2;
673 enum DIDEVTYPE_KEYBOARD =              3;
674 enum DIDEVTYPE_JOYSTICK =              4;
675 enum DIDEVTYPE_HID =                   0x00010000;
676 
677 enum DI8DEVCLASS_ALL =             0;
678 enum DI8DEVCLASS_DEVICE =          1;
679 enum DI8DEVCLASS_POINTER =         2;
680 enum DI8DEVCLASS_KEYBOARD =        3;
681 enum DI8DEVCLASS_GAMECTRL =        4;
682 
683 enum DI8DEVTYPE_DEVICE =           0x11;
684 enum DI8DEVTYPE_MOUSE =            0x12;
685 enum DI8DEVTYPE_KEYBOARD =         0x13;
686 enum DI8DEVTYPE_JOYSTICK =         0x14;
687 enum DI8DEVTYPE_GAMEPAD =          0x15;
688 enum DI8DEVTYPE_DRIVING =          0x16;
689 enum DI8DEVTYPE_FLIGHT =           0x17;
690 enum DI8DEVTYPE_1STPERSON =        0x18;
691 enum DI8DEVTYPE_DEVICECTRL =       0x19;
692 enum DI8DEVTYPE_SCREENPOINTER =    0x1A;
693 enum DI8DEVTYPE_REMOTE =           0x1B;
694 enum DI8DEVTYPE_SUPPLEMENTAL =     0x1C;
695 
696 enum DIDEVTYPEMOUSE_UNKNOWN =          1;
697 enum DIDEVTYPEMOUSE_TRADITIONAL =      2;
698 enum DIDEVTYPEMOUSE_FINGERSTICK =      3;
699 enum DIDEVTYPEMOUSE_TOUCHPAD =         4;
700 enum DIDEVTYPEMOUSE_TRACKBALL =        5;
701 
702 enum DIDEVTYPEKEYBOARD_UNKNOWN =       0;
703 enum DIDEVTYPEKEYBOARD_PCXT =          1;
704 enum DIDEVTYPEKEYBOARD_OLIVETTI =      2;
705 enum DIDEVTYPEKEYBOARD_PCAT =          3;
706 enum DIDEVTYPEKEYBOARD_PCENH =         4;
707 enum DIDEVTYPEKEYBOARD_NOKIA1050 =     5;
708 enum DIDEVTYPEKEYBOARD_NOKIA9140 =     6;
709 enum DIDEVTYPEKEYBOARD_NEC98 =         7;
710 enum DIDEVTYPEKEYBOARD_NEC98LAPTOP =   8;
711 enum DIDEVTYPEKEYBOARD_NEC98106 =      9;
712 enum DIDEVTYPEKEYBOARD_JAPAN106 =     10;
713 enum DIDEVTYPEKEYBOARD_JAPANAX =      11;
714 enum DIDEVTYPEKEYBOARD_J3100 =        12;
715 
716 enum DIDEVTYPEJOYSTICK_UNKNOWN =       1;
717 enum DIDEVTYPEJOYSTICK_TRADITIONAL =   2;
718 enum DIDEVTYPEJOYSTICK_FLIGHTSTICK =   3;
719 enum DIDEVTYPEJOYSTICK_GAMEPAD =       4;
720 enum DIDEVTYPEJOYSTICK_RUDDER =        5;
721 enum DIDEVTYPEJOYSTICK_WHEEL =         6;
722 enum DIDEVTYPEJOYSTICK_HEADTRACKER =   7;
723 
724 enum DI8DEVTYPEMOUSE_UNKNOWN =                     1;
725 enum DI8DEVTYPEMOUSE_TRADITIONAL =                 2;
726 enum DI8DEVTYPEMOUSE_FINGERSTICK =                 3;
727 enum DI8DEVTYPEMOUSE_TOUCHPAD =                    4;
728 enum DI8DEVTYPEMOUSE_TRACKBALL =                   5;
729 enum DI8DEVTYPEMOUSE_ABSOLUTE =                    6;
730 
731 enum DI8DEVTYPEKEYBOARD_UNKNOWN =                  0;
732 enum DI8DEVTYPEKEYBOARD_PCXT =                     1;
733 enum DI8DEVTYPEKEYBOARD_OLIVETTI =                 2;
734 enum DI8DEVTYPEKEYBOARD_PCAT =                     3;
735 enum DI8DEVTYPEKEYBOARD_PCENH =                    4;
736 enum DI8DEVTYPEKEYBOARD_NOKIA1050 =                5;
737 enum DI8DEVTYPEKEYBOARD_NOKIA9140 =                6;
738 enum DI8DEVTYPEKEYBOARD_NEC98 =                    7;
739 enum DI8DEVTYPEKEYBOARD_NEC98LAPTOP =              8;
740 enum DI8DEVTYPEKEYBOARD_NEC98106 =                 9;
741 enum DI8DEVTYPEKEYBOARD_JAPAN106 =                10;
742 enum DI8DEVTYPEKEYBOARD_JAPANAX =                 11;
743 enum DI8DEVTYPEKEYBOARD_J3100 =                   12;
744 
745 enum DI8DEVTYPE_LIMITEDGAMESUBTYPE =               1;
746 
747 enum DI8DEVTYPEJOYSTICK_LIMITED =                  DI8DEVTYPE_LIMITEDGAMESUBTYPE;
748 enum DI8DEVTYPEJOYSTICK_STANDARD =                 2;
749 
750 enum DI8DEVTYPEGAMEPAD_LIMITED =                   DI8DEVTYPE_LIMITEDGAMESUBTYPE;
751 enum DI8DEVTYPEGAMEPAD_STANDARD =                  2;
752 enum DI8DEVTYPEGAMEPAD_TILT =                      3;
753 
754 enum DI8DEVTYPEDRIVING_LIMITED =                   DI8DEVTYPE_LIMITEDGAMESUBTYPE;
755 enum DI8DEVTYPEDRIVING_COMBINEDPEDALS =            2;
756 enum DI8DEVTYPEDRIVING_DUALPEDALS =                3;
757 enum DI8DEVTYPEDRIVING_THREEPEDALS =               4;
758 enum DI8DEVTYPEDRIVING_HANDHELD =                  5;
759 
760 enum DI8DEVTYPEFLIGHT_LIMITED =                    DI8DEVTYPE_LIMITEDGAMESUBTYPE;
761 enum DI8DEVTYPEFLIGHT_STICK =                      2;
762 enum DI8DEVTYPEFLIGHT_YOKE =                       3;
763 enum DI8DEVTYPEFLIGHT_RC =                         4;
764 
765 enum DI8DEVTYPE1STPERSON_LIMITED =                 DI8DEVTYPE_LIMITEDGAMESUBTYPE;
766 enum DI8DEVTYPE1STPERSON_UNKNOWN =                 2;
767 enum DI8DEVTYPE1STPERSON_SIXDOF =                  3;
768 enum DI8DEVTYPE1STPERSON_SHOOTER =                 4;
769 
770 enum DI8DEVTYPESCREENPTR_UNKNOWN =                 2;
771 enum DI8DEVTYPESCREENPTR_LIGHTGUN =                3;
772 enum DI8DEVTYPESCREENPTR_LIGHTPEN =                4;
773 enum DI8DEVTYPESCREENPTR_TOUCH =                   5;
774 
775 enum DI8DEVTYPEREMOTE_UNKNOWN =                    2;
776 
777 enum DI8DEVTYPEDEVICECTRL_UNKNOWN =                2;
778 enum DI8DEVTYPEDEVICECTRL_COMMSSELECTION =         3;
779 enum DI8DEVTYPEDEVICECTRL_COMMSSELECTION_HARDWIRED = 4;
780 
781 enum DI8DEVTYPESUPPLEMENTAL_UNKNOWN =              2;
782 enum DI8DEVTYPESUPPLEMENTAL_2NDHANDCONTROLLER =    3;
783 enum DI8DEVTYPESUPPLEMENTAL_HEADTRACKER =          4;
784 enum DI8DEVTYPESUPPLEMENTAL_HANDTRACKER =          5;
785 enum DI8DEVTYPESUPPLEMENTAL_SHIFTSTICKGATE =       6;
786 enum DI8DEVTYPESUPPLEMENTAL_SHIFTER =              7;
787 enum DI8DEVTYPESUPPLEMENTAL_THROTTLE =             8;
788 enum DI8DEVTYPESUPPLEMENTAL_SPLITTHROTTLE =        9;
789 enum DI8DEVTYPESUPPLEMENTAL_COMBINEDPEDALS =      10;
790 enum DI8DEVTYPESUPPLEMENTAL_DUALPEDALS =          11;
791 enum DI8DEVTYPESUPPLEMENTAL_THREEPEDALS =         12;
792 enum DI8DEVTYPESUPPLEMENTAL_RUDDERPEDALS =        13;
793 
794 struct DIDEVICEINSTANCEW {
795     DWORD dwSize;
796     GUID guidInstance;
797     GUID guidProduct;
798     DWORD dwDevType;
799     WCHAR[MAX_PATH] tszInstanceName;
800     WCHAR[MAX_PATH] tszProductName;
801     GUID guidFFDriver;
802     WORD wUsagePage;
803     WORD wUsage;
804 }
805 alias DIDEVICEINSTANCEW* LPDIDEVICEINSTANCEW;
806 alias const(DIDEVICEINSTANCEW)* LPCDIDEVICEINSTANCEW;
807 
808 alias DIDEVICEINSTANCE = DIDEVICEINSTANCEW;
809 
810 enum DI_OK =                           S_OK;
811 enum DI_NOTATTACHED =                  S_FALSE;
812 enum DI_BUFFEROVERFLOW =               S_FALSE;
813 enum DI_PROPNOEFFECT =                 S_FALSE;
814 enum DI_NOEFFECT =                     S_FALSE;
815 enum DI_POLLEDDEVICE =                 HRESULT(0x0002);
816 enum DI_DOWNLOADSKIPPED =              HRESULT(0x0003);
817 enum DI_EFFECTRESTARTED =              HRESULT(0x0004);
818 enum DI_TRUNCATED =                    HRESULT(0x0008);
819 enum DI_SETTINGSNOTSAVED =             HRESULT(0x000B);
820 enum DI_TRUNCATEDANDRESTARTED =        HRESULT(0x000C);
821 enum DI_WRITEPROTECT =                 HRESULT(0x0013);
822 
823 enum DIERR_OLDDIRECTINPUTVERSION =     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_OLD_WIN_VERSION);
824 enum DIERR_BETADIRECTINPUTVERSION =    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_RMODE_APP);
825 enum DIERR_BADDRIVERVER =              MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BAD_DRIVER_LEVEL);
826 enum DIERR_DEVICENOTREG =              REGDB_E_CLASSNOTREG;
827 enum DIERR_NOTFOUND =                  MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND);
828 enum DIERR_OBJECTNOTFOUND =            MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND);
829 enum DIERR_INVALIDPARAM =              E_INVALIDARG;
830 enum DIERR_NOINTERFACE =               E_NOINTERFACE;
831 enum DIERR_GENERIC =                   E_FAIL;
832 enum DIERR_OUTOFMEMORY =               E_OUTOFMEMORY;
833 enum DIERR_UNSUPPORTED =               E_NOTIMPL;
834 enum DIERR_NOTINITIALIZED =            MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_READY);
835 enum DIERR_ALREADYINITIALIZED =        MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_ALREADY_INITIALIZED);
836 enum DIERR_NOAGGREGATION =             CLASS_E_NOAGGREGATION;
837 enum DIERR_OTHERAPPHASPRIO =           E_ACCESSDENIED;
838 enum DIERR_INPUTLOST =                 MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_READ_FAULT);
839 enum DIERR_ACQUIRED =                  MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BUSY);
840 enum DIERR_NOTACQUIRED =               MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_INVALID_ACCESS);
841 enum DIERR_READONLY =                  E_ACCESSDENIED;
842 enum DIERR_HANDLEEXISTS =              E_ACCESSDENIED;
843 enum E_PENDING =                       0x8000000AL;
844 
845 enum string DIDFT_MAKEINSTANCE(string n) = `	((WORD)(n) << 8)`;
846 auto DIDFT_GETTYPE(T)(T a) {return LOBYTE(cast(ushort) a);}
847 enum string DIDFT_GETINSTANCE(string n) = `	LOWORD((n) >> 8)`;
848 enum DIDFT_FFACTUATOR =	0x01000000;
849 enum DIDFT_FFEFFECTTRIGGER =	0x02000000;
850 enum DIDFT_OUTPUT =		0x10000000;
851 enum DIDFT_VENDORDEFINED =	0x04000000;
852 enum DIDFT_ALIAS =		0x08000000;
853 enum DIDFT_OPTIONAL =		0x80000000;
854 enum string DIDFT_ENUMCOLLECTION(string n) = `	((WORD)(n) << 8)`;
855 enum DIDFT_NOCOLLECTION =	0x00FFFF00;
856 
857 enum DIDF_ABSAXIS =		0x00000001;
858 enum DIDF_RELAXIS =		0x00000002;
859 enum DIGDD_PEEK =		0x00000001;
860 
861 enum string DISEQUENCE_COMPARE(string dwSq1,string cmp,string dwSq2) = ` ((int)((dwSq1) - (dwSq2)) cmp 0)`;
862 
863 struct DIDEVCAPS_DX3 {
864     DWORD dwSize;
865     DWORD dwFlags;
866     DWORD dwDevType;
867     DWORD dwAxes;
868     DWORD dwButtons;
869     DWORD dwPOVs;
870 }
871 alias DIDEVCAPS_DX3* LPDIDEVCAPS_DX3;
872 
873 struct DIDEVCAPS {
874     DWORD dwSize;
875     DWORD dwFlags;
876     DWORD dwDevType;
877     DWORD dwAxes;
878     DWORD dwButtons;
879     DWORD dwPOVs;
880     DWORD dwFFSamplePeriod;
881     DWORD dwFFMinTimeResolution;
882     DWORD dwFirmwareRevision;
883     DWORD dwHardwareRevision;
884     DWORD dwFFDriverVersion;
885 }
886 alias DIDEVCAPS* LPDIDEVCAPS;
887 
888 alias BOOL function(LPCDIDEVICEINSTANCEW, LPDIRECTINPUTDEVICE8W, DWORD, DWORD, LPVOID) LPDIENUMDEVICESBYSEMANTICSCBW;
889 alias LPDIENUMDEVICESBYSEMANTICSCB = LPDIENUMDEVICESBYSEMANTICSCBW;
890 alias LPDICONFIGUREDEVICESCALLBACK = extern(Windows) BOOL function(LPUNKNOWN, LPVOID);
891 alias LPDIENUMDEVICEOBJECTSCALLBACKW = extern(Windows) BOOL function(LPCDIDEVICEOBJECTINSTANCEW, LPVOID);
892 alias LPDIENUMDEVICEOBJECTSCALLBACK = LPDIENUMDEVICEOBJECTSCALLBACKW;
893 alias LPDIENUMEFFECTSCALLBACKW = extern(Windows) BOOL function(LPCDIEFFECTINFOW, LPVOID);
894 alias LPDIENUMDEVICESCALLBACKW = extern(Windows) BOOL function(LPCDIDEVICEINSTANCEW, LPVOID);
895 
896 alias LPDIENUMCREATEDEFFECTOBJECTSCALLBACK = BOOL function(LPDIRECTINPUTEFFECT, LPVOID);
897 
898 struct DIFILEEFFECT {
899 DWORD dwSize;
900 GUID GuidEffect;
901 LPCDIEFFECT lpDiEffect;
902 CHAR[MAX_PATH] szFriendlyName;
903 }
904 alias DIFILEEFFECT* LPDIFILEEFFECT;
905 
906 alias const(DIFILEEFFECT)* LPCDIFILEEFFECT;
907 alias BOOL function(LPCDIFILEEFFECT, LPVOID) LPDIENUMEFFECTSINFILECALLBACK;
908 
909 struct DIDEVICEOBJECTDATA {
910     DWORD dwOfs;
911     DWORD dwData;
912     DWORD dwTimeStamp;
913     DWORD dwSequence;
914     UINT_PTR uAppData;
915 }
916 alias DIDEVICEOBJECTDATA* LPDIDEVICEOBJECTDATA;
917 alias const(DIDEVICEOBJECTDATA)* LPCDIDEVICEOBJECTDATA;
918 
919 struct _DIOBJECTDATAFORMAT {
920     const(GUID)* pguid;
921     DWORD dwOfs;
922     DWORD dwType;
923     DWORD dwFlags;
924 }
925 alias _DIOBJECTDATAFORMAT DIOBJECTDATAFORMAT;
926 alias _DIOBJECTDATAFORMAT* LPDIOBJECTDATAFORMAT;
927 alias const(DIOBJECTDATAFORMAT)* LPCDIOBJECTDATAFORMAT;
928 
929 // D interfaces are pointers (so LP prefix)
930 alias LPDIRECTINPUTW = IDirectInputW;
931 alias LPDIRECTINPUT8W = IDirectInput8W;
932 alias LPDIRECTINPUTDEVICEW = IDirectInputDeviceW;
933 alias LPDIRECTINPUTDEVICE8W = IDirectInputDevice8W;
934 alias LPDIRECTINPUTEFFECT = IDirectInputEffect;
935 
936 interface IDirectInputW : IUnknown {
937 extern(Windows) @nogc nothrow @system:
938     HRESULT CreateDevice(REFGUID, LPDIRECTINPUTDEVICEW*, LPUNKNOWN);
939     HRESULT EnumDevices(DWORD, LPDIENUMDEVICESCALLBACKW, LPVOID, DWORD);
940     HRESULT GetDeviceStatus(REFGUID);
941     HRESULT RunControlPanel(HWND, DWORD);
942     HRESULT Initialize(HINSTANCE, DWORD);
943 }
944 
945 interface IDirectInputDeviceW : IUnknown {
946 extern(Windows) @nogc nothrow @system:
947     HRESULT GetCapabilities(LPDIDEVCAPS);
948     HRESULT EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKW, LPVOID, DWORD);
949     HRESULT GetProperty(REFGUID, LPDIPROPHEADER);
950     HRESULT SetProperty(REFGUID, LPCDIPROPHEADER);
951     HRESULT Acquire();
952     HRESULT Unacquire();
953     HRESULT GetDeviceState(DWORD, LPVOID);
954     HRESULT GetDeviceData(DWORD, LPDIDEVICEOBJECTDATA, LPDWORD, DWORD);
955     HRESULT SetDataFormat(LPCDIDATAFORMAT);
956     HRESULT SetEventNotification(HANDLE);
957     HRESULT SetCooperativeLevel(HWND, DWORD);
958     HRESULT GetObjectInfo(LPDIDEVICEOBJECTINSTANCEW, DWORD, DWORD);
959     HRESULT GetDeviceInfo(LPDIDEVICEINSTANCEW);
960     HRESULT RunControlPanel(HWND, DWORD);
961     HRESULT Initialize(HINSTANCE, DWORD, REFGUID);
962 }
963 
964 interface IDirectInputEffect : IUnknown {
965 extern(Windows) @nogc nothrow @system:
966     HRESULT Initialize(HINSTANCE, DWORD, REFGUID);
967     HRESULT GetEffectGuid(LPGUID);
968     HRESULT GetParameters(LPDIEFFECT, DWORD);
969     HRESULT SetParameters(LPCDIEFFECT, DWORD);
970     HRESULT Start(DWORD, DWORD);
971     HRESULT Stop();
972     HRESULT GetEffectStatus(LPDWORD);
973     HRESULT Download();
974     HRESULT Unload();
975     HRESULT Escape(LPDIEFFESCAPE);
976 }
977 
978 struct _DIDEVICEIMAGEINFOW {
979 	WCHAR[MAX_PATH] tszImagePath;
980 	DWORD dwFlags;
981 	DWORD dwViewID;
982 	RECT rcOverlay;
983 	DWORD dwObjID;
984 	DWORD dwcValidPts;
985 	POINT[5] rgptCalloutLine;
986 	RECT rcCalloutRect;
987 	DWORD dwTextAlign;
988 }alias _DIDEVICEIMAGEINFOW DIDEVICEIMAGEINFOW;alias _DIDEVICEIMAGEINFOW* LPDIDEVICEIMAGEINFOW;
989 alias const(DIDEVICEIMAGEINFOW)* LPCDIDEVICEIMAGEINFOW;
990 
991 struct _DIDEVICEIMAGEINFOHEADERW {
992 	DWORD dwSize;
993 	DWORD dwSizeImageInfo;
994 	DWORD dwcViews;
995 	DWORD dwcButtons;
996 	DWORD dwcAxes;
997 	DWORD dwcPOVs;
998 	DWORD dwBufferSize;
999 	DWORD dwBufferUsed;
1000 	LPDIDEVICEIMAGEINFOW lprgImageInfoArray;
1001 }alias _DIDEVICEIMAGEINFOHEADERW DIDEVICEIMAGEINFOHEADERW;alias _DIDEVICEIMAGEINFOHEADERW* LPDIDEVICEIMAGEINFOHEADERW;
1002 alias const(DIDEVICEIMAGEINFOHEADERW)* LPCDIDEVICEIMAGEINFOHEADERW;
1003 
1004 struct _DIACTIONW {
1005 	UINT_PTR uAppData;
1006 	DWORD dwSemantic;
1007 	DWORD dwFlags;
1008 	union {
1009         LPCWSTR lptszActionName;
1010 		UINT uResIdString;
1011 	}
1012 	GUID guidInstance;
1013 	DWORD dwObjID;
1014 	DWORD dwHow;
1015 }
1016 alias DIACTIONW = _DIACTIONW; alias LPDIACTIONW = _DIACTIONW;
1017 alias const(DIACTIONW)* LPCDIACTIONW;
1018 
1019 struct _DIACTIONFORMATW {
1020 	DWORD dwSize;
1021 	DWORD dwActionSize;
1022 	DWORD dwDataSize;
1023 	DWORD dwNumActions;
1024 	LPDIACTIONW rgoAction;
1025 	GUID guidActionMap;
1026 	DWORD dwGenre;
1027 	DWORD dwBufferSize;
1028 	LONG lAxisMin;
1029 	LONG lAxisMax;
1030 	HINSTANCE hInstString;
1031 	FILETIME ftTimeStamp;
1032 	DWORD dwCRC;
1033 	WCHAR[MAX_PATH] tszActionMap;
1034 }alias _DIACTIONFORMATW DIACTIONFORMATW;alias _DIACTIONFORMATW* LPDIACTIONFORMATW;
1035 alias const(DIACTIONFORMATW)* LPCDIACTIONFORMATW;
1036 
1037 alias IDirectInputDevice8 = IDirectInputDevice8W;
1038 interface IDirectInputDevice8W : IUnknown {
1039 extern(Windows) @nogc nothrow @system:
1040 	/*** IDirectInputDeviceW methods ***/
1041 	HRESULT GetCapabilities(LPDIDEVCAPS lpDIDevCaps);
1042 	HRESULT EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags);
1043 	HRESULT GetProperty(REFGUID rguidProp, LPDIPROPHEADER pdiph);
1044 	HRESULT SetProperty(REFGUID rguidProp, LPCDIPROPHEADER pdiph);
1045 	HRESULT Acquire();
1046 	HRESULT Unacquire();
1047 	HRESULT GetDeviceState(DWORD cbData, LPVOID lpvData);
1048 	HRESULT GetDeviceData(DWORD cbObjectData, LPDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD dwFlags);
1049 	HRESULT SetDataFormat(LPCDIDATAFORMAT lpdf);
1050 	HRESULT SetEventNotification(HANDLE hEvent);
1051 	HRESULT SetCooperativeLevel(HWND hwnd, DWORD dwFlags);
1052 	HRESULT GetObjectInfo(LPDIDEVICEOBJECTINSTANCEW pdidoi, DWORD dwObj, DWORD dwHow);
1053 	HRESULT GetDeviceInfo(LPDIDEVICEINSTANCEW pdidi);
1054 	HRESULT RunControlPanel(HWND hwndOwner, DWORD dwFlags);
1055 	HRESULT Initialize(HINSTANCE hinst, DWORD dwVersion, REFGUID rguid);
1056 	/*** IDirectInputDevice2W methods ***/
1057 	HRESULT CreateEffect(REFGUID rguid, LPCDIEFFECT lpeff, LPDIRECTINPUTEFFECT *ppdeff, LPUNKNOWN punkOuter);
1058 	HRESULT EnumEffects(LPDIENUMEFFECTSCALLBACKW lpCallback, LPVOID pvRef, DWORD dwEffType);
1059 	HRESULT GetEffectInfo(LPDIEFFECTINFOW pdei, REFGUID rguid);
1060 	HRESULT GetForceFeedbackState(LPDWORD pdwOut);
1061 	HRESULT SendForceFeedbackCommand(DWORD dwFlags);
1062 	HRESULT EnumCreatedEffectObjects(LPDIENUMCREATEDEFFECTOBJECTSCALLBACK lpCallback, LPVOID pvRef, DWORD fl);
1063 	HRESULT Escape(LPDIEFFESCAPE pesc);
1064 	HRESULT Poll();
1065 	HRESULT SendDeviceData(DWORD cbObjectData, LPCDIDEVICEOBJECTDATA rgdod, LPDWORD pdwInOut, DWORD fl);
1066 	/*** IDirectInputDevice7W methods ***/
1067 	HRESULT EnumEffectsInFile(LPCWSTR lpszFileName,LPDIENUMEFFECTSINFILECALLBACK pec,LPVOID pvRef,DWORD dwFlags);
1068 	HRESULT WriteEffectToFile(LPCWSTR lpszFileName,DWORD dwEntries,LPDIFILEEFFECT rgDiFileEft,DWORD dwFlags);
1069 	/*** IDirectInputDevice8W methods ***/
1070 	HRESULT BuildActionMap(LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags);
1071 	HRESULT SetActionMap(LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags);
1072 	HRESULT GetImageInfo(LPDIDEVICEIMAGEINFOHEADERW lpdiDevImageInfoHeader);
1073 }
1074 
1075 alias DWORD D3DCOLOR;
1076 
1077 struct _DICOLORSET {
1078 	DWORD dwSize;
1079 	D3DCOLOR cTextFore;
1080 	D3DCOLOR cTextHighlight;
1081 	D3DCOLOR cCalloutLine;
1082 	D3DCOLOR cCalloutHighlight;
1083 	D3DCOLOR cBorder;
1084 	D3DCOLOR cControlFill;
1085 	D3DCOLOR cHighlightFill;
1086 	D3DCOLOR cAreaFill;
1087 }
1088 alias _DICOLORSET DICOLORSET;
1089 alias _DICOLORSET* LPDICOLORSET;
1090 alias const(DICOLORSET)* LPCDICOLORSET;
1091 
1092 struct _DICONFIGUREDEVICESPARAMSW {
1093 	DWORD dwSize;
1094 	DWORD dwcUsers;
1095 	LPWSTR lptszUserNames;
1096 	DWORD dwcFormats;
1097 	LPDIACTIONFORMATW lprgFormats;
1098 	HWND hwnd;
1099 	DICOLORSET dics;
1100 	LPUNKNOWN lpUnkDDSTarget;
1101 }
1102 alias _DICONFIGUREDEVICESPARAMSW DICONFIGUREDEVICESPARAMSW;
1103 alias _DICONFIGUREDEVICESPARAMSW* LPDICONFIGUREDEVICESPARAMSW;
1104 alias const(DICONFIGUREDEVICESPARAMSW)* LPCDICONFIGUREDEVICESPARAMSW;
1105 
1106 alias IDirectInput8 = IDirectInput8W;
1107 interface IDirectInput8W : IUnknown {
1108 extern(Windows) @nogc nothrow @system:
1109 	/*** IDirectInput8W methods ***/
1110 	HRESULT CreateDevice(REFGUID rguid, LPDIRECTINPUTDEVICE8W* lplpDirectInputDevice, LPUNKNOWN pUnkOuter);
1111 	HRESULT EnumDevices(DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback, LPVOID pvRef, DWORD dwFlags);
1112 	HRESULT GetDeviceStatus(REFGUID rguidInstance);
1113 	HRESULT RunControlPanel(HWND hwndOwner, DWORD dwFlags);
1114 	HRESULT Initialize(HINSTANCE hinst, DWORD dwVersion);
1115 	HRESULT FindDevice(REFGUID rguid, LPCWSTR pszName, LPGUID pguidInstance);
1116 	HRESULT EnumDevicesBySemantics(LPCWSTR ptszUserName, LPDIACTIONFORMATW lpdiActionFormat, LPDIENUMDEVICESBYSEMANTICSCBW lpCallback, LPVOID pvRef, DWORD dwFlags);
1117 	HRESULT ConfigureDevices(LPDICONFIGUREDEVICESCALLBACK, LPDICONFIGUREDEVICESPARAMSW lpdiCDParams, DWORD dwFlags, LPVOID pvRefData);
1118 }