mode_lizard.h 1.9 KB

1234567891011121314151617181920212223242526272829
  1. // mode_lizard.h -- configurable lizard (desktop) keyboard+mouse mode.
  2. //
  3. // Not a standalone IController: lizard rides ON the puck interface (puck_hid.cpp calls rfLizard
  4. // when Steam is closed or in MODE_LIZARD), driving mouse(0x40)+keyboard(0x41)+consumer(0x03) on
  5. // the same puck HID slot. The mapping table g_lizardMap (lizard_map.h) drives all outputs; the
  6. // default map mirrors the original hardcoded Valve SC1 behavior. Mouse reuses the Xbox-mode
  7. // velocity+friction+sub-pixel glide model (g_mDiv / g_mFric).
  8. //
  9. // EVERY connected controller drives lizard: rfLizard merges g_in[s] across all used bond slots
  10. // (populated by the per-slot RF decode) onto the ONE shared desktop mouse/keyboard, so any controller
  11. // on any bond slot contributes and multiple controllers drive the same cursor/keys together. Per-slot
  12. // glide/edge state keeps one controller's motion from clobbering another's.
  13. #pragma once
  14. #include <Adafruit_TinyUSB.h>
  15. #include <stdint.h>
  16. // Drives the desktop mouse/keyboard from the binding table. Merges input from ALL bonded controllers
  17. // (g_in[s] for every used slot) onto the one shared mouse/keyboard -- a controller on any RF slot
  18. // contributes, and multiple controllers drive the same cursor/keys together. mdev/kdev may be the same
  19. // object (puck mode sends both reports to hid[0]).
  20. void rfLizard(Adafruit_USBD_HID *mdev, Adafruit_USBD_HID *kdev, uint8_t mrid,
  21. uint8_t krid);
  22. // Release any keyboard/mouse/consumer input lizard is currently holding on the host and reset rfLizard's
  23. // internal last-sent + glide state. Call on the lizard->Steam handoff (Steam takes over the gamepad with no
  24. // USB re-enumeration): without it a key/button held at that instant stays latched on the desktop until a
  25. // reconnect or power-cycle. mdev/kdev may be the same object (puck mode uses hid[0] for both).
  26. void rfLizardRelease(Adafruit_USBD_HID *mdev, Adafruit_USBD_HID *kdev,
  27. uint8_t mrid, uint8_t krid);