summaryrefslogtreecommitdiff
path: root/src/core/hid
diff options
context:
space:
mode:
authorGravatar Narr the Reg2022-04-20 12:00:26 -0500
committerGravatar Narr the Reg2022-04-23 17:11:43 -0500
commit0f3ad939a85494a8a9bdcb6f357c774f385f647e (patch)
tree1c050188b8ffb83815adcef9fd3efd200627cb90 /src/core/hid
parentservice: hid: Access shared memory directly (diff)
downloadyuzu-0f3ad939a85494a8a9bdcb6f357c774f385f647e.tar.gz
yuzu-0f3ad939a85494a8a9bdcb6f357c774f385f647e.tar.xz
yuzu-0f3ad939a85494a8a9bdcb6f357c774f385f647e.zip
service: hid: Ensure all structs are initialized
Diffstat (limited to 'src/core/hid')
-rw-r--r--src/core/hid/hid_types.h72
1 files changed, 36 insertions, 36 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
318struct TouchState { 318struct 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};
327static_assert(sizeof(TouchState) == 0x28, "Touchstate is an invalid size"); 327static_assert(sizeof(TouchState) == 0x28, "Touchstate is an invalid size");
328 328
329// This is nn::hid::NpadControllerColor 329// This is nn::hid::NpadControllerColor
330struct NpadControllerColor { 330struct NpadControllerColor {
331 u32 body; 331 u32 body{};
332 u32 button; 332 u32 button{};
333}; 333};
334static_assert(sizeof(NpadControllerColor) == 8, "NpadControllerColor is an invalid size"); 334static_assert(sizeof(NpadControllerColor) == 8, "NpadControllerColor is an invalid size");
335 335
336// This is nn::hid::AnalogStickState 336// This is nn::hid::AnalogStickState
337struct AnalogStickState { 337struct AnalogStickState {
338 s32 x; 338 s32 x{};
339 s32 y; 339 s32 y{};
340}; 340};
341static_assert(sizeof(AnalogStickState) == 8, "AnalogStickState is an invalid size"); 341static_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
356struct NpadPowerInfo { 356struct 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};
362static_assert(sizeof(NpadPowerInfo) == 0xC, "NpadPowerInfo is an invalid size"); 362static_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
476struct ConsoleSixAxisSensorHandle { 476struct 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};
481static_assert(sizeof(ConsoleSixAxisSensorHandle) == 4, 481static_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
485struct SixAxisSensorHandle { 485struct 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};
491static_assert(sizeof(SixAxisSensorHandle) == 4, "SixAxisSensorHandle is an invalid size"); 491static_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
502struct VibrationDeviceHandle { 502struct 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};
508static_assert(sizeof(VibrationDeviceHandle) == 4, "SixAxisSensorHandle is an invalid size"); 508static_assert(sizeof(VibrationDeviceHandle) == 4, "SixAxisSensorHandle is an invalid size");
509 509
510// This is nn::hid::VibrationValue 510// This is nn::hid::VibrationValue
511struct VibrationValue { 511struct 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};
517static_assert(sizeof(VibrationValue) == 0x10, "VibrationValue has incorrect size."); 517static_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
562struct KeyboardKey { 562struct 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};
566static_assert(sizeof(KeyboardKey) == 0x20, "KeyboardKey is an invalid size"); 566static_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
592struct MouseState { 592struct 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};
604static_assert(sizeof(MouseState) == 0x28, "MouseState is an invalid size"); 604static_assert(sizeof(MouseState) == 0x28, "MouseState is an invalid size");
605 605