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.

86 lines
2.3 KiB

  1. //@doc
  2. /******************************************************
  3. **
  4. ** @module FFDEVICE.CPP | Implementation file for FFDevice class
  5. **
  6. ** Description:
  7. **
  8. ** History:
  9. ** Created 11/17/97 Matthew L. Coill (mlc)
  10. **
  11. ** 20-Mar-99 waltw Added dwDeviceID to SetFirmwareVersion
  12. **
  13. ** (c) 1986-1997 Microsoft Corporation. All Rights Reserved.
  14. ******************************************************/
  15. #include "FFDevice.h"
  16. #include "Midi_obj.hpp"
  17. #include "DTrans.h"
  18. #include "joyregst.hpp"
  19. extern CJoltMidi* g_pJoltMidi;
  20. ForceFeedbackDevice g_ForceFeedbackDevice;
  21. /******************************************************
  22. **
  23. ** ForceFeedbackDevice::ForceFeedbackDevice()
  24. **
  25. ** @mfunc Constructor.
  26. **
  27. ******************************************************/
  28. ForceFeedbackDevice::ForceFeedbackDevice() :
  29. m_FirmwareAckNackValues(0),
  30. m_FirmwareVersionMajor(0),
  31. m_FirmwareVersionMinor(0),
  32. m_DriverVersionMajor(0),
  33. m_DriverVersionMinor(0)
  34. {
  35. m_OSVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  36. ::GetVersionEx(&m_OSVersion);
  37. }
  38. /******************************************************
  39. **
  40. ** ForceFeedbackDevice::DetectHardware()
  41. **
  42. ** @mfunc DetectHardware.
  43. **
  44. ******************************************************/
  45. BOOL ForceFeedbackDevice::DetectHardware()
  46. {
  47. if (NULL == g_pJoltMidi) return FALSE;
  48. return g_pJoltMidi->QueryForJolt();
  49. }
  50. /******************************************************
  51. **
  52. ** ForceFeedbackDevice::SetFirmwareVersion(DWORD major, DWORD minor)
  53. **
  54. ** @mfunc SetFirmwareVersion.
  55. **
  56. ******************************************************/
  57. void ForceFeedbackDevice::SetFirmwareVersion(DWORD dwDeviceID, DWORD major, DWORD minor)
  58. {
  59. m_FirmwareVersionMajor = major;
  60. m_FirmwareVersionMinor = minor;
  61. m_FirmwareAckNackValues = GetAckNackMethodFromRegistry(dwDeviceID);
  62. }
  63. /******************************************************
  64. **
  65. ** ForceFeedbackDevice::SetDriverVersion(DWORD major, DWORD minor)
  66. **
  67. ** @mfunc SetDriverVersion.
  68. **
  69. ******************************************************/
  70. void ForceFeedbackDevice::SetDriverVersion(DWORD major, DWORD minor)
  71. {
  72. if ((major == 0xFFFFFFFF) && (minor == 0xFFFFFFFF)) { // Check for version 1.0 driver version error
  73. m_DriverVersionMajor = 1;
  74. m_DriverVersionMinor = 0;
  75. } else {
  76. m_DriverVersionMajor = major;
  77. m_DriverVersionMinor = minor;
  78. }
  79. }