summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/hid/hid.h146
1 files changed, 73 insertions, 73 deletions
diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h
index 7803778d4..7fd45d56f 100644
--- a/src/core/hle/service/hid/hid.h
+++ b/src/core/hle/service/hid/hid.h
@@ -11,7 +11,7 @@ namespace HID {
11 11
12// Begin enums and output structs 12// Begin enums and output structs
13 13
14enum HIDControllerType : u32 { 14enum ControllerType : u32 {
15 ControllerType_ProController = 1 << 0, 15 ControllerType_ProController = 1 << 0,
16 ControllerType_Handheld = 1 << 1, 16 ControllerType_Handheld = 1 << 1,
17 ControllerType_JoyconPair = 1 << 2, 17 ControllerType_JoyconPair = 1 << 2,
@@ -19,7 +19,7 @@ enum HIDControllerType : u32 {
19 ControllerType_JoyconRight = 1 << 4, 19 ControllerType_JoyconRight = 1 << 4,
20}; 20};
21 21
22enum HIDControllerLayoutType : u32 { 22enum ControllerLayoutType : u32 {
23 Layout_ProController = 0, // Pro Controller or HID gamepad 23 Layout_ProController = 0, // Pro Controller or HID gamepad
24 Layout_Handheld = 1, // Two Joy-Con docked to rails 24 Layout_Handheld = 1, // Two Joy-Con docked to rails
25 Layout_Single = 2, // Horizontal single Joy-Con or pair of Joy-Con, adjusted for orientation 25 Layout_Single = 2, // Horizontal single Joy-Con or pair of Joy-Con, adjusted for orientation
@@ -29,16 +29,16 @@ enum HIDControllerLayoutType : u32 {
29 Layout_Default = 6, // Safe default, single Joy-Con have buttons/sticks rotated for orientation 29 Layout_Default = 6, // Safe default, single Joy-Con have buttons/sticks rotated for orientation
30}; 30};
31 31
32enum HIDControllerColorDescription { 32enum ControllerColorDescription {
33 ColorDesc_ColorsNonexistent = 1 << 1, 33 ColorDesc_ColorsNonexistent = 1 << 1,
34}; 34};
35 35
36enum HIDControllerConnectionState { 36enum ControllerConnectionState {
37 ConnectionState_Connected = 1 << 0, 37 ConnectionState_Connected = 1 << 0,
38 ConnectionState_Wired = 1 << 1, 38 ConnectionState_Wired = 1 << 1,
39}; 39};
40 40
41enum HIDControllerID { 41enum ControllerID {
42 Controller_Player1 = 0, 42 Controller_Player1 = 0,
43 Controller_Player2 = 1, 43 Controller_Player2 = 1,
44 Controller_Player3 = 2, 44 Controller_Player3 = 2,
@@ -53,26 +53,26 @@ enum HIDControllerID {
53 53
54// End enums and output structs 54// End enums and output structs
55 55
56// Begin HIDTouchScreen 56// Begin TouchScreen
57 57
58struct HIDTouchScreenHeader { 58struct TouchScreenHeader {
59 u64 timestampTicks; 59 u64 timestampTicks;
60 u64 numEntries; 60 u64 numEntries;
61 u64 latestEntry; 61 u64 latestEntry;
62 u64 maxEntryIndex; 62 u64 maxEntryIndex;
63 u64 timestamp; 63 u64 timestamp;
64}; 64};
65static_assert(sizeof(HIDTouchScreenHeader) == 0x28, 65static_assert(sizeof(TouchScreenHeader) == 0x28,
66 "HID touch screen header structure has incorrect size"); 66 "HID touch screen header structure has incorrect size");
67 67
68struct HIDTouchScreenEntryHeader { 68struct TouchScreenEntryHeader {
69 u64 timestamp; 69 u64 timestamp;
70 u64 numTouches; 70 u64 numTouches;
71}; 71};
72static_assert(sizeof(HIDTouchScreenEntryHeader) == 0x10, 72static_assert(sizeof(TouchScreenEntryHeader) == 0x10,
73 "HID touch screen entry header structure has incorrect size"); 73 "HID touch screen entry header structure has incorrect size");
74 74
75struct HIDTouchScreenEntryTouch { 75struct TouchScreenEntryTouch {
76 u64 timestamp; 76 u64 timestamp;
77 u32 padding; 77 u32 padding;
78 u32 touchIndex; 78 u32 touchIndex;
@@ -83,37 +83,37 @@ struct HIDTouchScreenEntryTouch {
83 u32 angle; 83 u32 angle;
84 u32 padding_2; 84 u32 padding_2;
85}; 85};
86static_assert(sizeof(HIDTouchScreenEntryTouch) == 0x28, 86static_assert(sizeof(TouchScreenEntryTouch) == 0x28,
87 "HID touch screen touch structure has incorrect size"); 87 "HID touch screen touch structure has incorrect size");
88 88
89struct HIDTouchScreenEntry { 89struct TouchScreenEntry {
90 HIDTouchScreenEntryHeader header; 90 TouchScreenEntryHeader header;
91 std::array<HIDTouchScreenEntryTouch, 16> touches; 91 std::array<TouchScreenEntryTouch, 16> touches;
92 u64 unk; 92 u64 unk;
93}; 93};
94static_assert(sizeof(HIDTouchScreenEntry) == 0x298, 94static_assert(sizeof(TouchScreenEntry) == 0x298,
95 "HID touch screen entry structure has incorrect size"); 95 "HID touch screen entry structure has incorrect size");
96 96
97struct HIDTouchScreen { 97struct TouchScreen {
98 HIDTouchScreenHeader header; 98 TouchScreenHeader header;
99 std::array<HIDTouchScreenEntry, 17> entries; 99 std::array<TouchScreenEntry, 17> entries;
100 std::array<u8, 0x3c0> padding; 100 std::array<u8, 0x3c0> padding;
101}; 101};
102static_assert(sizeof(HIDTouchScreen) == 0x3000, "HID touch screen structure has incorrect size"); 102static_assert(sizeof(TouchScreen) == 0x3000, "HID touch screen structure has incorrect size");
103 103
104// End HIDTouchScreen 104// End TouchScreen
105 105
106// Begin HIDMouse 106// Begin Mouse
107 107
108struct HIDMouseHeader { 108struct MouseHeader {
109 u64 timestampTicks; 109 u64 timestampTicks;
110 u64 numEntries; 110 u64 numEntries;
111 u64 latestEntry; 111 u64 latestEntry;
112 u64 maxEntryIndex; 112 u64 maxEntryIndex;
113}; 113};
114static_assert(sizeof(HIDMouseHeader) == 0x20, "HID mouse header structure has incorrect size"); 114static_assert(sizeof(MouseHeader) == 0x20, "HID mouse header structure has incorrect size");
115 115
116struct HIDMouseButtonState { 116struct MouseButtonState {
117 union { 117 union {
118 u64 hex{}; 118 u64 hex{};
119 119
@@ -126,7 +126,7 @@ struct HIDMouseButtonState {
126 }; 126 };
127}; 127};
128 128
129struct HIDMouseEntry { 129struct MouseEntry {
130 u64 timestamp; 130 u64 timestamp;
131 u64 timestamp_2; 131 u64 timestamp_2;
132 u32 x; 132 u32 x;
@@ -135,31 +135,31 @@ struct HIDMouseEntry {
135 u32 velocityY; 135 u32 velocityY;
136 u32 scrollVelocityX; 136 u32 scrollVelocityX;
137 u32 scrollVelocityY; 137 u32 scrollVelocityY;
138 HIDMouseButtonState buttons; 138 MouseButtonState buttons;
139}; 139};
140static_assert(sizeof(HIDMouseEntry) == 0x30, "HID mouse entry structure has incorrect size"); 140static_assert(sizeof(MouseEntry) == 0x30, "HID mouse entry structure has incorrect size");
141 141
142struct HIDMouse { 142struct Mouse {
143 HIDMouseHeader header; 143 MouseHeader header;
144 std::array<HIDMouseEntry, 17> entries; 144 std::array<MouseEntry, 17> entries;
145 std::array<u8, 0xB0> padding; 145 std::array<u8, 0xB0> padding;
146}; 146};
147static_assert(sizeof(HIDMouse) == 0x400, "HID mouse structure has incorrect size"); 147static_assert(sizeof(Mouse) == 0x400, "HID mouse structure has incorrect size");
148 148
149// End HIDMouse 149// End Mouse
150 150
151// Begin HIDKeyboard 151// Begin Keyboard
152 152
153struct HIDKeyboardHeader { 153struct KeyboardHeader {
154 u64 timestampTicks; 154 u64 timestampTicks;
155 u64 numEntries; 155 u64 numEntries;
156 u64 latestEntry; 156 u64 latestEntry;
157 u64 maxEntryIndex; 157 u64 maxEntryIndex;
158}; 158};
159static_assert(sizeof(HIDKeyboardHeader) == 0x20, 159static_assert(sizeof(KeyboardHeader) == 0x20,
160 "HID keyboard header structure has incorrect size"); 160 "HID keyboard header structure has incorrect size");
161 161
162struct HIDKeyboardModifierKeyState { 162struct KeyboardModifierKeyState {
163 union { 163 union {
164 u64 hex{}; 164 u64 hex{};
165 165
@@ -178,34 +178,34 @@ struct HIDKeyboardModifierKeyState {
178 }; 178 };
179}; 179};
180 180
181struct HIDKeyboardEntry { 181struct KeyboardEntry {
182 u64 timestamp; 182 u64 timestamp;
183 u64 timestamp_2; 183 u64 timestamp_2;
184 HIDKeyboardModifierKeyState modifier; 184 KeyboardModifierKeyState modifier;
185 u32 keys[8]; 185 u32 keys[8];
186}; 186};
187static_assert(sizeof(HIDKeyboardEntry) == 0x38, "HID keyboard entry structure has incorrect size"); 187static_assert(sizeof(KeyboardEntry) == 0x38, "HID keyboard entry structure has incorrect size");
188 188
189struct HIDKeyboard { 189struct Keyboard {
190 HIDKeyboardHeader header; 190 KeyboardHeader header;
191 std::array<HIDKeyboardEntry, 17> entries; 191 std::array<KeyboardEntry, 17> entries;
192 std::array<u8, 0x28> padding; 192 std::array<u8, 0x28> padding;
193}; 193};
194static_assert(sizeof(HIDKeyboard) == 0x400, "HID keyboard structure has incorrect size"); 194static_assert(sizeof(Keyboard) == 0x400, "HID keyboard structure has incorrect size");
195 195
196// End HIDKeyboard 196// End Keyboard
197 197
198// Begin HIDController 198// Begin Controller
199 199
200struct HIDControllerMAC { 200struct ControllerMAC {
201 u64 timestamp; 201 u64 timestamp;
202 std::array<u8, 0x8> mac; 202 std::array<u8, 0x8> mac;
203 u64 unk; 203 u64 unk;
204 u64 timestamp_2; 204 u64 timestamp_2;
205}; 205};
206static_assert(sizeof(HIDControllerMAC) == 0x20, "HID controller MAC structure has incorrect size"); 206static_assert(sizeof(ControllerMAC) == 0x20, "HID controller MAC structure has incorrect size");
207 207
208struct HIDControllerHeader { 208struct ControllerHeader {
209 u32 type; 209 u32 type;
210 u32 isHalf; 210 u32 isHalf;
211 u32 singleColorsDescriptor; 211 u32 singleColorsDescriptor;
@@ -217,19 +217,19 @@ struct HIDControllerHeader {
217 u32 rightColorBody; 217 u32 rightColorBody;
218 u32 rightColorbuttons; 218 u32 rightColorbuttons;
219}; 219};
220static_assert(sizeof(HIDControllerHeader) == 0x28, 220static_assert(sizeof(ControllerHeader) == 0x28,
221 "HID controller header structure has incorrect size"); 221 "HID controller header structure has incorrect size");
222 222
223struct HIDControllerLayoutHeader { 223struct ControllerLayoutHeader {
224 u64 timestampTicks; 224 u64 timestampTicks;
225 u64 numEntries; 225 u64 numEntries;
226 u64 latestEntry; 226 u64 latestEntry;
227 u64 maxEntryIndex; 227 u64 maxEntryIndex;
228}; 228};
229static_assert(sizeof(HIDControllerLayoutHeader) == 0x20, 229static_assert(sizeof(ControllerLayoutHeader) == 0x20,
230 "HID controller layout header structure has incorrect size"); 230 "HID controller layout header structure has incorrect size");
231 231
232struct HIDControllerPadState { 232struct ControllerPadState {
233 union { 233 union {
234 u64 hex{}; 234 u64 hex{};
235 235
@@ -270,43 +270,43 @@ struct HIDControllerPadState {
270 }; 270 };
271}; 271};
272 272
273struct HIDControllerInputEntry { 273struct ControllerInputEntry {
274 u64 timestamp; 274 u64 timestamp;
275 u64 timestamp_2; 275 u64 timestamp_2;
276 HIDControllerPadState buttons; 276 ControllerPadState buttons;
277 u32 joystickLeftX; 277 u32 joystickLeftX;
278 u32 joystickLeftY; 278 u32 joystickLeftY;
279 u32 joystickRightX; 279 u32 joystickRightX;
280 u32 joystickRightY; 280 u32 joystickRightY;
281 u64 connectionState; 281 u64 connectionState;
282}; 282};
283static_assert(sizeof(HIDControllerInputEntry) == 0x30, 283static_assert(sizeof(ControllerInputEntry) == 0x30,
284 "HID controller input entry structure has incorrect size"); 284 "HID controller input entry structure has incorrect size");
285 285
286struct HIDControllerLayout { 286struct ControllerLayout {
287 HIDControllerLayoutHeader header; 287 ControllerLayoutHeader header;
288 std::array<HIDControllerInputEntry, 17> entries; 288 std::array<ControllerInputEntry, 17> entries;
289}; 289};
290static_assert(sizeof(HIDControllerLayout) == 0x350, 290static_assert(sizeof(ControllerLayout) == 0x350,
291 "HID controller layout structure has incorrect size"); 291 "HID controller layout structure has incorrect size");
292 292
293struct HIDController { 293struct Controller {
294 HIDControllerHeader header; 294 ControllerHeader header;
295 std::array<HIDControllerLayout, 7> layouts; 295 std::array<ControllerLayout, 7> layouts;
296 std::array<u8, 0x2a70> unk_1; 296 std::array<u8, 0x2a70> unk_1;
297 HIDControllerMAC macLeft; 297 ControllerMAC macLeft;
298 HIDControllerMAC macRight; 298 ControllerMAC macRight;
299 std::array<u8, 0xdf8> unk_2; 299 std::array<u8, 0xdf8> unk_2;
300}; 300};
301static_assert(sizeof(HIDController) == 0x5000, "HID controller structure has incorrect size"); 301static_assert(sizeof(Controller) == 0x5000, "HID controller structure has incorrect size");
302 302
303// End HIDController 303// End Controller
304 304
305struct HIDSharedMemory { 305struct SharedMemory {
306 std::array<u8, 0x400> header; 306 std::array<u8, 0x400> header;
307 HIDTouchScreen touchscreen; 307 TouchScreen touchscreen;
308 HIDMouse mouse; 308 Mouse mouse;
309 HIDKeyboard keyboard; 309 Keyboard keyboard;
310 std::array<u8, 0x400> unkSection1; 310 std::array<u8, 0x400> unkSection1;
311 std::array<u8, 0x400> unkSection2; 311 std::array<u8, 0x400> unkSection2;
312 std::array<u8, 0x400> unkSection3; 312 std::array<u8, 0x400> unkSection3;
@@ -316,10 +316,10 @@ struct HIDSharedMemory {
316 std::array<u8, 0x200> unkSection7; 316 std::array<u8, 0x200> unkSection7;
317 std::array<u8, 0x800> unkSection8; 317 std::array<u8, 0x800> unkSection8;
318 std::array<u8, 0x4000> controllerSerials; 318 std::array<u8, 0x4000> controllerSerials;
319 std::array<HIDController, 10> controllers; 319 std::array<Controller, 10> controllers;
320 std::array<u8, 0x4600> unkSection9; 320 std::array<u8, 0x4600> unkSection9;
321}; 321};
322static_assert(sizeof(HIDSharedMemory) == 0x40000, "HID Shared Memory structure has incorrect size"); 322static_assert(sizeof(SharedMemory) == 0x40000, "HID Shared Memory structure has incorrect size");
323 323
324/// Reload input devices. Used when input configuration changed 324/// Reload input devices. Used when input configuration changed
325void ReloadInputDevices(); 325void ReloadInputDevices();