mode_ps3.h 1.6 KB

12345678910111213141516171819202122232425
  1. // mode_ps3.h -- Sony DualShock 3 / Sixaxis personality (MODE_PS3): 054C:0268.
  2. //
  3. // Unlike the PC-facing PS modes, this one is built to enumerate on a REAL PlayStation 3 console. The PS3 does
  4. // NOT parse the HID report descriptor to drive input the way a PC does -- it recognises the Sixaxis by VID/PID
  5. // and a fixed control-transfer "enable" handshake. So this mode replicates the genuine Sixaxis byte-for-byte:
  6. // the exact 148-byte HID report descriptor, the GET_REPORT(Feature) magic reports the console reads during
  7. // enable (0x01 calibration, 0xEF/0xF2 device+MAC info, 0xF5/0xF7/0xF8 status), and the SET_REPORT(0xF4)
  8. // operational command. It then streams the 49-byte Sixaxis input report (id 0x01): buttons, sticks, analog
  9. // pressures, accelerometer X/Y/Z + gyro Z, and a USB-plugged/charged status block. Rumble + LED arrive on the
  10. // 0x01 output report. Clean single-HID device (no wake mouse / WebUSB) -- the console wants a bare Sixaxis.
  11. #pragma once
  12. #include "controllers.h"
  13. class Ps3Controller : public IController {
  14. public:
  15. // STATIC mount (NOT dynamicMount): a real PS3 rejects the empty config a dynamic mode shows at plug-in
  16. // before a controller has linked, and dislikes the later detach/re-attach. A genuine Sixaxis is always
  17. // exactly one interface, so we present the single DS3 HID permanently from begin() and just stream neutral
  18. // reports until a controller connects. begin() also sets the USB identity (the static setup path, unlike
  19. // usbReenumerate, never calls usbIdentity()).
  20. void begin() override;
  21. void task() override;
  22. void usbIdentity() override;
  23. };
  24. extern Ps3Controller g_ps3Ctl;