diff options
| author | german77 <juangerman-13@hotmail.com> | 2021-10-21 00:49:09 -0500 |
|---|---|---|
| committer | Narr the Reg <juangerman-13@hotmail.com> | 2021-11-24 20:30:25 -0600 |
| commit | 95cf66b6559c3e7a1eb40be919f16217566ffdbc (patch) | |
| tree | 0219a3e9e5441bf696d38d693a5dba4bfa2e3672 /src/core/hle/service/hid/controllers/gesture.h | |
| parent | 85052b8662d9512077780f717fb2e168390ed705 (diff) | |
service/hid: Use ring buffer for gestures
Diffstat (limited to 'src/core/hle/service/hid/controllers/gesture.h')
| -rw-r--r-- | src/core/hle/service/hid/controllers/gesture.h | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/core/hle/service/hid/controllers/gesture.h b/src/core/hle/service/hid/controllers/gesture.h index 6128fb0ad..6f5abaa4f 100644 --- a/src/core/hle/service/hid/controllers/gesture.h +++ b/src/core/hle/service/hid/controllers/gesture.h @@ -71,7 +71,6 @@ private: // This is nn::hid::GestureState struct GestureState { s64_le sampling_number; - s64_le sampling_number2; s64_le detection_count; GestureType type; GestureDirection direction; @@ -85,21 +84,7 @@ private: s32_le point_count; std::array<Common::Point<s32_le>, 4> points; }; - static_assert(sizeof(GestureState) == 0x68, "GestureState is an invalid size"); - - struct CommonHeader { - s64_le timestamp; - s64_le total_entry_count; - s64_le last_entry_index; - s64_le entry_count; - }; - static_assert(sizeof(CommonHeader) == 0x20, "CommonHeader is an invalid size"); - - struct SharedMemory { - CommonHeader header; - std::array<GestureState, 17> gesture_states; - }; - static_assert(sizeof(SharedMemory) == 0x708, "SharedMemory is an invalid size"); + static_assert(sizeof(GestureState) == 0x60, "GestureState is an invalid size"); struct Finger { Common::Point<f32> pos{}; @@ -153,13 +138,16 @@ private: GestureType& type); // Retrieves the last gesture entry, as indicated by shared memory indices. - [[nodiscard]] GestureState& GetLastGestureEntry(); [[nodiscard]] const GestureState& GetLastGestureEntry() const; // Returns the average distance, angle and middle point of the active fingers GestureProperties GetGestureProperties(); - SharedMemory shared_memory{}; + // This is nn::hid::detail::GestureLifo + Lifo<GestureState> gesture_lifo{}; + static_assert(sizeof(gesture_lifo) == 0x708, "gesture_lifo is an invalid size"); + GestureState next_state{}; + Core::HID::EmulatedConsole* console; std::array<Finger, MAX_POINTS> fingers{}; |
