TouchSliderState.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #pragma once
  2. #include <stdint.h>
  3. #define SLIDER_OK 3
  4. #define SLIDER_SECTIONS 4
  5. #define SLIDER_SENSORS 32
  6. #define NO_PRESSURE 0
  7. #define FULL_PRESSURE 180
  8. namespace TLAC::Components
  9. {
  10. struct TouchSliderSerialState
  11. {
  12. uint8_t padding[0x1960];
  13. int sliderResponseCnt;
  14. struct
  15. {
  16. int scanMode;
  17. int scanCount;
  18. struct
  19. {
  20. uint32_t pressureHistory[4]; // first: current, second: last sample, ...
  21. } sensors[SLIDER_SENSORS];
  22. } sliderSerialResponse;
  23. struct
  24. {
  25. int scanMode;
  26. int scanCount;
  27. struct
  28. {
  29. uint32_t pressureHistory[4]; // first: current, second: last sample, ...
  30. } sensors[SLIDER_SENSORS];
  31. } sliderSerialResponseCopy; // the other one is copied here by the game, feel free to ignore it
  32. };
  33. struct TouchSliderState
  34. {
  35. uint8_t Padding0000[104];
  36. TouchSliderSerialState* SerialState;
  37. int32_t State;
  38. uint8_t Padding0074[20 + 12];
  39. int32_t SensorPressureLevels[SLIDER_SENSORS];
  40. uint8_t Padding0108[52 - 12];
  41. float SectionPositions[SLIDER_SECTIONS];
  42. int SectionConnections[SLIDER_SECTIONS];
  43. uint8_t Padding015C[4];
  44. bool SectionTouched[SLIDER_SECTIONS];
  45. uint8_t Padding013C[3128 - 52 - 40];
  46. struct
  47. {
  48. uint8_t Padding00[2];
  49. bool IsTouched;
  50. uint8_t Padding[45];
  51. } SensorTouched[SLIDER_SENSORS];
  52. // two different places to be set depending on operation mode now
  53. // stick/button based emulation directly controls sections and raw slider emulation controls fake serial inputs
  54. enum SliderSensorSetMode
  55. {
  56. SENSOR_SET_MODE_SECTIONS,
  57. SENSOR_SET_MODE_RAW
  58. };
  59. void SetSensor(int index, int value, SliderSensorSetMode mode);
  60. void ResetSensors(SliderSensorSetMode mode);
  61. };
  62. }