controllers.cpp 922 B

1234567891011121314151617181920212223242526
  1. #include "controllers.h"
  2. #include "config.h"
  3. #include "puck_hid.h"
  4. #include "mode_xinput.h"
  5. #include "mode_switch_hori.h"
  6. #include "mode_switch_pro.h"
  7. #include "mode_ps5.h"
  8. #include "mode_hidgyro.h"
  9. IController* g_active = nullptr;
  10. // Map a USB-presentation mode to its singleton controller. Steam and Lizard share the puck controller (the
  11. // lizard-vs-forward decision is made per-report inside it). This is the one place that knows the mode->class
  12. // mapping; everything else dispatches through g_active.
  13. IController* controllerFor(uint8_t mode){
  14. switch(mode){
  15. case MODE_STEAM: return &g_steamPuck;
  16. case MODE_LIZARD: return &g_steamPuck;
  17. case MODE_XBOX: return &g_xboxCtl;
  18. case MODE_SW_HORI: return &g_switchHori;
  19. case MODE_SW_PRO: return &g_switchPro;
  20. case MODE_PS5: return &g_ps5Ctl;
  21. case MODE_HIDGYRO: return &g_hidGyroCtl;
  22. default: return &g_steamPuck;
  23. }
  24. }