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.

68 lines
2.1 KiB

  1. /*****************************************************************************
  2. *
  3. * diqdevj.c
  4. *
  5. * Acquire an IDirectInputDevice8 as if it were a joystick.
  6. *
  7. *****************************************************************************/
  8. #include "diquick.h"
  9. /*****************************************************************************
  10. *
  11. * Devj_UpdateStatus
  12. *
  13. *****************************************************************************/
  14. STDMETHODIMP
  15. Devj_UpdateStatus(PDEVDLGINFO pddi, LPTSTR ptszBuf)
  16. {
  17. HRESULT hres;
  18. DIJOYSTATE2 js;
  19. IDirectInputDevice8 *pdid = pddi->pdid;
  20. hres = IDirectInputDevice8_GetDeviceState(pdid, sizeof(js), &js);
  21. if (SUCCEEDED(hres)) {
  22. UINT ib;
  23. ptszBuf += wsprintf(ptszBuf,
  24. TEXT("X = %d\r\n")
  25. TEXT("Y = %d\r\n")
  26. TEXT("Z = %d\r\n")
  27. TEXT("Rx = %d\r\n")
  28. TEXT("Ry = %d\r\n")
  29. TEXT("Rz = %d\r\n")
  30. TEXT("S0 = %d\r\n")
  31. TEXT("S1 = %d\r\n")
  32. TEXT("POV = %d %d %d %d\r\n"),
  33. js.lX, js.lY, js.lZ,
  34. js.lRx, js.lRy, js.lRz,
  35. js.rglSlider[0], js.rglSlider[1],
  36. js.rgdwPOV[0],
  37. js.rgdwPOV[1],
  38. js.rgdwPOV[2],
  39. js.rgdwPOV[3]);
  40. for (ib = 0; ib < 128; ib++) {
  41. if (js.rgbButtons[ib] & 0x80) {
  42. ptszBuf += wsprintf(ptszBuf, TEXT(" %d"), ib);
  43. }
  44. }
  45. }
  46. return hres;
  47. }
  48. /*****************************************************************************
  49. *
  50. * c_acqvtblDevJoy
  51. *
  52. *****************************************************************************/
  53. #pragma BEGIN_CONST_DATA
  54. ACQVTBL c_acqvtblDevJoy = {
  55. Devj_UpdateStatus,
  56. Common_AcqSetDataFormat,
  57. Common_AcqDestroy,
  58. &c_dfDIJoystick2,
  59. };
  60. #pragma END_CONST_DATA