Leaked source code of windows server 2003
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.

882 lines
26 KiB

  1. /*****************************************************************************
  2. *
  3. * DIDev.h
  4. *
  5. * Copyright (c) 1996-1997 Microsoft Corporation. All Rights Reserved.
  6. *
  7. * Abstract:
  8. *
  9. * Common header file for IDirectInputDevice implementation.
  10. *
  11. * The original didev.c file was getting too big, so the
  12. * stuff that supports IDirectInputEffect has been split out
  13. * into didevef.c. Since both files need to access the
  14. * internal structure of an IDirectInputDevice, we need this
  15. * common header file.
  16. *
  17. *****************************************************************************/
  18. /*****************************************************************************
  19. *
  20. * The sqiffle for this file.
  21. *
  22. *****************************************************************************/
  23. #define sqfl sqflDev
  24. /*****************************************************************************
  25. *
  26. * Declare the interfaces we will be providing.
  27. *
  28. *****************************************************************************/
  29. #define ThisClass CDIDev
  30. #ifdef IDirectInputDevice7Vtbl
  31. #define ThisInterface TFORM(IDirectInputDevice7)
  32. #define ThisInterfaceA IDirectInputDevice7A
  33. #define ThisInterfaceW IDirectInputDevice7W
  34. #define ThisInterfaceT IDirectInputDevice7
  35. #else
  36. #ifdef IDirectInputDevice2Vtbl
  37. #define ThisInterface TFORM(IDirectInputDevice2)
  38. #define ThisInterfaceA IDirectInputDevice2A
  39. #define ThisInterfaceW IDirectInputDevice2W
  40. #define ThisInterfaceT IDirectInputDevice2
  41. #else
  42. #define ThisInterface TFORM(IDirectInputDevice)
  43. #define ThisInterfaceA IDirectInputDeviceA
  44. #define ThisInterfaceW IDirectInputDeviceW
  45. #define ThisInterfaceT IDirectInputDevice
  46. #endif
  47. #endif
  48. Primary_Interface(CDIDev, TFORM(ThisInterfaceT));
  49. Secondary_Interface(CDIDev, SFORM(ThisInterfaceT));
  50. /*****************************************************************************
  51. *
  52. * @doc INTERNAL
  53. *
  54. * @enum DIOPT |
  55. *
  56. * Device data format optimization levels.
  57. *
  58. * @emem dioptNone |
  59. *
  60. * Device data format is not optimized at all. We must read
  61. * the device data into a private buffer and copy each field
  62. * into the application buffer.
  63. *
  64. * @emem dioptMatch |
  65. *
  66. * Application data format matches the device data format
  67. * in the places where the application requests data at all.
  68. * We can read the device data into a private buffer, then
  69. * block copy the data into the application buffer.
  70. *
  71. *
  72. * @emem dioptDirect |
  73. *
  74. * <e DIOPT.dioptMatch>, plus the entire device data
  75. * format fits inside the application format.
  76. * We can read the device data directly into the application
  77. * buffer.
  78. *
  79. * @emem dioptEqual |
  80. *
  81. * <e DIOPT.dioptDirect>, plus the device data format
  82. * and application data formats are completely equal
  83. * (except for fields that the app doesn't explicitly
  84. * ask for).
  85. * We can issue buffered reads directly into the application
  86. * buffer.
  87. *
  88. *****************************************************************************/
  89. typedef enum DIOPT
  90. {
  91. dioptNone = 0,
  92. dioptMatch = 1,
  93. dioptDirect = 2,
  94. dioptEqual = 3,
  95. } DIOPT;
  96. #undef BUGGY_DX7_WINNT
  97. #ifdef WINNT
  98. #define BUGGY_DX7_WINNT 1
  99. #endif //WINNT
  100. /*****************************************************************************
  101. *
  102. * @doc INTERNAL
  103. *
  104. * @struct CDIDev |
  105. *
  106. * The generic <i IDirectInputDevice> object.
  107. *
  108. * The A and W versions are simply alternate interfaces on the same
  109. * underlying object.
  110. *
  111. * @field IDirectInputDeviceA | ddA |
  112. *
  113. * ANSI DirectInputDevice object (containing vtbl).
  114. *
  115. * @field IDirectInputDeviceW | ddW |
  116. *
  117. * UNICODE DirectInputDevice object (containing vtbl).
  118. *
  119. #ifdef IDirectInputDevice2Vtbl
  120. * @field IDirectInputDevice2A | dd2A |
  121. *
  122. * ANSI DirectInputDevice2 object (containing vtbl).
  123. *
  124. * @field IDirectInputDevice2W | dd2W |
  125. *
  126. * UNICODE DirectInputDevice2 object (containing vtbl).
  127. #endif
  128. *
  129. * @field IDirectInputDeviceCallback * | pdcb |
  130. *
  131. * Callback object which handles the low-level device access.
  132. *
  133. * @field BOOL | fAcquired:1 |
  134. *
  135. * Set if the device has been acquired. Before the device
  136. * can be acquired, the <e CDIDev.pdix> must be set.
  137. *
  138. * @field BOOL | fAcquiredInstance:1 |
  139. *
  140. * Set if the device instance has been acquired by us.
  141. * This lets us know how much needs to be done on the
  142. * unacquire.
  143. *
  144. * @field BOOL | fCritInited:1 |
  145. *
  146. * Set if the critical section has been initialized.
  147. *
  148. #if DIRECTINPUT_VERSION > 0x0300
  149. * @field BOOL | fCook:1 |
  150. *
  151. * Set if the device requires that data be cooked.
  152. *
  153. * @field BOOL | fPolledDataFormat:1 |
  154. *
  155. * Set if the device's data format requires explicit polling.
  156. *
  157. * @field BOOL | fOnceAcquired:1 |
  158. *
  159. * Set once the device is acquired.
  160. *
  161. * @field BOOL | fOnceForcedUnacquired:1 |
  162. *
  163. * Set once the device is forced unacquired.
  164. *
  165. * @field BOOL | fUnacqiredWhenIconic:1 |
  166. *
  167. * Set once the device is unacquired (in CDIDev_CallWndProc) when the app is minimized.
  168. *
  169. #endif
  170. * @field HWND | hwnd |
  171. *
  172. * Window that has requested exclusive access when acquired.
  173. *
  174. * @field DWORD | discl |
  175. *
  176. * Current value of
  177. * <mf IDirectInputDevice::SetCooperativeLevel> flags.
  178. *
  179. #ifdef BUGGY_DX3_SP3
  180. * @field int | cInstCwp |
  181. *
  182. * Instance of the CallWndProc hook we installed with.
  183. *
  184. #endif
  185. * @field HANDLE | hNotify |
  186. *
  187. * The notification handle that should be set when the
  188. * state of the device changes. Note that this is actually
  189. * a copy of the original handle supplied by the application,
  190. * so the handle should be closed when no longer needed.
  191. *
  192. * @field FARPROC | GetState |
  193. *
  194. * Function that transfers the device data in response
  195. * to <mf IDirectInputDevice::GetDeviceState>. This field
  196. * is computed when the data format is set.
  197. *
  198. * @field PDIXLAT | pdix |
  199. *
  200. * Pointer to table used for data format translation.
  201. * It is indexed by device object; the value is the
  202. * location in the application data format where the
  203. * data should be stored.
  204. *
  205. * For example, if the object described by
  206. * <e CDIDev.df.rgodf[3]>
  207. * should be placed at offset 8 in the application
  208. * data format, then
  209. * <e CDIDev.pdix[3]> = 8.
  210. *
  211. * @field PING | rgiobj |
  212. *
  213. * The inverse of <e CDIDev.pdix>. Given an offset,
  214. * converts it to the device object index.
  215. *
  216. * For example, if the object described by
  217. * <e CDIDev.df.rgodf[3]>
  218. * should be placed at offset 8 in the application
  219. * data format, then
  220. * <e CDIDev.rgiobj[8]> = 3.
  221. *
  222. * Entries for invalid offsets are -1.
  223. *
  224. * @field DWORD | dwDataSize |
  225. *
  226. * Size of the data, as requested by the application.
  227. *
  228. #ifdef BUGGY_DX7_WINNT
  229. *
  230. * @field PDIXLAT | pdix2 |
  231. *
  232. * Pointer to table used for data format (c_rgodfDIJoy) translation.
  233. * It is indexed by device object; the value is the
  234. * location in the application data format where the
  235. * data should be stored.
  236. *
  237. * For example, if the object described by
  238. * <e CDIDev.df.rgodf[3]>
  239. * should be placed at offset 8 in the application
  240. * data format, then
  241. * <e CDIDev.pdix2[3]> = 8.
  242. *
  243. * See @devnotes on CDIDev_ParseDataFormatInternal for detail.
  244. *
  245. * @field PING | rgiobj2 |
  246. *
  247. * The inverse of <e CDIDev.pdix2>. Given an offset,
  248. * converts it to the device object index.
  249. *
  250. * For example, if the object described by
  251. * <e CDIDev.df.rgodf[3]>
  252. * should be placed at offset 8 in the application
  253. * data format, then
  254. * <e CDIDev.rgiobj2[8]> = 3.
  255. *
  256. * Entries for invalid offsets are -1.
  257. *
  258. * @field DWORD | dwDataSize2 |
  259. *
  260. * Size of the data, as requested by the application (connected to rgiobj2).
  261. *
  262. #endif
  263. *
  264. * @field DIDATAFORMAT | df |
  265. *
  266. * Device data format.
  267. *
  268. * @field DIOPT | diopt |
  269. *
  270. * Device optimization level.
  271. *
  272. * @field int | ibDelta |
  273. *
  274. * If <e CDIDev.diopt> is at least <e DIOPT.dioptMatch>,
  275. * contains the shift necessary in order to align the
  276. * application data format with the device data format.
  277. *
  278. * @field int | ibMin |
  279. *
  280. * If <e CDIDev.diopt> is at least <e DIOPT.dioptMatch>,
  281. * contains the offset of the first field in the device
  282. * format which is valid in both the application and
  283. * device data formats.
  284. *
  285. * @field DWORD | cbMatch |
  286. *
  287. * If <e CDIDev.diopt> is at least <e DIOPT.dioptMatch>,
  288. * contains the number of bytes which matched. This is the
  289. * number of bytes that can be block-copied.
  290. *
  291. * @field PV | pvBuffer |
  292. *
  293. * if <e CDIDev.diopt> is <e DIOPT.dioptMatch> or less,
  294. * then contains a scratch buffer equal in size to the
  295. * device data format which is used when an unoptimized
  296. * data format has been selected.
  297. *
  298. * @field PV | pvLastBuffer |
  299. *
  300. * Last instantaneous device state received. This is used
  301. * to emulate relative axes. Only the axis fields of the
  302. * structure are valid.
  303. *
  304. * @field PVXDINSTANCE | pvi |
  305. *
  306. * Instance handle for talking to the VxD.
  307. *
  308. * @field DWORD | cAxes |
  309. *
  310. * Number of axes on the device. This in turn yields the
  311. * size of the axis offset table.
  312. *
  313. * @field LPDWORD | rgdwAxesOfs |
  314. *
  315. * Axis offset table. This is used during relative axis
  316. * acquisition mode to convert the absolute numbers into
  317. * relative numbers.
  318. *
  319. * @field HRESULT | hresPolled |
  320. *
  321. * <c S_OK> if the device is interrupt-driven.
  322. * <c DI_POLLEDDEVICE> if the device is polled.
  323. *
  324. * @field HRESULT | hresNotAcquired |
  325. *
  326. * <c DIERR_INPUTLOST> if the device was unacquired without
  327. * the application's consent. <c DIERR_NOTACQUIRED> if
  328. * the application should have known better.
  329. *
  330. * @field DWORD | celtBuf |
  331. *
  332. * Size of the device buffer.
  333. *
  334. * @field DWORD | celtBufMax |
  335. *
  336. * The largest buffer size we will permit. There is
  337. * a secret property that lets you increase the value,
  338. * in case an ISV comes up with a good reason for having
  339. * a larger buffer.
  340. *
  341. * @field LPDWORD | rgdwPOV |
  342. *
  343. * An array of DWORDs listing the locations (data offsets)
  344. * of all the optional POVs that were in the app's requested
  345. * data format and which we were unable to satisfy. We
  346. * need this so we can set them to -1 in the device state
  347. * because most apps are lazy and don't check if the object
  348. * actually exists before reading from it. To keep them safe,
  349. * we normally return zeros in nonexistent objects, but for
  350. * POVs, the "safe" value is -1, not zero.
  351. *
  352. * @field DWORD | cdwPOV |
  353. *
  354. * Number of failed optional POVs in the <e CDIDev.rgdwPOV> array.
  355. *
  356. #ifdef IDirectInputDevice2Vtbl
  357. *
  358. * @field LPDIRECTINPUTEFFECTSHEPHERD | pes |
  359. *
  360. * The <i IDirectInputEffectShepherd>
  361. * object which does the
  362. * low-level goo related to the force feedback part of the device.
  363. *
  364. * @field SHEPHANDLE | sh |
  365. *
  366. * The joystick "tag" which is used by dieshep.c
  367. * to determine who owns the joystick.
  368. * The <e SHEPHANDLE.dwEffect> field is permanently
  369. * zero, so that we can pass it to
  370. * <mf IDirectInputEffectShepherd::Escape>
  371. * to perform a device escape.
  372. *
  373. * @field DWORD | dwVersion |
  374. *
  375. * Version number of DirectInput we are emulating.
  376. *
  377. * @field GPA | gpaEff |
  378. *
  379. * Pointer array of (held) <i IDirectInputEffect> objects
  380. * that have been created for this device.
  381. *
  382. * @field PEFFECTMAPINFO | rgemi |
  383. *
  384. * Array of <t EFFECTMAPINFO> structures, one for each
  385. * effect supported by the device.
  386. *
  387. * @field UINT | cemi |
  388. *
  389. * Number of elements in the <e CDIDev.rgemi> array.
  390. *
  391. * @field DWORD | didcFF |
  392. *
  393. * Cached device capability flags related to force-feedback.
  394. *
  395. * @field DIFFDEVICEATTRIBUTES | ffattr |
  396. *
  397. * Contains force feedback device attributes.
  398. *
  399. * @field DWORD | dwGain |
  400. *
  401. * The gain setting for the device.
  402. *
  403. * @field DWORD | dwAutoCenter |
  404. *
  405. * The autocenter setting for the device.
  406. #endif
  407. #if DIRECTINPUT_VERSION >= 0x04F0
  408. *
  409. * @field DWORD | didftInstance |
  410. *
  411. * The instance mask to use for the client. For
  412. * DX 3.0 clients, the value is 0x0000FF00, whereas
  413. * DX 5.0 clients have 0x00FFFF00. The larger
  414. * mask is to accomodate HID devices with huge numbers
  415. * of controls.
  416. *
  417. *
  418. #endif
  419. *
  420. * @field BOOL | fNotifiedNotBuffered:1 |
  421. *
  422. * Used only in XDEBUG to remember whether we
  423. * notified the caller that the device isn't buffered.
  424. *
  425. * @field LONG | cCrit |
  426. *
  427. * Number of times the critical section has been taken.
  428. * Used only in XDEBUG to check whether the caller is
  429. * releasing the object while another method is using it.
  430. *
  431. * @field DWORD | thidCrit |
  432. *
  433. * The thread that is currently in the critical section.
  434. * Used only in DEBUG for internal consistency checking.
  435. *
  436. * @field CRITICAL_SECTION | crst |
  437. *
  438. * Object critical section. Must be taken when accessing
  439. * volatile member variables.
  440. *
  441. * @field GUID | guid |
  442. *
  443. * The instance GUID of the device we are.
  444. *
  445. *****************************************************************************/
  446. typedef struct DIXLAT
  447. {
  448. DWORD dwOfs;
  449. } DIXLAT, *PDIXLAT;
  450. typedef struct CDIDev
  451. {
  452. /* Supported interfaces */
  453. TFORM(IDirectInputDevice) TFORM(dd);
  454. SFORM(IDirectInputDevice) SFORM(dd);
  455. #ifdef IDirectInputDevice2Vtbl
  456. TFORM(IDirectInputDevice2) TFORM(dd2);
  457. SFORM(IDirectInputDevice2) SFORM(dd2);
  458. #endif
  459. IDirectInputDeviceCallback *pdcb;
  460. BOOL fAcquired:1;
  461. BOOL fAcquiredInstance:1;
  462. BOOL fCritInited:1;
  463. #if DIRECTINPUT_VERSION > 0x0300
  464. BOOL fCook:1;
  465. BOOL fPolledDataFormat:1;
  466. BOOL fOnceAcquired:1;
  467. BOOL fOnceForcedUnacquired:1;
  468. #ifdef WINNT
  469. BOOL fUnacquiredWhenIconic:1;
  470. #endif
  471. #endif
  472. /* WARNING! EVERYTHING AFTER THIS LINE IS ZERO'd ON A RESET */
  473. HWND hwnd;
  474. DWORD discl;
  475. #ifdef BUGGY_DX3_SP3
  476. int cInstCwp;
  477. #endif
  478. HANDLE hNotify;
  479. STDMETHOD(GetState)(struct CDIDev *, PV);
  480. STDMETHOD(GetDeviceState)(struct CDIDev *, PV);
  481. PDIXLAT pdix;
  482. PINT rgiobj;
  483. DWORD dwDataSize;
  484. #ifdef BUGGY_DX7_WINNT
  485. PDIXLAT pdix2;
  486. PINT rgiobj2;
  487. DWORD dwDataSize2;
  488. #endif //BUGGY_DX7_WINNT
  489. DIDATAFORMAT df;
  490. DIOPT diopt;
  491. int ibDelta;
  492. int ibMin;
  493. DWORD cbMatch;
  494. PV pvBuffer;
  495. PV pvLastBuffer;
  496. PVXDINSTANCE pvi;
  497. PV pvData;
  498. DWORD cAxes;
  499. LPDWORD rgdwAxesOfs;
  500. HRESULT hresPolled;
  501. HRESULT hresNotAcquired;
  502. DWORD celtBuf;
  503. LPDWORD rgdwPOV;
  504. DWORD cdwPOV;
  505. #ifdef IDirectInputDevice2Vtbl
  506. PEFFECTMAPINFO rgemi;
  507. UINT cemi;
  508. DWORD didcFF;
  509. SHEPHANDLE sh;
  510. DIFFDEVICEATTRIBUTES ffattr;
  511. #endif
  512. /* WARNING! EVERYTHING ABOVE THIS LINE IS ZERO'd ON A RESET */
  513. DWORD celtBufMax; /* Must be first field after zero'd region */
  514. #ifdef IDirectInputDevice2Vtbl
  515. LPDIRECTINPUTEFFECTSHEPHERD pes;
  516. DWORD dwVersion;
  517. GPA gpaEff;
  518. DWORD dwGain;
  519. DWORD dwAutoCenter;
  520. #endif
  521. #if DIRECTINPUT_VERSION >= 0x04F0
  522. DWORD didftInstance;
  523. #endif
  524. RD(BOOL fNotifiedNotBuffered:1;)
  525. long cCrit;
  526. DWORD thidCrit;
  527. CRITICAL_SECTION crst;
  528. GUID guid; /* This is also zero'd on a reset */
  529. #if (DIRECTINPUT_VERSION > 0x061A)
  530. DIAPPHACKS diHacks;
  531. #endif
  532. } CDIDev, DD, *PDD;
  533. typedef IDirectInputDeviceA DDA, *PDDA;
  534. typedef IDirectInputDeviceW DDW, *PDDW;
  535. typedef DIDEVICEOBJECTDATA DOD, *PDOD;
  536. typedef LPCDIDEVICEOBJECTDATA PCDOD;
  537. /*****************************************************************************
  538. *
  539. * Methods that live outside didev.c
  540. *
  541. *****************************************************************************/
  542. #ifdef BUGGY_DX7_WINNT
  543. HRESULT CDIDev_ParseDataFormatInternal(PDD this, const DIDATAFORMAT *lpdf);
  544. #endif //BUGGY_DX7_WINNT
  545. /*****************************************************************************
  546. *
  547. * IDirectInputDevice::SetDataFormat
  548. *
  549. *****************************************************************************/
  550. STDMETHODIMP
  551. CDIDev_SetDataFormat(PV pdd, LPCDIDATAFORMAT lpdf _THAT);
  552. #ifdef INCLUDED_BY_DIDEV
  553. #ifdef XDEBUG
  554. CSET_STUBS(SetDataFormat, (PV pdd, LPCDIDATAFORMAT lpdf), (pdd, lpdf THAT_))
  555. #else
  556. #define CDIDev_SetDataFormatA CDIDev_SetDataFormat
  557. #define CDIDev_SetDataFormatW CDIDev_SetDataFormat
  558. #endif
  559. #endif
  560. /*****************************************************************************
  561. *
  562. * IDirectInputDevice::GetDeviceState
  563. *
  564. *****************************************************************************/
  565. STDMETHODIMP
  566. CDIDev_GetDeviceState(PV pdd, DWORD cbDataSize, LPVOID pvData _THAT);
  567. #ifdef INCLUDED_BY_DIDEV
  568. #ifdef XDEBUG
  569. CSET_STUBS(GetDeviceState, (PV pdd, DWORD cbDataSize, LPVOID pvData),
  570. (pdd, cbDataSize, pvData THAT_))
  571. #else
  572. #define CDIDev_GetDeviceStateA CDIDev_GetDeviceState
  573. #define CDIDev_GetDeviceStateW CDIDev_GetDeviceState
  574. #endif
  575. #endif
  576. /*****************************************************************************
  577. *
  578. * IDirectInputDevice::GetDeviceData
  579. *
  580. *****************************************************************************/
  581. STDMETHODIMP
  582. CDIDev_GetDeviceData(PV pdd, DWORD cbdod, PDOD rgdod,
  583. LPDWORD pdwInOut, DWORD fl _THAT);
  584. #ifdef INCLUDED_BY_DIDEV
  585. #ifdef XDEBUG
  586. CSET_STUBS(GetDeviceData,
  587. (PV pdd, DWORD cbdod, PDOD rgdod, LPDWORD pdwInOut, DWORD fl),
  588. (pdd, cbdod, rgdod, pdwInOut, fl THAT_))
  589. #else
  590. #define CDIDev_GetDeviceDataA CDIDev_GetDeviceData
  591. #define CDIDev_GetDeviceDataW CDIDev_GetDeviceData
  592. #endif
  593. #endif
  594. #ifdef IDirectInputDevice2Vtbl
  595. /*****************************************************************************
  596. *
  597. * IDirectInputDevice2::CreateEffect
  598. *
  599. *****************************************************************************/
  600. STDMETHODIMP
  601. CDIDev_CreateEffect(PV pdd, REFGUID rguid, LPCDIEFFECT peff,
  602. LPDIRECTINPUTEFFECT *ppdeff, LPUNKNOWN punkOuter _THAT);
  603. #ifdef INCLUDED_BY_DIDEV
  604. #ifdef XDEBUG
  605. CSET_STUBS(CreateEffect, (PV pdd, REFGUID rguid, LPCDIEFFECT peff,
  606. LPDIRECTINPUTEFFECT *ppdeff, LPUNKNOWN punkOuter),
  607. (pdd, rguid, peff, ppdeff, punkOuter THAT_))
  608. #else
  609. #define CDIDev_CreateEffectA CDIDev_CreateEffect
  610. #define CDIDev_CreateEffectW CDIDev_CreateEffect
  611. #endif
  612. #endif
  613. /*****************************************************************************
  614. *
  615. * IDirectInputDevice2::EnumEffects
  616. *
  617. *****************************************************************************/
  618. STDMETHODIMP
  619. CDIDev_EnumEffectsW(PV pdd, LPDIENUMEFFECTSCALLBACKW pecW, PV pvRef, DWORD fl);
  620. STDMETHODIMP
  621. CDIDev_EnumEffectsA(PV pdd, LPDIENUMEFFECTSCALLBACKA pecA, PV pvRef, DWORD fl);
  622. /*****************************************************************************
  623. *
  624. * IDirectInputDevice2::GetEffectInfo
  625. *
  626. *****************************************************************************/
  627. STDMETHODIMP
  628. CDIDev_GetEffectInfoW(PV pddW, LPDIEFFECTINFOW peiW, REFGUID rguid);
  629. STDMETHODIMP
  630. CDIDev_GetEffectInfoA(PV pddA, LPDIEFFECTINFOA peiA, REFGUID rguid);
  631. /*****************************************************************************
  632. *
  633. * IDirectInputDevice2::GetForceFeedbackState
  634. *
  635. *****************************************************************************/
  636. STDMETHODIMP
  637. CDIDev_GetForceFeedbackState(PV pdd, LPDWORD pdwOut _THAT);
  638. #ifdef INCLUDED_BY_DIDEV
  639. #ifdef XDEBUG
  640. CSET_STUBS(GetForceFeedbackState, (PV pdd, LPDWORD pdwOut),
  641. (pdd, pdwOut THAT_))
  642. #else
  643. #define CDIDev_GetForceFeedbackStateA CDIDev_GetForceFeedbackState
  644. #define CDIDev_GetForceFeedbackStateW CDIDev_GetForceFeedbackState
  645. #endif
  646. #endif
  647. /*****************************************************************************
  648. *
  649. * IDirectInputDevice2::SendForceFeedbackCommand
  650. *
  651. *****************************************************************************/
  652. STDMETHODIMP
  653. CDIDev_SendForceFeedbackCommand(PV pdd, DWORD dwCmd _THAT);
  654. #ifdef INCLUDED_BY_DIDEV
  655. #ifdef XDEBUG
  656. CSET_STUBS(SendForceFeedbackCommand, (PV pdd, DWORD dwCmd),
  657. (pdd, dwCmd THAT_))
  658. #else
  659. #define CDIDev_SendForceFeedbackCommandA CDIDev_SendForceFeedbackCommand
  660. #define CDIDev_SendForceFeedbackCommandW CDIDev_SendForceFeedbackCommand
  661. #endif
  662. #endif
  663. /*****************************************************************************
  664. *
  665. * IDirectInputDevice2::EnumCreatedEffects
  666. *
  667. *****************************************************************************/
  668. STDMETHODIMP
  669. CDIDev_EnumCreatedEffectObjects(PV pdd,
  670. LPDIENUMCREATEDEFFECTOBJECTSCALLBACK pec,
  671. LPVOID pvRef, DWORD dwFlags _THAT);
  672. #ifdef INCLUDED_BY_DIDEV
  673. #ifdef XDEBUG
  674. CSET_STUBS(EnumCreatedEffectObjects, (PV pdd,
  675. LPDIENUMCREATEDEFFECTOBJECTSCALLBACK pec,
  676. LPVOID pvRef, DWORD dwFlags),
  677. (pdd, pec, pvRef, dwFlags THAT_))
  678. #else
  679. #define CDIDev_EnumCreatedEffectObjectsA CDIDev_EnumCreatedEffectObjects
  680. #define CDIDev_EnumCreatedEffectObjectsW CDIDev_EnumCreatedEffectObjects
  681. #endif
  682. #endif
  683. /*****************************************************************************
  684. *
  685. * IDirectInputDevice2::Escape
  686. *
  687. *****************************************************************************/
  688. STDMETHODIMP
  689. CDIDev_Escape(PV pdd, LPDIEFFESCAPE pesc _THAT);
  690. #ifdef INCLUDED_BY_DIDEV
  691. #ifdef XDEBUG
  692. CSET_STUBS(Escape, (PV pdd, LPDIEFFESCAPE pesc), (pdd, pesc THAT_))
  693. #else
  694. #define CDIDev_EscapeA CDIDev_Escape
  695. #define CDIDev_EscapeW CDIDev_Escape
  696. #endif
  697. #endif
  698. /*****************************************************************************
  699. *
  700. * IDirectInputDevice2::Poll
  701. *
  702. *****************************************************************************/
  703. STDMETHODIMP
  704. CDIDev_Poll(PV pdd _THAT);
  705. #ifdef INCLUDED_BY_DIDEV
  706. #ifdef XDEBUG
  707. CSET_STUBS(Poll, (PV pdd), (pdd THAT_))
  708. #else
  709. #define CDIDev_PollA CDIDev_Poll
  710. #define CDIDev_PollW CDIDev_Poll
  711. #endif
  712. #endif
  713. /*****************************************************************************
  714. *
  715. * IDirectInputDevice2::SendDeviceData
  716. *
  717. *****************************************************************************/
  718. STDMETHODIMP
  719. CDIDev_SendDeviceData(PV pdd, DWORD cbdod, PCDOD rgdod,
  720. LPDWORD pdwInOut, DWORD fl _THAT);
  721. #ifdef INCLUDED_BY_DIDEV
  722. #ifdef XDEBUG
  723. CSET_STUBS(SendDeviceData,
  724. (PV pdd, DWORD cbdod, PCDOD rgdod, LPDWORD pdwInOut, DWORD fl),
  725. (pdd, cbdod, rgdod, pdwInOut, fl THAT_))
  726. #else
  727. #define CDIDev_SendDeviceDataA CDIDev_SendDeviceData
  728. #define CDIDev_SendDeviceDataW CDIDev_SendDeviceData
  729. #endif
  730. #endif
  731. #endif /* IDirectInputDevice2Vtbl */
  732. /*****************************************************************************
  733. *
  734. * More internal worker functions.
  735. *
  736. * IsConsists is used for assertion checking.
  737. *
  738. * Finalize calls Unacquire to clean up in the case where the
  739. * caller forgot.
  740. *
  741. * Similarly, Reset needs to reset the GetDeviceState pointer.
  742. *
  743. * SetDataFormat needs to set the axis mode property.
  744. *
  745. * CDIDev_InitFF is used by CDIDev_Initialize to initialize
  746. * the force-feedback portion of the device.
  747. *
  748. *****************************************************************************/
  749. #ifdef DEBUG
  750. BOOL INTERNAL CDIDev_IsConsistent(PDD this);
  751. #endif
  752. STDMETHODIMP CDIDev_InternalUnacquire(PV pdd);
  753. STDMETHODIMP CDIDev_GetAbsDeviceState(PDD this, LPVOID pvData);
  754. STDMETHODIMP CDIDev_GetRelDeviceState(PDD this, LPVOID pvData);
  755. STDMETHODIMP
  756. CDIDev_RealSetProperty(PDD this, REFGUID rguid, LPCDIPROPHEADER pdiph);
  757. #ifdef IDirectInputDevice2Vtbl
  758. STDMETHODIMP CDIDev_FFAcquire(PDD this);
  759. STDMETHODIMP CDIDev_InitFF(PDD this);
  760. STDMETHODIMP CDIDev_GetLoad(PDD this, LPDWORD pdw);
  761. STDMETHODIMP CDIDev_RefreshGain(PDD this);
  762. HRESULT INTERNAL CDIDev_CreateEffectDriver(PDD this);
  763. #endif