gesture.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright 2018 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <array>
  6. #include "common/common_types.h"
  7. #include "common/swap.h"
  8. #include "core/hle/service/hid/controllers/controller_base.h"
  9. namespace Service::HID {
  10. class Controller_Gesture final : public ControllerBase {
  11. public:
  12. Controller_Gesture();
  13. ~Controller_Gesture() override;
  14. // Called when the controller is initialized
  15. void OnInit() override;
  16. // When the controller is released
  17. void OnRelease() override;
  18. // When the controller is requesting an update for the shared memory
  19. void OnUpdate(u8* data, size_t size) override;
  20. // Called when input devices should be loaded
  21. void OnLoadInputDevices() override;
  22. private:
  23. struct Locations {
  24. s32_le x;
  25. s32_le y;
  26. };
  27. struct GestureState {
  28. s64_le sampling_number;
  29. s64_le sampling_number2;
  30. s64_le detection_count;
  31. s32_le type;
  32. s32_le dir;
  33. s32_le x;
  34. s32_le y;
  35. s32_le delta_x;
  36. s32_le delta_y;
  37. f32 vel_x;
  38. f32 vel_y;
  39. s32_le attributes;
  40. f32 scale;
  41. f32 rotation;
  42. s32_le location_count;
  43. std::array<Locations, 4> locations;
  44. };
  45. static_assert(sizeof(GestureState) == 0x68, "GestureState is an invalid size");
  46. struct SharedMemory {
  47. CommonHeader header;
  48. std::array<GestureState, 17> gesture_states;
  49. };
  50. SharedMemory shared_memory{};
  51. };
  52. } // namespace Service::HID