GCPadStatus.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2008 Dolphin Emulator Project
  2. // Licensed under GPLv2+
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include "Common/CommonTypes.h"
  6. enum PadError
  7. {
  8. PAD_ERR_NONE = 0,
  9. PAD_ERR_NO_CONTROLLER = -1,
  10. PAD_ERR_NOT_READY = -2,
  11. PAD_ERR_TRANSFER = -3,
  12. };
  13. enum
  14. {
  15. PAD_USE_ORIGIN = 0x0080,
  16. };
  17. enum PadButton
  18. {
  19. PAD_BUTTON_LEFT = 0x0001,
  20. PAD_BUTTON_RIGHT = 0x0002,
  21. PAD_BUTTON_DOWN = 0x0004,
  22. PAD_BUTTON_UP = 0x0008,
  23. PAD_TRIGGER_Z = 0x0010,
  24. PAD_TRIGGER_R = 0x0020,
  25. PAD_TRIGGER_L = 0x0040,
  26. PAD_BUTTON_A = 0x0100,
  27. PAD_BUTTON_B = 0x0200,
  28. PAD_BUTTON_X = 0x0400,
  29. PAD_BUTTON_Y = 0x0800,
  30. PAD_BUTTON_START = 0x1000,
  31. };
  32. struct GCPadStatus
  33. {
  34. u16 button; // Or-ed PAD_BUTTON_* and PAD_TRIGGER_* bits
  35. u8 stickX; // 0 <= stickX <= 255
  36. u8 stickY; // 0 <= stickY <= 255
  37. u8 substickX; // 0 <= substickX <= 255
  38. u8 substickY; // 0 <= substickY <= 255
  39. u8 triggerLeft; // 0 <= triggerLeft <= 255
  40. u8 triggerRight; // 0 <= triggerRight <= 255
  41. u8 analogA; // 0 <= analogA <= 255
  42. u8 analogB; // 0 <= analogB <= 255
  43. s8 err; // one of PAD_ERR_* number
  44. static const u8 MAIN_STICK_CENTER_X = 0x80;
  45. static const u8 MAIN_STICK_CENTER_Y = 0x80;
  46. static const u8 MAIN_STICK_RADIUS = 0x7f;
  47. static const u8 C_STICK_CENTER_X = 0x80;
  48. static const u8 C_STICK_CENTER_Y = 0x80;
  49. static const u8 C_STICK_RADIUS = 0x7f;
  50. };