diff options
| author | 2021-01-11 00:03:17 -0600 | |
|---|---|---|
| committer | 2021-02-03 20:17:08 -0600 | |
| commit | 8019b2b9b5265647dbadc45f60a12e4bbfefbd77 (patch) | |
| tree | 106629207499feaa0efe1ed93105264d8bb1714b /src | |
| parent | Fix npad struct to match switchbrew (diff) | |
| download | yuzu-8019b2b9b5265647dbadc45f60a12e4bbfefbd77.tar.gz yuzu-8019b2b9b5265647dbadc45f60a12e4bbfefbd77.tar.xz yuzu-8019b2b9b5265647dbadc45f60a12e4bbfefbd77.zip | |
Add footer types and address comments
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/service/hid/controllers/keyboard.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/keyboard.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/mouse.cpp | 1 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/mouse.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 79 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.h | 60 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/xpad.h | 14 |
7 files changed, 106 insertions, 58 deletions
diff --git a/src/core/hle/service/hid/controllers/keyboard.cpp b/src/core/hle/service/hid/controllers/keyboard.cpp index fd5d5e057..c4a59147d 100644 --- a/src/core/hle/service/hid/controllers/keyboard.cpp +++ b/src/core/hle/service/hid/controllers/keyboard.cpp | |||
| @@ -56,7 +56,7 @@ void Controller_Keyboard::OnUpdate(const Core::Timing::CoreTiming& core_timing, | |||
| 56 | cur_entry.modifier.caps_lock.Assign(keyboard_mods[CapsLock]->GetStatus()); | 56 | cur_entry.modifier.caps_lock.Assign(keyboard_mods[CapsLock]->GetStatus()); |
| 57 | cur_entry.modifier.scroll_lock.Assign(keyboard_mods[ScrollLock]->GetStatus()); | 57 | cur_entry.modifier.scroll_lock.Assign(keyboard_mods[ScrollLock]->GetStatus()); |
| 58 | cur_entry.modifier.num_lock.Assign(keyboard_mods[NumLock]->GetStatus()); | 58 | cur_entry.modifier.num_lock.Assign(keyboard_mods[NumLock]->GetStatus()); |
| 59 | cur_entry.modifier.katana.Assign(0); | 59 | cur_entry.modifier.katakana.Assign(0); |
| 60 | cur_entry.modifier.hiragana.Assign(0); | 60 | cur_entry.modifier.hiragana.Assign(0); |
| 61 | } | 61 | } |
| 62 | std::memcpy(data + SHARED_MEMORY_OFFSET, &shared_memory, sizeof(SharedMemory)); | 62 | std::memcpy(data + SHARED_MEMORY_OFFSET, &shared_memory, sizeof(SharedMemory)); |
diff --git a/src/core/hle/service/hid/controllers/keyboard.h b/src/core/hle/service/hid/controllers/keyboard.h index 8a89eb4bb..b5b281752 100644 --- a/src/core/hle/service/hid/controllers/keyboard.h +++ b/src/core/hle/service/hid/controllers/keyboard.h | |||
| @@ -34,7 +34,7 @@ public: | |||
| 34 | private: | 34 | private: |
| 35 | struct Modifiers { | 35 | struct Modifiers { |
| 36 | union { | 36 | union { |
| 37 | s32_le raw{}; | 37 | u32_le raw{}; |
| 38 | BitField<0, 1, u32> control; | 38 | BitField<0, 1, u32> control; |
| 39 | BitField<1, 1, u32> shift; | 39 | BitField<1, 1, u32> shift; |
| 40 | BitField<2, 1, u32> left_alt; | 40 | BitField<2, 1, u32> left_alt; |
| @@ -43,7 +43,7 @@ private: | |||
| 43 | BitField<8, 1, u32> caps_lock; | 43 | BitField<8, 1, u32> caps_lock; |
| 44 | BitField<9, 1, u32> scroll_lock; | 44 | BitField<9, 1, u32> scroll_lock; |
| 45 | BitField<10, 1, u32> num_lock; | 45 | BitField<10, 1, u32> num_lock; |
| 46 | BitField<11, 1, u32> katana; | 46 | BitField<11, 1, u32> katakana; |
| 47 | BitField<12, 1, u32> hiragana; | 47 | BitField<12, 1, u32> hiragana; |
| 48 | }; | 48 | }; |
| 49 | }; | 49 | }; |
diff --git a/src/core/hle/service/hid/controllers/mouse.cpp b/src/core/hle/service/hid/controllers/mouse.cpp index 30924d9e2..2e7457604 100644 --- a/src/core/hle/service/hid/controllers/mouse.cpp +++ b/src/core/hle/service/hid/controllers/mouse.cpp | |||
| @@ -35,6 +35,7 @@ void Controller_Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* | |||
| 35 | 35 | ||
| 36 | cur_entry.sampling_number = last_entry.sampling_number + 1; | 36 | cur_entry.sampling_number = last_entry.sampling_number + 1; |
| 37 | cur_entry.sampling_number2 = cur_entry.sampling_number; | 37 | cur_entry.sampling_number2 = cur_entry.sampling_number; |
| 38 | |||
| 38 | cur_entry.attribute.raw = 0; | 39 | cur_entry.attribute.raw = 0; |
| 39 | if (Settings::values.mouse_enabled) { | 40 | if (Settings::values.mouse_enabled) { |
| 40 | const auto [px, py, sx, sy] = mouse_device->GetStatus(); | 41 | const auto [px, py, sx, sy] = mouse_device->GetStatus(); |
diff --git a/src/core/hle/service/hid/controllers/mouse.h b/src/core/hle/service/hid/controllers/mouse.h index 2c8ebe1d5..3b432a36e 100644 --- a/src/core/hle/service/hid/controllers/mouse.h +++ b/src/core/hle/service/hid/controllers/mouse.h | |||
| @@ -33,7 +33,7 @@ public: | |||
| 33 | private: | 33 | private: |
| 34 | struct Buttons { | 34 | struct Buttons { |
| 35 | union { | 35 | union { |
| 36 | s32_le raw{}; | 36 | u32_le raw{}; |
| 37 | BitField<0, 1, u32> left; | 37 | BitField<0, 1, u32> left; |
| 38 | BitField<1, 1, u32> right; | 38 | BitField<1, 1, u32> right; |
| 39 | BitField<2, 1, u32> middle; | 39 | BitField<2, 1, u32> middle; |
| @@ -45,7 +45,7 @@ private: | |||
| 45 | 45 | ||
| 46 | struct Attributes { | 46 | struct Attributes { |
| 47 | union { | 47 | union { |
| 48 | s32_le raw{}; | 48 | u32_le raw{}; |
| 49 | BitField<0, 1, u32> transferable; | 49 | BitField<0, 1, u32> transferable; |
| 50 | BitField<1, 1, u32> is_connected; | 50 | BitField<1, 1, u32> is_connected; |
| 51 | }; | 51 | }; |
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 5d91e6fc1..5eeb6081f 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -170,6 +170,7 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) { | |||
| 170 | controller.system_properties.use_plus.Assign(1); | 170 | controller.system_properties.use_plus.Assign(1); |
| 171 | controller.system_properties.use_minus.Assign(1); | 171 | controller.system_properties.use_minus.Assign(1); |
| 172 | controller.assignment_mode = NpadAssignments::Single; | 172 | controller.assignment_mode = NpadAssignments::Single; |
| 173 | controller.footer_type = AppletFooterUiType::SwitchProController; | ||
| 173 | break; | 174 | break; |
| 174 | case NPadControllerType::Handheld: | 175 | case NPadControllerType::Handheld: |
| 175 | controller.style_set.handheld.Assign(1); | 176 | controller.style_set.handheld.Assign(1); |
| @@ -179,6 +180,7 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) { | |||
| 179 | controller.system_properties.use_plus.Assign(1); | 180 | controller.system_properties.use_plus.Assign(1); |
| 180 | controller.system_properties.use_minus.Assign(1); | 181 | controller.system_properties.use_minus.Assign(1); |
| 181 | controller.assignment_mode = NpadAssignments::Dual; | 182 | controller.assignment_mode = NpadAssignments::Dual; |
| 183 | controller.footer_type = AppletFooterUiType::HandheldJoyConLeftJoyConRight; | ||
| 182 | break; | 184 | break; |
| 183 | case NPadControllerType::JoyDual: | 185 | case NPadControllerType::JoyDual: |
| 184 | controller.style_set.joycon_dual.Assign(1); | 186 | controller.style_set.joycon_dual.Assign(1); |
| @@ -188,6 +190,7 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) { | |||
| 188 | controller.system_properties.use_plus.Assign(1); | 190 | controller.system_properties.use_plus.Assign(1); |
| 189 | controller.system_properties.use_minus.Assign(1); | 191 | controller.system_properties.use_minus.Assign(1); |
| 190 | controller.assignment_mode = NpadAssignments::Dual; | 192 | controller.assignment_mode = NpadAssignments::Dual; |
| 193 | controller.footer_type = AppletFooterUiType::JoyDual; | ||
| 191 | break; | 194 | break; |
| 192 | case NPadControllerType::JoyLeft: | 195 | case NPadControllerType::JoyLeft: |
| 193 | controller.style_set.joycon_left.Assign(1); | 196 | controller.style_set.joycon_left.Assign(1); |
| @@ -195,6 +198,7 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) { | |||
| 195 | controller.system_properties.is_horizontal.Assign(1); | 198 | controller.system_properties.is_horizontal.Assign(1); |
| 196 | controller.system_properties.use_minus.Assign(1); | 199 | controller.system_properties.use_minus.Assign(1); |
| 197 | controller.assignment_mode = NpadAssignments::Single; | 200 | controller.assignment_mode = NpadAssignments::Single; |
| 201 | controller.footer_type = AppletFooterUiType::JoyLeftHorizontal; | ||
| 198 | break; | 202 | break; |
| 199 | case NPadControllerType::JoyRight: | 203 | case NPadControllerType::JoyRight: |
| 200 | controller.style_set.joycon_right.Assign(1); | 204 | controller.style_set.joycon_right.Assign(1); |
| @@ -202,6 +206,7 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) { | |||
| 202 | controller.system_properties.is_horizontal.Assign(1); | 206 | controller.system_properties.is_horizontal.Assign(1); |
| 203 | controller.system_properties.use_plus.Assign(1); | 207 | controller.system_properties.use_plus.Assign(1); |
| 204 | controller.assignment_mode = NpadAssignments::Single; | 208 | controller.assignment_mode = NpadAssignments::Single; |
| 209 | controller.footer_type = AppletFooterUiType::JoyRightHorizontal; | ||
| 205 | break; | 210 | break; |
| 206 | case NPadControllerType::Pokeball: | 211 | case NPadControllerType::Pokeball: |
| 207 | controller.style_set.palma.Assign(1); | 212 | controller.style_set.palma.Assign(1); |
| @@ -224,6 +229,7 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) { | |||
| 224 | controller.joycon_color.right.button = | 229 | controller.joycon_color.right.button = |
| 225 | Settings::values.players.GetValue()[controller_idx].button_color_right; | 230 | Settings::values.players.GetValue()[controller_idx].button_color_right; |
| 226 | 231 | ||
| 232 | // TODO: Investigate when we should report all batery types | ||
| 227 | controller.battery_level_dual = BATTERY_FULL; | 233 | controller.battery_level_dual = BATTERY_FULL; |
| 228 | controller.battery_level_left = BATTERY_FULL; | 234 | controller.battery_level_left = BATTERY_FULL; |
| 229 | controller.battery_level_right = BATTERY_FULL; | 235 | controller.battery_level_right = BATTERY_FULL; |
| @@ -450,7 +456,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* | |||
| 450 | npad.system_ext_states.npad[npad.system_ext_states.common.last_entry_index]; | 456 | npad.system_ext_states.npad[npad.system_ext_states.common.last_entry_index]; |
| 451 | 457 | ||
| 452 | libnx_entry.connection_status.raw = 0; | 458 | libnx_entry.connection_status.raw = 0; |
| 453 | libnx_entry.connection_status.IsConnected.Assign(1); | 459 | libnx_entry.connection_status.is_connected.Assign(1); |
| 454 | 460 | ||
| 455 | switch (controller_type) { | 461 | switch (controller_type) { |
| 456 | case NPadControllerType::None: | 462 | case NPadControllerType::None: |
| @@ -458,67 +464,67 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* | |||
| 458 | break; | 464 | break; |
| 459 | case NPadControllerType::ProController: | 465 | case NPadControllerType::ProController: |
| 460 | main_controller.connection_status.raw = 0; | 466 | main_controller.connection_status.raw = 0; |
| 461 | main_controller.connection_status.IsConnected.Assign(1); | 467 | main_controller.connection_status.is_connected.Assign(1); |
| 462 | main_controller.connection_status.IsWired.Assign(1); | 468 | main_controller.connection_status.is_wired.Assign(1); |
| 463 | main_controller.pad.pad_states.raw = pad_state.pad_states.raw; | 469 | main_controller.pad.pad_states.raw = pad_state.pad_states.raw; |
| 464 | main_controller.pad.l_stick = pad_state.l_stick; | 470 | main_controller.pad.l_stick = pad_state.l_stick; |
| 465 | main_controller.pad.r_stick = pad_state.r_stick; | 471 | main_controller.pad.r_stick = pad_state.r_stick; |
| 466 | 472 | ||
| 467 | libnx_entry.connection_status.IsWired.Assign(1); | 473 | libnx_entry.connection_status.is_wired.Assign(1); |
| 468 | break; | 474 | break; |
| 469 | case NPadControllerType::Handheld: | 475 | case NPadControllerType::Handheld: |
| 470 | handheld_entry.connection_status.raw = 0; | 476 | handheld_entry.connection_status.raw = 0; |
| 471 | handheld_entry.connection_status.IsConnected.Assign(1); | 477 | handheld_entry.connection_status.is_connected.Assign(1); |
| 472 | handheld_entry.connection_status.IsWired.Assign(1); | 478 | handheld_entry.connection_status.is_wired.Assign(1); |
| 473 | handheld_entry.connection_status.IsLeftJoyConnected.Assign(1); | 479 | handheld_entry.connection_status.is_left_connected.Assign(1); |
| 474 | handheld_entry.connection_status.IsRightJoyConnected.Assign(1); | 480 | handheld_entry.connection_status.is_right_connected.Assign(1); |
| 475 | handheld_entry.connection_status.IsLeftJoyWired.Assign(1); | 481 | handheld_entry.connection_status.is_left_wired.Assign(1); |
| 476 | handheld_entry.connection_status.IsRightJoyWired.Assign(1); | 482 | handheld_entry.connection_status.is_right_wired.Assign(1); |
| 477 | handheld_entry.pad.pad_states.raw = pad_state.pad_states.raw; | 483 | handheld_entry.pad.pad_states.raw = pad_state.pad_states.raw; |
| 478 | handheld_entry.pad.l_stick = pad_state.l_stick; | 484 | handheld_entry.pad.l_stick = pad_state.l_stick; |
| 479 | handheld_entry.pad.r_stick = pad_state.r_stick; | 485 | handheld_entry.pad.r_stick = pad_state.r_stick; |
| 480 | 486 | ||
| 481 | libnx_entry.connection_status.IsWired.Assign(1); | 487 | libnx_entry.connection_status.is_wired.Assign(1); |
| 482 | libnx_entry.connection_status.IsLeftJoyConnected.Assign(1); | 488 | libnx_entry.connection_status.is_left_connected.Assign(1); |
| 483 | libnx_entry.connection_status.IsRightJoyConnected.Assign(1); | 489 | libnx_entry.connection_status.is_right_connected.Assign(1); |
| 484 | libnx_entry.connection_status.IsLeftJoyWired.Assign(1); | 490 | libnx_entry.connection_status.is_left_wired.Assign(1); |
| 485 | libnx_entry.connection_status.IsRightJoyWired.Assign(1); | 491 | libnx_entry.connection_status.is_right_wired.Assign(1); |
| 486 | break; | 492 | break; |
| 487 | case NPadControllerType::JoyDual: | 493 | case NPadControllerType::JoyDual: |
| 488 | dual_entry.connection_status.raw = 0; | 494 | dual_entry.connection_status.raw = 0; |
| 489 | dual_entry.connection_status.IsConnected.Assign(1); | 495 | dual_entry.connection_status.is_connected.Assign(1); |
| 490 | dual_entry.connection_status.IsLeftJoyConnected.Assign(1); | 496 | dual_entry.connection_status.is_left_connected.Assign(1); |
| 491 | dual_entry.connection_status.IsRightJoyConnected.Assign(1); | 497 | dual_entry.connection_status.is_right_connected.Assign(1); |
| 492 | dual_entry.pad.pad_states.raw = pad_state.pad_states.raw; | 498 | dual_entry.pad.pad_states.raw = pad_state.pad_states.raw; |
| 493 | dual_entry.pad.l_stick = pad_state.l_stick; | 499 | dual_entry.pad.l_stick = pad_state.l_stick; |
| 494 | dual_entry.pad.r_stick = pad_state.r_stick; | 500 | dual_entry.pad.r_stick = pad_state.r_stick; |
| 495 | 501 | ||
| 496 | libnx_entry.connection_status.IsLeftJoyConnected.Assign(1); | 502 | libnx_entry.connection_status.is_left_connected.Assign(1); |
| 497 | libnx_entry.connection_status.IsRightJoyConnected.Assign(1); | 503 | libnx_entry.connection_status.is_right_connected.Assign(1); |
| 498 | break; | 504 | break; |
| 499 | case NPadControllerType::JoyLeft: | 505 | case NPadControllerType::JoyLeft: |
| 500 | left_entry.connection_status.raw = 0; | 506 | left_entry.connection_status.raw = 0; |
| 501 | left_entry.connection_status.IsConnected.Assign(1); | 507 | left_entry.connection_status.is_connected.Assign(1); |
| 502 | left_entry.connection_status.IsLeftJoyConnected.Assign(1); | 508 | left_entry.connection_status.is_left_connected.Assign(1); |
| 503 | left_entry.pad.pad_states.raw = pad_state.pad_states.raw; | 509 | left_entry.pad.pad_states.raw = pad_state.pad_states.raw; |
| 504 | left_entry.pad.l_stick = pad_state.l_stick; | 510 | left_entry.pad.l_stick = pad_state.l_stick; |
| 505 | left_entry.pad.r_stick = pad_state.r_stick; | 511 | left_entry.pad.r_stick = pad_state.r_stick; |
| 506 | 512 | ||
| 507 | libnx_entry.connection_status.IsLeftJoyConnected.Assign(1); | 513 | libnx_entry.connection_status.is_left_connected.Assign(1); |
| 508 | break; | 514 | break; |
| 509 | case NPadControllerType::JoyRight: | 515 | case NPadControllerType::JoyRight: |
| 510 | right_entry.connection_status.raw = 0; | 516 | right_entry.connection_status.raw = 0; |
| 511 | right_entry.connection_status.IsConnected.Assign(1); | 517 | right_entry.connection_status.is_connected.Assign(1); |
| 512 | right_entry.connection_status.IsRightJoyConnected.Assign(1); | 518 | right_entry.connection_status.is_right_connected.Assign(1); |
| 513 | right_entry.pad.pad_states.raw = pad_state.pad_states.raw; | 519 | right_entry.pad.pad_states.raw = pad_state.pad_states.raw; |
| 514 | right_entry.pad.l_stick = pad_state.l_stick; | 520 | right_entry.pad.l_stick = pad_state.l_stick; |
| 515 | right_entry.pad.r_stick = pad_state.r_stick; | 521 | right_entry.pad.r_stick = pad_state.r_stick; |
| 516 | 522 | ||
| 517 | libnx_entry.connection_status.IsRightJoyConnected.Assign(1); | 523 | libnx_entry.connection_status.is_right_connected.Assign(1); |
| 518 | break; | 524 | break; |
| 519 | case NPadControllerType::Pokeball: | 525 | case NPadControllerType::Pokeball: |
| 520 | pokeball_entry.connection_status.raw = 0; | 526 | pokeball_entry.connection_status.raw = 0; |
| 521 | pokeball_entry.connection_status.IsConnected.Assign(1); | 527 | pokeball_entry.connection_status.is_connected.Assign(1); |
| 522 | pokeball_entry.pad.pad_states.raw = pad_state.pad_states.raw; | 528 | pokeball_entry.pad.pad_states.raw = pad_state.pad_states.raw; |
| 523 | pokeball_entry.pad.l_stick = pad_state.l_stick; | 529 | pokeball_entry.pad.l_stick = pad_state.l_stick; |
| 524 | pokeball_entry.pad.r_stick = pad_state.r_stick; | 530 | pokeball_entry.pad.r_stick = pad_state.r_stick; |
| @@ -609,7 +615,7 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing | |||
| 609 | case NPadControllerType::ProController: | 615 | case NPadControllerType::ProController: |
| 610 | full_sixaxis_entry.attribute.raw = 0; | 616 | full_sixaxis_entry.attribute.raw = 0; |
| 611 | if (sixaxis_sensors_enabled && motions[i][0]) { | 617 | if (sixaxis_sensors_enabled && motions[i][0]) { |
| 612 | full_sixaxis_entry.attribute.IsConnected.Assign(1); | 618 | full_sixaxis_entry.attribute.is_connected.Assign(1); |
| 613 | full_sixaxis_entry.accel = motion_devices[0].accel; | 619 | full_sixaxis_entry.accel = motion_devices[0].accel; |
| 614 | full_sixaxis_entry.gyro = motion_devices[0].gyro; | 620 | full_sixaxis_entry.gyro = motion_devices[0].gyro; |
| 615 | full_sixaxis_entry.rotation = motion_devices[0].rotation; | 621 | full_sixaxis_entry.rotation = motion_devices[0].rotation; |
| @@ -619,7 +625,7 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing | |||
| 619 | case NPadControllerType::Handheld: | 625 | case NPadControllerType::Handheld: |
| 620 | handheld_sixaxis_entry.attribute.raw = 0; | 626 | handheld_sixaxis_entry.attribute.raw = 0; |
| 621 | if (sixaxis_sensors_enabled && motions[i][0]) { | 627 | if (sixaxis_sensors_enabled && motions[i][0]) { |
| 622 | handheld_sixaxis_entry.attribute.IsConnected.Assign(1); | 628 | handheld_sixaxis_entry.attribute.is_connected.Assign(1); |
| 623 | handheld_sixaxis_entry.accel = motion_devices[0].accel; | 629 | handheld_sixaxis_entry.accel = motion_devices[0].accel; |
| 624 | handheld_sixaxis_entry.gyro = motion_devices[0].gyro; | 630 | handheld_sixaxis_entry.gyro = motion_devices[0].gyro; |
| 625 | handheld_sixaxis_entry.rotation = motion_devices[0].rotation; | 631 | handheld_sixaxis_entry.rotation = motion_devices[0].rotation; |
| @@ -631,7 +637,7 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing | |||
| 631 | dual_right_sixaxis_entry.attribute.raw = 0; | 637 | dual_right_sixaxis_entry.attribute.raw = 0; |
| 632 | if (sixaxis_sensors_enabled && motions[i][0]) { | 638 | if (sixaxis_sensors_enabled && motions[i][0]) { |
| 633 | // Set motion for the left joycon | 639 | // Set motion for the left joycon |
| 634 | dual_left_sixaxis_entry.attribute.IsConnected.Assign(1); | 640 | dual_left_sixaxis_entry.attribute.is_connected.Assign(1); |
| 635 | dual_left_sixaxis_entry.accel = motion_devices[0].accel; | 641 | dual_left_sixaxis_entry.accel = motion_devices[0].accel; |
| 636 | dual_left_sixaxis_entry.gyro = motion_devices[0].gyro; | 642 | dual_left_sixaxis_entry.gyro = motion_devices[0].gyro; |
| 637 | dual_left_sixaxis_entry.rotation = motion_devices[0].rotation; | 643 | dual_left_sixaxis_entry.rotation = motion_devices[0].rotation; |
| @@ -639,7 +645,7 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing | |||
| 639 | } | 645 | } |
| 640 | if (sixaxis_sensors_enabled && motions[i][1]) { | 646 | if (sixaxis_sensors_enabled && motions[i][1]) { |
| 641 | // Set motion for the right joycon | 647 | // Set motion for the right joycon |
| 642 | dual_right_sixaxis_entry.attribute.IsConnected.Assign(1); | 648 | dual_right_sixaxis_entry.attribute.is_connected.Assign(1); |
| 643 | dual_right_sixaxis_entry.accel = motion_devices[1].accel; | 649 | dual_right_sixaxis_entry.accel = motion_devices[1].accel; |
| 644 | dual_right_sixaxis_entry.gyro = motion_devices[1].gyro; | 650 | dual_right_sixaxis_entry.gyro = motion_devices[1].gyro; |
| 645 | dual_right_sixaxis_entry.rotation = motion_devices[1].rotation; | 651 | dual_right_sixaxis_entry.rotation = motion_devices[1].rotation; |
| @@ -649,7 +655,7 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing | |||
| 649 | case NPadControllerType::JoyLeft: | 655 | case NPadControllerType::JoyLeft: |
| 650 | left_sixaxis_entry.attribute.raw = 0; | 656 | left_sixaxis_entry.attribute.raw = 0; |
| 651 | if (sixaxis_sensors_enabled && motions[i][0]) { | 657 | if (sixaxis_sensors_enabled && motions[i][0]) { |
| 652 | left_sixaxis_entry.attribute.IsConnected.Assign(1); | 658 | left_sixaxis_entry.attribute.is_connected.Assign(1); |
| 653 | left_sixaxis_entry.accel = motion_devices[0].accel; | 659 | left_sixaxis_entry.accel = motion_devices[0].accel; |
| 654 | left_sixaxis_entry.gyro = motion_devices[0].gyro; | 660 | left_sixaxis_entry.gyro = motion_devices[0].gyro; |
| 655 | left_sixaxis_entry.rotation = motion_devices[0].rotation; | 661 | left_sixaxis_entry.rotation = motion_devices[0].rotation; |
| @@ -659,7 +665,7 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing | |||
| 659 | case NPadControllerType::JoyRight: | 665 | case NPadControllerType::JoyRight: |
| 660 | right_sixaxis_entry.attribute.raw = 0; | 666 | right_sixaxis_entry.attribute.raw = 0; |
| 661 | if (sixaxis_sensors_enabled && motions[i][1]) { | 667 | if (sixaxis_sensors_enabled && motions[i][1]) { |
| 662 | right_sixaxis_entry.attribute.IsConnected.Assign(1); | 668 | right_sixaxis_entry.attribute.is_connected.Assign(1); |
| 663 | right_sixaxis_entry.accel = motion_devices[1].accel; | 669 | right_sixaxis_entry.accel = motion_devices[1].accel; |
| 664 | right_sixaxis_entry.gyro = motion_devices[1].gyro; | 670 | right_sixaxis_entry.gyro = motion_devices[1].gyro; |
| 665 | right_sixaxis_entry.rotation = motion_devices[1].rotation; | 671 | right_sixaxis_entry.rotation = motion_devices[1].rotation; |
| @@ -937,6 +943,13 @@ void Controller_NPad::DisconnectNpadAtIndex(std::size_t npad_index) { | |||
| 937 | controller.device_type.raw = 0; | 943 | controller.device_type.raw = 0; |
| 938 | controller.system_properties.raw = 0; | 944 | controller.system_properties.raw = 0; |
| 939 | controller.button_properties.raw = 0; | 945 | controller.button_properties.raw = 0; |
| 946 | controller.battery_level_dual = 0; | ||
| 947 | controller.battery_level_left = 0; | ||
| 948 | controller.battery_level_right = 0; | ||
| 949 | controller.fullkey_color = {}; | ||
| 950 | controller.joycon_color = {}; | ||
| 951 | controller.assignment_mode = NpadAssignments::Dual; | ||
| 952 | controller.footer_type = AppletFooterUiType::None; | ||
| 940 | 953 | ||
| 941 | SignalStyleSetChangedEvent(IndexToNPad(npad_index)); | 954 | SignalStyleSetChangedEvent(IndexToNPad(npad_index)); |
| 942 | } | 955 | } |
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index d791e327c..9eecb1830 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h | |||
| @@ -326,12 +326,12 @@ private: | |||
| 326 | struct ConnectionState { | 326 | struct ConnectionState { |
| 327 | union { | 327 | union { |
| 328 | u32_le raw{}; | 328 | u32_le raw{}; |
| 329 | BitField<0, 1, u32> IsConnected; | 329 | BitField<0, 1, u32> is_connected; |
| 330 | BitField<1, 1, u32> IsWired; | 330 | BitField<1, 1, u32> is_wired; |
| 331 | BitField<2, 1, u32> IsLeftJoyConnected; | 331 | BitField<2, 1, u32> is_left_connected; |
| 332 | BitField<3, 1, u32> IsLeftJoyWired; | 332 | BitField<3, 1, u32> is_left_wired; |
| 333 | BitField<4, 1, u32> IsRightJoyConnected; | 333 | BitField<4, 1, u32> is_right_connected; |
| 334 | BitField<5, 1, u32> IsRightJoyWired; | 334 | BitField<5, 1, u32> is_right_wired; |
| 335 | }; | 335 | }; |
| 336 | }; | 336 | }; |
| 337 | static_assert(sizeof(ConnectionState) == 4, "ConnectionState is an invalid size"); | 337 | static_assert(sizeof(ConnectionState) == 4, "ConnectionState is an invalid size"); |
| @@ -360,8 +360,8 @@ private: | |||
| 360 | struct SixAxisAttributes { | 360 | struct SixAxisAttributes { |
| 361 | union { | 361 | union { |
| 362 | u32_le raw{}; | 362 | u32_le raw{}; |
| 363 | BitField<0, 1, u32> IsConnected; | 363 | BitField<0, 1, u32> is_connected; |
| 364 | BitField<1, 1, u32> IsInterpolated; | 364 | BitField<1, 1, u32> is_interpolated; |
| 365 | }; | 365 | }; |
| 366 | }; | 366 | }; |
| 367 | static_assert(sizeof(SixAxisAttributes) == 4, "SixAxisAttributes is an invalid size"); | 367 | static_assert(sizeof(SixAxisAttributes) == 4, "SixAxisAttributes is an invalid size"); |
| @@ -394,8 +394,8 @@ private: | |||
| 394 | BitField<3, 1, s64> is_powered_joy_dual; | 394 | BitField<3, 1, s64> is_powered_joy_dual; |
| 395 | BitField<4, 1, s64> is_powered_joy_left; | 395 | BitField<4, 1, s64> is_powered_joy_left; |
| 396 | BitField<5, 1, s64> is_powered_joy_right; | 396 | BitField<5, 1, s64> is_powered_joy_right; |
| 397 | BitField<9, 1, s64> is_system_unsuported_button; | 397 | BitField<9, 1, s64> is_system_unsupported_button; |
| 398 | BitField<10, 1, s64> is_system_ext_unsuported_button; | 398 | BitField<10, 1, s64> is_system_ext_unsupported_button; |
| 399 | BitField<11, 1, s64> is_vertical; | 399 | BitField<11, 1, s64> is_vertical; |
| 400 | BitField<12, 1, s64> is_horizontal; | 400 | BitField<12, 1, s64> is_horizontal; |
| 401 | BitField<13, 1, s64> use_plus; | 401 | BitField<13, 1, s64> use_plus; |
| @@ -443,6 +443,38 @@ private: | |||
| 443 | std::array<Common::Vec3f, 3> orientation; | 443 | std::array<Common::Vec3f, 3> orientation; |
| 444 | }; | 444 | }; |
| 445 | 445 | ||
| 446 | struct NfcXcdHandle { | ||
| 447 | INSERT_PADDING_BYTES(0x60); | ||
| 448 | }; | ||
| 449 | |||
| 450 | struct AppletFooterUiAttributes { | ||
| 451 | INSERT_PADDING_BYTES(0x4); | ||
| 452 | }; | ||
| 453 | |||
| 454 | enum class AppletFooterUiType : u8 { | ||
| 455 | None = 0, | ||
| 456 | HandheldNone = 1, | ||
| 457 | HandheldJoyConLeftOnly = 1, | ||
| 458 | HandheldJoyConRightOnly = 3, | ||
| 459 | HandheldJoyConLeftJoyConRight = 4, | ||
| 460 | JoyDual = 5, | ||
| 461 | JoyDualLeftOnly = 6, | ||
| 462 | JoyDualRightOnly = 7, | ||
| 463 | JoyLeftHorizontal = 8, | ||
| 464 | JoyLeftVertical = 9, | ||
| 465 | JoyRightHorizontal = 10, | ||
| 466 | JoyRightVertical = 11, | ||
| 467 | SwitchProController = 12, | ||
| 468 | CompatibleProController = 13, | ||
| 469 | CompatibleJoyCon = 14, | ||
| 470 | LarkHvc1 = 15, | ||
| 471 | LarkHvc2 = 16, | ||
| 472 | LarkNesLeft = 17, | ||
| 473 | LarkNesRight = 18, | ||
| 474 | Lucia = 19, | ||
| 475 | Verification = 20, | ||
| 476 | }; | ||
| 477 | |||
| 446 | struct NPadEntry { | 478 | struct NPadEntry { |
| 447 | NpadStyleSet style_set; | 479 | NpadStyleSet style_set; |
| 448 | NpadAssignments assignment_mode; | 480 | NpadAssignments assignment_mode; |
| @@ -469,8 +501,11 @@ private: | |||
| 469 | u32 battery_level_dual; | 501 | u32 battery_level_dual; |
| 470 | u32 battery_level_left; | 502 | u32 battery_level_left; |
| 471 | u32 battery_level_right; | 503 | u32 battery_level_right; |
| 472 | INSERT_PADDING_BYTES(0x5c); | 504 | AppletFooterUiAttributes footer_attributes; |
| 473 | INSERT_PADDING_BYTES(0xdf8); | 505 | AppletFooterUiType footer_type; |
| 506 | // nfc_states needs to be checked switchbrew does not match with HW | ||
| 507 | NfcXcdHandle nfc_states; | ||
| 508 | INSERT_PADDING_BYTES(0xdef); | ||
| 474 | }; | 509 | }; |
| 475 | static_assert(sizeof(NPadEntry) == 0x5000, "NPadEntry is an invalid size"); | 510 | static_assert(sizeof(NPadEntry) == 0x5000, "NPadEntry is an invalid size"); |
| 476 | 511 | ||
| @@ -506,7 +541,6 @@ private: | |||
| 506 | std::vector<u32> supported_npad_id_types{}; | 541 | std::vector<u32> supported_npad_id_types{}; |
| 507 | NpadHoldType hold_type{NpadHoldType::Vertical}; | 542 | NpadHoldType hold_type{NpadHoldType::Vertical}; |
| 508 | NpadHandheldActivationMode handheld_activation_mode{NpadHandheldActivationMode::Dual}; | 543 | NpadHandheldActivationMode handheld_activation_mode{NpadHandheldActivationMode::Dual}; |
| 509 | // NpadCommunicationMode is unknown, default value is 1 | ||
| 510 | NpadCommunicationMode communication_mode{NpadCommunicationMode::Default}; | 544 | NpadCommunicationMode communication_mode{NpadCommunicationMode::Default}; |
| 511 | // Each controller should have their own styleset changed event | 545 | // Each controller should have their own styleset changed event |
| 512 | std::array<Kernel::EventPair, 10> styleset_changed_events; | 546 | std::array<Kernel::EventPair, 10> styleset_changed_events; |
diff --git a/src/core/hle/service/hid/controllers/xpad.h b/src/core/hle/service/hid/controllers/xpad.h index d91cf62a2..5b59961bd 100644 --- a/src/core/hle/service/hid/controllers/xpad.h +++ b/src/core/hle/service/hid/controllers/xpad.h | |||
| @@ -31,13 +31,13 @@ public: | |||
| 31 | private: | 31 | private: |
| 32 | struct Attributes { | 32 | struct Attributes { |
| 33 | union { | 33 | union { |
| 34 | s32_le raw{}; | 34 | u32_le raw{}; |
| 35 | BitField<0, 1, u32> IsConnected; | 35 | BitField<0, 1, u32> is_connected; |
| 36 | BitField<1, 1, u32> IsWired; | 36 | BitField<1, 1, u32> is_wired; |
| 37 | BitField<2, 1, u32> IsLeftConnected; | 37 | BitField<2, 1, u32> is_left_connected; |
| 38 | BitField<3, 1, u32> IsLeftWired; | 38 | BitField<3, 1, u32> is_left_wired; |
| 39 | BitField<4, 1, u32> IsRightConnected; | 39 | BitField<4, 1, u32> is_right_connected; |
| 40 | BitField<5, 1, u32> IsRightWired; | 40 | BitField<5, 1, u32> is_right_wired; |
| 41 | }; | 41 | }; |
| 42 | }; | 42 | }; |
| 43 | static_assert(sizeof(Attributes) == 4, "Attributes is an invalid size"); | 43 | static_assert(sizeof(Attributes) == 4, "Attributes is an invalid size"); |