diff options
| author | 2018-05-07 09:06:02 -0600 | |
|---|---|---|
| committer | 2018-05-07 11:06:02 -0400 | |
| commit | 266703b50ea61433fa6bba200433040ffd5f7377 (patch) | |
| tree | 35abf16d7d2f9c122692f90fde33e738908c4502 /src | |
| parent | Merge pull request #434 from lioncash/vdtor (diff) | |
| download | yuzu-266703b50ea61433fa6bba200433040ffd5f7377.tar.gz yuzu-266703b50ea61433fa6bba200433040ffd5f7377.tar.xz yuzu-266703b50ea61433fa6bba200433040ffd5f7377.zip | |
hid: Tweaks, Analog Sticks (#435)
* hid: Update mouse/keyboard state
* hid: Working analog sticks
* hid: Nits
* hid: Nits
* hid: Update mystery sections
* hid: Tweaks
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 190 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.h | 98 | ||||
| -rw-r--r-- | src/core/settings.h | 4 |
3 files changed, 224 insertions, 68 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index dc7ff5c31..1891255cb 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -60,7 +60,10 @@ private: | |||
| 60 | std::transform(Settings::values.buttons.begin() + Settings::NativeButton::BUTTON_HID_BEGIN, | 60 | std::transform(Settings::values.buttons.begin() + Settings::NativeButton::BUTTON_HID_BEGIN, |
| 61 | Settings::values.buttons.begin() + Settings::NativeButton::BUTTON_HID_END, | 61 | Settings::values.buttons.begin() + Settings::NativeButton::BUTTON_HID_END, |
| 62 | buttons.begin(), Input::CreateDevice<Input::ButtonDevice>); | 62 | buttons.begin(), Input::CreateDevice<Input::ButtonDevice>); |
| 63 | // TODO(shinyquagsire23): sticks, gyro, touch, mouse, keyboard | 63 | std::transform(Settings::values.analogs.begin() + Settings::NativeAnalog::STICK_HID_BEGIN, |
| 64 | Settings::values.analogs.begin() + Settings::NativeAnalog::STICK_HID_END, | ||
| 65 | sticks.begin(), Input::CreateDevice<Input::AnalogDevice>); | ||
| 66 | // TODO(shinyquagsire23): gyro, touch, mouse, keyboard | ||
| 64 | } | 67 | } |
| 65 | 68 | ||
| 66 | void UpdatePadCallback(u64 userdata, int cycles_late) { | 69 | void UpdatePadCallback(u64 userdata, int cycles_late) { |
| @@ -79,61 +82,70 @@ private: | |||
| 79 | controller_header.left_color_body = JOYCON_BODY_NEON_BLUE; | 82 | controller_header.left_color_body = JOYCON_BODY_NEON_BLUE; |
| 80 | controller_header.left_color_buttons = JOYCON_BUTTONS_NEON_BLUE; | 83 | controller_header.left_color_buttons = JOYCON_BUTTONS_NEON_BLUE; |
| 81 | 84 | ||
| 82 | for (int index = 0; index < HID_NUM_LAYOUTS; index++) { | 85 | for (size_t controller = 0; controller < mem.controllers.size(); controller++) { |
| 83 | ControllerLayout& layout = mem.controllers[Controller_Handheld].layouts[index]; | 86 | for (int index = 0; index < HID_NUM_LAYOUTS; index++) { |
| 84 | layout.header.num_entries = HID_NUM_ENTRIES; | 87 | ControllerLayout& layout = mem.controllers[controller].layouts[index]; |
| 85 | layout.header.max_entry_index = HID_NUM_ENTRIES - 1; | 88 | layout.header.num_entries = HID_NUM_ENTRIES; |
| 86 | 89 | layout.header.max_entry_index = HID_NUM_ENTRIES - 1; | |
| 87 | // HID shared memory stores the state of the past 17 samples in a circlular buffer, | 90 | |
| 88 | // each with a timestamp in number of samples since boot. | 91 | // HID shared memory stores the state of the past 17 samples in a circlular buffer, |
| 89 | layout.header.timestamp_ticks = CoreTiming::GetTicks(); | 92 | // each with a timestamp in number of samples since boot. |
| 90 | layout.header.latest_entry = (layout.header.latest_entry + 1) % HID_NUM_ENTRIES; | 93 | layout.header.timestamp_ticks = CoreTiming::GetTicks(); |
| 91 | 94 | layout.header.latest_entry = (layout.header.latest_entry + 1) % HID_NUM_ENTRIES; | |
| 92 | ControllerInputEntry& entry = layout.entries[layout.header.latest_entry]; | 95 | |
| 93 | entry.connection_state = ConnectionState_Connected | ConnectionState_Wired; | 96 | ControllerInputEntry& entry = layout.entries[layout.header.latest_entry]; |
| 94 | entry.timestamp++; | 97 | entry.connection_state = ConnectionState_Connected | ConnectionState_Wired; |
| 95 | entry.timestamp_2++; // TODO(shinyquagsire23): Is this always identical to timestamp? | 98 | entry.timestamp++; |
| 96 | 99 | // TODO(shinyquagsire23): Is this always identical to timestamp? | |
| 97 | // TODO(shinyquagsire23): Set up some LUTs for each layout mapping in the future? | 100 | entry.timestamp_2++; |
| 98 | // For now everything is just the default handheld layout, but split Joy-Con will | 101 | |
| 99 | // rotate the face buttons and directions for certain layouts. | 102 | // TODO(shinyquagsire23): More than just handheld input |
| 100 | ControllerPadState& state = entry.buttons; | 103 | if (controller != Controller_Handheld) |
| 101 | using namespace Settings::NativeButton; | 104 | continue; |
| 102 | state.a.Assign(buttons[A - BUTTON_HID_BEGIN]->GetStatus()); | 105 | |
| 103 | state.b.Assign(buttons[B - BUTTON_HID_BEGIN]->GetStatus()); | 106 | // TODO(shinyquagsire23): Set up some LUTs for each layout mapping in the future? |
| 104 | state.x.Assign(buttons[X - BUTTON_HID_BEGIN]->GetStatus()); | 107 | // For now everything is just the default handheld layout, but split Joy-Con will |
| 105 | state.y.Assign(buttons[Y - BUTTON_HID_BEGIN]->GetStatus()); | 108 | // rotate the face buttons and directions for certain layouts. |
| 106 | state.lstick.Assign(buttons[LStick - BUTTON_HID_BEGIN]->GetStatus()); | 109 | ControllerPadState& state = entry.buttons; |
| 107 | state.rstick.Assign(buttons[RStick - BUTTON_HID_BEGIN]->GetStatus()); | 110 | using namespace Settings::NativeButton; |
| 108 | state.l.Assign(buttons[L - BUTTON_HID_BEGIN]->GetStatus()); | 111 | state.a.Assign(buttons[A - BUTTON_HID_BEGIN]->GetStatus()); |
| 109 | state.r.Assign(buttons[R - BUTTON_HID_BEGIN]->GetStatus()); | 112 | state.b.Assign(buttons[B - BUTTON_HID_BEGIN]->GetStatus()); |
| 110 | state.zl.Assign(buttons[ZL - BUTTON_HID_BEGIN]->GetStatus()); | 113 | state.x.Assign(buttons[X - BUTTON_HID_BEGIN]->GetStatus()); |
| 111 | state.zr.Assign(buttons[ZR - BUTTON_HID_BEGIN]->GetStatus()); | 114 | state.y.Assign(buttons[Y - BUTTON_HID_BEGIN]->GetStatus()); |
| 112 | state.plus.Assign(buttons[Plus - BUTTON_HID_BEGIN]->GetStatus()); | 115 | state.lstick.Assign(buttons[LStick - BUTTON_HID_BEGIN]->GetStatus()); |
| 113 | state.minus.Assign(buttons[Minus - BUTTON_HID_BEGIN]->GetStatus()); | 116 | state.rstick.Assign(buttons[RStick - BUTTON_HID_BEGIN]->GetStatus()); |
| 114 | 117 | state.l.Assign(buttons[L - BUTTON_HID_BEGIN]->GetStatus()); | |
| 115 | state.dleft.Assign(buttons[DLeft - BUTTON_HID_BEGIN]->GetStatus()); | 118 | state.r.Assign(buttons[R - BUTTON_HID_BEGIN]->GetStatus()); |
| 116 | state.dup.Assign(buttons[DUp - BUTTON_HID_BEGIN]->GetStatus()); | 119 | state.zl.Assign(buttons[ZL - BUTTON_HID_BEGIN]->GetStatus()); |
| 117 | state.dright.Assign(buttons[DRight - BUTTON_HID_BEGIN]->GetStatus()); | 120 | state.zr.Assign(buttons[ZR - BUTTON_HID_BEGIN]->GetStatus()); |
| 118 | state.ddown.Assign(buttons[DDown - BUTTON_HID_BEGIN]->GetStatus()); | 121 | state.plus.Assign(buttons[Plus - BUTTON_HID_BEGIN]->GetStatus()); |
| 119 | 122 | state.minus.Assign(buttons[Minus - BUTTON_HID_BEGIN]->GetStatus()); | |
| 120 | state.lstick_left.Assign(buttons[LStick_Left - BUTTON_HID_BEGIN]->GetStatus()); | 123 | |
| 121 | state.lstick_up.Assign(buttons[LStick_Up - BUTTON_HID_BEGIN]->GetStatus()); | 124 | state.dleft.Assign(buttons[DLeft - BUTTON_HID_BEGIN]->GetStatus()); |
| 122 | state.lstick_right.Assign(buttons[LStick_Right - BUTTON_HID_BEGIN]->GetStatus()); | 125 | state.dup.Assign(buttons[DUp - BUTTON_HID_BEGIN]->GetStatus()); |
| 123 | state.lstick_down.Assign(buttons[LStick_Down - BUTTON_HID_BEGIN]->GetStatus()); | 126 | state.dright.Assign(buttons[DRight - BUTTON_HID_BEGIN]->GetStatus()); |
| 124 | 127 | state.ddown.Assign(buttons[DDown - BUTTON_HID_BEGIN]->GetStatus()); | |
| 125 | state.rstick_left.Assign(buttons[RStick_Left - BUTTON_HID_BEGIN]->GetStatus()); | 128 | |
| 126 | state.rstick_up.Assign(buttons[RStick_Up - BUTTON_HID_BEGIN]->GetStatus()); | 129 | state.lstick_left.Assign(buttons[LStick_Left - BUTTON_HID_BEGIN]->GetStatus()); |
| 127 | state.rstick_right.Assign(buttons[RStick_Right - BUTTON_HID_BEGIN]->GetStatus()); | 130 | state.lstick_up.Assign(buttons[LStick_Up - BUTTON_HID_BEGIN]->GetStatus()); |
| 128 | state.rstick_down.Assign(buttons[RStick_Down - BUTTON_HID_BEGIN]->GetStatus()); | 131 | state.lstick_right.Assign(buttons[LStick_Right - BUTTON_HID_BEGIN]->GetStatus()); |
| 129 | 132 | state.lstick_down.Assign(buttons[LStick_Down - BUTTON_HID_BEGIN]->GetStatus()); | |
| 130 | state.sl.Assign(buttons[SL - BUTTON_HID_BEGIN]->GetStatus()); | 133 | |
| 131 | state.sr.Assign(buttons[SR - BUTTON_HID_BEGIN]->GetStatus()); | 134 | state.rstick_left.Assign(buttons[RStick_Left - BUTTON_HID_BEGIN]->GetStatus()); |
| 132 | 135 | state.rstick_up.Assign(buttons[RStick_Up - BUTTON_HID_BEGIN]->GetStatus()); | |
| 133 | // TODO(shinyquagsire23): Analog stick vals | 136 | state.rstick_right.Assign(buttons[RStick_Right - BUTTON_HID_BEGIN]->GetStatus()); |
| 134 | 137 | state.rstick_down.Assign(buttons[RStick_Down - BUTTON_HID_BEGIN]->GetStatus()); | |
| 135 | // TODO(shinyquagsire23): Update pad info proper, (circular buffers, timestamps, | 138 | |
| 136 | // layouts) | 139 | state.sl.Assign(buttons[SL - BUTTON_HID_BEGIN]->GetStatus()); |
| 140 | state.sr.Assign(buttons[SR - BUTTON_HID_BEGIN]->GetStatus()); | ||
| 141 | |||
| 142 | const auto [stick_l_x_f, stick_l_y_f] = sticks[Joystick_Left]->GetStatus(); | ||
| 143 | const auto [stick_r_x_f, stick_r_y_f] = sticks[Joystick_Right]->GetStatus(); | ||
| 144 | entry.joystick_left_x = static_cast<s32>(stick_l_x_f * HID_JOYSTICK_MAX); | ||
| 145 | entry.joystick_left_y = static_cast<s32>(stick_l_y_f * HID_JOYSTICK_MAX); | ||
| 146 | entry.joystick_right_x = static_cast<s32>(stick_r_x_f * HID_JOYSTICK_MAX); | ||
| 147 | entry.joystick_right_y = static_cast<s32>(stick_r_y_f * HID_JOYSTICK_MAX); | ||
| 148 | } | ||
| 137 | } | 149 | } |
| 138 | 150 | ||
| 139 | // TODO(bunnei): Properly implement the touch screen, the below will just write empty data | 151 | // TODO(bunnei): Properly implement the touch screen, the below will just write empty data |
| @@ -151,6 +163,71 @@ private: | |||
| 151 | touchscreen.entries[curr_entry].header.timestamp = sample_counter; | 163 | touchscreen.entries[curr_entry].header.timestamp = sample_counter; |
| 152 | touchscreen.entries[curr_entry].header.num_touches = 0; | 164 | touchscreen.entries[curr_entry].header.num_touches = 0; |
| 153 | 165 | ||
| 166 | // TODO(shinyquagsire23): Properly implement mouse | ||
| 167 | Mouse& mouse = mem.mouse; | ||
| 168 | const u64 last_mouse_entry = mouse.header.latest_entry; | ||
| 169 | const u64 curr_mouse_entry = (mouse.header.latest_entry + 1) % mouse.entries.size(); | ||
| 170 | const u64 mouse_sample_counter = mouse.entries[last_mouse_entry].timestamp + 1; | ||
| 171 | mouse.header.timestamp_ticks = timestamp; | ||
| 172 | mouse.header.num_entries = mouse.entries.size(); | ||
| 173 | mouse.header.max_entry_index = mouse.entries.size(); | ||
| 174 | mouse.header.latest_entry = curr_mouse_entry; | ||
| 175 | |||
| 176 | mouse.entries[curr_mouse_entry].timestamp = mouse_sample_counter; | ||
| 177 | mouse.entries[curr_mouse_entry].timestamp_2 = mouse_sample_counter; | ||
| 178 | |||
| 179 | // TODO(shinyquagsire23): Properly implement keyboard | ||
| 180 | Keyboard& keyboard = mem.keyboard; | ||
| 181 | const u64 last_keyboard_entry = keyboard.header.latest_entry; | ||
| 182 | const u64 curr_keyboard_entry = | ||
| 183 | (keyboard.header.latest_entry + 1) % keyboard.entries.size(); | ||
| 184 | const u64 keyboard_sample_counter = keyboard.entries[last_keyboard_entry].timestamp + 1; | ||
| 185 | keyboard.header.timestamp_ticks = timestamp; | ||
| 186 | keyboard.header.num_entries = keyboard.entries.size(); | ||
| 187 | keyboard.header.latest_entry = last_keyboard_entry; | ||
| 188 | keyboard.header.max_entry_index = keyboard.entries.size(); | ||
| 189 | |||
| 190 | keyboard.entries[curr_keyboard_entry].timestamp = keyboard_sample_counter; | ||
| 191 | keyboard.entries[curr_keyboard_entry].timestamp_2 = keyboard_sample_counter; | ||
| 192 | |||
| 193 | // TODO(shinyquagsire23): Figure out what any of these are | ||
| 194 | for (size_t i = 0; i < mem.unk_input_1.size(); i++) { | ||
| 195 | UnkInput1& input = mem.unk_input_1[i]; | ||
| 196 | const u64 last_input_entry = input.header.latest_entry; | ||
| 197 | const u64 curr_input_entry = (input.header.latest_entry + 1) % input.entries.size(); | ||
| 198 | const u64 input_sample_counter = input.entries[last_input_entry].timestamp + 1; | ||
| 199 | |||
| 200 | input.header.timestamp_ticks = timestamp; | ||
| 201 | input.header.num_entries = input.entries.size(); | ||
| 202 | input.header.latest_entry = last_input_entry; | ||
| 203 | input.header.max_entry_index = input.entries.size(); | ||
| 204 | |||
| 205 | input.entries[curr_input_entry].timestamp = input_sample_counter; | ||
| 206 | input.entries[curr_input_entry].timestamp_2 = input_sample_counter; | ||
| 207 | } | ||
| 208 | |||
| 209 | for (size_t i = 0; i < mem.unk_input_2.size(); i++) { | ||
| 210 | UnkInput2& input = mem.unk_input_2[i]; | ||
| 211 | |||
| 212 | input.header.timestamp_ticks = timestamp; | ||
| 213 | input.header.num_entries = 17; | ||
| 214 | input.header.latest_entry = 0; | ||
| 215 | input.header.max_entry_index = 0; | ||
| 216 | } | ||
| 217 | |||
| 218 | UnkInput3& input = mem.unk_input_3; | ||
| 219 | const u64 last_input_entry = input.header.latest_entry; | ||
| 220 | const u64 curr_input_entry = (input.header.latest_entry + 1) % input.entries.size(); | ||
| 221 | const u64 input_sample_counter = input.entries[last_input_entry].timestamp + 1; | ||
| 222 | |||
| 223 | input.header.timestamp_ticks = timestamp; | ||
| 224 | input.header.num_entries = input.entries.size(); | ||
| 225 | input.header.latest_entry = last_input_entry; | ||
| 226 | input.header.max_entry_index = input.entries.size(); | ||
| 227 | |||
| 228 | input.entries[curr_input_entry].timestamp = input_sample_counter; | ||
| 229 | input.entries[curr_input_entry].timestamp_2 = input_sample_counter; | ||
| 230 | |||
| 154 | // TODO(shinyquagsire23): Signal events | 231 | // TODO(shinyquagsire23): Signal events |
| 155 | 232 | ||
| 156 | std::memcpy(shared_mem->GetPointer(), &mem, sizeof(SharedMemory)); | 233 | std::memcpy(shared_mem->GetPointer(), &mem, sizeof(SharedMemory)); |
| @@ -169,6 +246,7 @@ private: | |||
| 169 | std::atomic<bool> is_device_reload_pending{true}; | 246 | std::atomic<bool> is_device_reload_pending{true}; |
| 170 | std::array<std::unique_ptr<Input::ButtonDevice>, Settings::NativeButton::NUM_BUTTONS_HID> | 247 | std::array<std::unique_ptr<Input::ButtonDevice>, Settings::NativeButton::NUM_BUTTONS_HID> |
| 171 | buttons; | 248 | buttons; |
| 249 | std::array<std::unique_ptr<Input::AnalogDevice>, Settings::NativeAnalog::NUM_STICKS_HID> sticks; | ||
| 172 | }; | 250 | }; |
| 173 | 251 | ||
| 174 | class IActiveVibrationDeviceList final : public ServiceFramework<IActiveVibrationDeviceList> { | 252 | class IActiveVibrationDeviceList final : public ServiceFramework<IActiveVibrationDeviceList> { |
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index 350174ccd..b499308d6 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h | |||
| @@ -48,6 +48,11 @@ enum ControllerConnectionState { | |||
| 48 | ConnectionState_Wired = 1 << 1, | 48 | ConnectionState_Wired = 1 << 1, |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | enum ControllerJoystick { | ||
| 52 | Joystick_Left = 0, | ||
| 53 | Joystick_Right = 1, | ||
| 54 | }; | ||
| 55 | |||
| 51 | enum ControllerID { | 56 | enum ControllerID { |
| 52 | Controller_Player1 = 0, | 57 | Controller_Player1 = 0, |
| 53 | Controller_Player2 = 1, | 58 | Controller_Player2 = 1, |
| @@ -63,6 +68,34 @@ enum ControllerID { | |||
| 63 | 68 | ||
| 64 | // End enums and output structs | 69 | // End enums and output structs |
| 65 | 70 | ||
| 71 | // Begin UnkInput3 | ||
| 72 | |||
| 73 | struct UnkInput3Header { | ||
| 74 | u64 timestamp_ticks; | ||
| 75 | u64 num_entries; | ||
| 76 | u64 latest_entry; | ||
| 77 | u64 max_entry_index; | ||
| 78 | }; | ||
| 79 | static_assert(sizeof(UnkInput3Header) == 0x20, "HID UnkInput3 header structure has incorrect size"); | ||
| 80 | |||
| 81 | struct UnkInput3Entry { | ||
| 82 | u64 timestamp; | ||
| 83 | u64 timestamp_2; | ||
| 84 | u64 unk_8; | ||
| 85 | u64 unk_10; | ||
| 86 | u64 unk_18; | ||
| 87 | }; | ||
| 88 | static_assert(sizeof(UnkInput3Entry) == 0x28, "HID UnkInput3 entry structure has incorrect size"); | ||
| 89 | |||
| 90 | struct UnkInput3 { | ||
| 91 | UnkInput3Header header; | ||
| 92 | std::array<UnkInput3Entry, 17> entries; | ||
| 93 | std::array<u8, 0x138> padding; | ||
| 94 | }; | ||
| 95 | static_assert(sizeof(UnkInput3) == 0x400, "HID UnkInput3 structure has incorrect size"); | ||
| 96 | |||
| 97 | // End UnkInput3 | ||
| 98 | |||
| 66 | // Begin TouchScreen | 99 | // Begin TouchScreen |
| 67 | 100 | ||
| 68 | struct TouchScreenHeader { | 101 | struct TouchScreenHeader { |
| @@ -204,6 +237,52 @@ static_assert(sizeof(Keyboard) == 0x400, "HID keyboard structure has incorrect s | |||
| 204 | 237 | ||
| 205 | // End Keyboard | 238 | // End Keyboard |
| 206 | 239 | ||
| 240 | // Begin UnkInput1 | ||
| 241 | |||
| 242 | struct UnkInput1Header { | ||
| 243 | u64 timestamp_ticks; | ||
| 244 | u64 num_entries; | ||
| 245 | u64 latest_entry; | ||
| 246 | u64 max_entry_index; | ||
| 247 | }; | ||
| 248 | static_assert(sizeof(UnkInput1Header) == 0x20, "HID UnkInput1 header structure has incorrect size"); | ||
| 249 | |||
| 250 | struct UnkInput1Entry { | ||
| 251 | u64 timestamp; | ||
| 252 | u64 timestamp_2; | ||
| 253 | u64 unk_8; | ||
| 254 | u64 unk_10; | ||
| 255 | u64 unk_18; | ||
| 256 | }; | ||
| 257 | static_assert(sizeof(UnkInput1Entry) == 0x28, "HID UnkInput1 entry structure has incorrect size"); | ||
| 258 | |||
| 259 | struct UnkInput1 { | ||
| 260 | UnkInput1Header header; | ||
| 261 | std::array<UnkInput1Entry, 17> entries; | ||
| 262 | std::array<u8, 0x138> padding; | ||
| 263 | }; | ||
| 264 | static_assert(sizeof(UnkInput1) == 0x400, "HID UnkInput1 structure has incorrect size"); | ||
| 265 | |||
| 266 | // End UnkInput1 | ||
| 267 | |||
| 268 | // Begin UnkInput2 | ||
| 269 | |||
| 270 | struct UnkInput2Header { | ||
| 271 | u64 timestamp_ticks; | ||
| 272 | u64 num_entries; | ||
| 273 | u64 latest_entry; | ||
| 274 | u64 max_entry_index; | ||
| 275 | }; | ||
| 276 | static_assert(sizeof(UnkInput2Header) == 0x20, "HID UnkInput2 header structure has incorrect size"); | ||
| 277 | |||
| 278 | struct UnkInput2 { | ||
| 279 | UnkInput2Header header; | ||
| 280 | std::array<u8, 0x1E0> padding; | ||
| 281 | }; | ||
| 282 | static_assert(sizeof(UnkInput2) == 0x200, "HID UnkInput2 structure has incorrect size"); | ||
| 283 | |||
| 284 | // End UnkInput2 | ||
| 285 | |||
| 207 | // Begin Controller | 286 | // Begin Controller |
| 208 | 287 | ||
| 209 | struct ControllerMAC { | 288 | struct ControllerMAC { |
| @@ -283,10 +362,10 @@ struct ControllerInputEntry { | |||
| 283 | u64 timestamp; | 362 | u64 timestamp; |
| 284 | u64 timestamp_2; | 363 | u64 timestamp_2; |
| 285 | ControllerPadState buttons; | 364 | ControllerPadState buttons; |
| 286 | u32 joystick_left_x; | 365 | s32 joystick_left_x; |
| 287 | u32 joystick_left_y; | 366 | s32 joystick_left_y; |
| 288 | u32 joystick_right_x; | 367 | s32 joystick_right_x; |
| 289 | u32 joystick_right_y; | 368 | s32 joystick_right_y; |
| 290 | u64 connection_state; | 369 | u64 connection_state; |
| 291 | }; | 370 | }; |
| 292 | static_assert(sizeof(ControllerInputEntry) == 0x30, | 371 | static_assert(sizeof(ControllerInputEntry) == 0x30, |
| @@ -312,17 +391,12 @@ static_assert(sizeof(Controller) == 0x5000, "HID controller structure has incorr | |||
| 312 | // End Controller | 391 | // End Controller |
| 313 | 392 | ||
| 314 | struct SharedMemory { | 393 | struct SharedMemory { |
| 315 | std::array<u8, 0x400> header; | 394 | UnkInput3 unk_input_3; |
| 316 | TouchScreen touchscreen; | 395 | TouchScreen touchscreen; |
| 317 | Mouse mouse; | 396 | Mouse mouse; |
| 318 | Keyboard keyboard; | 397 | Keyboard keyboard; |
| 319 | std::array<u8, 0x400> unk_section_1; | 398 | std::array<UnkInput1, 4> unk_input_1; |
| 320 | std::array<u8, 0x400> unk_section_2; | 399 | std::array<UnkInput2, 3> unk_input_2; |
| 321 | std::array<u8, 0x400> unk_section_3; | ||
| 322 | std::array<u8, 0x400> unk_section_4; | ||
| 323 | std::array<u8, 0x200> unk_section_5; | ||
| 324 | std::array<u8, 0x200> unk_section_6; | ||
| 325 | std::array<u8, 0x200> unk_section_7; | ||
| 326 | std::array<u8, 0x800> unk_section_8; | 400 | std::array<u8, 0x800> unk_section_8; |
| 327 | std::array<u8, 0x4000> controller_serials; | 401 | std::array<u8, 0x4000> controller_serials; |
| 328 | std::array<Controller, 10> controllers; | 402 | std::array<Controller, 10> controllers; |
diff --git a/src/core/settings.h b/src/core/settings.h index 2c94caab7..cfec63c21 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -99,6 +99,10 @@ enum Values { | |||
| 99 | NumAnalogs, | 99 | NumAnalogs, |
| 100 | }; | 100 | }; |
| 101 | 101 | ||
| 102 | constexpr int STICK_HID_BEGIN = LStick; | ||
| 103 | constexpr int STICK_HID_END = NumAnalogs; | ||
| 104 | constexpr int NUM_STICKS_HID = NumAnalogs; | ||
| 105 | |||
| 102 | static const std::array<const char*, NumAnalogs> mapping = {{ | 106 | static const std::array<const char*, NumAnalogs> mapping = {{ |
| 103 | "lstick", | 107 | "lstick", |
| 104 | "rstick", | 108 | "rstick", |