mode_xinput.h 1.0 KB

12345678910111213141516171819202122232425262728
  1. // mode_xinput.h -- Xbox 360 wired (XInput) personality (MODE_XBOX): XInput gamepad + right-pad mouse.
  2. //
  3. // Real Xbox 360 pads are NOT HID: they use a vendor interface (class 0xFF / sub 0x5D / proto 0x01) carrying a
  4. // 20-byte XInput report. A custom TinyUSB class driver serves that interface plus a second boot-mouse interface
  5. // for the right trackpad. Host binds by VID/PID (045E:028E) + the FF/5D/01 interface. The OUT endpoint carries
  6. // rumble, relayed to the controller as a haptic by task().
  7. #pragma once
  8. #include "controllers.h"
  9. #include <stdint.h>
  10. class XboxController : public IController {
  11. public:
  12. void begin() override;
  13. void onReport45(int slot, const uint8_t *rep, bool fresh,
  14. uint8_t bodyTlen) override;
  15. // legacy XInput rumble -> haptic relay + stuck-rumble watchdog
  16. void task() override;
  17. bool dynamicMount() const override
  18. {
  19. return true;
  20. }
  21. uint8_t maxSlots() const override;
  22. void usbIdentity() override;
  23. void beginPool() override;
  24. void mountSlots(uint8_t k) override;
  25. };
  26. extern XboxController g_xboxCtl;