diff options
| author | 2021-10-22 23:04:06 -0500 | |
|---|---|---|
| committer | 2021-11-24 20:30:25 -0600 | |
| commit | b564f024f0be5023cf13fb2fca953ea6c1feeeb6 (patch) | |
| tree | bb2fb272058a239a345856d4b34389791ea0a783 /src/core/hle | |
| parent | service/hid: Match shared memory closer to HW (diff) | |
| download | yuzu-b564f024f0be5023cf13fb2fca953ea6c1feeeb6.tar.gz yuzu-b564f024f0be5023cf13fb2fca953ea6c1feeeb6.tar.xz yuzu-b564f024f0be5023cf13fb2fca953ea6c1feeeb6.zip | |
Morph review first wave
Diffstat (limited to 'src/core/hle')
| -rw-r--r-- | src/core/hle/service/hid/controllers/console_sixaxis.h | 14 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/debug_pad.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/gesture.cpp | 9 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/gesture.h | 33 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/keyboard.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.h | 22 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/stubbed.h | 8 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/touchscreen.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/touchscreen.h | 14 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/xpad.h | 6 | ||||
| -rw-r--r-- | src/core/hle/service/hid/ring_lifo.h | 10 |
12 files changed, 56 insertions, 74 deletions
diff --git a/src/core/hle/service/hid/controllers/console_sixaxis.h b/src/core/hle/service/hid/controllers/console_sixaxis.h index 6d18d2ce0..95729e6b2 100644 --- a/src/core/hle/service/hid/controllers/console_sixaxis.h +++ b/src/core/hle/service/hid/controllers/console_sixaxis.h | |||
| @@ -35,8 +35,8 @@ public: | |||
| 35 | private: | 35 | private: |
| 36 | struct SevenSixAxisState { | 36 | struct SevenSixAxisState { |
| 37 | INSERT_PADDING_WORDS(4); // unused | 37 | INSERT_PADDING_WORDS(4); // unused |
| 38 | s64_le sampling_number{}; | 38 | s64 sampling_number{}; |
| 39 | s64_le sampling_number2{}; | 39 | s64 sampling_number2{}; |
| 40 | u64 unknown{}; | 40 | u64 unknown{}; |
| 41 | Common::Vec3f accel{}; | 41 | Common::Vec3f accel{}; |
| 42 | Common::Vec3f gyro{}; | 42 | Common::Vec3f gyro{}; |
| @@ -45,10 +45,10 @@ private: | |||
| 45 | static_assert(sizeof(SevenSixAxisState) == 0x50, "SevenSixAxisState is an invalid size"); | 45 | static_assert(sizeof(SevenSixAxisState) == 0x50, "SevenSixAxisState is an invalid size"); |
| 46 | 46 | ||
| 47 | struct CommonHeader { | 47 | struct CommonHeader { |
| 48 | s64_le timestamp; | 48 | s64 timestamp; |
| 49 | s64_le total_entry_count; | 49 | s64 total_entry_count; |
| 50 | s64_le last_entry_index; | 50 | s64 last_entry_index; |
| 51 | s64_le entry_count; | 51 | s64 entry_count; |
| 52 | }; | 52 | }; |
| 53 | static_assert(sizeof(CommonHeader) == 0x20, "CommonHeader is an invalid size"); | 53 | static_assert(sizeof(CommonHeader) == 0x20, "CommonHeader is an invalid size"); |
| 54 | 54 | ||
| @@ -61,7 +61,7 @@ private: | |||
| 61 | 61 | ||
| 62 | // This is nn::hid::detail::ConsoleSixAxisSensorSharedMemoryFormat | 62 | // This is nn::hid::detail::ConsoleSixAxisSensorSharedMemoryFormat |
| 63 | struct ConsoleSharedMemory { | 63 | struct ConsoleSharedMemory { |
| 64 | u64_le sampling_number{}; | 64 | u64 sampling_number{}; |
| 65 | bool is_seven_six_axis_sensor_at_rest{}; | 65 | bool is_seven_six_axis_sensor_at_rest{}; |
| 66 | f32 verticalization_error{}; | 66 | f32 verticalization_error{}; |
| 67 | Common::Vec3f gyro_bias{}; | 67 | Common::Vec3f gyro_bias{}; |
diff --git a/src/core/hle/service/hid/controllers/debug_pad.h b/src/core/hle/service/hid/controllers/debug_pad.h index 11b6c669b..bd0f15eaa 100644 --- a/src/core/hle/service/hid/controllers/debug_pad.h +++ b/src/core/hle/service/hid/controllers/debug_pad.h | |||
| @@ -38,7 +38,7 @@ private: | |||
| 38 | // This is nn::hid::DebugPadAttribute | 38 | // This is nn::hid::DebugPadAttribute |
| 39 | struct DebugPadAttribute { | 39 | struct DebugPadAttribute { |
| 40 | union { | 40 | union { |
| 41 | u32_le raw{}; | 41 | u32 raw{}; |
| 42 | BitField<0, 1, u32> connected; | 42 | BitField<0, 1, u32> connected; |
| 43 | }; | 43 | }; |
| 44 | }; | 44 | }; |
| @@ -46,7 +46,7 @@ private: | |||
| 46 | 46 | ||
| 47 | // This is nn::hid::DebugPadState | 47 | // This is nn::hid::DebugPadState |
| 48 | struct DebugPadState { | 48 | struct DebugPadState { |
| 49 | s64_le sampling_number; | 49 | s64 sampling_number; |
| 50 | DebugPadAttribute attribute; | 50 | DebugPadAttribute attribute; |
| 51 | Core::HID::DebugPadButton pad_state; | 51 | Core::HID::DebugPadButton pad_state; |
| 52 | Core::HID::AnalogStickState r_stick; | 52 | Core::HID::AnalogStickState r_stick; |
diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp index a82d04b3b..7a7bc68a2 100644 --- a/src/core/hle/service/hid/controllers/gesture.cpp +++ b/src/core/hle/service/hid/controllers/gesture.cpp | |||
| @@ -65,10 +65,7 @@ void Controller_Gesture::OnUpdate(const Core::Timing::CoreTiming& core_timing, u | |||
| 65 | void Controller_Gesture::ReadTouchInput() { | 65 | void Controller_Gesture::ReadTouchInput() { |
| 66 | const auto touch_status = console->GetTouch(); | 66 | const auto touch_status = console->GetTouch(); |
| 67 | for (std::size_t id = 0; id < fingers.size(); ++id) { | 67 | for (std::size_t id = 0; id < fingers.size(); ++id) { |
| 68 | const Core::HID::TouchFinger& status = touch_status[id]; | 68 | fingers[id] = touch_status[id]; |
| 69 | Finger& finger = fingers[id]; | ||
| 70 | finger.pos = status.position; | ||
| 71 | finger.pressed = status.pressed; | ||
| 72 | } | 69 | } |
| 73 | } | 70 | } |
| 74 | 71 | ||
| @@ -315,14 +312,14 @@ const Controller_Gesture::GestureState& Controller_Gesture::GetLastGestureEntry( | |||
| 315 | 312 | ||
| 316 | Controller_Gesture::GestureProperties Controller_Gesture::GetGestureProperties() { | 313 | Controller_Gesture::GestureProperties Controller_Gesture::GetGestureProperties() { |
| 317 | GestureProperties gesture; | 314 | GestureProperties gesture; |
| 318 | std::array<Finger, MAX_POINTS> active_fingers; | 315 | std::array<Core::HID::TouchFinger, MAX_POINTS> active_fingers; |
| 319 | const auto end_iter = std::copy_if(fingers.begin(), fingers.end(), active_fingers.begin(), | 316 | const auto end_iter = std::copy_if(fingers.begin(), fingers.end(), active_fingers.begin(), |
| 320 | [](const auto& finger) { return finger.pressed; }); | 317 | [](const auto& finger) { return finger.pressed; }); |
| 321 | gesture.active_points = | 318 | gesture.active_points = |
| 322 | static_cast<std::size_t>(std::distance(active_fingers.begin(), end_iter)); | 319 | static_cast<std::size_t>(std::distance(active_fingers.begin(), end_iter)); |
| 323 | 320 | ||
| 324 | for (size_t id = 0; id < gesture.active_points; ++id) { | 321 | for (size_t id = 0; id < gesture.active_points; ++id) { |
| 325 | const auto& [active_x, active_y] = active_fingers[id].pos; | 322 | const auto& [active_x, active_y] = active_fingers[id].position; |
| 326 | gesture.points[id] = { | 323 | gesture.points[id] = { |
| 327 | .x = static_cast<s32>(active_x * Layout::ScreenUndocked::Width), | 324 | .x = static_cast<s32>(active_x * Layout::ScreenUndocked::Width), |
| 328 | .y = static_cast<s32>(active_y * Layout::ScreenUndocked::Height), | 325 | .y = static_cast<s32>(active_y * Layout::ScreenUndocked::Height), |
diff --git a/src/core/hle/service/hid/controllers/gesture.h b/src/core/hle/service/hid/controllers/gesture.h index 6f5abaa4f..58139a5cf 100644 --- a/src/core/hle/service/hid/controllers/gesture.h +++ b/src/core/hle/service/hid/controllers/gesture.h | |||
| @@ -60,7 +60,7 @@ private: | |||
| 60 | // This is nn::hid::GestureAttribute | 60 | // This is nn::hid::GestureAttribute |
| 61 | struct GestureAttribute { | 61 | struct GestureAttribute { |
| 62 | union { | 62 | union { |
| 63 | u32_le raw{}; | 63 | u32 raw{}; |
| 64 | 64 | ||
| 65 | BitField<4, 1, u32> is_new_touch; | 65 | BitField<4, 1, u32> is_new_touch; |
| 66 | BitField<8, 1, u32> is_double_tap; | 66 | BitField<8, 1, u32> is_double_tap; |
| @@ -70,33 +70,28 @@ private: | |||
| 70 | 70 | ||
| 71 | // This is nn::hid::GestureState | 71 | // This is nn::hid::GestureState |
| 72 | struct GestureState { | 72 | struct GestureState { |
| 73 | s64_le sampling_number; | 73 | s64 sampling_number; |
| 74 | s64_le detection_count; | 74 | s64 detection_count; |
| 75 | GestureType type; | 75 | GestureType type; |
| 76 | GestureDirection direction; | 76 | GestureDirection direction; |
| 77 | Common::Point<s32_le> pos; | 77 | Common::Point<s32> pos; |
| 78 | Common::Point<s32_le> delta; | 78 | Common::Point<s32> delta; |
| 79 | f32 vel_x; | 79 | f32 vel_x; |
| 80 | f32 vel_y; | 80 | f32 vel_y; |
| 81 | GestureAttribute attributes; | 81 | GestureAttribute attributes; |
| 82 | f32 scale; | 82 | f32 scale; |
| 83 | f32 rotation_angle; | 83 | f32 rotation_angle; |
| 84 | s32_le point_count; | 84 | s32 point_count; |
| 85 | std::array<Common::Point<s32_le>, 4> points; | 85 | std::array<Common::Point<s32>, 4> points; |
| 86 | }; | 86 | }; |
| 87 | static_assert(sizeof(GestureState) == 0x60, "GestureState is an invalid size"); | 87 | static_assert(sizeof(GestureState) == 0x60, "GestureState is an invalid size"); |
| 88 | 88 | ||
| 89 | struct Finger { | ||
| 90 | Common::Point<f32> pos{}; | ||
| 91 | bool pressed{}; | ||
| 92 | }; | ||
| 93 | |||
| 94 | struct GestureProperties { | 89 | struct GestureProperties { |
| 95 | std::array<Common::Point<s32_le>, MAX_POINTS> points{}; | 90 | std::array<Common::Point<s32>, MAX_POINTS> points{}; |
| 96 | std::size_t active_points{}; | 91 | std::size_t active_points{}; |
| 97 | Common::Point<s32_le> mid_point{}; | 92 | Common::Point<s32> mid_point{}; |
| 98 | s64_le detection_count{}; | 93 | s64 detection_count{}; |
| 99 | u64_le delta_time{}; | 94 | u64 delta_time{}; |
| 100 | f32 average_distance{}; | 95 | f32 average_distance{}; |
| 101 | f32 angle{}; | 96 | f32 angle{}; |
| 102 | }; | 97 | }; |
| @@ -150,10 +145,10 @@ private: | |||
| 150 | 145 | ||
| 151 | Core::HID::EmulatedConsole* console; | 146 | Core::HID::EmulatedConsole* console; |
| 152 | 147 | ||
| 153 | std::array<Finger, MAX_POINTS> fingers{}; | 148 | std::array<Core::HID::TouchFinger, MAX_POINTS> fingers{}; |
| 154 | GestureProperties last_gesture{}; | 149 | GestureProperties last_gesture{}; |
| 155 | s64_le last_update_timestamp{}; | 150 | s64 last_update_timestamp{}; |
| 156 | s64_le last_tap_timestamp{}; | 151 | s64 last_tap_timestamp{}; |
| 157 | f32 last_pan_time_difference{}; | 152 | f32 last_pan_time_difference{}; |
| 158 | bool force_update{false}; | 153 | bool force_update{false}; |
| 159 | bool enable_press_and_tap{false}; | 154 | bool enable_press_and_tap{false}; |
diff --git a/src/core/hle/service/hid/controllers/keyboard.h b/src/core/hle/service/hid/controllers/keyboard.h index 6919e092a..aba4f123e 100644 --- a/src/core/hle/service/hid/controllers/keyboard.h +++ b/src/core/hle/service/hid/controllers/keyboard.h | |||
| @@ -37,7 +37,7 @@ public: | |||
| 37 | private: | 37 | private: |
| 38 | // This is nn::hid::detail::KeyboardState | 38 | // This is nn::hid::detail::KeyboardState |
| 39 | struct KeyboardState { | 39 | struct KeyboardState { |
| 40 | s64_le sampling_number; | 40 | s64 sampling_number; |
| 41 | Core::HID::KeyboardModifier modifier; | 41 | Core::HID::KeyboardModifier modifier; |
| 42 | Core::HID::KeyboardKey key; | 42 | Core::HID::KeyboardKey key; |
| 43 | }; | 43 | }; |
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index aad298364..7bf31f63a 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -106,7 +106,7 @@ Controller_NPad::Controller_NPad(Core::System& system_, | |||
| 106 | Core::HID::ControllerUpdateCallback engine_callback{ | 106 | Core::HID::ControllerUpdateCallback engine_callback{ |
| 107 | .on_change = [this, | 107 | .on_change = [this, |
| 108 | i](Core::HID::ControllerTriggerType type) { ControllerUpdate(type, i); }, | 108 | i](Core::HID::ControllerTriggerType type) { ControllerUpdate(type, i); }, |
| 109 | .is_service = true, | 109 | .is_npad_service = true, |
| 110 | }; | 110 | }; |
| 111 | controller.callback_key = controller.device->SetCallback(engine_callback); | 111 | controller.callback_key = controller.device->SetCallback(engine_callback); |
| 112 | } | 112 | } |
| @@ -157,7 +157,6 @@ void Controller_NPad::ControllerUpdate(Core::HID::ControllerTriggerType type, | |||
| 157 | 157 | ||
| 158 | void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) { | 158 | void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) { |
| 159 | auto& controller = controller_data[controller_idx]; | 159 | auto& controller = controller_data[controller_idx]; |
| 160 | LOG_WARNING(Service_HID, "Connect {} {}", controller_idx, controller.is_connected); | ||
| 161 | const auto controller_type = controller.device->GetNpadType(); | 160 | const auto controller_type = controller.device->GetNpadType(); |
| 162 | auto& shared_memory = controller.shared_memory_entry; | 161 | auto& shared_memory = controller.shared_memory_entry; |
| 163 | if (controller_type == Core::HID::NpadType::None) { | 162 | if (controller_type == Core::HID::NpadType::None) { |
| @@ -892,7 +891,6 @@ void Controller_NPad::DisconnectNpad(u32 npad_id) { | |||
| 892 | 891 | ||
| 893 | void Controller_NPad::DisconnectNpadAtIndex(std::size_t npad_index) { | 892 | void Controller_NPad::DisconnectNpadAtIndex(std::size_t npad_index) { |
| 894 | auto& controller = controller_data[npad_index]; | 893 | auto& controller = controller_data[npad_index]; |
| 895 | LOG_WARNING(Service_HID, "Disconnect {} {}", npad_index, controller.is_connected); | ||
| 896 | for (std::size_t device_idx = 0; device_idx < controller.vibration.size(); ++device_idx) { | 894 | for (std::size_t device_idx = 0; device_idx < controller.vibration.size(); ++device_idx) { |
| 897 | // Send an empty vibration to stop any vibrations. | 895 | // Send an empty vibration to stop any vibrations. |
| 898 | VibrateControllerAtIndex(npad_index, device_idx, {}); | 896 | VibrateControllerAtIndex(npad_index, device_idx, {}); |
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index 7c534a32f..0a2dc6992 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h | |||
| @@ -195,7 +195,7 @@ public: | |||
| 195 | 195 | ||
| 196 | private: | 196 | private: |
| 197 | // This is nn::hid::detail::ColorAttribute | 197 | // This is nn::hid::detail::ColorAttribute |
| 198 | enum class ColorAttribute : u32_le { | 198 | enum class ColorAttribute : u32 { |
| 199 | Ok = 0, | 199 | Ok = 0, |
| 200 | ReadError = 1, | 200 | ReadError = 1, |
| 201 | NoController = 2, | 201 | NoController = 2, |
| @@ -220,7 +220,7 @@ private: | |||
| 220 | // This is nn::hid::NpadAttribute | 220 | // This is nn::hid::NpadAttribute |
| 221 | struct NpadAttribute { | 221 | struct NpadAttribute { |
| 222 | union { | 222 | union { |
| 223 | u32_le raw{}; | 223 | u32 raw{}; |
| 224 | BitField<0, 1, u32> is_connected; | 224 | BitField<0, 1, u32> is_connected; |
| 225 | BitField<1, 1, u32> is_wired; | 225 | BitField<1, 1, u32> is_wired; |
| 226 | BitField<2, 1, u32> is_left_connected; | 226 | BitField<2, 1, u32> is_left_connected; |
| @@ -251,7 +251,7 @@ private: | |||
| 251 | // This is nn::hid::SixAxisSensorAttribute | 251 | // This is nn::hid::SixAxisSensorAttribute |
| 252 | struct SixAxisSensorAttribute { | 252 | struct SixAxisSensorAttribute { |
| 253 | union { | 253 | union { |
| 254 | u32_le raw{}; | 254 | u32 raw{}; |
| 255 | BitField<0, 1, u32> is_connected; | 255 | BitField<0, 1, u32> is_connected; |
| 256 | BitField<1, 1, u32> is_interpolated; | 256 | BitField<1, 1, u32> is_interpolated; |
| 257 | }; | 257 | }; |
| @@ -260,8 +260,8 @@ private: | |||
| 260 | 260 | ||
| 261 | // This is nn::hid::SixAxisSensorState | 261 | // This is nn::hid::SixAxisSensorState |
| 262 | struct SixAxisSensorState { | 262 | struct SixAxisSensorState { |
| 263 | s64_le delta_time{}; | 263 | s64 delta_time{}; |
| 264 | s64_le sampling_number{}; | 264 | s64 sampling_number{}; |
| 265 | Common::Vec3f accel{}; | 265 | Common::Vec3f accel{}; |
| 266 | Common::Vec3f gyro{}; | 266 | Common::Vec3f gyro{}; |
| 267 | Common::Vec3f rotation{}; | 267 | Common::Vec3f rotation{}; |
| @@ -273,16 +273,16 @@ private: | |||
| 273 | 273 | ||
| 274 | // This is nn::hid::server::NpadGcTriggerState | 274 | // This is nn::hid::server::NpadGcTriggerState |
| 275 | struct NpadGcTriggerState { | 275 | struct NpadGcTriggerState { |
| 276 | s64_le sampling_number{}; | 276 | s64 sampling_number{}; |
| 277 | s32_le l_analog{}; | 277 | s32 l_analog{}; |
| 278 | s32_le r_analog{}; | 278 | s32 r_analog{}; |
| 279 | }; | 279 | }; |
| 280 | static_assert(sizeof(NpadGcTriggerState) == 0x10, "NpadGcTriggerState is an invalid size"); | 280 | static_assert(sizeof(NpadGcTriggerState) == 0x10, "NpadGcTriggerState is an invalid size"); |
| 281 | 281 | ||
| 282 | // This is nn::hid::NpadSystemProperties | 282 | // This is nn::hid::NpadSystemProperties |
| 283 | struct NPadSystemProperties { | 283 | struct NPadSystemProperties { |
| 284 | union { | 284 | union { |
| 285 | s64_le raw{}; | 285 | s64 raw{}; |
| 286 | BitField<0, 1, s64> is_charging_joy_dual; | 286 | BitField<0, 1, s64> is_charging_joy_dual; |
| 287 | BitField<1, 1, s64> is_charging_joy_left; | 287 | BitField<1, 1, s64> is_charging_joy_left; |
| 288 | BitField<2, 1, s64> is_charging_joy_right; | 288 | BitField<2, 1, s64> is_charging_joy_right; |
| @@ -303,7 +303,7 @@ private: | |||
| 303 | // This is nn::hid::NpadSystemButtonProperties | 303 | // This is nn::hid::NpadSystemButtonProperties |
| 304 | struct NpadSystemButtonProperties { | 304 | struct NpadSystemButtonProperties { |
| 305 | union { | 305 | union { |
| 306 | s32_le raw{}; | 306 | s32 raw{}; |
| 307 | BitField<0, 1, s32> is_home_button_protection_enabled; | 307 | BitField<0, 1, s32> is_home_button_protection_enabled; |
| 308 | }; | 308 | }; |
| 309 | }; | 309 | }; |
| @@ -313,7 +313,7 @@ private: | |||
| 313 | // This is nn::hid::system::DeviceType | 313 | // This is nn::hid::system::DeviceType |
| 314 | struct DeviceType { | 314 | struct DeviceType { |
| 315 | union { | 315 | union { |
| 316 | u32_le raw{}; | 316 | u32 raw{}; |
| 317 | BitField<0, 1, s32> fullkey; | 317 | BitField<0, 1, s32> fullkey; |
| 318 | BitField<1, 1, s32> debug_pad; | 318 | BitField<1, 1, s32> debug_pad; |
| 319 | BitField<2, 1, s32> handheld_left; | 319 | BitField<2, 1, s32> handheld_left; |
diff --git a/src/core/hle/service/hid/controllers/stubbed.h b/src/core/hle/service/hid/controllers/stubbed.h index 29f95a100..10aecad4c 100644 --- a/src/core/hle/service/hid/controllers/stubbed.h +++ b/src/core/hle/service/hid/controllers/stubbed.h | |||
| @@ -26,10 +26,10 @@ public: | |||
| 26 | 26 | ||
| 27 | private: | 27 | private: |
| 28 | struct CommonHeader { | 28 | struct CommonHeader { |
| 29 | s64_le timestamp; | 29 | s64 timestamp; |
| 30 | s64_le total_entry_count; | 30 | s64 total_entry_count; |
| 31 | s64_le last_entry_index; | 31 | s64 last_entry_index; |
| 32 | s64_le entry_count; | 32 | s64 entry_count; |
| 33 | }; | 33 | }; |
| 34 | static_assert(sizeof(CommonHeader) == 0x20, "CommonHeader is an invalid size"); | 34 | static_assert(sizeof(CommonHeader) == 0x20, "CommonHeader is an invalid size"); |
| 35 | 35 | ||
diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index e0a44d06b..5ba8d96a8 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp | |||
| @@ -66,7 +66,7 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin | |||
| 66 | } | 66 | } |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | std::array<Finger, MAX_FINGERS> active_fingers; | 69 | std::array<Core::HID::TouchFinger, MAX_FINGERS> active_fingers; |
| 70 | const auto end_iter = std::copy_if(fingers.begin(), fingers.end(), active_fingers.begin(), | 70 | const auto end_iter = std::copy_if(fingers.begin(), fingers.end(), active_fingers.begin(), |
| 71 | [](const auto& finger) { return finger.pressed; }); | 71 | [](const auto& finger) { return finger.pressed; }); |
| 72 | const auto active_fingers_count = | 72 | const auto active_fingers_count = |
| @@ -76,7 +76,7 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin | |||
| 76 | const auto& last_entry = touch_screen_lifo.ReadCurrentEntry().state; | 76 | const auto& last_entry = touch_screen_lifo.ReadCurrentEntry().state; |
| 77 | 77 | ||
| 78 | next_state.sampling_number = last_entry.sampling_number + 1; | 78 | next_state.sampling_number = last_entry.sampling_number + 1; |
| 79 | next_state.entry_count = static_cast<s32_le>(active_fingers_count); | 79 | next_state.entry_count = static_cast<s32>(active_fingers_count); |
| 80 | 80 | ||
| 81 | for (std::size_t id = 0; id < MAX_FINGERS; ++id) { | 81 | for (std::size_t id = 0; id < MAX_FINGERS; ++id) { |
| 82 | auto& touch_entry = next_state.states[id]; | 82 | auto& touch_entry = next_state.states[id]; |
diff --git a/src/core/hle/service/hid/controllers/touchscreen.h b/src/core/hle/service/hid/controllers/touchscreen.h index bcf79237d..fa4dfa1a2 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.h +++ b/src/core/hle/service/hid/controllers/touchscreen.h | |||
| @@ -50,27 +50,19 @@ private: | |||
| 50 | 50 | ||
| 51 | // This is nn::hid::TouchScreenState | 51 | // This is nn::hid::TouchScreenState |
| 52 | struct TouchScreenState { | 52 | struct TouchScreenState { |
| 53 | s64_le sampling_number; | 53 | s64 sampling_number; |
| 54 | s32_le entry_count; | 54 | s32 entry_count; |
| 55 | INSERT_PADDING_BYTES(4); // Reserved | 55 | INSERT_PADDING_BYTES(4); // Reserved |
| 56 | std::array<Core::HID::TouchState, MAX_FINGERS> states; | 56 | std::array<Core::HID::TouchState, MAX_FINGERS> states; |
| 57 | }; | 57 | }; |
| 58 | static_assert(sizeof(TouchScreenState) == 0x290, "TouchScreenState is an invalid size"); | 58 | static_assert(sizeof(TouchScreenState) == 0x290, "TouchScreenState is an invalid size"); |
| 59 | 59 | ||
| 60 | struct Finger { | ||
| 61 | u64_le last_touch{}; | ||
| 62 | Common::Point<float> position; | ||
| 63 | u32_le id{}; | ||
| 64 | bool pressed{}; | ||
| 65 | Core::HID::TouchAttribute attribute; | ||
| 66 | }; | ||
| 67 | |||
| 68 | // This is nn::hid::detail::TouchScreenLifo | 60 | // This is nn::hid::detail::TouchScreenLifo |
| 69 | Lifo<TouchScreenState> touch_screen_lifo{}; | 61 | Lifo<TouchScreenState> touch_screen_lifo{}; |
| 70 | static_assert(sizeof(touch_screen_lifo) == 0x2C38, "touch_screen_lifo is an invalid size"); | 62 | static_assert(sizeof(touch_screen_lifo) == 0x2C38, "touch_screen_lifo is an invalid size"); |
| 71 | TouchScreenState next_state{}; | 63 | TouchScreenState next_state{}; |
| 72 | 64 | ||
| 73 | std::array<Finger, MAX_FINGERS> fingers; | 65 | std::array<Core::HID::TouchFinger, MAX_FINGERS> fingers; |
| 74 | Core::HID::EmulatedConsole* console; | 66 | Core::HID::EmulatedConsole* console; |
| 75 | }; | 67 | }; |
| 76 | } // namespace Service::HID | 68 | } // namespace Service::HID |
diff --git a/src/core/hle/service/hid/controllers/xpad.h b/src/core/hle/service/hid/controllers/xpad.h index a5421f93b..75e0d2911 100644 --- a/src/core/hle/service/hid/controllers/xpad.h +++ b/src/core/hle/service/hid/controllers/xpad.h | |||
| @@ -31,7 +31,7 @@ private: | |||
| 31 | // This is nn::hid::BasicXpadAttributeSet | 31 | // This is nn::hid::BasicXpadAttributeSet |
| 32 | struct BasicXpadAttributeSet { | 32 | struct BasicXpadAttributeSet { |
| 33 | union { | 33 | union { |
| 34 | u32_le raw{}; | 34 | u32 raw{}; |
| 35 | BitField<0, 1, u32> is_connected; | 35 | BitField<0, 1, u32> is_connected; |
| 36 | BitField<1, 1, u32> is_wired; | 36 | BitField<1, 1, u32> is_wired; |
| 37 | BitField<2, 1, u32> is_left_connected; | 37 | BitField<2, 1, u32> is_left_connected; |
| @@ -45,7 +45,7 @@ private: | |||
| 45 | // This is nn::hid::BasicXpadButtonSet | 45 | // This is nn::hid::BasicXpadButtonSet |
| 46 | struct BasicXpadButtonSet { | 46 | struct BasicXpadButtonSet { |
| 47 | union { | 47 | union { |
| 48 | u32_le raw{}; | 48 | u32 raw{}; |
| 49 | // Button states | 49 | // Button states |
| 50 | BitField<0, 1, u32> a; | 50 | BitField<0, 1, u32> a; |
| 51 | BitField<1, 1, u32> b; | 51 | BitField<1, 1, u32> b; |
| @@ -93,7 +93,7 @@ private: | |||
| 93 | 93 | ||
| 94 | // This is nn::hid::detail::BasicXpadState | 94 | // This is nn::hid::detail::BasicXpadState |
| 95 | struct BasicXpadState { | 95 | struct BasicXpadState { |
| 96 | s64_le sampling_number; | 96 | s64 sampling_number; |
| 97 | BasicXpadAttributeSet attributes; | 97 | BasicXpadAttributeSet attributes; |
| 98 | BasicXpadButtonSet pad_states; | 98 | BasicXpadButtonSet pad_states; |
| 99 | Core::HID::AnalogStickState l_stick; | 99 | Core::HID::AnalogStickState l_stick; |
diff --git a/src/core/hle/service/hid/ring_lifo.h b/src/core/hle/service/hid/ring_lifo.h index 1cc2a194f..f68d82762 100644 --- a/src/core/hle/service/hid/ring_lifo.h +++ b/src/core/hle/service/hid/ring_lifo.h | |||
| @@ -12,16 +12,16 @@ constexpr std::size_t max_entry_size = 17; | |||
| 12 | 12 | ||
| 13 | template <typename State> | 13 | template <typename State> |
| 14 | struct AtomicStorage { | 14 | struct AtomicStorage { |
| 15 | s64_le sampling_number; | 15 | s64 sampling_number; |
| 16 | State state; | 16 | State state; |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | template <typename State> | 19 | template <typename State> |
| 20 | struct Lifo { | 20 | struct Lifo { |
| 21 | s64_le timestamp{}; | 21 | s64 timestamp{}; |
| 22 | s64_le total_entry_count = max_entry_size; | 22 | s64 total_entry_count = max_entry_size; |
| 23 | s64_le last_entry_index{}; | 23 | s64 last_entry_index{}; |
| 24 | s64_le entry_count{}; | 24 | s64 entry_count{}; |
| 25 | std::array<AtomicStorage<State>, max_entry_size> entries{}; | 25 | std::array<AtomicStorage<State>, max_entry_size> entries{}; |
| 26 | 26 | ||
| 27 | const AtomicStorage<State>& ReadCurrentEntry() const { | 27 | const AtomicStorage<State>& ReadCurrentEntry() const { |