summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/hid/controllers/touchscreen.cpp13
-rw-r--r--src/core/hle/service/hid/controllers/touchscreen.h7
2 files changed, 10 insertions, 10 deletions
diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp
index ac9112c40..6ef17acc5 100644
--- a/src/core/hle/service/hid/controllers/touchscreen.cpp
+++ b/src/core/hle/service/hid/controllers/touchscreen.cpp
@@ -74,8 +74,11 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin
74 for (std::size_t id = 0; id < MAX_FINGERS; ++id) { 74 for (std::size_t id = 0; id < MAX_FINGERS; ++id) {
75 auto& touch_entry = cur_entry.states[id]; 75 auto& touch_entry = cur_entry.states[id];
76 if (id < active_fingers_count) { 76 if (id < active_fingers_count) {
77 touch_entry.x = static_cast<u16>(active_fingers[id].x * Layout::ScreenUndocked::Width); 77 const auto& [active_x, active_y] = active_fingers[id].position;
78 touch_entry.y = static_cast<u16>(active_fingers[id].y * Layout::ScreenUndocked::Height); 78 touch_entry.position = {
79 .x = static_cast<u16>(active_x * Layout::ScreenUndocked::Width),
80 .y = static_cast<u16>(active_y * Layout::ScreenUndocked::Height),
81 };
79 touch_entry.diameter_x = Settings::values.touchscreen.diameter_x; 82 touch_entry.diameter_x = Settings::values.touchscreen.diameter_x;
80 touch_entry.diameter_y = Settings::values.touchscreen.diameter_y; 83 touch_entry.diameter_y = Settings::values.touchscreen.diameter_y;
81 touch_entry.rotation_angle = Settings::values.touchscreen.rotation_angle; 84 touch_entry.rotation_angle = Settings::values.touchscreen.rotation_angle;
@@ -86,8 +89,7 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin
86 } else { 89 } else {
87 // Clear touch entry 90 // Clear touch entry
88 touch_entry.attribute.raw = 0; 91 touch_entry.attribute.raw = 0;
89 touch_entry.x = 0; 92 touch_entry.position = {};
90 touch_entry.y = 0;
91 touch_entry.diameter_x = 0; 93 touch_entry.diameter_x = 0;
92 touch_entry.diameter_y = 0; 94 touch_entry.diameter_y = 0;
93 touch_entry.rotation_angle = 0; 95 touch_entry.rotation_angle = 0;
@@ -140,8 +142,7 @@ std::size_t Controller_Touchscreen::UpdateTouchInputEvent(
140 fingers[finger_id].id = static_cast<u32_le>(finger_id); 142 fingers[finger_id].id = static_cast<u32_le>(finger_id);
141 attribute.start_touch.Assign(1); 143 attribute.start_touch.Assign(1);
142 } 144 }
143 fingers[finger_id].x = x; 145 fingers[finger_id].position = {x, y};
144 fingers[finger_id].y = y;
145 fingers[finger_id].attribute = attribute; 146 fingers[finger_id].attribute = attribute;
146 return finger_id; 147 return finger_id;
147 } 148 }
diff --git a/src/core/hle/service/hid/controllers/touchscreen.h b/src/core/hle/service/hid/controllers/touchscreen.h
index 2869d0cfd..ef2becefd 100644
--- a/src/core/hle/service/hid/controllers/touchscreen.h
+++ b/src/core/hle/service/hid/controllers/touchscreen.h
@@ -7,6 +7,7 @@
7#include "common/bit_field.h" 7#include "common/bit_field.h"
8#include "common/common_funcs.h" 8#include "common/common_funcs.h"
9#include "common/common_types.h" 9#include "common/common_types.h"
10#include "common/point.h"
10#include "common/swap.h" 11#include "common/swap.h"
11#include "core/frontend/input.h" 12#include "core/frontend/input.h"
12#include "core/hle/service/hid/controllers/controller_base.h" 13#include "core/hle/service/hid/controllers/controller_base.h"
@@ -55,8 +56,7 @@ private:
55 u64_le delta_time; 56 u64_le delta_time;
56 Attributes attribute; 57 Attributes attribute;
57 u32_le finger; 58 u32_le finger;
58 u32_le x; 59 Common::Point<u32_le> position;
59 u32_le y;
60 u32_le diameter_x; 60 u32_le diameter_x;
61 u32_le diameter_y; 61 u32_le diameter_y;
62 u32_le rotation_angle; 62 u32_le rotation_angle;
@@ -81,8 +81,7 @@ private:
81 81
82 struct Finger { 82 struct Finger {
83 u64_le last_touch{}; 83 u64_le last_touch{};
84 float x{}; 84 Common::Point<float> position;
85 float y{};
86 u32_le id{}; 85 u32_le id{};
87 bool pressed{}; 86 bool pressed{};
88 Attributes attribute; 87 Attributes attribute;