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.

115 lines
3.5 KiB

  1. /*****************************************************************************
  2. *
  3. * DILib3.c
  4. *
  5. * Copyright (c) 1996 Microsoft Corporation. All Rights Reserved.
  6. *
  7. * Abstract:
  8. *
  9. * Objects exported statically into our library.
  10. *
  11. * Contents:
  12. *
  13. * c_dfDIJoystick
  14. *
  15. *****************************************************************************/
  16. #include "dinputpr.h"
  17. /*****************************************************************************
  18. *
  19. * @doc INTERNAL
  20. *
  21. * @global DIOBJECTDATAFORMAT | c_rgdoiDIJoy[] |
  22. *
  23. * Device object data formats for joystick-style access.
  24. *
  25. * @doc EXTERNAL
  26. *
  27. * @global DIDEVICEFORMAT | c_dfDIJoystick |
  28. *
  29. * Predefined device format for joystick-style access.
  30. *
  31. * When a device has been set to the joystick data format,
  32. * the <mf IDirectInputDevice::GetDeviceState> function
  33. * returns a <t DIJOYSTATE> structure, and the
  34. * <mf IDirectInputDevice::GetDeviceData> function
  35. * returns a <t DIDEVICEOBJECTDATA> whose <p dwOfs>
  36. * field is a <c DIJOFS_*> value which describes the
  37. * object whose data is being reported.
  38. *
  39. *****************************************************************************/
  40. #pragma BEGIN_CONST_DATA
  41. #define MAKEVAL(guid, f, type, aspect) \
  42. { &GUID_##guid, \
  43. FIELD_OFFSET(DIJOYSTATE, f), \
  44. DIDFT_##type | DIDFT_ANYINSTANCE | DIDFT_OPTIONAL, \
  45. DIDOI_ASPECT##aspect, \
  46. } \
  47. #define MAKEBTN(n) \
  48. { 0, \
  49. FIELD_OFFSET(DIJOYSTATE, rgbButtons[n]), \
  50. DIDFT_BUTTON | DIDFT_ANYINSTANCE | DIDFT_OPTIONAL, \
  51. DIDOI_ASPECTUNKNOWN, \
  52. } \
  53. static DIOBJECTDATAFORMAT c_rgodfDIJoy[] = {
  54. MAKEVAL( XAxis, lX, AXIS, POSITION),
  55. MAKEVAL( YAxis, lY, AXIS, POSITION),
  56. MAKEVAL( ZAxis, lZ, AXIS, POSITION),
  57. MAKEVAL(RxAxis, lRx, AXIS, POSITION),
  58. MAKEVAL(RyAxis, lRy, AXIS, POSITION),
  59. MAKEVAL(RzAxis, lRz, AXIS, POSITION),
  60. MAKEVAL(Slider,rglSlider[0], AXIS, POSITION),
  61. MAKEVAL(Slider,rglSlider[1], AXIS, POSITION),
  62. MAKEVAL(POV, rgdwPOV[0], POV, UNKNOWN),
  63. MAKEVAL(POV, rgdwPOV[1], POV, UNKNOWN),
  64. MAKEVAL(POV, rgdwPOV[2], POV, UNKNOWN),
  65. MAKEVAL(POV, rgdwPOV[3], POV, UNKNOWN),
  66. MAKEBTN( 0),
  67. MAKEBTN( 1),
  68. MAKEBTN( 2),
  69. MAKEBTN( 3),
  70. MAKEBTN( 4),
  71. MAKEBTN( 5),
  72. MAKEBTN( 6),
  73. MAKEBTN( 7),
  74. MAKEBTN( 8),
  75. MAKEBTN( 9),
  76. MAKEBTN(10),
  77. MAKEBTN(11),
  78. MAKEBTN(12),
  79. MAKEBTN(13),
  80. MAKEBTN(14),
  81. MAKEBTN(15),
  82. MAKEBTN(16),
  83. MAKEBTN(17),
  84. MAKEBTN(18),
  85. MAKEBTN(19),
  86. MAKEBTN(20),
  87. MAKEBTN(21),
  88. MAKEBTN(22),
  89. MAKEBTN(23),
  90. MAKEBTN(24),
  91. MAKEBTN(25),
  92. MAKEBTN(26),
  93. MAKEBTN(27),
  94. MAKEBTN(28),
  95. MAKEBTN(29),
  96. MAKEBTN(30),
  97. MAKEBTN(31),
  98. };
  99. const DIDATAFORMAT c_dfDIJoystick = {
  100. sizeof(DIDATAFORMAT),
  101. sizeof(DIOBJECTDATAFORMAT),
  102. DIDF_ABSAXIS,
  103. sizeof(DIJOYSTATE),
  104. cA(c_rgodfDIJoy),
  105. c_rgodfDIJoy,
  106. };
  107. #pragma END_CONST_DATA