From b564f024f0be5023cf13fb2fca953ea6c1feeeb6 Mon Sep 17 00:00:00 2001 From: german77 Date: Fri, 22 Oct 2021 23:04:06 -0500 Subject: [PATCH] Morph review first wave --- src/core/core.h | 2 +- src/core/frontend/applets/controller.cpp | 5 +- src/core/hid/emulated_console.cpp | 4 +- src/core/hid/emulated_console.h | 10 ++-- src/core/hid/emulated_controller.cpp | 6 +-- src/core/hid/emulated_controller.h | 22 ++++----- src/core/hid/emulated_devices.cpp | 4 +- src/core/hid/hid_core.cpp | 8 ++-- src/core/hid/hid_types.h | 48 +++++++++---------- src/core/hid/input_converter.cpp | 12 ++--- .../service/hid/controllers/console_sixaxis.h | 14 +++--- .../hle/service/hid/controllers/debug_pad.h | 4 +- .../hle/service/hid/controllers/gesture.cpp | 9 ++-- .../hle/service/hid/controllers/gesture.h | 33 ++++++------- .../hle/service/hid/controllers/keyboard.h | 2 +- src/core/hle/service/hid/controllers/npad.cpp | 4 +- src/core/hle/service/hid/controllers/npad.h | 22 ++++----- .../hle/service/hid/controllers/stubbed.h | 8 ++-- .../service/hid/controllers/touchscreen.cpp | 4 +- .../hle/service/hid/controllers/touchscreen.h | 14 ++---- src/core/hle/service/hid/controllers/xpad.h | 6 +-- src/core/hle/service/hid/ring_lifo.h | 10 ++-- .../configure_input_player_widget.cpp | 2 +- 23 files changed, 117 insertions(+), 136 deletions(-) diff --git a/src/core/core.h b/src/core/core.h index 5a031efb0b..645e5c241c 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -289,7 +289,7 @@ public: /// Provides a constant reference to the kernel instance. [[nodiscard]] const Kernel::KernelCore& Kernel() const; - /// Gets a mutable reference to the HID interface + /// Gets a mutable reference to the HID interface. [[nodiscard]] HID::HIDCore& HIDCore(); /// Gets an immutable reference to the HID interface. diff --git a/src/core/frontend/applets/controller.cpp b/src/core/frontend/applets/controller.cpp index 30500ef1ef..212ace8924 100644 --- a/src/core/frontend/applets/controller.cpp +++ b/src/core/frontend/applets/controller.cpp @@ -13,8 +13,7 @@ namespace Core::Frontend { ControllerApplet::~ControllerApplet() = default; -DefaultControllerApplet::DefaultControllerApplet(HID::HIDCore& hid_core_) - : hid_core{hid_core_} {} +DefaultControllerApplet::DefaultControllerApplet(HID::HIDCore& hid_core_) : hid_core{hid_core_} {} DefaultControllerApplet::~DefaultControllerApplet() = default; @@ -26,7 +25,7 @@ void DefaultControllerApplet::ReconfigureControllers(std::function callb parameters.enable_single_mode ? 1 : parameters.min_players; // Disconnect Handheld first. - auto* handheld =hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld); + auto* handheld = hid_core.GetEmulatedController(Core::HID::NpadIdType::Handheld); handheld->Disconnect(); // Deduce the best configuration based on the input parameters. diff --git a/src/core/hid/emulated_console.cpp b/src/core/hid/emulated_console.cpp index 540fd107be..d1d4a5355c 100644 --- a/src/core/hid/emulated_console.cpp +++ b/src/core/hid/emulated_console.cpp @@ -6,7 +6,7 @@ #include "core/hid/input_converter.h" namespace Core::HID { -EmulatedConsole::EmulatedConsole() {} +EmulatedConsole::EmulatedConsole() = default; EmulatedConsole::~EmulatedConsole() = default; @@ -191,7 +191,7 @@ TouchFingerState EmulatedConsole::GetTouch() const { } void EmulatedConsole::TriggerOnChange(ConsoleTriggerType type) { - for (const std::pair poller_pair : callback_list) { + for (const auto& poller_pair : callback_list) { const ConsoleUpdateCallback& poller = poller_pair.second; if (poller.on_change) { poller.on_change(type); diff --git a/src/core/hid/emulated_console.h b/src/core/hid/emulated_console.h index c48d25794f..f26f24f2ec 100644 --- a/src/core/hid/emulated_console.h +++ b/src/core/hid/emulated_console.h @@ -20,7 +20,7 @@ namespace Core::HID { struct ConsoleMotionInfo { - Input::MotionStatus raw_status; + Input::MotionStatus raw_status{}; MotionInput emulated{}; }; @@ -34,21 +34,21 @@ using ConsoleMotionValues = ConsoleMotionInfo; using TouchValues = std::array; struct TouchFinger { - u64_le last_touch{}; + u64 last_touch{}; Common::Point position{}; - u32_le id{}; - bool pressed{}; + u32 id{}; TouchAttribute attribute{}; + bool pressed{}; }; // Contains all motion related data that is used on the services struct ConsoleMotion { - bool is_at_rest{}; Common::Vec3f accel{}; Common::Vec3f gyro{}; Common::Vec3f rotation{}; std::array orientation{}; Common::Quaternion quaternion{}; + bool is_at_rest{}; }; using TouchFingerState = std::array; diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index d59758e999..228f801833 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp @@ -865,10 +865,10 @@ BatteryLevelState EmulatedController::GetBattery() const { return controller.battery_state; } -void EmulatedController::TriggerOnChange(ControllerTriggerType type, bool is_service_update) { - for (const std::pair poller_pair : callback_list) { +void EmulatedController::TriggerOnChange(ControllerTriggerType type, bool is_npad_service_update) { + for (const auto& poller_pair : callback_list) { const ControllerUpdateCallback& poller = poller_pair.second; - if (!is_service_update && poller.is_service) { + if (!is_npad_service_update && poller.is_npad_service) { continue; } if (poller.on_change) { diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h index 50f21ccd9c..d667685493 100644 --- a/src/core/hid/emulated_controller.h +++ b/src/core/hid/emulated_controller.h @@ -20,7 +20,7 @@ namespace Core::HID { struct ControllerMotionInfo { - Input::MotionStatus raw_status; + Input::MotionStatus raw_status{}; MotionInput emulated{}; }; @@ -51,28 +51,28 @@ using BatteryValues = std::array; using VibrationValues = std::array; struct AnalogSticks { - AnalogStickState left; - AnalogStickState right; + AnalogStickState left{}; + AnalogStickState right{}; }; struct ControllerColors { - NpadControllerColor fullkey; - NpadControllerColor left; - NpadControllerColor right; + NpadControllerColor fullkey{}; + NpadControllerColor left{}; + NpadControllerColor right{}; }; struct BatteryLevelState { - NpadPowerInfo dual; - NpadPowerInfo left; - NpadPowerInfo right; + NpadPowerInfo dual{}; + NpadPowerInfo left{}; + NpadPowerInfo right{}; }; struct ControllerMotion { - bool is_at_rest; Common::Vec3f accel{}; Common::Vec3f gyro{}; Common::Vec3f rotation{}; std::array orientation{}; + bool is_at_rest{}; }; using MotionState = std::array; @@ -113,7 +113,7 @@ enum class ControllerTriggerType { struct ControllerUpdateCallback { std::function on_change; - bool is_service; + bool is_npad_service; }; class EmulatedController { diff --git a/src/core/hid/emulated_devices.cpp b/src/core/hid/emulated_devices.cpp index 54a753d8a5..1c4065cd85 100644 --- a/src/core/hid/emulated_devices.cpp +++ b/src/core/hid/emulated_devices.cpp @@ -9,7 +9,7 @@ namespace Core::HID { -EmulatedDevices::EmulatedDevices() {} +EmulatedDevices::EmulatedDevices() = default; EmulatedDevices::~EmulatedDevices() = default; @@ -332,7 +332,7 @@ MousePosition EmulatedDevices::GetMousePosition() const { } void EmulatedDevices::TriggerOnChange(DeviceTriggerType type) { - for (const std::pair poller_pair : callback_list) { + for (const auto& poller_pair : callback_list) { const InterfaceUpdateCallback& poller = poller_pair.second; if (poller.on_change) { poller.on_change(type); diff --git a/src/core/hid/hid_core.cpp b/src/core/hid/hid_core.cpp index cc1b3c2950..3cb26e1e71 100644 --- a/src/core/hid/hid_core.cpp +++ b/src/core/hid/hid_core.cpp @@ -113,8 +113,8 @@ NpadStyleTag HIDCore::GetSupportedStyleTag() const { s8 HIDCore::GetPlayerCount() const { s8 active_players = 0; - for (std::size_t player_index = 0; player_index < available_controllers -2; player_index++) { - const auto* controller = GetEmulatedControllerByIndex(player_index); + for (std::size_t player_index = 0; player_index < available_controllers - 2; ++player_index) { + const auto* const controller = GetEmulatedControllerByIndex(player_index); if (controller->IsConnected()) { active_players++; } @@ -123,8 +123,8 @@ s8 HIDCore::GetPlayerCount() const { } NpadIdType HIDCore::GetFirstNpadId() const { - for (std::size_t player_index = 0; player_index < available_controllers; player_index++) { - const auto* controller = GetEmulatedControllerByIndex(player_index); + for (std::size_t player_index = 0; player_index < available_controllers; ++player_index) { + const auto* const controller = GetEmulatedControllerByIndex(player_index); if (controller->IsConnected()) { return controller->GetNpadIdType(); } diff --git a/src/core/hid/hid_types.h b/src/core/hid/hid_types.h index 539436283d..59ec593b84 100644 --- a/src/core/hid/hid_types.h +++ b/src/core/hid/hid_types.h @@ -100,7 +100,7 @@ enum class NpadType : u8 { // This is nn::hid::NpadStyleTag struct NpadStyleTag { union { - u32_le raw{}; + u32 raw{}; BitField<0, 1, u32> fullkey; BitField<1, 1, u32> handheld; @@ -132,35 +132,35 @@ static_assert(sizeof(TouchAttribute) == 0x4, "TouchAttribute is an invalid size" // This is nn::hid::TouchState struct TouchState { - u64_le delta_time; + u64 delta_time; TouchAttribute attribute; - u32_le finger; - Common::Point position; - u32_le diameter_x; - u32_le diameter_y; - u32_le rotation_angle; + u32 finger; + Common::Point position; + u32 diameter_x; + u32 diameter_y; + u32 rotation_angle; }; static_assert(sizeof(TouchState) == 0x28, "Touchstate is an invalid size"); // This is nn::hid::NpadControllerColor struct NpadControllerColor { - u32_le body; - u32_le button; + u32 body; + u32 button; }; static_assert(sizeof(NpadControllerColor) == 8, "NpadControllerColor is an invalid size"); // This is nn::hid::AnalogStickState struct AnalogStickState { - s32_le x; - s32_le y; + s32 x; + s32 y; }; static_assert(sizeof(AnalogStickState) == 8, "AnalogStickState is an invalid size"); // This is nn::hid::server::NpadGcTriggerState struct NpadGcTriggerState { - s64_le sampling_number{}; - s32_le left{}; - s32_le right{}; + s64 sampling_number{}; + s32 left{}; + s32 right{}; }; static_assert(sizeof(NpadGcTriggerState) == 0x10, "NpadGcTriggerState is an invalid size"); @@ -286,7 +286,7 @@ static_assert(sizeof(NpadButtonState) == 0x8, "NpadButtonState has incorrect siz // This is nn::hid::DebugPadButton struct DebugPadButton { union { - u32_le raw{}; + u32 raw{}; BitField<0, 1, u32> a; BitField<1, 1, u32> b; BitField<2, 1, u32> x; @@ -345,7 +345,7 @@ static_assert(sizeof(VibrationDeviceInfo) == 0x8, "VibrationDeviceInfo has incor // This is nn::hid::KeyboardModifier struct KeyboardModifier { union { - u32_le raw{}; + u32 raw{}; BitField<0, 1, u32> control; BitField<1, 1, u32> shift; BitField<2, 1, u32> left_alt; @@ -383,7 +383,7 @@ static_assert(sizeof(MouseButton) == 0x4, "MouseButton is an invalid size"); // This is nn::hid::MouseAttribute struct MouseAttribute { union { - u32_le raw{}; + u32 raw{}; BitField<0, 1, u32> transferable; BitField<1, 1, u32> is_connected; }; @@ -392,13 +392,13 @@ static_assert(sizeof(MouseAttribute) == 0x4, "MouseAttribute is an invalid size" // This is nn::hid::detail::MouseState struct MouseState { - s64_le sampling_number; - s32_le x; - s32_le y; - s32_le delta_x; - s32_le delta_y; - s32_le delta_wheel_x; - s32_le delta_wheel_y; + s64 sampling_number; + s32 x; + s32 y; + s32 delta_x; + s32 delta_y; + s32 delta_wheel_x; + s32 delta_wheel_y; MouseButton button; MouseAttribute attribute; }; diff --git a/src/core/hid/input_converter.cpp b/src/core/hid/input_converter.cpp index 128a48ec91..b3c8913cea 100644 --- a/src/core/hid/input_converter.cpp +++ b/src/core/hid/input_converter.cpp @@ -142,8 +142,8 @@ Input::StickStatus TransformToStick(const Input::CallbackStatus& callback) { } SanitizeStick(status.x, status.y, true); - const Input::AnalogProperties& properties_x = status.x.properties; - const Input::AnalogProperties& properties_y = status.y.properties; + const auto& properties_x = status.x.properties; + const auto& properties_y = status.y.properties; const float x = status.x.value; const float y = status.y.value; @@ -213,7 +213,7 @@ Input::TriggerStatus TransformToTrigger(const Input::CallbackStatus& callback) { } SanitizeAnalog(status.analog, true); - const Input::AnalogProperties& properties = status.analog.properties; + const auto& properties = status.analog.properties; float& value = status.analog.value; // Set button status @@ -231,7 +231,7 @@ Input::TriggerStatus TransformToTrigger(const Input::CallbackStatus& callback) { } void SanitizeAnalog(Input::AnalogStatus& analog, bool clamp_value) { - const Input::AnalogProperties& properties = analog.properties; + const auto& properties = analog.properties; float& raw_value = analog.raw_value; float& value = analog.value; @@ -271,8 +271,8 @@ void SanitizeAnalog(Input::AnalogStatus& analog, bool clamp_value) { } void SanitizeStick(Input::AnalogStatus& analog_x, Input::AnalogStatus& analog_y, bool clamp_value) { - const Input::AnalogProperties& properties_x = analog_x.properties; - const Input::AnalogProperties& properties_y = analog_y.properties; + const auto& properties_x = analog_x.properties; + const auto& properties_y = analog_y.properties; float& raw_x = analog_x.raw_value; float& raw_y = analog_y.raw_value; float& x = analog_x.value; diff --git a/src/core/hle/service/hid/controllers/console_sixaxis.h b/src/core/hle/service/hid/controllers/console_sixaxis.h index 6d18d2ce07..95729e6b23 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: private: struct SevenSixAxisState { INSERT_PADDING_WORDS(4); // unused - s64_le sampling_number{}; - s64_le sampling_number2{}; + s64 sampling_number{}; + s64 sampling_number2{}; u64 unknown{}; Common::Vec3f accel{}; Common::Vec3f gyro{}; @@ -45,10 +45,10 @@ private: static_assert(sizeof(SevenSixAxisState) == 0x50, "SevenSixAxisState is an invalid size"); struct CommonHeader { - s64_le timestamp; - s64_le total_entry_count; - s64_le last_entry_index; - s64_le entry_count; + s64 timestamp; + s64 total_entry_count; + s64 last_entry_index; + s64 entry_count; }; static_assert(sizeof(CommonHeader) == 0x20, "CommonHeader is an invalid size"); @@ -61,7 +61,7 @@ private: // This is nn::hid::detail::ConsoleSixAxisSensorSharedMemoryFormat struct ConsoleSharedMemory { - u64_le sampling_number{}; + u64 sampling_number{}; bool is_seven_six_axis_sensor_at_rest{}; f32 verticalization_error{}; 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 11b6c669b4..bd0f15eaa6 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: // This is nn::hid::DebugPadAttribute struct DebugPadAttribute { union { - u32_le raw{}; + u32 raw{}; BitField<0, 1, u32> connected; }; }; @@ -46,7 +46,7 @@ private: // This is nn::hid::DebugPadState struct DebugPadState { - s64_le sampling_number; + s64 sampling_number; DebugPadAttribute attribute; Core::HID::DebugPadButton pad_state; 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 a82d04b3b9..7a7bc68a2a 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 void Controller_Gesture::ReadTouchInput() { const auto touch_status = console->GetTouch(); for (std::size_t id = 0; id < fingers.size(); ++id) { - const Core::HID::TouchFinger& status = touch_status[id]; - Finger& finger = fingers[id]; - finger.pos = status.position; - finger.pressed = status.pressed; + fingers[id] = touch_status[id]; } } @@ -315,14 +312,14 @@ const Controller_Gesture::GestureState& Controller_Gesture::GetLastGestureEntry( Controller_Gesture::GestureProperties Controller_Gesture::GetGestureProperties() { GestureProperties gesture; - std::array active_fingers; + std::array active_fingers; const auto end_iter = std::copy_if(fingers.begin(), fingers.end(), active_fingers.begin(), [](const auto& finger) { return finger.pressed; }); gesture.active_points = static_cast(std::distance(active_fingers.begin(), end_iter)); for (size_t id = 0; id < gesture.active_points; ++id) { - const auto& [active_x, active_y] = active_fingers[id].pos; + const auto& [active_x, active_y] = active_fingers[id].position; gesture.points[id] = { .x = static_cast(active_x * Layout::ScreenUndocked::Width), .y = static_cast(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 6f5abaa4fa..58139a5cf9 100644 --- a/src/core/hle/service/hid/controllers/gesture.h +++ b/src/core/hle/service/hid/controllers/gesture.h @@ -60,7 +60,7 @@ private: // This is nn::hid::GestureAttribute struct GestureAttribute { union { - u32_le raw{}; + u32 raw{}; BitField<4, 1, u32> is_new_touch; BitField<8, 1, u32> is_double_tap; @@ -70,33 +70,28 @@ private: // This is nn::hid::GestureState struct GestureState { - s64_le sampling_number; - s64_le detection_count; + s64 sampling_number; + s64 detection_count; GestureType type; GestureDirection direction; - Common::Point pos; - Common::Point delta; + Common::Point pos; + Common::Point delta; f32 vel_x; f32 vel_y; GestureAttribute attributes; f32 scale; f32 rotation_angle; - s32_le point_count; - std::array, 4> points; + s32 point_count; + std::array, 4> points; }; static_assert(sizeof(GestureState) == 0x60, "GestureState is an invalid size"); - struct Finger { - Common::Point pos{}; - bool pressed{}; - }; - struct GestureProperties { - std::array, MAX_POINTS> points{}; + std::array, MAX_POINTS> points{}; std::size_t active_points{}; - Common::Point mid_point{}; - s64_le detection_count{}; - u64_le delta_time{}; + Common::Point mid_point{}; + s64 detection_count{}; + u64 delta_time{}; f32 average_distance{}; f32 angle{}; }; @@ -150,10 +145,10 @@ private: Core::HID::EmulatedConsole* console; - std::array fingers{}; + std::array fingers{}; GestureProperties last_gesture{}; - s64_le last_update_timestamp{}; - s64_le last_tap_timestamp{}; + s64 last_update_timestamp{}; + s64 last_tap_timestamp{}; f32 last_pan_time_difference{}; bool force_update{false}; 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 6919e092a2..aba4f123ec 100644 --- a/src/core/hle/service/hid/controllers/keyboard.h +++ b/src/core/hle/service/hid/controllers/keyboard.h @@ -37,7 +37,7 @@ public: private: // This is nn::hid::detail::KeyboardState struct KeyboardState { - s64_le sampling_number; + s64 sampling_number; Core::HID::KeyboardModifier modifier; Core::HID::KeyboardKey key; }; diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index aad298364c..7bf31f63a8 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_, Core::HID::ControllerUpdateCallback engine_callback{ .on_change = [this, i](Core::HID::ControllerTriggerType type) { ControllerUpdate(type, i); }, - .is_service = true, + .is_npad_service = true, }; controller.callback_key = controller.device->SetCallback(engine_callback); } @@ -157,7 +157,6 @@ void Controller_NPad::ControllerUpdate(Core::HID::ControllerTriggerType type, void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) { auto& controller = controller_data[controller_idx]; - LOG_WARNING(Service_HID, "Connect {} {}", controller_idx, controller.is_connected); const auto controller_type = controller.device->GetNpadType(); auto& shared_memory = controller.shared_memory_entry; if (controller_type == Core::HID::NpadType::None) { @@ -892,7 +891,6 @@ void Controller_NPad::DisconnectNpad(u32 npad_id) { void Controller_NPad::DisconnectNpadAtIndex(std::size_t npad_index) { auto& controller = controller_data[npad_index]; - LOG_WARNING(Service_HID, "Disconnect {} {}", npad_index, controller.is_connected); for (std::size_t device_idx = 0; device_idx < controller.vibration.size(); ++device_idx) { // Send an empty vibration to stop any vibrations. 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 7c534a32f9..0a2dc69920 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h @@ -195,7 +195,7 @@ public: private: // This is nn::hid::detail::ColorAttribute - enum class ColorAttribute : u32_le { + enum class ColorAttribute : u32 { Ok = 0, ReadError = 1, NoController = 2, @@ -220,7 +220,7 @@ private: // This is nn::hid::NpadAttribute struct NpadAttribute { union { - u32_le raw{}; + u32 raw{}; BitField<0, 1, u32> is_connected; BitField<1, 1, u32> is_wired; BitField<2, 1, u32> is_left_connected; @@ -251,7 +251,7 @@ private: // This is nn::hid::SixAxisSensorAttribute struct SixAxisSensorAttribute { union { - u32_le raw{}; + u32 raw{}; BitField<0, 1, u32> is_connected; BitField<1, 1, u32> is_interpolated; }; @@ -260,8 +260,8 @@ private: // This is nn::hid::SixAxisSensorState struct SixAxisSensorState { - s64_le delta_time{}; - s64_le sampling_number{}; + s64 delta_time{}; + s64 sampling_number{}; Common::Vec3f accel{}; Common::Vec3f gyro{}; Common::Vec3f rotation{}; @@ -273,16 +273,16 @@ private: // This is nn::hid::server::NpadGcTriggerState struct NpadGcTriggerState { - s64_le sampling_number{}; - s32_le l_analog{}; - s32_le r_analog{}; + s64 sampling_number{}; + s32 l_analog{}; + s32 r_analog{}; }; static_assert(sizeof(NpadGcTriggerState) == 0x10, "NpadGcTriggerState is an invalid size"); // This is nn::hid::NpadSystemProperties struct NPadSystemProperties { union { - s64_le raw{}; + s64 raw{}; BitField<0, 1, s64> is_charging_joy_dual; BitField<1, 1, s64> is_charging_joy_left; BitField<2, 1, s64> is_charging_joy_right; @@ -303,7 +303,7 @@ private: // This is nn::hid::NpadSystemButtonProperties struct NpadSystemButtonProperties { union { - s32_le raw{}; + s32 raw{}; BitField<0, 1, s32> is_home_button_protection_enabled; }; }; @@ -313,7 +313,7 @@ private: // This is nn::hid::system::DeviceType struct DeviceType { union { - u32_le raw{}; + u32 raw{}; BitField<0, 1, s32> fullkey; BitField<1, 1, s32> debug_pad; 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 29f95a1006..10aecad4ca 100644 --- a/src/core/hle/service/hid/controllers/stubbed.h +++ b/src/core/hle/service/hid/controllers/stubbed.h @@ -26,10 +26,10 @@ public: private: struct CommonHeader { - s64_le timestamp; - s64_le total_entry_count; - s64_le last_entry_index; - s64_le entry_count; + s64 timestamp; + s64 total_entry_count; + s64 last_entry_index; + s64 entry_count; }; static_assert(sizeof(CommonHeader) == 0x20, "CommonHeader is an invalid size"); diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index e0a44d06b2..5ba8d96a83 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 } } - std::array active_fingers; + std::array active_fingers; const auto end_iter = std::copy_if(fingers.begin(), fingers.end(), active_fingers.begin(), [](const auto& finger) { return finger.pressed; }); const auto active_fingers_count = @@ -76,7 +76,7 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin const auto& last_entry = touch_screen_lifo.ReadCurrentEntry().state; next_state.sampling_number = last_entry.sampling_number + 1; - next_state.entry_count = static_cast(active_fingers_count); + next_state.entry_count = static_cast(active_fingers_count); for (std::size_t id = 0; id < MAX_FINGERS; ++id) { 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 bcf79237dd..fa4dfa1a20 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.h +++ b/src/core/hle/service/hid/controllers/touchscreen.h @@ -50,27 +50,19 @@ private: // This is nn::hid::TouchScreenState struct TouchScreenState { - s64_le sampling_number; - s32_le entry_count; + s64 sampling_number; + s32 entry_count; INSERT_PADDING_BYTES(4); // Reserved std::array states; }; static_assert(sizeof(TouchScreenState) == 0x290, "TouchScreenState is an invalid size"); - struct Finger { - u64_le last_touch{}; - Common::Point position; - u32_le id{}; - bool pressed{}; - Core::HID::TouchAttribute attribute; - }; - // This is nn::hid::detail::TouchScreenLifo Lifo touch_screen_lifo{}; static_assert(sizeof(touch_screen_lifo) == 0x2C38, "touch_screen_lifo is an invalid size"); TouchScreenState next_state{}; - std::array fingers; + std::array fingers; Core::HID::EmulatedConsole* console; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/controllers/xpad.h b/src/core/hle/service/hid/controllers/xpad.h index a5421f93b6..75e0d29116 100644 --- a/src/core/hle/service/hid/controllers/xpad.h +++ b/src/core/hle/service/hid/controllers/xpad.h @@ -31,7 +31,7 @@ private: // This is nn::hid::BasicXpadAttributeSet struct BasicXpadAttributeSet { union { - u32_le raw{}; + u32 raw{}; BitField<0, 1, u32> is_connected; BitField<1, 1, u32> is_wired; BitField<2, 1, u32> is_left_connected; @@ -45,7 +45,7 @@ private: // This is nn::hid::BasicXpadButtonSet struct BasicXpadButtonSet { union { - u32_le raw{}; + u32 raw{}; // Button states BitField<0, 1, u32> a; BitField<1, 1, u32> b; @@ -93,7 +93,7 @@ private: // This is nn::hid::detail::BasicXpadState struct BasicXpadState { - s64_le sampling_number; + s64 sampling_number; BasicXpadAttributeSet attributes; BasicXpadButtonSet pad_states; 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 1cc2a194f0..f68d827622 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; template struct AtomicStorage { - s64_le sampling_number; + s64 sampling_number; State state; }; template struct Lifo { - s64_le timestamp{}; - s64_le total_entry_count = max_entry_size; - s64_le last_entry_index{}; - s64_le entry_count{}; + s64 timestamp{}; + s64 total_entry_count = max_entry_size; + s64 last_entry_index{}; + s64 entry_count{}; std::array, max_entry_size> entries{}; const AtomicStorage& ReadCurrentEntry() const { diff --git a/src/yuzu/configuration/configure_input_player_widget.cpp b/src/yuzu/configuration/configure_input_player_widget.cpp index be87204fc3..3f179150dc 100644 --- a/src/yuzu/configuration/configure_input_player_widget.cpp +++ b/src/yuzu/configuration/configure_input_player_widget.cpp @@ -28,7 +28,7 @@ void PlayerControlPreview::SetController(Core::HID::EmulatedController* controll controller = controller_; Core::HID::ControllerUpdateCallback engine_callback{ .on_change = [this](Core::HID::ControllerTriggerType type) { ControllerUpdate(type); }, - .is_service = false, + .is_npad_service = false, }; callback_key = controller->SetCallback(engine_callback); ControllerUpdate(Core::HID::ControllerTriggerType::All);