Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1849 lines
70 KiB

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