summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/hid/controllers/keyboard.cpp17
-rw-r--r--src/core/hle/service/hid/controllers/keyboard.h21
-rw-r--r--src/core/hle/service/hid/controllers/mouse.cpp12
-rw-r--r--src/core/hle/service/hid/controllers/mouse.h26
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp12
-rw-r--r--src/core/hle/service/hid/controllers/npad.h33
-rw-r--r--src/core/hle/service/hid/controllers/xpad.h70
-rw-r--r--src/core/hle/service/hid/hid.cpp20
-rw-r--r--src/core/hle/service/hid/hid.h10
9 files changed, 191 insertions, 30 deletions
diff --git a/src/core/hle/service/hid/controllers/keyboard.cpp b/src/core/hle/service/hid/controllers/keyboard.cpp
index 59b694cd4..fd5d5e057 100644
--- a/src/core/hle/service/hid/controllers/keyboard.cpp
+++ b/src/core/hle/service/hid/controllers/keyboard.cpp
@@ -39,16 +39,25 @@ void Controller_Keyboard::OnUpdate(const Core::Timing::CoreTiming& core_timing,
39 cur_entry.sampling_number2 = cur_entry.sampling_number; 39 cur_entry.sampling_number2 = cur_entry.sampling_number;
40 40
41 cur_entry.key.fill(0); 41 cur_entry.key.fill(0);
42 cur_entry.modifier = 0;
43 if (Settings::values.keyboard_enabled) { 42 if (Settings::values.keyboard_enabled) {
44 for (std::size_t i = 0; i < keyboard_keys.size(); ++i) { 43 for (std::size_t i = 0; i < keyboard_keys.size(); ++i) {
45 auto& entry = cur_entry.key[i / KEYS_PER_BYTE]; 44 auto& entry = cur_entry.key[i / KEYS_PER_BYTE];
46 entry = static_cast<u8>(entry | (keyboard_keys[i]->GetStatus() << (i % KEYS_PER_BYTE))); 45 entry = static_cast<u8>(entry | (keyboard_keys[i]->GetStatus() << (i % KEYS_PER_BYTE)));
47 } 46 }
48 47
49 for (std::size_t i = 0; i < keyboard_mods.size(); ++i) { 48 using namespace Settings::NativeKeyboard;
50 cur_entry.modifier |= (keyboard_mods[i]->GetStatus() << i); 49
51 } 50 // TODO: Assign the correct key to all modifiers
51 cur_entry.modifier.control.Assign(keyboard_mods[LeftControl]->GetStatus());
52 cur_entry.modifier.shift.Assign(keyboard_mods[LeftShift]->GetStatus());
53 cur_entry.modifier.left_alt.Assign(keyboard_mods[LeftAlt]->GetStatus());
54 cur_entry.modifier.right_alt.Assign(keyboard_mods[RightAlt]->GetStatus());
55 cur_entry.modifier.gui.Assign(0);
56 cur_entry.modifier.caps_lock.Assign(keyboard_mods[CapsLock]->GetStatus());
57 cur_entry.modifier.scroll_lock.Assign(keyboard_mods[ScrollLock]->GetStatus());
58 cur_entry.modifier.num_lock.Assign(keyboard_mods[NumLock]->GetStatus());
59 cur_entry.modifier.katana.Assign(0);
60 cur_entry.modifier.hiragana.Assign(0);
52 } 61 }
53 std::memcpy(data + SHARED_MEMORY_OFFSET, &shared_memory, sizeof(SharedMemory)); 62 std::memcpy(data + SHARED_MEMORY_OFFSET, &shared_memory, sizeof(SharedMemory));
54} 63}
diff --git a/src/core/hle/service/hid/controllers/keyboard.h b/src/core/hle/service/hid/controllers/keyboard.h
index f3eef5936..8a89eb4bb 100644
--- a/src/core/hle/service/hid/controllers/keyboard.h
+++ b/src/core/hle/service/hid/controllers/keyboard.h
@@ -5,6 +5,7 @@
5#pragma once 5#pragma once
6 6
7#include <array> 7#include <array>
8#include "common/bit_field.h"
8#include "common/common_funcs.h" 9#include "common/common_funcs.h"
9#include "common/common_types.h" 10#include "common/common_types.h"
10#include "common/swap.h" 11#include "common/swap.h"
@@ -31,12 +32,28 @@ public:
31 void OnLoadInputDevices() override; 32 void OnLoadInputDevices() override;
32 33
33private: 34private:
35 struct Modifiers {
36 union {
37 s32_le raw{};
38 BitField<0, 1, u32> control;
39 BitField<1, 1, u32> shift;
40 BitField<2, 1, u32> left_alt;
41 BitField<3, 1, u32> right_alt;
42 BitField<4, 1, u32> gui;
43 BitField<8, 1, u32> caps_lock;
44 BitField<9, 1, u32> scroll_lock;
45 BitField<10, 1, u32> num_lock;
46 BitField<11, 1, u32> katana;
47 BitField<12, 1, u32> hiragana;
48 };
49 };
50 static_assert(sizeof(Modifiers) == 0x4, "Modifiers is an invalid size");
51
34 struct KeyboardState { 52 struct KeyboardState {
35 s64_le sampling_number; 53 s64_le sampling_number;
36 s64_le sampling_number2; 54 s64_le sampling_number2;
37 55
38 s32_le modifier; 56 Modifiers modifier;
39 s32_le attribute;
40 std::array<u8, 32> key; 57 std::array<u8, 32> key;
41 }; 58 };
42 static_assert(sizeof(KeyboardState) == 0x38, "KeyboardState is an invalid size"); 59 static_assert(sizeof(KeyboardState) == 0x38, "KeyboardState is an invalid size");
diff --git a/src/core/hle/service/hid/controllers/mouse.cpp b/src/core/hle/service/hid/controllers/mouse.cpp
index ac40989c5..30924d9e2 100644
--- a/src/core/hle/service/hid/controllers/mouse.cpp
+++ b/src/core/hle/service/hid/controllers/mouse.cpp
@@ -35,7 +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 if (Settings::values.mouse_enabled) { 39 if (Settings::values.mouse_enabled) {
40 const auto [px, py, sx, sy] = mouse_device->GetStatus(); 40 const auto [px, py, sx, sy] = mouse_device->GetStatus();
41 const auto x = static_cast<s32>(px * Layout::ScreenUndocked::Width); 41 const auto x = static_cast<s32>(px * Layout::ScreenUndocked::Width);
@@ -46,10 +46,14 @@ void Controller_Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
46 cur_entry.delta_y = y - last_entry.y; 46 cur_entry.delta_y = y - last_entry.y;
47 cur_entry.mouse_wheel_x = sx; 47 cur_entry.mouse_wheel_x = sx;
48 cur_entry.mouse_wheel_y = sy; 48 cur_entry.mouse_wheel_y = sy;
49 cur_entry.attribute.is_connected.Assign(1);
49 50
50 for (std::size_t i = 0; i < mouse_button_devices.size(); ++i) { 51 using namespace Settings::NativeMouseButton;
51 cur_entry.button |= (mouse_button_devices[i]->GetStatus() << i); 52 cur_entry.button.left.Assign(mouse_button_devices[Left]->GetStatus());
52 } 53 cur_entry.button.right.Assign(mouse_button_devices[Right]->GetStatus());
54 cur_entry.button.middle.Assign(mouse_button_devices[Middle]->GetStatus());
55 cur_entry.button.forward.Assign(mouse_button_devices[Forward]->GetStatus());
56 cur_entry.button.back.Assign(mouse_button_devices[Back]->GetStatus());
53 } 57 }
54 58
55 std::memcpy(data + SHARED_MEMORY_OFFSET, &shared_memory, sizeof(SharedMemory)); 59 std::memcpy(data + SHARED_MEMORY_OFFSET, &shared_memory, sizeof(SharedMemory));
diff --git a/src/core/hle/service/hid/controllers/mouse.h b/src/core/hle/service/hid/controllers/mouse.h
index 357ab7107..2c8ebe1d5 100644
--- a/src/core/hle/service/hid/controllers/mouse.h
+++ b/src/core/hle/service/hid/controllers/mouse.h
@@ -5,6 +5,7 @@
5#pragma once 5#pragma once
6 6
7#include <array> 7#include <array>
8#include "common/bit_field.h"
8#include "common/common_types.h" 9#include "common/common_types.h"
9#include "common/swap.h" 10#include "common/swap.h"
10#include "core/frontend/input.h" 11#include "core/frontend/input.h"
@@ -30,6 +31,27 @@ public:
30 void OnLoadInputDevices() override; 31 void OnLoadInputDevices() override;
31 32
32private: 33private:
34 struct Buttons {
35 union {
36 s32_le raw{};
37 BitField<0, 1, u32> left;
38 BitField<1, 1, u32> right;
39 BitField<2, 1, u32> middle;
40 BitField<3, 1, u32> forward;
41 BitField<4, 1, u32> back;
42 };
43 };
44 static_assert(sizeof(Buttons) == 0x4, "Buttons is an invalid size");
45
46 struct Attributes {
47 union {
48 s32_le raw{};
49 BitField<0, 1, u32> transferable;
50 BitField<1, 1, u32> is_connected;
51 };
52 };
53 static_assert(sizeof(Attributes) == 0x4, "Attributes is an invalid size");
54
33 struct MouseState { 55 struct MouseState {
34 s64_le sampling_number; 56 s64_le sampling_number;
35 s64_le sampling_number2; 57 s64_le sampling_number2;
@@ -39,8 +61,8 @@ private:
39 s32_le delta_y; 61 s32_le delta_y;
40 s32_le mouse_wheel_x; 62 s32_le mouse_wheel_x;
41 s32_le mouse_wheel_y; 63 s32_le mouse_wheel_y;
42 s32_le button; 64 Buttons button;
43 s32_le attribute; 65 Attributes attribute;
44 }; 66 };
45 static_assert(sizeof(MouseState) == 0x30, "MouseState is an invalid size"); 67 static_assert(sizeof(MouseState) == 0x30, "MouseState is an invalid size");
46 68
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index 0c227b135..251db1f84 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -609,7 +609,9 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
609 UNREACHABLE(); 609 UNREACHABLE();
610 break; 610 break;
611 case NPadControllerType::ProController: 611 case NPadControllerType::ProController:
612 full_sixaxis_entry.attribute.raw = 0;
612 if (sixaxis_sensors_enabled && motions[i][0]) { 613 if (sixaxis_sensors_enabled && motions[i][0]) {
614 full_sixaxis_entry.attribute.IsConnected.Assign(1);
613 full_sixaxis_entry.accel = motion_devices[0].accel; 615 full_sixaxis_entry.accel = motion_devices[0].accel;
614 full_sixaxis_entry.gyro = motion_devices[0].gyro; 616 full_sixaxis_entry.gyro = motion_devices[0].gyro;
615 full_sixaxis_entry.rotation = motion_devices[0].rotation; 617 full_sixaxis_entry.rotation = motion_devices[0].rotation;
@@ -617,7 +619,9 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
617 } 619 }
618 break; 620 break;
619 case NPadControllerType::Handheld: 621 case NPadControllerType::Handheld:
622 handheld_sixaxis_entry.attribute.raw = 0;
620 if (sixaxis_sensors_enabled && motions[i][0]) { 623 if (sixaxis_sensors_enabled && motions[i][0]) {
624 handheld_sixaxis_entry.attribute.IsConnected.Assign(1);
621 handheld_sixaxis_entry.accel = motion_devices[0].accel; 625 handheld_sixaxis_entry.accel = motion_devices[0].accel;
622 handheld_sixaxis_entry.gyro = motion_devices[0].gyro; 626 handheld_sixaxis_entry.gyro = motion_devices[0].gyro;
623 handheld_sixaxis_entry.rotation = motion_devices[0].rotation; 627 handheld_sixaxis_entry.rotation = motion_devices[0].rotation;
@@ -625,8 +629,11 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
625 } 629 }
626 break; 630 break;
627 case NPadControllerType::JoyDual: 631 case NPadControllerType::JoyDual:
632 dual_left_sixaxis_entry.attribute.raw = 0;
633 dual_right_sixaxis_entry.attribute.raw = 0;
628 if (sixaxis_sensors_enabled && motions[i][0]) { 634 if (sixaxis_sensors_enabled && motions[i][0]) {
629 // Set motion for the left joycon 635 // Set motion for the left joycon
636 dual_left_sixaxis_entry.attribute.IsConnected.Assign(1);
630 dual_left_sixaxis_entry.accel = motion_devices[0].accel; 637 dual_left_sixaxis_entry.accel = motion_devices[0].accel;
631 dual_left_sixaxis_entry.gyro = motion_devices[0].gyro; 638 dual_left_sixaxis_entry.gyro = motion_devices[0].gyro;
632 dual_left_sixaxis_entry.rotation = motion_devices[0].rotation; 639 dual_left_sixaxis_entry.rotation = motion_devices[0].rotation;
@@ -634,6 +641,7 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
634 } 641 }
635 if (sixaxis_sensors_enabled && motions[i][1]) { 642 if (sixaxis_sensors_enabled && motions[i][1]) {
636 // Set motion for the right joycon 643 // Set motion for the right joycon
644 dual_right_sixaxis_entry.attribute.IsConnected.Assign(1);
637 dual_right_sixaxis_entry.accel = motion_devices[1].accel; 645 dual_right_sixaxis_entry.accel = motion_devices[1].accel;
638 dual_right_sixaxis_entry.gyro = motion_devices[1].gyro; 646 dual_right_sixaxis_entry.gyro = motion_devices[1].gyro;
639 dual_right_sixaxis_entry.rotation = motion_devices[1].rotation; 647 dual_right_sixaxis_entry.rotation = motion_devices[1].rotation;
@@ -641,7 +649,9 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
641 } 649 }
642 break; 650 break;
643 case NPadControllerType::JoyLeft: 651 case NPadControllerType::JoyLeft:
652 left_sixaxis_entry.attribute.raw = 0;
644 if (sixaxis_sensors_enabled && motions[i][0]) { 653 if (sixaxis_sensors_enabled && motions[i][0]) {
654 left_sixaxis_entry.attribute.IsConnected.Assign(1);
645 left_sixaxis_entry.accel = motion_devices[0].accel; 655 left_sixaxis_entry.accel = motion_devices[0].accel;
646 left_sixaxis_entry.gyro = motion_devices[0].gyro; 656 left_sixaxis_entry.gyro = motion_devices[0].gyro;
647 left_sixaxis_entry.rotation = motion_devices[0].rotation; 657 left_sixaxis_entry.rotation = motion_devices[0].rotation;
@@ -649,7 +659,9 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing
649 } 659 }
650 break; 660 break;
651 case NPadControllerType::JoyRight: 661 case NPadControllerType::JoyRight:
662 right_sixaxis_entry.attribute.raw = 0;
652 if (sixaxis_sensors_enabled && motions[i][1]) { 663 if (sixaxis_sensors_enabled && motions[i][1]) {
664 right_sixaxis_entry.attribute.IsConnected.Assign(1);
653 right_sixaxis_entry.accel = motion_devices[1].accel; 665 right_sixaxis_entry.accel = motion_devices[1].accel;
654 right_sixaxis_entry.gyro = motion_devices[1].gyro; 666 right_sixaxis_entry.gyro = motion_devices[1].gyro;
655 right_sixaxis_entry.rotation = motion_devices[1].rotation; 667 right_sixaxis_entry.rotation = motion_devices[1].rotation;
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h
index 2e13922b9..e5778921f 100644
--- a/src/core/hle/service/hid/controllers/npad.h
+++ b/src/core/hle/service/hid/controllers/npad.h
@@ -113,8 +113,13 @@ public:
113 BitField<2, 1, u32> joycon_dual; 113 BitField<2, 1, u32> joycon_dual;
114 BitField<3, 1, u32> joycon_left; 114 BitField<3, 1, u32> joycon_left;
115 BitField<4, 1, u32> joycon_right; 115 BitField<4, 1, u32> joycon_right;
116 116 BitField<5, 1, u32> gamecube;
117 BitField<6, 1, u32> pokeball; // TODO(ogniK): Confirm when possible 117 BitField<6, 1, u32> pokeball;
118 BitField<7, 1, u32> lark;
119 BitField<8, 1, u32> handheld_lark;
120 BitField<9, 1, u32> lucia;
121 BitField<29, 1, u32> system_ext;
122 BitField<30, 1, u32> system;
118 }; 123 };
119 }; 124 };
120 static_assert(sizeof(NpadStyleSet) == 4, "NpadStyleSet is an invalid size"); 125 static_assert(sizeof(NpadStyleSet) == 4, "NpadStyleSet is an invalid size");
@@ -285,6 +290,9 @@ private:
285 290
286 BitField<26, 1, u64> right_sl; 291 BitField<26, 1, u64> right_sl;
287 BitField<27, 1, u64> right_sr; 292 BitField<27, 1, u64> right_sr;
293
294 BitField<28, 1, u64> palma;
295 BitField<30, 1, u64> handheld_left_b;
288 }; 296 };
289 }; 297 };
290 static_assert(sizeof(ControllerPadState) == 8, "ControllerPadState is an invalid size"); 298 static_assert(sizeof(ControllerPadState) == 8, "ControllerPadState is an invalid size");
@@ -329,6 +337,15 @@ private:
329 }; 337 };
330 static_assert(sizeof(NPadGeneric) == 0x350, "NPadGeneric is an invalid size"); 338 static_assert(sizeof(NPadGeneric) == 0x350, "NPadGeneric is an invalid size");
331 339
340 struct SixAxisAttributes {
341 union {
342 u32_le raw{};
343 BitField<0, 1, u32> IsConnected;
344 BitField<1, 1, u32> IsInterpolated;
345 };
346 };
347 static_assert(sizeof(SixAxisAttributes) == 4, "SixAxisAttributes is an invalid size");
348
332 struct SixAxisStates { 349 struct SixAxisStates {
333 s64_le timestamp{}; 350 s64_le timestamp{};
334 INSERT_PADDING_WORDS(2); 351 INSERT_PADDING_WORDS(2);
@@ -337,7 +354,8 @@ private:
337 Common::Vec3f gyro{}; 354 Common::Vec3f gyro{};
338 Common::Vec3f rotation{}; 355 Common::Vec3f rotation{};
339 std::array<Common::Vec3f, 3> orientation{}; 356 std::array<Common::Vec3f, 3> orientation{};
340 s64_le always_one{1}; 357 SixAxisAttributes attribute;
358 INSERT_PADDING_BYTES(4); // Reserved
341 }; 359 };
342 static_assert(sizeof(SixAxisStates) == 0x68, "SixAxisStates is an invalid size"); 360 static_assert(sizeof(SixAxisStates) == 0x68, "SixAxisStates is an invalid size");
343 361
@@ -356,10 +374,19 @@ private:
356 struct NPadProperties { 374 struct NPadProperties {
357 union { 375 union {
358 s64_le raw{}; 376 s64_le raw{};
377 BitField<0, 1, s64> is_charging_joy_dual;
378 BitField<1, 1, s64> is_charging_joy_left;
379 BitField<2, 1, s64> is_charging_joy_right;
380 BitField<3, 1, s64> is_powered_joy_dual;
381 BitField<4, 1, s64> is_powered_joy_left;
382 BitField<5, 1, s64> is_powered_joy_right;
383 BitField<9, 1, s64> is_system_unsuported_button;
384 BitField<10, 1, s64> is_system_ext_unsuported_button;
359 BitField<11, 1, s64> is_vertical; 385 BitField<11, 1, s64> is_vertical;
360 BitField<12, 1, s64> is_horizontal; 386 BitField<12, 1, s64> is_horizontal;
361 BitField<13, 1, s64> use_plus; 387 BitField<13, 1, s64> use_plus;
362 BitField<14, 1, s64> use_minus; 388 BitField<14, 1, s64> use_minus;
389 BitField<15, 1, s64> use_directional_buttons;
363 }; 390 };
364 }; 391 };
365 392
diff --git a/src/core/hle/service/hid/controllers/xpad.h b/src/core/hle/service/hid/controllers/xpad.h
index ad229787c..d91cf62a2 100644
--- a/src/core/hle/service/hid/controllers/xpad.h
+++ b/src/core/hle/service/hid/controllers/xpad.h
@@ -4,6 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#include "common/bit_field.h"
7#include "common/common_funcs.h" 8#include "common/common_funcs.h"
8#include "common/common_types.h" 9#include "common/common_types.h"
9#include "common/swap.h" 10#include "common/swap.h"
@@ -28,6 +29,67 @@ public:
28 void OnLoadInputDevices() override; 29 void OnLoadInputDevices() override;
29 30
30private: 31private:
32 struct Attributes {
33 union {
34 s32_le raw{};
35 BitField<0, 1, u32> IsConnected;
36 BitField<1, 1, u32> IsWired;
37 BitField<2, 1, u32> IsLeftConnected;
38 BitField<3, 1, u32> IsLeftWired;
39 BitField<4, 1, u32> IsRightConnected;
40 BitField<5, 1, u32> IsRightWired;
41 };
42 };
43 static_assert(sizeof(Attributes) == 4, "Attributes is an invalid size");
44
45 struct Buttons {
46 union {
47 u32_le raw{};
48 // Button states
49 BitField<0, 1, u32> a;
50 BitField<1, 1, u32> b;
51 BitField<2, 1, u32> x;
52 BitField<3, 1, u32> y;
53 BitField<4, 1, u32> l_stick;
54 BitField<5, 1, u32> r_stick;
55 BitField<6, 1, u32> l;
56 BitField<7, 1, u32> r;
57 BitField<8, 1, u32> zl;
58 BitField<9, 1, u32> zr;
59 BitField<10, 1, u32> plus;
60 BitField<11, 1, u32> minus;
61
62 // D-Pad
63 BitField<12, 1, u32> d_left;
64 BitField<13, 1, u32> d_up;
65 BitField<14, 1, u32> d_right;
66 BitField<15, 1, u32> d_down;
67
68 // Left JoyStick
69 BitField<16, 1, u32> l_stick_left;
70 BitField<17, 1, u32> l_stick_up;
71 BitField<18, 1, u32> l_stick_right;
72 BitField<19, 1, u32> l_stick_down;
73
74 // Right JoyStick
75 BitField<20, 1, u32> r_stick_left;
76 BitField<21, 1, u32> r_stick_up;
77 BitField<22, 1, u32> r_stick_right;
78 BitField<23, 1, u32> r_stick_down;
79
80 // Not always active?
81 BitField<24, 1, u32> left_sl;
82 BitField<25, 1, u32> left_sr;
83
84 BitField<26, 1, u32> right_sl;
85 BitField<27, 1, u32> right_sr;
86
87 BitField<28, 1, u32> palma;
88 BitField<30, 1, u32> handheld_left_b;
89 };
90 };
91 static_assert(sizeof(Buttons) == 4, "Buttons is an invalid size");
92
31 struct AnalogStick { 93 struct AnalogStick {
32 s32_le x; 94 s32_le x;
33 s32_le y; 95 s32_le y;
@@ -37,10 +99,10 @@ private:
37 struct XPadState { 99 struct XPadState {
38 s64_le sampling_number; 100 s64_le sampling_number;
39 s64_le sampling_number2; 101 s64_le sampling_number2;
40 s32_le attributes; 102 Attributes attributes;
41 u32_le pad_states; 103 Buttons pad_states;
42 AnalogStick x_stick; 104 AnalogStick l_stick;
43 AnalogStick y_stick; 105 AnalogStick r_stick;
44 }; 106 };
45 static_assert(sizeof(XPadState) == 0x28, "XPadState is an invalid size"); 107 static_assert(sizeof(XPadState) == 0x28, "XPadState is an invalid size");
46 108
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 4cee4838c..370e266a8 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -59,20 +59,26 @@ IAppletResource::IAppletResource(Core::System& system_)
59 MakeController<Controller_Mouse>(HidController::Mouse); 59 MakeController<Controller_Mouse>(HidController::Mouse);
60 MakeController<Controller_Keyboard>(HidController::Keyboard); 60 MakeController<Controller_Keyboard>(HidController::Keyboard);
61 MakeController<Controller_XPad>(HidController::XPad); 61 MakeController<Controller_XPad>(HidController::XPad);
62 MakeController<Controller_Stubbed>(HidController::Unknown1); 62 MakeController<Controller_Stubbed>(HidController::HomeButton);
63 MakeController<Controller_Stubbed>(HidController::Unknown2); 63 MakeController<Controller_Stubbed>(HidController::SleepButton);
64 MakeController<Controller_Stubbed>(HidController::Unknown3); 64 MakeController<Controller_Stubbed>(HidController::CaptureButton);
65 MakeController<Controller_Stubbed>(HidController::SixAxisSensor); 65 MakeController<Controller_Stubbed>(HidController::InputDetector);
66 MakeController<Controller_Stubbed>(HidController::UniquePad);
66 MakeController<Controller_NPad>(HidController::NPad); 67 MakeController<Controller_NPad>(HidController::NPad);
67 MakeController<Controller_Gesture>(HidController::Gesture); 68 MakeController<Controller_Gesture>(HidController::Gesture);
69 MakeController<Controller_Stubbed>(HidController::ConsoleSixAxisSensor);
68 70
69 // Homebrew doesn't try to activate some controllers, so we activate them by default 71 // Homebrew doesn't try to activate some controllers, so we activate them by default
70 GetController<Controller_NPad>(HidController::NPad).ActivateController(); 72 GetController<Controller_NPad>(HidController::NPad).ActivateController();
71 GetController<Controller_Touchscreen>(HidController::Touchscreen).ActivateController(); 73 GetController<Controller_Touchscreen>(HidController::Touchscreen).ActivateController();
72 74
73 GetController<Controller_Stubbed>(HidController::Unknown1).SetCommonHeaderOffset(0x4c00); 75 GetController<Controller_Stubbed>(HidController::HomeButton).SetCommonHeaderOffset(0x4C00);
74 GetController<Controller_Stubbed>(HidController::Unknown2).SetCommonHeaderOffset(0x4e00); 76 GetController<Controller_Stubbed>(HidController::SleepButton).SetCommonHeaderOffset(0x4E00);
75 GetController<Controller_Stubbed>(HidController::Unknown3).SetCommonHeaderOffset(0x5000); 77 GetController<Controller_Stubbed>(HidController::CaptureButton).SetCommonHeaderOffset(0x5000);
78 GetController<Controller_Stubbed>(HidController::InputDetector).SetCommonHeaderOffset(0x5200);
79 GetController<Controller_Stubbed>(HidController::UniquePad).SetCommonHeaderOffset(0x5A00);
80 GetController<Controller_Stubbed>(HidController::ConsoleSixAxisSensor)
81 .SetCommonHeaderOffset(0x3C200);
76 82
77 // Register update callbacks 83 // Register update callbacks
78 pad_update_event = Core::Timing::CreateEvent( 84 pad_update_event = Core::Timing::CreateEvent(
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index d991bd721..7cc0433e2 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -29,12 +29,14 @@ enum class HidController : std::size_t {
29 Mouse, 29 Mouse,
30 Keyboard, 30 Keyboard,
31 XPad, 31 XPad,
32 Unknown1, 32 HomeButton,
33 Unknown2, 33 SleepButton,
34 Unknown3, 34 CaptureButton,
35 SixAxisSensor, 35 InputDetector,
36 UniquePad,
36 NPad, 37 NPad,
37 Gesture, 38 Gesture,
39 ConsoleSixAxisSensor,
38 40
39 MaxControllers, 41 MaxControllers,
40}; 42};