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.

118 lines
4.9 KiB

  1. /*****************************************************************************
  2. *
  3. * DILib4.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_dfDIJoystick2
  14. *
  15. *****************************************************************************/
  16. #include "dinputpr.h"
  17. /*****************************************************************************
  18. *
  19. * @doc INTERNAL
  20. *
  21. * @global DIOBJECTDATAFORMAT | c_rgdoiDIJoy2[] |
  22. *
  23. * Device object data formats for joystick-style access.
  24. *
  25. * @doc EXTERNAL
  26. *
  27. * @global DIDEVICEFORMAT | c_dfDIJoystick2 |
  28. *
  29. * Predefined device format for extended 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 DIJOYSTATE2> 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(DIJOYSTATE2, f), \
  44. DIDFT_##type | DIDFT_ANYINSTANCE | DIDFT_OPTIONAL, \
  45. DIDOI_ASPECT##aspect, \
  46. } \
  47. #define MAKEVALS(l, aspect) \
  48. MAKEVAL( XAxis,l##X, AXIS, aspect), \
  49. MAKEVAL( YAxis,l##Y, AXIS, aspect), \
  50. MAKEVAL( ZAxis,l##Z, AXIS, aspect), \
  51. MAKEVAL(RxAxis,l##Rx, AXIS, aspect), \
  52. MAKEVAL(RyAxis,l##Ry, AXIS, aspect), \
  53. MAKEVAL(RzAxis,l##Rz, AXIS, aspect), \
  54. MAKEVAL(Slider,rgl##Slider[0], AXIS, aspect), \
  55. MAKEVAL(Slider,rgl##Slider[1], AXIS, aspect) \
  56. #define MAKEPOV(n) \
  57. MAKEVAL(POV, rgdwPOV[n], POV, UNKNOWN) \
  58. #define MAKEBTN(n) \
  59. { 0, \
  60. FIELD_OFFSET(DIJOYSTATE2, rgbButtons[n]), \
  61. DIDFT_BUTTON | DIDFT_ANYINSTANCE | DIDFT_OPTIONAL, \
  62. DIDOI_ASPECTUNKNOWN, \
  63. } \
  64. #define MAKEBTNS(n) \
  65. MAKEBTN(n + 0x00), \
  66. MAKEBTN(n + 0x01), \
  67. MAKEBTN(n + 0x02), \
  68. MAKEBTN(n + 0x03), \
  69. MAKEBTN(n + 0x04), \
  70. MAKEBTN(n + 0x05), \
  71. MAKEBTN(n + 0x06), \
  72. MAKEBTN(n + 0x07), \
  73. MAKEBTN(n + 0x08), \
  74. MAKEBTN(n + 0x09), \
  75. MAKEBTN(n + 0x0A), \
  76. MAKEBTN(n + 0x0B), \
  77. MAKEBTN(n + 0x0C), \
  78. MAKEBTN(n + 0x0D), \
  79. MAKEBTN(n + 0x0E), \
  80. MAKEBTN(n + 0x0F) \
  81. static DIOBJECTDATAFORMAT c_rgodfDIJoy2[] = {
  82. MAKEVALS(l, POSITION),
  83. MAKEPOV(0),
  84. MAKEPOV(1),
  85. MAKEPOV(2),
  86. MAKEPOV(3),
  87. MAKEBTNS(0x00),
  88. MAKEBTNS(0x10),
  89. MAKEBTNS(0x20),
  90. MAKEBTNS(0x30),
  91. MAKEBTNS(0x40),
  92. MAKEBTNS(0x50),
  93. MAKEBTNS(0x60),
  94. MAKEBTNS(0x70),
  95. MAKEVALS(lV, VELOCITY),
  96. MAKEVALS(lA, ACCEL),
  97. MAKEVALS(lF, FORCE),
  98. };
  99. const DIDATAFORMAT c_dfDIJoystick2 = {
  100. sizeof(DIDATAFORMAT),
  101. sizeof(DIOBJECTDATAFORMAT),
  102. DIDF_ABSAXIS,
  103. sizeof(DIJOYSTATE2),
  104. cA(c_rgodfDIJoy2),
  105. c_rgodfDIJoy2,
  106. };
  107. #pragma END_CONST_DATA