diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hid/hid_types.h | 72 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/console_sixaxis.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/console_sixaxis.h | 8 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/debug_pad.h | 15 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/gesture.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/gesture.h | 30 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/keyboard.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/keyboard.h | 12 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/mouse.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/mouse.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.h | 9 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/stubbed.h | 10 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/touchscreen.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/touchscreen.h | 16 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/xpad.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/xpad.h | 12 |
16 files changed, 105 insertions, 104 deletions
diff --git a/src/core/hid/hid_types.h b/src/core/hid/hid_types.h index df2b1dfc5..26ec1091b 100644 --- a/src/core/hid/hid_types.h +++ b/src/core/hid/hid_types.h | |||
| @@ -316,27 +316,27 @@ static_assert(sizeof(TouchAttribute) == 0x4, "TouchAttribute is an invalid size" | |||
| 316 | 316 | ||
| 317 | // This is nn::hid::TouchState | 317 | // This is nn::hid::TouchState |
| 318 | struct TouchState { | 318 | struct TouchState { |
| 319 | u64 delta_time; | 319 | u64 delta_time{}; |
| 320 | TouchAttribute attribute; | 320 | TouchAttribute attribute{}; |
| 321 | u32 finger; | 321 | u32 finger{}; |
| 322 | Common::Point<u32> position; | 322 | Common::Point<u32> position{}; |
| 323 | u32 diameter_x; | 323 | u32 diameter_x{}; |
| 324 | u32 diameter_y; | 324 | u32 diameter_y{}; |
| 325 | u32 rotation_angle; | 325 | u32 rotation_angle{}; |
| 326 | }; | 326 | }; |
| 327 | static_assert(sizeof(TouchState) == 0x28, "Touchstate is an invalid size"); | 327 | static_assert(sizeof(TouchState) == 0x28, "Touchstate is an invalid size"); |
| 328 | 328 | ||
| 329 | // This is nn::hid::NpadControllerColor | 329 | // This is nn::hid::NpadControllerColor |
| 330 | struct NpadControllerColor { | 330 | struct NpadControllerColor { |
| 331 | u32 body; | 331 | u32 body{}; |
| 332 | u32 button; | 332 | u32 button{}; |
| 333 | }; | 333 | }; |
| 334 | static_assert(sizeof(NpadControllerColor) == 8, "NpadControllerColor is an invalid size"); | 334 | static_assert(sizeof(NpadControllerColor) == 8, "NpadControllerColor is an invalid size"); |
| 335 | 335 | ||
| 336 | // This is nn::hid::AnalogStickState | 336 | // This is nn::hid::AnalogStickState |
| 337 | struct AnalogStickState { | 337 | struct AnalogStickState { |
| 338 | s32 x; | 338 | s32 x{}; |
| 339 | s32 y; | 339 | s32 y{}; |
| 340 | }; | 340 | }; |
| 341 | static_assert(sizeof(AnalogStickState) == 8, "AnalogStickState is an invalid size"); | 341 | static_assert(sizeof(AnalogStickState) == 8, "AnalogStickState is an invalid size"); |
| 342 | 342 | ||
| @@ -354,10 +354,10 @@ static_assert(sizeof(NpadBatteryLevel) == 0x4, "NpadBatteryLevel is an invalid s | |||
| 354 | 354 | ||
| 355 | // This is nn::hid::system::NpadPowerInfo | 355 | // This is nn::hid::system::NpadPowerInfo |
| 356 | struct NpadPowerInfo { | 356 | struct NpadPowerInfo { |
| 357 | bool is_powered; | 357 | bool is_powered{}; |
| 358 | bool is_charging; | 358 | bool is_charging{}; |
| 359 | INSERT_PADDING_BYTES(0x6); | 359 | INSERT_PADDING_BYTES(0x6); |
| 360 | NpadBatteryLevel battery_level; | 360 | NpadBatteryLevel battery_level{8}; |
| 361 | }; | 361 | }; |
| 362 | static_assert(sizeof(NpadPowerInfo) == 0xC, "NpadPowerInfo is an invalid size"); | 362 | static_assert(sizeof(NpadPowerInfo) == 0xC, "NpadPowerInfo is an invalid size"); |
| 363 | 363 | ||
| @@ -474,8 +474,8 @@ static_assert(sizeof(DebugPadButton) == 0x4, "DebugPadButton is an invalid size" | |||
| 474 | 474 | ||
| 475 | // This is nn::hid::ConsoleSixAxisSensorHandle | 475 | // This is nn::hid::ConsoleSixAxisSensorHandle |
| 476 | struct ConsoleSixAxisSensorHandle { | 476 | struct ConsoleSixAxisSensorHandle { |
| 477 | u8 unknown_1; | 477 | u8 unknown_1{}; |
| 478 | u8 unknown_2; | 478 | u8 unknown_2{}; |
| 479 | INSERT_PADDING_BYTES_NOINIT(2); | 479 | INSERT_PADDING_BYTES_NOINIT(2); |
| 480 | }; | 480 | }; |
| 481 | static_assert(sizeof(ConsoleSixAxisSensorHandle) == 4, | 481 | static_assert(sizeof(ConsoleSixAxisSensorHandle) == 4, |
| @@ -483,9 +483,9 @@ static_assert(sizeof(ConsoleSixAxisSensorHandle) == 4, | |||
| 483 | 483 | ||
| 484 | // This is nn::hid::SixAxisSensorHandle | 484 | // This is nn::hid::SixAxisSensorHandle |
| 485 | struct SixAxisSensorHandle { | 485 | struct SixAxisSensorHandle { |
| 486 | NpadStyleIndex npad_type; | 486 | NpadStyleIndex npad_type{NpadStyleIndex::None}; |
| 487 | u8 npad_id; | 487 | u8 npad_id{}; |
| 488 | DeviceIndex device_index; | 488 | DeviceIndex device_index{DeviceIndex::None}; |
| 489 | INSERT_PADDING_BYTES_NOINIT(1); | 489 | INSERT_PADDING_BYTES_NOINIT(1); |
| 490 | }; | 490 | }; |
| 491 | static_assert(sizeof(SixAxisSensorHandle) == 4, "SixAxisSensorHandle is an invalid size"); | 491 | static_assert(sizeof(SixAxisSensorHandle) == 4, "SixAxisSensorHandle is an invalid size"); |
| @@ -500,19 +500,19 @@ static_assert(sizeof(SixAxisSensorFusionParameters) == 8, | |||
| 500 | 500 | ||
| 501 | // This is nn::hid::VibrationDeviceHandle | 501 | // This is nn::hid::VibrationDeviceHandle |
| 502 | struct VibrationDeviceHandle { | 502 | struct VibrationDeviceHandle { |
| 503 | NpadStyleIndex npad_type; | 503 | NpadStyleIndex npad_type{NpadStyleIndex::None}; |
| 504 | u8 npad_id; | 504 | u8 npad_id{}; |
| 505 | DeviceIndex device_index; | 505 | DeviceIndex device_index{DeviceIndex::None}; |
| 506 | INSERT_PADDING_BYTES_NOINIT(1); | 506 | INSERT_PADDING_BYTES_NOINIT(1); |
| 507 | }; | 507 | }; |
| 508 | static_assert(sizeof(VibrationDeviceHandle) == 4, "SixAxisSensorHandle is an invalid size"); | 508 | static_assert(sizeof(VibrationDeviceHandle) == 4, "SixAxisSensorHandle is an invalid size"); |
| 509 | 509 | ||
| 510 | // This is nn::hid::VibrationValue | 510 | // This is nn::hid::VibrationValue |
| 511 | struct VibrationValue { | 511 | struct VibrationValue { |
| 512 | f32 low_amplitude; | 512 | f32 low_amplitude{}; |
| 513 | f32 low_frequency; | 513 | f32 low_frequency{}; |
| 514 | f32 high_amplitude; | 514 | f32 high_amplitude{}; |
| 515 | f32 high_frequency; | 515 | f32 high_frequency{}; |
| 516 | }; | 516 | }; |
| 517 | static_assert(sizeof(VibrationValue) == 0x10, "VibrationValue has incorrect size."); | 517 | static_assert(sizeof(VibrationValue) == 0x10, "VibrationValue has incorrect size."); |
| 518 | 518 | ||
| @@ -561,7 +561,7 @@ static_assert(sizeof(KeyboardAttribute) == 0x4, "KeyboardAttribute is an invalid | |||
| 561 | // This is nn::hid::KeyboardKey | 561 | // This is nn::hid::KeyboardKey |
| 562 | struct KeyboardKey { | 562 | struct KeyboardKey { |
| 563 | // This should be a 256 bit flag | 563 | // This should be a 256 bit flag |
| 564 | std::array<u8, 32> key; | 564 | std::array<u8, 32> key{}; |
| 565 | }; | 565 | }; |
| 566 | static_assert(sizeof(KeyboardKey) == 0x20, "KeyboardKey is an invalid size"); | 566 | static_assert(sizeof(KeyboardKey) == 0x20, "KeyboardKey is an invalid size"); |
| 567 | 567 | ||
| @@ -590,16 +590,16 @@ static_assert(sizeof(MouseAttribute) == 0x4, "MouseAttribute is an invalid size" | |||
| 590 | 590 | ||
| 591 | // This is nn::hid::detail::MouseState | 591 | // This is nn::hid::detail::MouseState |
| 592 | struct MouseState { | 592 | struct MouseState { |
| 593 | s64 sampling_number; | 593 | s64 sampling_number{}; |
| 594 | s32 x; | 594 | s32 x{}; |
| 595 | s32 y; | 595 | s32 y{}; |
| 596 | s32 delta_x; | 596 | s32 delta_x{}; |
| 597 | s32 delta_y; | 597 | s32 delta_y{}; |
| 598 | // Axis Order in HW is switched for the wheel | 598 | // Axis Order in HW is switched for the wheel |
| 599 | s32 delta_wheel_y; | 599 | s32 delta_wheel_y{}; |
| 600 | s32 delta_wheel_x; | 600 | s32 delta_wheel_x{}; |
| 601 | MouseButton button; | 601 | MouseButton button{}; |
| 602 | MouseAttribute attribute; | 602 | MouseAttribute attribute{}; |
| 603 | }; | 603 | }; |
| 604 | static_assert(sizeof(MouseState) == 0x28, "MouseState is an invalid size"); | 604 | static_assert(sizeof(MouseState) == 0x28, "MouseState is an invalid size"); |
| 605 | 605 | ||
diff --git a/src/core/hle/service/hid/controllers/console_sixaxis.cpp b/src/core/hle/service/hid/controllers/console_sixaxis.cpp index c93bcd678..bb3cba910 100644 --- a/src/core/hle/service/hid/controllers/console_sixaxis.cpp +++ b/src/core/hle/service/hid/controllers/console_sixaxis.cpp | |||
| @@ -15,8 +15,8 @@ Controller_ConsoleSixAxis::Controller_ConsoleSixAxis(Core::HID::HIDCore& hid_cor | |||
| 15 | console = hid_core.GetEmulatedConsole(); | 15 | console = hid_core.GetEmulatedConsole(); |
| 16 | static_assert(SHARED_MEMORY_OFFSET + sizeof(ConsoleSharedMemory) < shared_memory_size, | 16 | static_assert(SHARED_MEMORY_OFFSET + sizeof(ConsoleSharedMemory) < shared_memory_size, |
| 17 | "ConsoleSharedMemory is bigger than the shared memory"); | 17 | "ConsoleSharedMemory is bigger than the shared memory"); |
| 18 | shared_memory = | 18 | shared_memory = std::construct_at( |
| 19 | std::construct_at(reinterpret_cast<ConsoleSharedMemory*>(raw_shared_memory_ + SHARED_MEMORY_OFFSET)); | 19 | reinterpret_cast<ConsoleSharedMemory*>(raw_shared_memory_ + SHARED_MEMORY_OFFSET)); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | Controller_ConsoleSixAxis::~Controller_ConsoleSixAxis() = default; | 22 | Controller_ConsoleSixAxis::~Controller_ConsoleSixAxis() = default; |
diff --git a/src/core/hle/service/hid/controllers/console_sixaxis.h b/src/core/hle/service/hid/controllers/console_sixaxis.h index 85b281957..2fd11538f 100644 --- a/src/core/hle/service/hid/controllers/console_sixaxis.h +++ b/src/core/hle/service/hid/controllers/console_sixaxis.h | |||
| @@ -61,13 +61,13 @@ private: | |||
| 61 | Lifo<SevenSixAxisState, 0x21> seven_sixaxis_lifo{}; | 61 | Lifo<SevenSixAxisState, 0x21> seven_sixaxis_lifo{}; |
| 62 | static_assert(sizeof(seven_sixaxis_lifo) == 0xA70, "SevenSixAxisState is an invalid size"); | 62 | static_assert(sizeof(seven_sixaxis_lifo) == 0xA70, "SevenSixAxisState is an invalid size"); |
| 63 | 63 | ||
| 64 | ConsoleSharedMemory* shared_memory; | 64 | SevenSixAxisState next_seven_sixaxis_state{}; |
| 65 | |||
| 66 | Core::HID::EmulatedConsole* console; | ||
| 67 | u8* transfer_memory = nullptr; | 65 | u8* transfer_memory = nullptr; |
| 66 | ConsoleSharedMemory* shared_memory = nullptr; | ||
| 67 | Core::HID::EmulatedConsole* console = nullptr; | ||
| 68 | |||
| 68 | bool is_transfer_memory_set = false; | 69 | bool is_transfer_memory_set = false; |
| 69 | u64 last_saved_timestamp{}; | 70 | u64 last_saved_timestamp{}; |
| 70 | u64 last_global_timestamp{}; | 71 | u64 last_global_timestamp{}; |
| 71 | SevenSixAxisState next_seven_sixaxis_state{}; | ||
| 72 | }; | 72 | }; |
| 73 | } // namespace Service::HID | 73 | } // namespace Service::HID |
diff --git a/src/core/hle/service/hid/controllers/debug_pad.h b/src/core/hle/service/hid/controllers/debug_pad.h index 543e9f3a6..68ff0ea79 100644 --- a/src/core/hle/service/hid/controllers/debug_pad.h +++ b/src/core/hle/service/hid/controllers/debug_pad.h | |||
| @@ -41,11 +41,11 @@ private: | |||
| 41 | 41 | ||
| 42 | // This is nn::hid::DebugPadState | 42 | // This is nn::hid::DebugPadState |
| 43 | struct DebugPadState { | 43 | struct DebugPadState { |
| 44 | s64 sampling_number; | 44 | s64 sampling_number{}; |
| 45 | DebugPadAttribute attribute; | 45 | DebugPadAttribute attribute{}; |
| 46 | Core::HID::DebugPadButton pad_state; | 46 | Core::HID::DebugPadButton pad_state{}; |
| 47 | Core::HID::AnalogStickState r_stick; | 47 | Core::HID::AnalogStickState r_stick{}; |
| 48 | Core::HID::AnalogStickState l_stick; | 48 | Core::HID::AnalogStickState l_stick{}; |
| 49 | }; | 49 | }; |
| 50 | static_assert(sizeof(DebugPadState) == 0x20, "DebugPadState is an invalid state"); | 50 | static_assert(sizeof(DebugPadState) == 0x20, "DebugPadState is an invalid state"); |
| 51 | 51 | ||
| @@ -57,9 +57,8 @@ private: | |||
| 57 | }; | 57 | }; |
| 58 | static_assert(sizeof(DebugPadSharedMemory) == 0x400, "DebugPadSharedMemory is an invalid size"); | 58 | static_assert(sizeof(DebugPadSharedMemory) == 0x400, "DebugPadSharedMemory is an invalid size"); |
| 59 | 59 | ||
| 60 | DebugPadSharedMemory* shared_memory; | ||
| 61 | |||
| 62 | DebugPadState next_state{}; | 60 | DebugPadState next_state{}; |
| 63 | Core::HID::EmulatedController* controller; | 61 | DebugPadSharedMemory* shared_memory = nullptr; |
| 62 | Core::HID::EmulatedController* controller = nullptr; | ||
| 64 | }; | 63 | }; |
| 65 | } // namespace Service::HID | 64 | } // namespace Service::HID |
diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp index e03d47ef3..3eae1ae35 100644 --- a/src/core/hle/service/hid/controllers/gesture.cpp +++ b/src/core/hle/service/hid/controllers/gesture.cpp | |||
| @@ -27,8 +27,8 @@ Controller_Gesture::Controller_Gesture(Core::HID::HIDCore& hid_core_, u8* raw_sh | |||
| 27 | : ControllerBase(hid_core_) { | 27 | : ControllerBase(hid_core_) { |
| 28 | static_assert(SHARED_MEMORY_OFFSET + sizeof(GestureSharedMemory) < shared_memory_size, | 28 | static_assert(SHARED_MEMORY_OFFSET + sizeof(GestureSharedMemory) < shared_memory_size, |
| 29 | "GestureSharedMemory is bigger than the shared memory"); | 29 | "GestureSharedMemory is bigger than the shared memory"); |
| 30 | shared_memory = | 30 | shared_memory = std::construct_at( |
| 31 | std::construct_at(reinterpret_cast<GestureSharedMemory*>(raw_shared_memory_ + SHARED_MEMORY_OFFSET)); | 31 | reinterpret_cast<GestureSharedMemory*>(raw_shared_memory_ + SHARED_MEMORY_OFFSET)); |
| 32 | console = hid_core.GetEmulatedConsole(); | 32 | console = hid_core.GetEmulatedConsole(); |
| 33 | } | 33 | } |
| 34 | Controller_Gesture::~Controller_Gesture() = default; | 34 | Controller_Gesture::~Controller_Gesture() = default; |
diff --git a/src/core/hle/service/hid/controllers/gesture.h b/src/core/hle/service/hid/controllers/gesture.h index c8edb35e1..c62a341bf 100644 --- a/src/core/hle/service/hid/controllers/gesture.h +++ b/src/core/hle/service/hid/controllers/gesture.h | |||
| @@ -66,19 +66,19 @@ private: | |||
| 66 | 66 | ||
| 67 | // This is nn::hid::GestureState | 67 | // This is nn::hid::GestureState |
| 68 | struct GestureState { | 68 | struct GestureState { |
| 69 | s64 sampling_number; | 69 | s64 sampling_number{}; |
| 70 | s64 detection_count; | 70 | s64 detection_count{}; |
| 71 | GestureType type; | 71 | GestureType type{GestureType::Idle}; |
| 72 | GestureDirection direction; | 72 | GestureDirection direction{GestureDirection::None}; |
| 73 | Common::Point<s32> pos; | 73 | Common::Point<s32> pos{}; |
| 74 | Common::Point<s32> delta; | 74 | Common::Point<s32> delta{}; |
| 75 | f32 vel_x; | 75 | f32 vel_x{}; |
| 76 | f32 vel_y; | 76 | f32 vel_y{}; |
| 77 | GestureAttribute attributes; | 77 | GestureAttribute attributes{}; |
| 78 | f32 scale; | 78 | f32 scale{}; |
| 79 | f32 rotation_angle; | 79 | f32 rotation_angle{}; |
| 80 | s32 point_count; | 80 | s32 point_count{}; |
| 81 | std::array<Common::Point<s32>, 4> points; | 81 | std::array<Common::Point<s32>, 4> points{}; |
| 82 | }; | 82 | }; |
| 83 | static_assert(sizeof(GestureState) == 0x60, "GestureState is an invalid size"); | 83 | static_assert(sizeof(GestureState) == 0x60, "GestureState is an invalid size"); |
| 84 | 84 | ||
| @@ -142,9 +142,9 @@ private: | |||
| 142 | // Returns the average distance, angle and middle point of the active fingers | 142 | // Returns the average distance, angle and middle point of the active fingers |
| 143 | GestureProperties GetGestureProperties(); | 143 | GestureProperties GetGestureProperties(); |
| 144 | 144 | ||
| 145 | GestureSharedMemory* shared_memory; | ||
| 146 | GestureState next_state{}; | 145 | GestureState next_state{}; |
| 147 | Core::HID::EmulatedConsole* console; | 146 | GestureSharedMemory* shared_memory = nullptr; |
| 147 | Core::HID::EmulatedConsole* console = nullptr; | ||
| 148 | 148 | ||
| 149 | std::array<Core::HID::TouchFinger, MAX_POINTS> fingers{}; | 149 | std::array<Core::HID::TouchFinger, MAX_POINTS> fingers{}; |
| 150 | GestureProperties last_gesture{}; | 150 | GestureProperties last_gesture{}; |
diff --git a/src/core/hle/service/hid/controllers/keyboard.cpp b/src/core/hle/service/hid/controllers/keyboard.cpp index 534a3ff18..117d87433 100644 --- a/src/core/hle/service/hid/controllers/keyboard.cpp +++ b/src/core/hle/service/hid/controllers/keyboard.cpp | |||
| @@ -16,8 +16,8 @@ Controller_Keyboard::Controller_Keyboard(Core::HID::HIDCore& hid_core_, u8* raw_ | |||
| 16 | : ControllerBase{hid_core_} { | 16 | : ControllerBase{hid_core_} { |
| 17 | static_assert(SHARED_MEMORY_OFFSET + sizeof(KeyboardSharedMemory) < shared_memory_size, | 17 | static_assert(SHARED_MEMORY_OFFSET + sizeof(KeyboardSharedMemory) < shared_memory_size, |
| 18 | "KeyboardSharedMemory is bigger than the shared memory"); | 18 | "KeyboardSharedMemory is bigger than the shared memory"); |
| 19 | shared_memory = | 19 | shared_memory = std::construct_at( |
| 20 | std::construct_at(reinterpret_cast<KeyboardSharedMemory*>(raw_shared_memory_ + SHARED_MEMORY_OFFSET)); | 20 | reinterpret_cast<KeyboardSharedMemory*>(raw_shared_memory_ + SHARED_MEMORY_OFFSET)); |
| 21 | emulated_devices = hid_core.GetEmulatedDevices(); | 21 | emulated_devices = hid_core.GetEmulatedDevices(); |
| 22 | } | 22 | } |
| 23 | 23 | ||
diff --git a/src/core/hle/service/hid/controllers/keyboard.h b/src/core/hle/service/hid/controllers/keyboard.h index 4c9c06a39..7532f53c6 100644 --- a/src/core/hle/service/hid/controllers/keyboard.h +++ b/src/core/hle/service/hid/controllers/keyboard.h | |||
| @@ -31,10 +31,10 @@ public: | |||
| 31 | private: | 31 | private: |
| 32 | // This is nn::hid::detail::KeyboardState | 32 | // This is nn::hid::detail::KeyboardState |
| 33 | struct KeyboardState { | 33 | struct KeyboardState { |
| 34 | s64 sampling_number; | 34 | s64 sampling_number{}; |
| 35 | Core::HID::KeyboardModifier modifier; | 35 | Core::HID::KeyboardModifier modifier{}; |
| 36 | Core::HID::KeyboardAttribute attribute; | 36 | Core::HID::KeyboardAttribute attribute{}; |
| 37 | Core::HID::KeyboardKey key; | 37 | Core::HID::KeyboardKey key{}; |
| 38 | }; | 38 | }; |
| 39 | static_assert(sizeof(KeyboardState) == 0x30, "KeyboardState is an invalid size"); | 39 | static_assert(sizeof(KeyboardState) == 0x30, "KeyboardState is an invalid size"); |
| 40 | 40 | ||
| @@ -46,8 +46,8 @@ private: | |||
| 46 | }; | 46 | }; |
| 47 | static_assert(sizeof(KeyboardSharedMemory) == 0x400, "KeyboardSharedMemory is an invalid size"); | 47 | static_assert(sizeof(KeyboardSharedMemory) == 0x400, "KeyboardSharedMemory is an invalid size"); |
| 48 | 48 | ||
| 49 | KeyboardSharedMemory* shared_memory; | ||
| 50 | KeyboardState next_state{}; | 49 | KeyboardState next_state{}; |
| 51 | Core::HID::EmulatedDevices* emulated_devices; | 50 | KeyboardSharedMemory* shared_memory = nullptr; |
| 51 | Core::HID::EmulatedDevices* emulated_devices = nullptr; | ||
| 52 | }; | 52 | }; |
| 53 | } // namespace Service::HID | 53 | } // namespace Service::HID |
diff --git a/src/core/hle/service/hid/controllers/mouse.cpp b/src/core/hle/service/hid/controllers/mouse.cpp index 730be33cd..b11cb438d 100644 --- a/src/core/hle/service/hid/controllers/mouse.cpp +++ b/src/core/hle/service/hid/controllers/mouse.cpp | |||
| @@ -16,7 +16,8 @@ Controller_Mouse::Controller_Mouse(Core::HID::HIDCore& hid_core_, u8* raw_shared | |||
| 16 | : ControllerBase{hid_core_} { | 16 | : ControllerBase{hid_core_} { |
| 17 | static_assert(SHARED_MEMORY_OFFSET + sizeof(MouseSharedMemory) < shared_memory_size, | 17 | static_assert(SHARED_MEMORY_OFFSET + sizeof(MouseSharedMemory) < shared_memory_size, |
| 18 | "MouseSharedMemory is bigger than the shared memory"); | 18 | "MouseSharedMemory is bigger than the shared memory"); |
| 19 | shared_memory = std::construct_at(reinterpret_cast<MouseSharedMemory*>(raw_shared_memory_ + SHARED_MEMORY_OFFSET)); | 19 | shared_memory = std::construct_at( |
| 20 | reinterpret_cast<MouseSharedMemory*>(raw_shared_memory_ + SHARED_MEMORY_OFFSET)); | ||
| 20 | emulated_devices = hid_core.GetEmulatedDevices(); | 21 | emulated_devices = hid_core.GetEmulatedDevices(); |
| 21 | } | 22 | } |
| 22 | 23 | ||
diff --git a/src/core/hle/service/hid/controllers/mouse.h b/src/core/hle/service/hid/controllers/mouse.h index a9395c44b..733d00577 100644 --- a/src/core/hle/service/hid/controllers/mouse.h +++ b/src/core/hle/service/hid/controllers/mouse.h | |||
| @@ -37,9 +37,9 @@ private: | |||
| 37 | }; | 37 | }; |
| 38 | static_assert(sizeof(MouseSharedMemory) == 0x400, "MouseSharedMemory is an invalid size"); | 38 | static_assert(sizeof(MouseSharedMemory) == 0x400, "MouseSharedMemory is an invalid size"); |
| 39 | 39 | ||
| 40 | MouseSharedMemory* shared_memory; | ||
| 41 | Core::HID::MouseState next_state{}; | 40 | Core::HID::MouseState next_state{}; |
| 42 | Core::HID::AnalogStickState last_mouse_wheel_state{}; | 41 | Core::HID::AnalogStickState last_mouse_wheel_state{}; |
| 43 | Core::HID::EmulatedDevices* emulated_devices; | 42 | MouseSharedMemory* shared_memory = nullptr; |
| 43 | Core::HID::EmulatedDevices* emulated_devices = nullptr; | ||
| 44 | }; | 44 | }; |
| 45 | } // namespace Service::HID | 45 | } // namespace Service::HID |
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index 425b84abd..0a96825a5 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h | |||
| @@ -187,7 +187,7 @@ public: | |||
| 187 | static bool IsDeviceHandleValid(const Core::HID::VibrationDeviceHandle& device_handle); | 187 | static bool IsDeviceHandleValid(const Core::HID::VibrationDeviceHandle& device_handle); |
| 188 | 188 | ||
| 189 | private: | 189 | private: |
| 190 | static const std::size_t NPAD_COUNT = 10; | 190 | static constexpr std::size_t NPAD_COUNT = 10; |
| 191 | 191 | ||
| 192 | // This is nn::hid::detail::ColorAttribute | 192 | // This is nn::hid::detail::ColorAttribute |
| 193 | enum class ColorAttribute : u32 { | 193 | enum class ColorAttribute : u32 { |
| @@ -470,9 +470,9 @@ private: | |||
| 470 | }; | 470 | }; |
| 471 | 471 | ||
| 472 | struct NpadControllerData { | 472 | struct NpadControllerData { |
| 473 | Core::HID::EmulatedController* device; | ||
| 474 | Kernel::KEvent* styleset_changed_event{}; | 473 | Kernel::KEvent* styleset_changed_event{}; |
| 475 | NpadInternalState* shared_memory; | 474 | NpadInternalState* shared_memory = nullptr; |
| 475 | Core::HID::EmulatedController* device = nullptr; | ||
| 476 | 476 | ||
| 477 | std::array<VibrationData, 2> vibration{}; | 477 | std::array<VibrationData, 2> vibration{}; |
| 478 | bool unintended_home_button_input_protection{}; | 478 | bool unintended_home_button_input_protection{}; |
| @@ -502,8 +502,7 @@ private: | |||
| 502 | SixAxisSensorState sixaxis_dual_right_state{}; | 502 | SixAxisSensorState sixaxis_dual_right_state{}; |
| 503 | SixAxisSensorState sixaxis_left_lifo_state{}; | 503 | SixAxisSensorState sixaxis_left_lifo_state{}; |
| 504 | SixAxisSensorState sixaxis_right_lifo_state{}; | 504 | SixAxisSensorState sixaxis_right_lifo_state{}; |
| 505 | 505 | int callback_key{}; | |
| 506 | int callback_key; | ||
| 507 | }; | 506 | }; |
| 508 | 507 | ||
| 509 | void ControllerUpdate(Core::HID::ControllerTriggerType type, std::size_t controller_idx); | 508 | void ControllerUpdate(Core::HID::ControllerTriggerType type, std::size_t controller_idx); |
diff --git a/src/core/hle/service/hid/controllers/stubbed.h b/src/core/hle/service/hid/controllers/stubbed.h index 5973358bc..1483a968e 100644 --- a/src/core/hle/service/hid/controllers/stubbed.h +++ b/src/core/hle/service/hid/controllers/stubbed.h | |||
| @@ -25,14 +25,14 @@ public: | |||
| 25 | 25 | ||
| 26 | private: | 26 | private: |
| 27 | struct CommonHeader { | 27 | struct CommonHeader { |
| 28 | s64 timestamp; | 28 | s64 timestamp{}; |
| 29 | s64 total_entry_count; | 29 | s64 total_entry_count{}; |
| 30 | s64 last_entry_index; | 30 | s64 last_entry_index{}; |
| 31 | s64 entry_count; | 31 | s64 entry_count{}; |
| 32 | }; | 32 | }; |
| 33 | static_assert(sizeof(CommonHeader) == 0x20, "CommonHeader is an invalid size"); | 33 | static_assert(sizeof(CommonHeader) == 0x20, "CommonHeader is an invalid size"); |
| 34 | 34 | ||
| 35 | u8* raw_shared_memory; | 35 | u8* raw_shared_memory = nullptr; |
| 36 | bool smart_update{}; | 36 | bool smart_update{}; |
| 37 | std::size_t common_offset{}; | 37 | std::size_t common_offset{}; |
| 38 | }; | 38 | }; |
diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index 5f584586b..108ce5a41 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp | |||
| @@ -20,7 +20,8 @@ Controller_Touchscreen::Controller_Touchscreen(Core::HID::HIDCore& hid_core_, | |||
| 20 | : ControllerBase{hid_core_} { | 20 | : ControllerBase{hid_core_} { |
| 21 | static_assert(SHARED_MEMORY_OFFSET + sizeof(TouchSharedMemory) < shared_memory_size, | 21 | static_assert(SHARED_MEMORY_OFFSET + sizeof(TouchSharedMemory) < shared_memory_size, |
| 22 | "TouchSharedMemory is bigger than the shared memory"); | 22 | "TouchSharedMemory is bigger than the shared memory"); |
| 23 | shared_memory = std::construct_at(reinterpret_cast<TouchSharedMemory*>(raw_shared_memory_ + SHARED_MEMORY_OFFSET)); | 23 | shared_memory = std::construct_at( |
| 24 | reinterpret_cast<TouchSharedMemory*>(raw_shared_memory_ + SHARED_MEMORY_OFFSET)); | ||
| 24 | console = hid_core.GetEmulatedConsole(); | 25 | console = hid_core.GetEmulatedConsole(); |
| 25 | } | 26 | } |
| 26 | 27 | ||
diff --git a/src/core/hle/service/hid/controllers/touchscreen.h b/src/core/hle/service/hid/controllers/touchscreen.h index 2e1dde2f1..e57a3a80e 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.h +++ b/src/core/hle/service/hid/controllers/touchscreen.h | |||
| @@ -25,7 +25,7 @@ public: | |||
| 25 | 25 | ||
| 26 | // This is nn::hid::TouchScreenConfigurationForNx | 26 | // This is nn::hid::TouchScreenConfigurationForNx |
| 27 | struct TouchScreenConfigurationForNx { | 27 | struct TouchScreenConfigurationForNx { |
| 28 | TouchScreenModeForNx mode; | 28 | TouchScreenModeForNx mode{TouchScreenModeForNx::UseSystemSetting}; |
| 29 | INSERT_PADDING_BYTES_NOINIT(0x7); | 29 | INSERT_PADDING_BYTES_NOINIT(0x7); |
| 30 | INSERT_PADDING_BYTES_NOINIT(0xF); // Reserved | 30 | INSERT_PADDING_BYTES_NOINIT(0xF); // Reserved |
| 31 | }; | 31 | }; |
| @@ -49,10 +49,10 @@ private: | |||
| 49 | 49 | ||
| 50 | // This is nn::hid::TouchScreenState | 50 | // This is nn::hid::TouchScreenState |
| 51 | struct TouchScreenState { | 51 | struct TouchScreenState { |
| 52 | s64 sampling_number; | 52 | s64 sampling_number{}; |
| 53 | s32 entry_count; | 53 | s32 entry_count{}; |
| 54 | INSERT_PADDING_BYTES(4); // Reserved | 54 | INSERT_PADDING_BYTES(4); // Reserved |
| 55 | std::array<Core::HID::TouchState, MAX_FINGERS> states; | 55 | std::array<Core::HID::TouchState, MAX_FINGERS> states{}; |
| 56 | }; | 56 | }; |
| 57 | static_assert(sizeof(TouchScreenState) == 0x290, "TouchScreenState is an invalid size"); | 57 | static_assert(sizeof(TouchScreenState) == 0x290, "TouchScreenState is an invalid size"); |
| 58 | 58 | ||
| @@ -64,10 +64,10 @@ private: | |||
| 64 | }; | 64 | }; |
| 65 | static_assert(sizeof(TouchSharedMemory) == 0x3000, "TouchSharedMemory is an invalid size"); | 65 | static_assert(sizeof(TouchSharedMemory) == 0x3000, "TouchSharedMemory is an invalid size"); |
| 66 | 66 | ||
| 67 | TouchSharedMemory* shared_memory; | ||
| 68 | |||
| 69 | TouchScreenState next_state{}; | 67 | TouchScreenState next_state{}; |
| 70 | std::array<Core::HID::TouchFinger, MAX_FINGERS> fingers; | 68 | TouchSharedMemory* shared_memory = nullptr; |
| 71 | Core::HID::EmulatedConsole* console; | 69 | Core::HID::EmulatedConsole* console = nullptr; |
| 70 | |||
| 71 | std::array<Core::HID::TouchFinger, MAX_FINGERS> fingers{}; | ||
| 72 | }; | 72 | }; |
| 73 | } // namespace Service::HID | 73 | } // namespace Service::HID |
diff --git a/src/core/hle/service/hid/controllers/xpad.cpp b/src/core/hle/service/hid/controllers/xpad.cpp index a35632560..62119e2c5 100644 --- a/src/core/hle/service/hid/controllers/xpad.cpp +++ b/src/core/hle/service/hid/controllers/xpad.cpp | |||
| @@ -14,7 +14,8 @@ Controller_XPad::Controller_XPad(Core::HID::HIDCore& hid_core_, u8* raw_shared_m | |||
| 14 | : ControllerBase{hid_core_} { | 14 | : ControllerBase{hid_core_} { |
| 15 | static_assert(SHARED_MEMORY_OFFSET + sizeof(XpadSharedMemory) < shared_memory_size, | 15 | static_assert(SHARED_MEMORY_OFFSET + sizeof(XpadSharedMemory) < shared_memory_size, |
| 16 | "XpadSharedMemory is bigger than the shared memory"); | 16 | "XpadSharedMemory is bigger than the shared memory"); |
| 17 | shared_memory = std::construct_at(reinterpret_cast<XpadSharedMemory*>(raw_shared_memory_ + SHARED_MEMORY_OFFSET)); | 17 | shared_memory = std::construct_at( |
| 18 | reinterpret_cast<XpadSharedMemory*>(raw_shared_memory_ + SHARED_MEMORY_OFFSET)); | ||
| 18 | } | 19 | } |
| 19 | Controller_XPad::~Controller_XPad() = default; | 20 | Controller_XPad::~Controller_XPad() = default; |
| 20 | 21 | ||
diff --git a/src/core/hle/service/hid/controllers/xpad.h b/src/core/hle/service/hid/controllers/xpad.h index 7ed8d5d97..d01dee5fc 100644 --- a/src/core/hle/service/hid/controllers/xpad.h +++ b/src/core/hle/service/hid/controllers/xpad.h | |||
| @@ -90,11 +90,11 @@ private: | |||
| 90 | 90 | ||
| 91 | // This is nn::hid::detail::BasicXpadState | 91 | // This is nn::hid::detail::BasicXpadState |
| 92 | struct BasicXpadState { | 92 | struct BasicXpadState { |
| 93 | s64 sampling_number; | 93 | s64 sampling_number{}; |
| 94 | BasicXpadAttributeSet attributes; | 94 | BasicXpadAttributeSet attributes{}; |
| 95 | BasicXpadButtonSet pad_states; | 95 | BasicXpadButtonSet pad_states{}; |
| 96 | Core::HID::AnalogStickState l_stick; | 96 | Core::HID::AnalogStickState l_stick{}; |
| 97 | Core::HID::AnalogStickState r_stick; | 97 | Core::HID::AnalogStickState r_stick{}; |
| 98 | }; | 98 | }; |
| 99 | static_assert(sizeof(BasicXpadState) == 0x20, "BasicXpadState is an invalid size"); | 99 | static_assert(sizeof(BasicXpadState) == 0x20, "BasicXpadState is an invalid size"); |
| 100 | 100 | ||
| @@ -106,7 +106,7 @@ private: | |||
| 106 | }; | 106 | }; |
| 107 | static_assert(sizeof(XpadSharedMemory) == 0x400, "XpadSharedMemory is an invalid size"); | 107 | static_assert(sizeof(XpadSharedMemory) == 0x400, "XpadSharedMemory is an invalid size"); |
| 108 | 108 | ||
| 109 | XpadSharedMemory* shared_memory; | ||
| 110 | BasicXpadState next_state{}; | 109 | BasicXpadState next_state{}; |
| 110 | XpadSharedMemory* shared_memory = nullptr; | ||
| 111 | }; | 111 | }; |
| 112 | } // namespace Service::HID | 112 | } // namespace Service::HID |