diff options
| -rw-r--r-- | src/core/hle/service/hid/controllers/debug_pad.cpp | 53 | ||||
| -rw-r--r-- | src/core/hle/service/hid/controllers/keyboard.cpp | 17 |
2 files changed, 37 insertions, 33 deletions
diff --git a/src/core/hle/service/hid/controllers/debug_pad.cpp b/src/core/hle/service/hid/controllers/debug_pad.cpp index cb35919e9..ad251ed4a 100644 --- a/src/core/hle/service/hid/controllers/debug_pad.cpp +++ b/src/core/hle/service/hid/controllers/debug_pad.cpp | |||
| @@ -39,33 +39,36 @@ void Controller_DebugPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, | |||
| 39 | 39 | ||
| 40 | cur_entry.sampling_number = last_entry.sampling_number + 1; | 40 | cur_entry.sampling_number = last_entry.sampling_number + 1; |
| 41 | cur_entry.sampling_number2 = cur_entry.sampling_number; | 41 | cur_entry.sampling_number2 = cur_entry.sampling_number; |
| 42 | cur_entry.attribute.connected.Assign(1); | ||
| 43 | auto& pad = cur_entry.pad_state; | ||
| 44 | 42 | ||
| 45 | using namespace Settings::NativeButton; | 43 | if (Settings::values.debug_pad_enabled) { |
| 46 | pad.a.Assign(buttons[A - BUTTON_HID_BEGIN]->GetStatus()); | 44 | cur_entry.attribute.connected.Assign(1); |
| 47 | pad.b.Assign(buttons[B - BUTTON_HID_BEGIN]->GetStatus()); | 45 | auto& pad = cur_entry.pad_state; |
| 48 | pad.x.Assign(buttons[X - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 49 | pad.y.Assign(buttons[Y - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 50 | pad.l.Assign(buttons[L - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 51 | pad.r.Assign(buttons[R - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 52 | pad.zl.Assign(buttons[ZL - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 53 | pad.zr.Assign(buttons[ZR - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 54 | pad.plus.Assign(buttons[Plus - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 55 | pad.minus.Assign(buttons[Minus - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 56 | pad.d_left.Assign(buttons[DLeft - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 57 | pad.d_up.Assign(buttons[DUp - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 58 | pad.d_right.Assign(buttons[DRight - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 59 | pad.d_down.Assign(buttons[DDown - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 60 | 46 | ||
| 61 | const auto [stick_l_x_f, stick_l_y_f] = | 47 | using namespace Settings::NativeButton; |
| 62 | analogs[static_cast<std::size_t>(JoystickId::Joystick_Left)]->GetStatus(); | 48 | pad.a.Assign(buttons[A - BUTTON_HID_BEGIN]->GetStatus()); |
| 63 | const auto [stick_r_x_f, stick_r_y_f] = | 49 | pad.b.Assign(buttons[B - BUTTON_HID_BEGIN]->GetStatus()); |
| 64 | analogs[static_cast<std::size_t>(JoystickId::Joystick_Right)]->GetStatus(); | 50 | pad.x.Assign(buttons[X - BUTTON_HID_BEGIN]->GetStatus()); |
| 65 | cur_entry.l_stick.x = static_cast<s32>(stick_l_x_f * HID_JOYSTICK_MAX); | 51 | pad.y.Assign(buttons[Y - BUTTON_HID_BEGIN]->GetStatus()); |
| 66 | cur_entry.l_stick.y = static_cast<s32>(stick_l_y_f * HID_JOYSTICK_MAX); | 52 | pad.l.Assign(buttons[L - BUTTON_HID_BEGIN]->GetStatus()); |
| 67 | cur_entry.r_stick.x = static_cast<s32>(stick_r_x_f * HID_JOYSTICK_MAX); | 53 | pad.r.Assign(buttons[R - BUTTON_HID_BEGIN]->GetStatus()); |
| 68 | cur_entry.r_stick.y = static_cast<s32>(stick_r_y_f * HID_JOYSTICK_MAX); | 54 | pad.zl.Assign(buttons[ZL - BUTTON_HID_BEGIN]->GetStatus()); |
| 55 | pad.zr.Assign(buttons[ZR - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 56 | pad.plus.Assign(buttons[Plus - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 57 | pad.minus.Assign(buttons[Minus - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 58 | pad.d_left.Assign(buttons[DLeft - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 59 | pad.d_up.Assign(buttons[DUp - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 60 | pad.d_right.Assign(buttons[DRight - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 61 | pad.d_down.Assign(buttons[DDown - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 62 | |||
| 63 | const auto [stick_l_x_f, stick_l_y_f] = | ||
| 64 | analogs[static_cast<std::size_t>(JoystickId::Joystick_Left)]->GetStatus(); | ||
| 65 | const auto [stick_r_x_f, stick_r_y_f] = | ||
| 66 | analogs[static_cast<std::size_t>(JoystickId::Joystick_Right)]->GetStatus(); | ||
| 67 | cur_entry.l_stick.x = static_cast<s32>(stick_l_x_f * HID_JOYSTICK_MAX); | ||
| 68 | cur_entry.l_stick.y = static_cast<s32>(stick_l_y_f * HID_JOYSTICK_MAX); | ||
| 69 | cur_entry.r_stick.x = static_cast<s32>(stick_r_x_f * HID_JOYSTICK_MAX); | ||
| 70 | cur_entry.r_stick.y = static_cast<s32>(stick_r_y_f * HID_JOYSTICK_MAX); | ||
| 71 | } | ||
| 69 | 72 | ||
| 70 | std::memcpy(data, &shared_memory, sizeof(SharedMemory)); | 73 | std::memcpy(data, &shared_memory, sizeof(SharedMemory)); |
| 71 | } | 74 | } |
diff --git a/src/core/hle/service/hid/controllers/keyboard.cpp b/src/core/hle/service/hid/controllers/keyboard.cpp index feae89525..0b896d5ad 100644 --- a/src/core/hle/service/hid/controllers/keyboard.cpp +++ b/src/core/hle/service/hid/controllers/keyboard.cpp | |||
| @@ -40,15 +40,16 @@ void Controller_Keyboard::OnUpdate(const Core::Timing::CoreTiming& core_timing, | |||
| 40 | 40 | ||
| 41 | cur_entry.key.fill(0); | 41 | cur_entry.key.fill(0); |
| 42 | cur_entry.modifier = 0; | 42 | cur_entry.modifier = 0; |
| 43 | 43 | if (Settings::values.keyboard_enabled) { | |
| 44 | for (std::size_t i = 0; i < keyboard_keys.size(); ++i) { | 44 | for (std::size_t i = 0; i < keyboard_keys.size(); ++i) { |
| 45 | cur_entry.key[i / KEYS_PER_BYTE] |= (keyboard_keys[i]->GetStatus() << (i % KEYS_PER_BYTE)); | 45 | cur_entry.key[i / KEYS_PER_BYTE] |= |
| 46 | } | 46 | (keyboard_keys[i]->GetStatus() << (i % KEYS_PER_BYTE)); |
| 47 | 47 | } | |
| 48 | for (std::size_t i = 0; i < keyboard_mods.size(); ++i) { | 48 | |
| 49 | cur_entry.modifier |= (keyboard_mods[i]->GetStatus() << i); | 49 | for (std::size_t i = 0; i < keyboard_mods.size(); ++i) { |
| 50 | cur_entry.modifier |= (keyboard_mods[i]->GetStatus() << i); | ||
| 51 | } | ||
| 50 | } | 52 | } |
| 51 | |||
| 52 | std::memcpy(data + SHARED_MEMORY_OFFSET, &shared_memory, sizeof(SharedMemory)); | 53 | std::memcpy(data + SHARED_MEMORY_OFFSET, &shared_memory, sizeof(SharedMemory)); |
| 53 | } | 54 | } |
| 54 | 55 | ||