libnx  v4.2.0
hiddbg.h
Go to the documentation of this file.
1 /**
2  * @file hiddbg.h
3  * @brief hid:dbg service IPC wrapper.
4  * @author yellows8
5  */
6 #pragma once
7 #include "../types.h"
8 #include "../services/hid.h"
9 #include "../services/hidsys.h"
10 #include "../sf/service.h"
11 
12 /// HiddbgNpadButton. For the remaining buttons, see \ref HidNpadButton.
13 typedef enum {
14  HiddbgNpadButton_Home = BIT(18), ///< HOME button
15  HiddbgNpadButton_Capture = BIT(19), ///< Capture button
17 
18 /// HdlsAttribute
19 typedef enum {
20  HiddbgHdlsAttribute_HasVirtualSixAxisSensorAcceleration = BIT(0), ///< HasVirtualSixAxisSensorAcceleration
21  HiddbgHdlsAttribute_HasVirtualSixAxisSensorAngle = BIT(1), ///< HasVirtualSixAxisSensorAngle
23 
24 /// State for overriding \ref HidDebugPadState.
25 typedef struct {
26  u32 attributes; ///< Bitfield of \ref HidDebugPadAttribute.
27  u32 buttons; ///< Bitfield of \ref HidDebugPadButton.
31 
32 /// State for overriding \ref HidMouseState.
33 typedef struct {
34  s32 x; ///< X
35  s32 y; ///< Y
36  s32 delta_x; ///< DeltaX
37  s32 delta_y; ///< DeltaY
38  s32 wheel_delta; ///< WheelDelta
39  u32 buttons; ///< Bitfield of \ref HidMouseButton.
40  u32 attributes; ///< Bitfield of \ref HidMouseAttribute.
42 
43 /// State for overriding \ref HidKeyboardState.
44 typedef struct {
45  u64 modifiers; ///< Bitfield of \ref HidKeyboardModifier.
46  u64 keys[4];
48 
49 /// State for overriding SleepButtonState.
50 typedef struct {
51  u64 buttons; ///< Bitfield of buttons, only bit0 is used.
53 
54 /// HdlsHandle
55 typedef struct {
56  u64 handle; ///< Handle
58 
59 /// HdlsSessionId, returned by \ref hiddbgAttachHdlsWorkBuffer.
60 typedef struct {
61  u64 id; ///< Id
63 
64 /// HdlsDeviceInfo, for [7.0.0-8.1.0].
65 typedef struct {
66  u32 deviceTypeInternal; ///< Only one bit can be set. BIT(N*4+0) = Pro-Controller, BIT(N*4+1) = Joy-Con Left, BIT(N*4+2) = Joy-Con Right, BIT(N*4+3) = invalid. Where N is 0-1. BIT(8-10) = Pro-Controller, BIT(11) = Famicom-Controller, BIT(12) = Famicom-Controller II with microphone, BIT(13) = NES-Controller(DeviceType=0x200), BIT(14) = NES-Controller(DeviceType=0x400), BIT(15-16) = invalid, BIT(17) = unknown(DeviceType=0x8000), BIT(18-20) = invalid, BIT(21-23) = unknown(DeviceType=0x80000000).
67  u32 singleColorBody; ///< RGBA Single Body Color.
68  u32 singleColorButtons; ///< RGBA Single Buttons Color.
69  u8 npadInterfaceType; ///< \ref HidNpadInterfaceType. Additional type field used with the above type field (only applies to type bit0-bit2 and bit21), if the value doesn't match one of the following a default is used. Type Pro-Controller: value 0x3 indicates that the controller is connected via USB. Type BIT(21): value 0x3 = unknown. When value is 0x2, state is merged with an existing controller (when the type value is compatible with this). Otherwise, it's a dedicated controller.
70  u8 pad[0x3]; ///< Padding.
72 
73 /// HdlsDeviceInfo, for [9.0.0+]. Converted to/from \ref HiddbgHdlsDeviceInfoV7 on prior sysvers.
74 typedef struct {
75  u8 deviceType; ///< \ref HidDeviceType
76  u8 npadInterfaceType; ///< \ref HidNpadInterfaceType. Additional type field used with the above type field (only applies to ::HidDeviceType_JoyRight1, ::HidDeviceType_JoyLeft2, ::HidDeviceType_FullKey3, and ::HidDeviceType_System19), if the value doesn't match one of the following a default is used. ::HidDeviceType_FullKey3: ::HidNpadInterfaceType_USB indicates that the controller is connected via USB. :::HidDeviceType_System19: ::HidNpadInterfaceType_USB = unknown. When value is ::HidNpadInterfaceType_Rail, state is merged with an existing controller (with ::HidDeviceType_JoyRight1 / ::HidDeviceType_JoyLeft2). Otherwise, it's a dedicated controller.
77  u8 pad[0x2]; ///< Padding.
78  u32 singleColorBody; ///< RGBA Single Body Color.
79  u32 singleColorButtons; ///< RGBA Single Buttons Color.
80  u32 colorLeftGrip; ///< [9.0.0+] RGBA Left Grip Color.
81  u32 colorRightGrip; ///< [9.0.0+] RGBA Right Grip Color.
83 
84 /// HdlsState, for [7.0.0-8.1.0].
85 typedef struct {
86  u8 is_powered; ///< IsPowered for the main PowerInfo, see \ref HidNpadSystemProperties.
87  u8 flags; ///< ORRed with IsPowered to set the value of the first byte for \ref HidNpadSystemProperties. For example, value 1 here will set IsCharging for the main PowerInfo.
88  u8 unk_x2[0x6]; ///< Unknown
89  u32 battery_level; ///< BatteryLevel for the main PowerInfo, see \ref HidPowerInfo.
90  u32 buttons; ///< See \ref HiddbgNpadButton.
93  u8 indicator; ///< Indicator. Unused for input. Set with output from \ref hiddbgDumpHdlsStates. Not set by \ref hiddbgGetAbstractedPadsState.
94  u8 padding[0x3]; ///< Padding
96 
97 /// HdlsState, for [9.0.0-11.0.1].
98 typedef struct {
99  u32 battery_level; ///< BatteryLevel for the main PowerInfo, see \ref HidPowerInfo.
100  u32 flags; ///< Used to set the main PowerInfo for \ref HidNpadSystemProperties. BIT(0) -> IsPowered, BIT(1) -> IsCharging.
101  u64 buttons; ///< See \ref HiddbgNpadButton. [9.0.0+] Masked with 0xfffffffff00fffff.
104  u8 indicator; ///< Indicator. Unused for input. Set with output from \ref hiddbgDumpHdlsStates.
105  u8 padding[0x3]; ///< Padding
107 
108 /// HdlsState, for [12.0.0+].
109 typedef struct {
110  u32 battery_level; ///< BatteryLevel for the main PowerInfo, see \ref HidPowerInfo.
111  u32 flags; ///< Used to set the main PowerInfo for \ref HidNpadSystemProperties. BIT(0) -> IsPowered, BIT(1) -> IsCharging.
112  u64 buttons; ///< See \ref HiddbgNpadButton. [9.0.0+] Masked with 0xfffffffff00fffff.
115  HidVector six_axis_sensor_acceleration; ///< VirtualSixAxisSensorAcceleration
116  HidVector six_axis_sensor_angle; ///< VirtualSixAxisSensorAngle
117  u32 attribute; ///< Bitfield of \ref HiddbgHdlsAttribute.
118  u8 indicator; ///< Indicator. Unused for input.
119  u8 padding[0x3]; ///< Padding
121 
122 /// HdlsNpadAssignmentEntry
123 typedef struct {
124  HiddbgHdlsHandle handle; ///< \ref HiddbgHdlsHandle
125  u32 unk_x8; ///< Unknown
126  u32 unk_xc; ///< Unknown
127  u64 unk_x10; ///< Unknown
128  u8 unk_x18; ///< Unknown
129  u8 pad[0x7]; ///< Padding
131 
132 /// HdlsNpadAssignment. Same controllers as \ref HiddbgHdlsStateList, with different entry data.
133 typedef struct {
134  s32 total_entries; ///< Total entries for the below entries.
135  u32 pad; ///< Padding
136  HiddbgHdlsNpadAssignmentEntry entries[0x10]; ///< \ref HiddbgHdlsNpadAssignmentEntry
138 
139 /// HdlsStateListEntryV7, for [7.0.0-8.1.0].
140 typedef struct {
141  HiddbgHdlsHandle handle; ///< \ref HiddbgHdlsHandle
142  HiddbgHdlsDeviceInfoV7 device; ///< \ref HiddbgHdlsDeviceInfoV7. With \ref hiddbgApplyHdlsStateList this is only used when creating new devices.
143  HiddbgHdlsStateV7 state; ///< \ref HiddbgHdlsStateV7
145 
146 /// HdlsStateListV7, for [7.0.0-8.1.0]. This contains a list of all controllers, including non-virtual controllers.
147 typedef struct {
148  s32 total_entries; ///< Total entries for the below entries.
149  u32 pad; ///< Padding
150  HiddbgHdlsStateListEntryV7 entries[0x10]; ///< \ref HiddbgHdlsStateListEntryV7
152 
153 /// HdlsStateListEntry, for [9.0.0-11.0.1].
154 typedef struct {
155  HiddbgHdlsHandle handle; ///< \ref HiddbgHdlsHandle
156  HiddbgHdlsDeviceInfo device; ///< \ref HiddbgHdlsDeviceInfo. With \ref hiddbgApplyHdlsStateList this is only used when creating new devices.
157  alignas(8) HiddbgHdlsStateV9 state; ///< \ref HiddbgHdlsStateV9
159 
160 /// HdlsStateList, for [9.0.0-11.0.1].
161 typedef struct {
162  s32 total_entries; ///< Total entries for the below entries.
163  u32 pad; ///< Padding
164  HiddbgHdlsStateListEntryV9 entries[0x10]; ///< \ref HiddbgHdlsStateListEntryV9
166 
167 /// HdlsStateListEntry, for [12.0.0+].
168 typedef struct {
169  HiddbgHdlsHandle handle; ///< \ref HiddbgHdlsHandle
170  HiddbgHdlsDeviceInfo device; ///< \ref HiddbgHdlsDeviceInfo. With \ref hiddbgApplyHdlsStateList this is only used when creating new devices.
171  alignas(8) HiddbgHdlsState state; ///< \ref HiddbgHdlsState
173 
174 /// HdlsStateList, for [12.0.0+].
175 /// This contains a list of all controllers, including non-virtual controllers.
176 typedef struct {
177  s32 total_entries; ///< Total entries for the below entries.
178  u32 pad; ///< Padding
179  HiddbgHdlsStateListEntry entries[0x10]; ///< \ref HiddbgHdlsStateListEntry
181 
182 /// AbstractedPadHandle
183 typedef struct {
184  u64 handle; ///< Handle
186 
187 /// AbstractedPadState
188 typedef struct {
189  u32 type; ///< Type. Converted to HiddbgHdlsDeviceInfoV7::type internally by \ref hiddbgSetAutoPilotVirtualPadState. BIT(0) -> BIT(0), BIT(1) -> BIT(15), BIT(2-3) -> BIT(1-2), BIT(4-5) -> BIT(1-2), BIT(6) -> BIT(3). BIT(7-11) -> BIT(11-15), BIT(12-14) -> BIT(12-14), BIT(15) -> BIT(17), BIT(31) -> BIT(21).
190  u8 flags; ///< Flags. Only bit0 is used by \ref hiddbgSetAutoPilotVirtualPadState, when clear it will skip using the rest of the input and run \ref hiddbgUnsetAutoPilotVirtualPadState internally.
191  u8 pad[0x3]; ///< Padding
192 
193  u32 singleColorBody; ///< RGBA Single Body Color
194  u32 singleColorButtons; ///< RGBA Single Buttons Color
195  u8 npadInterfaceType; ///< See HiddbgHdlsDeviceInfo::npadInterfaceType.
196  u8 pad2[0x3]; ///< Padding
197 
199 
200  u8 unused[0x60]; ///< Unused with \ref hiddbgSetAutoPilotVirtualPadState. Not set by \ref hiddbgGetAbstractedPadsState.
202 
203 /// Initialize hiddbg.
205 
206 /// Exit hiddbg.
207 void hiddbgExit(void);
208 
209 /// Gets the Service object for the actual hiddbg service session.
211 
212 /**
213  * @brief SetDebugPadAutoPilotState
214  * @param[in] state \ref HiddbgDebugPadAutoPilotState
215  */
217 
218 /**
219  * @brief UnsetDebugPadAutoPilotState
220  */
222 
223 /**
224  * @brief SetTouchScreenAutoPilotState
225  * @param[in] states Input array of \ref HiddbgMouseAutoPilotState.
226  * @param[in] count Total entries in the states array. Max is 16.
227  */
229 
230 /**
231  * @brief UnsetTouchScreenAutoPilotState
232  */
234 
235 /**
236  * @brief SetMouseAutoPilotState
237  * @param[in] state \ref HiddbgMouseAutoPilotState
238  */
240 
241 /**
242  * @brief UnsetMouseAutoPilotState
243  */
245 
246 /**
247  * @brief SetKeyboardAutoPilotState
248  * @param[in] state \ref HiddbgKeyboardAutoPilotState
249  */
251 
252 /**
253  * @brief UnsetKeyboardAutoPilotState
254  */
256 
257 /**
258  * @brief Deactivates the HomeButton.
259  */
261 
262 /**
263  * @brief SetSleepButtonAutoPilotState
264  * @param[in] state \ref HiddbgSleepButtonAutoPilotState
265  */
267 
268 /**
269  * @brief UnsetSleepButtonAutoPilotState
270  */
272 
273 /**
274  * @brief Writes the input RGB colors to the spi-flash for the specified UniquePad (offset 0x6050 size 0x6).
275  * @note Only available with [3.0.0+].
276  * @param[in] colorBody RGB body color.
277  * @param[in] colorButtons RGB buttons color.
278  * @param[in] unique_pad_id \ref HidsysUniquePadId
279  */
280 Result hiddbgUpdateControllerColor(u32 colorBody, u32 colorButtons, HidsysUniquePadId unique_pad_id);
281 
282 /**
283  * @brief Writes the input RGB colors followed by inval to the spi-flash for the specified UniquePad (offset 0x6050 size 0xD).
284  * @note Only available with [5.0.0+].
285  * @param[in] colorBody RGB body color.
286  * @param[in] colorButtons RGB buttons color.
287  * @param[in] colorLeftGrip RGB left grip color.
288  * @param[in] colorRightGrip RGB right grip color.
289  * @param[in] inval Input value.
290  * @param[in] unique_pad_id \ref HidsysUniquePadId
291  */
292 Result hiddbgUpdateDesignInfo(u32 colorBody, u32 colorButtons, u32 colorLeftGrip, u32 colorRightGrip, u8 inval, HidsysUniquePadId unique_pad_id);
293 
294 /**
295  * @brief Get the OperationEvent for the specified UniquePad.
296  * @note The Event must be closed by the user once finished with it.
297  * @note Only available with [6.0.0+].
298  * @param[out] out_event Output Event.
299  * @param[in] autoclear The autoclear for the Event.
300  * @param[in] unique_pad_id \ref HidsysUniquePadId
301 **/
302 Result hiddbgAcquireOperationEventHandle(Event* out_event, bool autoclear, HidsysUniquePadId unique_pad_id);
303 
304 /**
305  * @brief Reads spi-flash for the specified UniquePad.
306  * @note This also uses \ref hiddbgAcquireOperationEventHandle to wait for the operation to finish, then \ref hiddbgGetOperationResult is used.
307  * @note Only available with [6.0.0+].
308  * @param[in] offset Offset in spi-flash.
309  * @param[out] buffer Output buffer.
310  * @param[in] size Output buffer size.
311  * @param[in] unique_pad_id \ref HidsysUniquePadId
312 **/
313 Result hiddbgReadSerialFlash(u32 offset, void* buffer, size_t size, HidsysUniquePadId unique_pad_id);
314 
315 /**
316  * @brief Writes spi-flash for the specified UniquePad.
317  * @note This also uses \ref hiddbgAcquireOperationEventHandle to wait for the operation to finish, then \ref hiddbgGetOperationResult is used.
318  * @note Only available with [6.0.0+].
319  * @param[in] offset Offset in spi-flash.
320  * @param[in] buffer Input buffer, must be 0x1000-byte aligned.
321  * @param[in] tmem_size Size of the buffer, must be 0x1000-byte aligned.
322  * @param[in] size Actual transfer size.
323  * @param[in] unique_pad_id \ref HidsysUniquePadId
324 **/
325 Result hiddbgWriteSerialFlash(u32 offset, void* buffer, size_t tmem_size, size_t size, HidsysUniquePadId unique_pad_id);
326 
327 /**
328  * @brief Get the Result for the Operation and handles cleanup, for the specified UniquePad.
329  * @note Only available with [6.0.0+].
330  * @param[in] unique_pad_id \ref HidsysUniquePadId
331 **/
333 
334 /**
335  * @brief Gets the internal DeviceType for the specified controller.
336  * @note Only available with [6.0.0+].
337  * @param[in] unique_pad_id \ref HidsysUniquePadId
338  * @param[out] out Pre-9.0.0 this is an u32, with [9.0.0+] it's an u8.
339 **/
341 
342 /** @name AbstractedPad
343  * This is for virtual HID controllers. Only use this on pre-7.0.0, Hdls should be used otherwise.
344  */
345 ///@{
346 
347 /**
348  * @brief Gets a list of \ref HiddbgAbstractedPadHandle.
349  * @note Only available with [5.0.0-8.1.0].
350  * @param[out] handles Output array of \ref HiddbgAbstractedPadHandle.
351  * @param[in] count Max number of entries for the handles array.
352  * @param[out] total_out Total output entries.
353  */
355 
356 /**
357  * @brief Gets the state for the specified \ref HiddbgAbstractedPadHandle.
358  * @note Only available with [5.0.0-8.1.0].
359  * @param[in] handle \ref HiddbgAbstractedPadHandle
360  * @param[out] state \ref HiddbgAbstractedPadState
361  */
363 
364 /**
365  * @brief Similar to \ref hiddbgGetAbstractedPadHandles except this also returns the state for each pad in output array states.
366  * @note Only available with [5.0.0-8.1.0].
367  * @param[out] handles Output array of \ref HiddbgAbstractedPadHandle.
368  * @param[out] states Output array of \ref HiddbgAbstractedPadState.
369  * @param[in] count Max number of entries for the handles/states arrays.
370  * @param[out] total_out Total output entries.
371  */
373 
374 /**
375  * @brief Sets AutoPilot state for the specified pad.
376  * @note Only available with [5.0.0-8.1.0].
377  * @param[in] AbstractedVirtualPadId This can be any unique value as long as it's within bounds. For example, 0-7 is usable.
378  * @param[in] state \ref HiddbgAbstractedPadState
379  */
380 Result hiddbgSetAutoPilotVirtualPadState(s8 AbstractedVirtualPadId, const HiddbgAbstractedPadState *state);
381 
382 /**
383  * @brief Clears AutoPilot state for the specified pad set by \ref hiddbgSetAutoPilotVirtualPadState.
384  * @note Only available with [5.0.0-8.1.0].
385  * @param[in] AbstractedVirtualPadId Id from \ref hiddbgSetAutoPilotVirtualPadState.
386  */
387 Result hiddbgUnsetAutoPilotVirtualPadState(s8 AbstractedVirtualPadId);
388 
389 /**
390  * @brief Clears AutoPilot state for all pads set by \ref hiddbgSetAutoPilotVirtualPadState.
391  */
393 
394 ///@}
395 
396 /** @name Hdls
397  * This is for virtual HID controllers.
398  */
399 ///@{
400 
401 /**
402  * @brief Initialize Hdls.
403  * @note Only available with [7.0.0+].
404  * @param[out] session_id [13.0.0+] \ref HiddbgHdlsSessionId
405  */
407 
408 /**
409  * @brief Exit Hdls, must be called at some point prior to \ref hiddbgExit.
410  * @note Only available with [7.0.0+].
411  * @param[in] session_id [13.0.0+] \ref HiddbgHdlsSessionId
412  */
414 
415 /**
416  * @brief Checks if the given device is still attached.
417  * @note Only available with [7.0.0+].
418  * @param[in] session_id [13.0.0+] \ref HiddbgHdlsSessionId
419  * @param[in] handle \ref HiddbgHdlsHandle
420  * @param[out] out Whether the device is attached.
421  */
423 
424 /**
425  * @brief Gets state for \ref HiddbgHdlsNpadAssignment.
426  * @note Only available with [7.0.0+].
427  * @param[in] session_id [13.0.0+] \ref HiddbgHdlsSessionId
428  * @param[out] state \ref HiddbgHdlsNpadAssignment
429  */
431 
432 /**
433  * @brief Gets state for \ref HiddbgHdlsStateList.
434  * @note Only available with [7.0.0+].
435  * @param[in] session_id [13.0.0+] \ref HiddbgHdlsSessionId
436  * @param[out] state \ref HiddbgHdlsStateList
437  */
439 
440 /**
441  * @brief Sets state for \ref HiddbgHdlsNpadAssignment.
442  * @note Only available with [7.0.0+].
443  * @param[in] session_id [13.0.0+] \ref HiddbgHdlsSessionId
444  * @param[in] state \ref HiddbgHdlsNpadAssignment
445  * @param[in] flag Flag
446  */
448 
449 /**
450  * @brief Sets state for \ref HiddbgHdlsStateList.
451  * @note The \ref HiddbgHdlsState will be applied for each \ref HiddbgHdlsHandle. If a \ref HiddbgHdlsHandle is not found, code similar to \ref hiddbgAttachHdlsVirtualDevice will run with the \ref HiddbgHdlsDeviceInfo, then it will continue with applying state with the new device.
452  * @note Only available with [7.0.0+].
453  * @param[in] session_id [13.0.0+] \ref HiddbgHdlsSessionId
454  * @param[in] state \ref HiddbgHdlsStateList
455  */
457 
458 /**
459  * @brief Attach a device with the input info.
460  * @note Only available with [7.0.0+].
461  * @param[out] handle \ref HiddbgHdlsHandle
462  * @param[in] info \ref HiddbgHdlsDeviceInfo
463  */
465 
466 /**
467  * @brief Detach the specified device.
468  * @note Only available with [7.0.0+].
469  * @param[in] handle \ref HiddbgHdlsHandle
470  */
472 
473 /**
474  * @brief Sets state for the specified device.
475  * @note Only available with [7.0.0+].
476  * @param[in] handle \ref HiddbgHdlsHandle
477  * @param[in] state \ref HiddbgHdlsState
478  */
480 
481 ///@}
482 
HiddbgHdlsDeviceInfoV7::singleColorBody
u32 singleColorBody
RGBA Single Body Color.
Definition: hiddbg.h:67
HiddbgMouseAutoPilotState
State for overriding HidMouseState.
Definition: hiddbg.h:33
hiddbgAcquireOperationEventHandle
Result hiddbgAcquireOperationEventHandle(Event *out_event, bool autoclear, HidsysUniquePadId unique_pad_id)
Get the OperationEvent for the specified UniquePad.
HiddbgHdlsDeviceInfoV7::npadInterfaceType
u8 npadInterfaceType
HidNpadInterfaceType. Additional type field used with the above type field (only applies to type bit0...
Definition: hiddbg.h:69
HiddbgMouseAutoPilotState::wheel_delta
s32 wheel_delta
WheelDelta.
Definition: hiddbg.h:38
HiddbgHdlsNpadAssignmentEntry::unk_x8
u32 unk_x8
Unknown.
Definition: hiddbg.h:125
HiddbgHdlsDeviceInfo::colorRightGrip
u32 colorRightGrip
[9.0.0+] RGBA Right Grip Color.
Definition: hiddbg.h:81
HiddbgAbstractedPadState::type
u32 type
Type. Converted to HiddbgHdlsDeviceInfoV7::type internally by hiddbgSetAutoPilotVirtualPadState....
Definition: hiddbg.h:189
HiddbgHdlsState::six_axis_sensor_acceleration
HidVector six_axis_sensor_acceleration
VirtualSixAxisSensorAcceleration.
Definition: hiddbg.h:115
HiddbgHdlsStateListEntryV7::device
HiddbgHdlsDeviceInfoV7 device
HiddbgHdlsDeviceInfoV7. With hiddbgApplyHdlsStateList this is only used when creating new devices.
Definition: hiddbg.h:142
HiddbgNpadButton_Capture
@ HiddbgNpadButton_Capture
Capture button.
Definition: hiddbg.h:15
HiddbgHdlsStateV7::battery_level
u32 battery_level
BatteryLevel for the main PowerInfo, see HidPowerInfo.
Definition: hiddbg.h:89
HiddbgHdlsState::indicator
u8 indicator
Indicator. Unused for input.
Definition: hiddbg.h:118
HiddbgHdlsStateList::pad
u32 pad
Padding.
Definition: hiddbg.h:178
u8
uint8_t u8
8-bit unsigned integer.
Definition: types.h:19
HiddbgKeyboardAutoPilotState
State for overriding HidKeyboardState.
Definition: hiddbg.h:44
HiddbgHdlsState::six_axis_sensor_angle
HidVector six_axis_sensor_angle
VirtualSixAxisSensorAngle.
Definition: hiddbg.h:116
HiddbgHdlsStateListV7::total_entries
s32 total_entries
Total entries for the below entries.
Definition: hiddbg.h:148
hiddbgSetKeyboardAutoPilotState
Result hiddbgSetKeyboardAutoPilotState(const HiddbgKeyboardAutoPilotState *state)
SetKeyboardAutoPilotState.
hiddbgUpdateControllerColor
Result hiddbgUpdateControllerColor(u32 colorBody, u32 colorButtons, HidsysUniquePadId unique_pad_id)
Writes the input RGB colors to the spi-flash for the specified UniquePad (offset 0x6050 size 0x6).
Event
Kernel-mode event structure.
Definition: event.h:13
HiddbgHdlsSessionId::id
u64 id
Id.
Definition: hiddbg.h:61
HiddbgHdlsStateV9::buttons
u64 buttons
See HiddbgNpadButton. [9.0.0+] Masked with 0xfffffffff00fffff.
Definition: hiddbg.h:101
HiddbgHdlsStateV7::analog_stick_l
HidAnalogStickState analog_stick_l
AnalogStickL.
Definition: hiddbg.h:91
HiddbgHdlsNpadAssignmentEntry::unk_xc
u32 unk_xc
Unknown.
Definition: hiddbg.h:126
HiddbgHdlsNpadAssignmentEntry::unk_x18
u8 unk_x18
Unknown.
Definition: hiddbg.h:128
hiddbgUnsetKeyboardAutoPilotState
Result hiddbgUnsetKeyboardAutoPilotState(void)
UnsetKeyboardAutoPilotState.
hiddbgSetSleepButtonAutoPilotState
Result hiddbgSetSleepButtonAutoPilotState(const HiddbgSleepButtonAutoPilotState *state)
SetSleepButtonAutoPilotState.
hiddbgUnsetTouchScreenAutoPilotState
Result hiddbgUnsetTouchScreenAutoPilotState(void)
UnsetTouchScreenAutoPilotState.
hiddbgSetTouchScreenAutoPilotState
Result hiddbgSetTouchScreenAutoPilotState(const HidTouchState *states, s32 count)
SetTouchScreenAutoPilotState.
hiddbgIsHdlsVirtualDeviceAttached
Result hiddbgIsHdlsVirtualDeviceAttached(HiddbgHdlsSessionId session_id, HiddbgHdlsHandle handle, bool *out)
Checks if the given device is still attached.
HiddbgMouseAutoPilotState::delta_x
s32 delta_x
DeltaX.
Definition: hiddbg.h:36
HiddbgDebugPadAutoPilotState
State for overriding HidDebugPadState.
Definition: hiddbg.h:25
HiddbgDebugPadAutoPilotState::analog_stick_l
HidAnalogStickState analog_stick_l
AnalogStickL.
Definition: hiddbg.h:28
HiddbgAbstractedPadState
AbstractedPadState.
Definition: hiddbg.h:188
HiddbgHdlsState::flags
u32 flags
Used to set the main PowerInfo for HidNpadSystemProperties. BIT(0) -> IsPowered, BIT(1) -> IsCharging...
Definition: hiddbg.h:111
HiddbgHdlsAttribute_HasVirtualSixAxisSensorAcceleration
@ HiddbgHdlsAttribute_HasVirtualSixAxisSensorAcceleration
HasVirtualSixAxisSensorAcceleration.
Definition: hiddbg.h:20
hiddbgInitialize
Result hiddbgInitialize(void)
Initialize hiddbg.
HiddbgHdlsStateListEntryV7::handle
HiddbgHdlsHandle handle
HiddbgHdlsHandle
Definition: hiddbg.h:141
HiddbgDebugPadAutoPilotState::analog_stick_r
HidAnalogStickState analog_stick_r
AnalogStickR.
Definition: hiddbg.h:29
hiddbgGetAbstractedPadsState
Result hiddbgGetAbstractedPadsState(HiddbgAbstractedPadHandle *handles, HiddbgAbstractedPadState *states, s32 count, s32 *total_out)
Similar to hiddbgGetAbstractedPadHandles except this also returns the state for each pad in output ar...
HiddbgDebugPadAutoPilotState::attributes
u32 attributes
Bitfield of HidDebugPadAttribute.
Definition: hiddbg.h:26
HiddbgHdlsStateV9::battery_level
u32 battery_level
BatteryLevel for the main PowerInfo, see HidPowerInfo.
Definition: hiddbg.h:99
s32
int32_t s32
32-bit signed integer.
Definition: types.h:27
hiddbgUpdateDesignInfo
Result hiddbgUpdateDesignInfo(u32 colorBody, u32 colorButtons, u32 colorLeftGrip, u32 colorRightGrip, u8 inval, HidsysUniquePadId unique_pad_id)
Writes the input RGB colors followed by inval to the spi-flash for the specified UniquePad (offset 0x...
HiddbgSleepButtonAutoPilotState
State for overriding SleepButtonState.
Definition: hiddbg.h:50
HiddbgNpadButton_Home
@ HiddbgNpadButton_Home
HOME button.
Definition: hiddbg.h:14
hiddbgGetUniquePadDeviceTypeSetInternal
Result hiddbgGetUniquePadDeviceTypeSetInternal(HidsysUniquePadId unique_pad_id, u32 *out)
Gets the internal DeviceType for the specified controller.
HiddbgMouseAutoPilotState::x
s32 x
X.
Definition: hiddbg.h:34
HiddbgHdlsStateListEntry::device
HiddbgHdlsDeviceInfo device
HiddbgHdlsDeviceInfo. With hiddbgApplyHdlsStateList this is only used when creating new devices.
Definition: hiddbg.h:170
HiddbgHdlsAttribute
HiddbgHdlsAttribute
HdlsAttribute.
Definition: hiddbg.h:19
hiddbgUnsetAllAutoPilotVirtualPadState
Result hiddbgUnsetAllAutoPilotVirtualPadState(void)
Clears AutoPilot state for all pads set by hiddbgSetAutoPilotVirtualPadState.
hiddbgReadSerialFlash
Result hiddbgReadSerialFlash(u32 offset, void *buffer, size_t size, HidsysUniquePadId unique_pad_id)
Reads spi-flash for the specified UniquePad.
HiddbgHdlsNpadAssignment
HdlsNpadAssignment. Same controllers as HiddbgHdlsStateList, with different entry data.
Definition: hiddbg.h:133
HiddbgHdlsStateV7
HdlsState, for [7.0.0-8.1.0].
Definition: hiddbg.h:85
HiddbgMouseAutoPilotState::delta_y
s32 delta_y
DeltaY.
Definition: hiddbg.h:37
HiddbgAbstractedPadState::npadInterfaceType
u8 npadInterfaceType
See HiddbgHdlsDeviceInfo::npadInterfaceType.
Definition: hiddbg.h:195
HiddbgHdlsDeviceInfoV7::deviceTypeInternal
u32 deviceTypeInternal
Only one bit can be set. BIT(N*4+0) = Pro-Controller, BIT(N*4+1) = Joy-Con Left, BIT(N*4+2) = Joy-Con...
Definition: hiddbg.h:66
HiddbgHdlsStateListEntryV9::device
HiddbgHdlsDeviceInfo device
HiddbgHdlsDeviceInfo. With hiddbgApplyHdlsStateList this is only used when creating new devices.
Definition: hiddbg.h:156
hiddbgUnsetDebugPadAutoPilotState
Result hiddbgUnsetDebugPadAutoPilotState(void)
UnsetDebugPadAutoPilotState.
HiddbgHdlsStateV7::is_powered
u8 is_powered
IsPowered for the main PowerInfo, see HidNpadSystemProperties.
Definition: hiddbg.h:86
hiddbgUnsetAutoPilotVirtualPadState
Result hiddbgUnsetAutoPilotVirtualPadState(s8 AbstractedVirtualPadId)
Clears AutoPilot state for the specified pad set by hiddbgSetAutoPilotVirtualPadState.
hiddbgSetDebugPadAutoPilotState
Result hiddbgSetDebugPadAutoPilotState(const HiddbgDebugPadAutoPilotState *state)
SetDebugPadAutoPilotState.
HiddbgHdlsStateListEntryV9
HdlsStateListEntry, for [9.0.0-11.0.1].
Definition: hiddbg.h:154
HiddbgHdlsDeviceInfoV7::singleColorButtons
u32 singleColorButtons
RGBA Single Buttons Color.
Definition: hiddbg.h:68
hiddbgReleaseHdlsWorkBuffer
Result hiddbgReleaseHdlsWorkBuffer(HiddbgHdlsSessionId session_id)
Exit Hdls, must be called at some point prior to hiddbgExit.
HiddbgHdlsNpadAssignment::total_entries
s32 total_entries
Total entries for the below entries.
Definition: hiddbg.h:134
HiddbgSleepButtonAutoPilotState::buttons
u64 buttons
Bitfield of buttons, only bit0 is used.
Definition: hiddbg.h:51
hiddbgGetAbstractedPadState
Result hiddbgGetAbstractedPadState(HiddbgAbstractedPadHandle handle, HiddbgAbstractedPadState *state)
Gets the state for the specified HiddbgAbstractedPadHandle.
u32
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21
HiddbgAbstractedPadState::flags
u8 flags
Flags. Only bit0 is used by hiddbgSetAutoPilotVirtualPadState, when clear it will skip using the rest...
Definition: hiddbg.h:190
hiddbgSetAutoPilotVirtualPadState
Result hiddbgSetAutoPilotVirtualPadState(s8 AbstractedVirtualPadId, const HiddbgAbstractedPadState *state)
Sets AutoPilot state for the specified pad.
HiddbgHdlsState::buttons
u64 buttons
See HiddbgNpadButton. [9.0.0+] Masked with 0xfffffffff00fffff.
Definition: hiddbg.h:112
HiddbgDebugPadAutoPilotState::buttons
u32 buttons
Bitfield of HidDebugPadButton.
Definition: hiddbg.h:27
HiddbgMouseAutoPilotState::y
s32 y
Y.
Definition: hiddbg.h:35
HiddbgHdlsStateListV7
HdlsStateListV7, for [7.0.0-8.1.0]. This contains a list of all controllers, including non-virtual co...
Definition: hiddbg.h:147
HiddbgHdlsHandle
HdlsHandle.
Definition: hiddbg.h:55
s8
int8_t s8
8-bit signed integer.
Definition: types.h:25
HiddbgHdlsAttribute_HasVirtualSixAxisSensorAngle
@ HiddbgHdlsAttribute_HasVirtualSixAxisSensorAngle
HasVirtualSixAxisSensorAngle.
Definition: hiddbg.h:21
HiddbgHdlsStateListV7::pad
u32 pad
Padding.
Definition: hiddbg.h:149
HidAnalogStickState
HidAnalogStickState.
Definition: hid.h:560
u64
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22
HiddbgAbstractedPadHandle::handle
u64 handle
Handle.
Definition: hiddbg.h:184
HidTouchState
HidTouchState.
Definition: hid.h:624
HiddbgHdlsStateV9::analog_stick_l
HidAnalogStickState analog_stick_l
AnalogStickL.
Definition: hiddbg.h:102
HiddbgHdlsStateV9::flags
u32 flags
Used to set the main PowerInfo for HidNpadSystemProperties. BIT(0) -> IsPowered, BIT(1) -> IsCharging...
Definition: hiddbg.h:100
HiddbgHdlsStateListV9::total_entries
s32 total_entries
Total entries for the below entries.
Definition: hiddbg.h:162
HiddbgHdlsDeviceInfo::npadInterfaceType
u8 npadInterfaceType
HidNpadInterfaceType. Additional type field used with the above type field (only applies to HidDevice...
Definition: hiddbg.h:76
Result
u32 Result
Function error code result type.
Definition: types.h:44
HiddbgKeyboardAutoPilotState::modifiers
u64 modifiers
Bitfield of HidKeyboardModifier.
Definition: hiddbg.h:45
HiddbgHdlsStateListEntry::handle
HiddbgHdlsHandle handle
HiddbgHdlsHandle
Definition: hiddbg.h:169
HiddbgHdlsStateListEntryV9::handle
HiddbgHdlsHandle handle
HiddbgHdlsHandle
Definition: hiddbg.h:155
hiddbgUnsetSleepButtonAutoPilotState
Result hiddbgUnsetSleepButtonAutoPilotState(void)
UnsetSleepButtonAutoPilotState.
hiddbgGetAbstractedPadHandles
Result hiddbgGetAbstractedPadHandles(HiddbgAbstractedPadHandle *handles, s32 count, s32 *total_out)
Gets a list of HiddbgAbstractedPadHandle.
hiddbgDeactivateHomeButton
Result hiddbgDeactivateHomeButton(void)
Deactivates the HomeButton.
hiddbgWriteSerialFlash
Result hiddbgWriteSerialFlash(u32 offset, void *buffer, size_t tmem_size, size_t size, HidsysUniquePadId unique_pad_id)
Writes spi-flash for the specified UniquePad.
HiddbgHdlsStateV9::analog_stick_r
HidAnalogStickState analog_stick_r
AnalogStickR.
Definition: hiddbg.h:103
HiddbgHdlsState
HdlsState, for [12.0.0+].
Definition: hiddbg.h:109
HiddbgHdlsState::battery_level
u32 battery_level
BatteryLevel for the main PowerInfo, see HidPowerInfo.
Definition: hiddbg.h:110
HiddbgMouseAutoPilotState::attributes
u32 attributes
Bitfield of HidMouseAttribute.
Definition: hiddbg.h:40
HiddbgHdlsStateList
HdlsStateList, for [12.0.0+].
Definition: hiddbg.h:176
HiddbgHdlsSessionId
HdlsSessionId, returned by hiddbgAttachHdlsWorkBuffer.
Definition: hiddbg.h:60
hiddbgDetachHdlsVirtualDevice
Result hiddbgDetachHdlsVirtualDevice(HiddbgHdlsHandle handle)
Detach the specified device.
hiddbgUnsetMouseAutoPilotState
Result hiddbgUnsetMouseAutoPilotState(void)
UnsetMouseAutoPilotState.
HiddbgAbstractedPadState::singleColorButtons
u32 singleColorButtons
RGBA Single Buttons Color.
Definition: hiddbg.h:194
hiddbgExit
void hiddbgExit(void)
Exit hiddbg.
HiddbgHdlsStateV9
HdlsState, for [9.0.0-11.0.1].
Definition: hiddbg.h:98
HiddbgHdlsNpadAssignmentEntry::handle
HiddbgHdlsHandle handle
HiddbgHdlsHandle
Definition: hiddbg.h:124
HiddbgHdlsStateV7::analog_stick_r
HidAnalogStickState analog_stick_r
AnalogStickR.
Definition: hiddbg.h:92
HiddbgHdlsDeviceInfo::deviceType
u8 deviceType
HidDeviceType
Definition: hiddbg.h:75
hiddbgDumpHdlsStates
Result hiddbgDumpHdlsStates(HiddbgHdlsSessionId session_id, HiddbgHdlsStateList *state)
Gets state for HiddbgHdlsStateList.
HiddbgHdlsDeviceInfo
HdlsDeviceInfo, for [9.0.0+]. Converted to/from HiddbgHdlsDeviceInfoV7 on prior sysvers.
Definition: hiddbg.h:74
HiddbgHdlsStateV7::indicator
u8 indicator
Indicator. Unused for input. Set with output from hiddbgDumpHdlsStates. Not set by hiddbgGetAbstracte...
Definition: hiddbg.h:93
HiddbgMouseAutoPilotState::buttons
u32 buttons
Bitfield of HidMouseButton.
Definition: hiddbg.h:39
HidVector
HidVector.
Definition: hid.h:566
HiddbgHdlsState::analog_stick_l
HidAnalogStickState analog_stick_l
AnalogStickL.
Definition: hiddbg.h:113
HiddbgHdlsStateListV9::pad
u32 pad
Padding.
Definition: hiddbg.h:163
HiddbgHdlsDeviceInfo::singleColorBody
u32 singleColorBody
RGBA Single Body Color.
Definition: hiddbg.h:78
BIT
#define BIT(n)
Creates a bitmask from a bit number.
Definition: types.h:54
hiddbgApplyHdlsStateList
Result hiddbgApplyHdlsStateList(HiddbgHdlsSessionId session_id, const HiddbgHdlsStateList *state)
Sets state for HiddbgHdlsStateList.
HiddbgHdlsDeviceInfo::singleColorButtons
u32 singleColorButtons
RGBA Single Buttons Color.
Definition: hiddbg.h:79
Service
Service object structure.
Definition: service.h:13
HidsysUniquePadId
UniquePadId for a controller.
Definition: hidsys.h:48
hiddbgGetOperationResult
Result hiddbgGetOperationResult(HidsysUniquePadId unique_pad_id)
Get the Result for the Operation and handles cleanup, for the specified UniquePad.
HiddbgHdlsStateListEntryV7::state
HiddbgHdlsStateV7 state
HiddbgHdlsStateV7
Definition: hiddbg.h:143
HiddbgNpadButton
HiddbgNpadButton
HiddbgNpadButton. For the remaining buttons, see HidNpadButton.
Definition: hiddbg.h:13
HiddbgHdlsHandle::handle
u64 handle
Handle.
Definition: hiddbg.h:56
HiddbgHdlsStateV7::flags
u8 flags
ORRed with IsPowered to set the value of the first byte for HidNpadSystemProperties....
Definition: hiddbg.h:87
HiddbgHdlsState::attribute
u32 attribute
Bitfield of HiddbgHdlsAttribute.
Definition: hiddbg.h:117
hiddbgAttachHdlsVirtualDevice
Result hiddbgAttachHdlsVirtualDevice(HiddbgHdlsHandle *handle, const HiddbgHdlsDeviceInfo *info)
Attach a device with the input info.
hiddbgApplyHdlsNpadAssignmentState
Result hiddbgApplyHdlsNpadAssignmentState(HiddbgHdlsSessionId session_id, const HiddbgHdlsNpadAssignment *state, bool flag)
Sets state for HiddbgHdlsNpadAssignment.
HiddbgHdlsStateList::total_entries
s32 total_entries
Total entries for the below entries.
Definition: hiddbg.h:177
hiddbgSetMouseAutoPilotState
Result hiddbgSetMouseAutoPilotState(const HiddbgMouseAutoPilotState *state)
SetMouseAutoPilotState.
hiddbgSetHdlsState
Result hiddbgSetHdlsState(HiddbgHdlsHandle handle, const HiddbgHdlsState *state)
Sets state for the specified device.
HiddbgAbstractedPadState::singleColorBody
u32 singleColorBody
RGBA Single Body Color.
Definition: hiddbg.h:193
HiddbgHdlsState::analog_stick_r
HidAnalogStickState analog_stick_r
AnalogStickR.
Definition: hiddbg.h:114
HiddbgHdlsNpadAssignmentEntry::unk_x10
u64 unk_x10
Unknown.
Definition: hiddbg.h:127
HiddbgHdlsStateListV9
HdlsStateList, for [9.0.0-11.0.1].
Definition: hiddbg.h:161
HiddbgHdlsStateV9::indicator
u8 indicator
Indicator. Unused for input. Set with output from hiddbgDumpHdlsStates.
Definition: hiddbg.h:104
HiddbgHdlsStateListEntryV7
HdlsStateListEntryV7, for [7.0.0-8.1.0].
Definition: hiddbg.h:140
HiddbgHdlsStateV7::buttons
u32 buttons
See HiddbgNpadButton.
Definition: hiddbg.h:90
HiddbgHdlsDeviceInfo::colorLeftGrip
u32 colorLeftGrip
[9.0.0+] RGBA Left Grip Color.
Definition: hiddbg.h:80
HiddbgHdlsStateListEntry
HdlsStateListEntry, for [12.0.0+].
Definition: hiddbg.h:168
hiddbgAttachHdlsWorkBuffer
Result hiddbgAttachHdlsWorkBuffer(HiddbgHdlsSessionId *session_id)
Initialize Hdls.
HiddbgHdlsDeviceInfoV7
HdlsDeviceInfo, for [7.0.0-8.1.0].
Definition: hiddbg.h:65
HiddbgAbstractedPadHandle
AbstractedPadHandle.
Definition: hiddbg.h:183
HiddbgHdlsNpadAssignment::pad
u32 pad
Padding.
Definition: hiddbg.h:135
hiddbgDumpHdlsNpadAssignmentState
Result hiddbgDumpHdlsNpadAssignmentState(HiddbgHdlsSessionId session_id, HiddbgHdlsNpadAssignment *state)
Gets state for HiddbgHdlsNpadAssignment.
hiddbgGetServiceSession
Service * hiddbgGetServiceSession(void)
Gets the Service object for the actual hiddbg service session.
HiddbgAbstractedPadState::state
HiddbgHdlsStateV7 state
State.
Definition: hiddbg.h:198
HiddbgHdlsNpadAssignmentEntry
HdlsNpadAssignmentEntry.
Definition: hiddbg.h:123