8 #include "../services/hid.h"
9 #include "../services/hidsys.h"
10 #include "../sf/service.h"
Result hiddbgGetUniquePadDeviceTypeSetInternal(HidsysUniquePadId unique_pad_id, u32 *out)
Gets the internal DeviceType for the specified controller.
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...
Result hiddbgWriteSerialFlash(u32 offset, void *buffer, size_t tmem_size, size_t size, HidsysUniquePadId unique_pad_id)
Writes spi-flash for the specified UniquePad.
Result hiddbgSetMouseAutoPilotState(const HiddbgMouseAutoPilotState *state)
SetMouseAutoPilotState.
Result hiddbgUnsetSleepButtonAutoPilotState(void)
UnsetSleepButtonAutoPilotState.
Result hiddbgGetAbstractedPadState(HiddbgAbstractedPadHandle handle, HiddbgAbstractedPadState *state)
Gets the state for the specified HiddbgAbstractedPadHandle.
Result hiddbgApplyHdlsNpadAssignmentState(HiddbgHdlsSessionId session_id, const HiddbgHdlsNpadAssignment *state, bool flag)
Sets state for HiddbgHdlsNpadAssignment.
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...
Result hiddbgDumpHdlsNpadAssignmentState(HiddbgHdlsSessionId session_id, HiddbgHdlsNpadAssignment *state)
Gets state for HiddbgHdlsNpadAssignment.
Result hiddbgSetAutoPilotVirtualPadState(s8 AbstractedVirtualPadId, const HiddbgAbstractedPadState *state)
Sets AutoPilot state for the specified pad.
Result hiddbgAcquireOperationEventHandle(Event *out_event, bool autoclear, HidsysUniquePadId unique_pad_id)
Get the OperationEvent for the specified UniquePad.
void hiddbgExit(void)
Exit hiddbg.
Result hiddbgReadSerialFlash(u32 offset, void *buffer, size_t size, HidsysUniquePadId unique_pad_id)
Reads spi-flash for the specified UniquePad.
Result hiddbgDetachHdlsVirtualDevice(HiddbgHdlsHandle handle)
Detach the specified device.
Result hiddbgReleaseHdlsWorkBuffer(HiddbgHdlsSessionId session_id)
Exit Hdls, must be called at some point prior to hiddbgExit.
Result hiddbgDumpHdlsStates(HiddbgHdlsSessionId session_id, HiddbgHdlsStateList *state)
Gets state for HiddbgHdlsStateList.
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).
Result hiddbgSetTouchScreenAutoPilotState(const HidTouchState *states, s32 count)
SetTouchScreenAutoPilotState.
HiddbgHdlsAttribute
HdlsAttribute.
Definition: hiddbg.h:19
@ HiddbgHdlsAttribute_HasVirtualSixAxisSensorAngle
HasVirtualSixAxisSensorAngle.
Definition: hiddbg.h:21
@ HiddbgHdlsAttribute_HasVirtualSixAxisSensorAcceleration
HasVirtualSixAxisSensorAcceleration.
Definition: hiddbg.h:20
Result hiddbgUnsetMouseAutoPilotState(void)
UnsetMouseAutoPilotState.
Result hiddbgUnsetKeyboardAutoPilotState(void)
UnsetKeyboardAutoPilotState.
Service * hiddbgGetServiceSession(void)
Gets the Service object for the actual hiddbg service session.
Result hiddbgApplyHdlsStateList(HiddbgHdlsSessionId session_id, const HiddbgHdlsStateList *state)
Sets state for HiddbgHdlsStateList.
Result hiddbgGetOperationResult(HidsysUniquePadId unique_pad_id)
Get the Result for the Operation and handles cleanup, for the specified UniquePad.
Result hiddbgSetHdlsState(HiddbgHdlsHandle handle, const HiddbgHdlsState *state)
Sets state for the specified device.
Result hiddbgSetSleepButtonAutoPilotState(const HiddbgSleepButtonAutoPilotState *state)
SetSleepButtonAutoPilotState.
Result hiddbgIsHdlsVirtualDeviceAttached(HiddbgHdlsSessionId session_id, HiddbgHdlsHandle handle, bool *out)
Checks if the given device is still attached.
Result hiddbgSetDebugPadAutoPilotState(const HiddbgDebugPadAutoPilotState *state)
SetDebugPadAutoPilotState.
Result hiddbgDeactivateHomeButton(void)
Deactivates the HomeButton.
Result hiddbgUnsetDebugPadAutoPilotState(void)
UnsetDebugPadAutoPilotState.
Result hiddbgAttachHdlsWorkBuffer(HiddbgHdlsSessionId *session_id, void *buffer, size_t size)
Initialize Hdls.
Result hiddbgSetKeyboardAutoPilotState(const HiddbgKeyboardAutoPilotState *state)
SetKeyboardAutoPilotState.
Result hiddbgAttachHdlsVirtualDevice(HiddbgHdlsHandle *handle, const HiddbgHdlsDeviceInfo *info)
Attach a device with the input info.
Result hiddbgInitialize(void)
Initialize hiddbg.
Result hiddbgUnsetTouchScreenAutoPilotState(void)
UnsetTouchScreenAutoPilotState.
Result hiddbgUnsetAutoPilotVirtualPadState(s8 AbstractedVirtualPadId)
Clears AutoPilot state for the specified pad set by hiddbgSetAutoPilotVirtualPadState.
Result hiddbgGetAbstractedPadHandles(HiddbgAbstractedPadHandle *handles, s32 count, s32 *total_out)
Gets a list of HiddbgAbstractedPadHandle.
HiddbgNpadButton
HiddbgNpadButton. For the remaining buttons, see HidNpadButton.
Definition: hiddbg.h:13
@ HiddbgNpadButton_Capture
Capture button.
Definition: hiddbg.h:15
@ HiddbgNpadButton_Home
HOME button.
Definition: hiddbg.h:14
Result hiddbgUnsetAllAutoPilotVirtualPadState(void)
Clears AutoPilot state for all pads set by hiddbgSetAutoPilotVirtualPadState.
Kernel-mode event structure.
Definition: event.h:13
HidAnalogStickState.
Definition: hid.h:584
HidTouchState.
Definition: hid.h:648
HidVector.
Definition: hid.h:590
AbstractedPadHandle.
Definition: hiddbg.h:183
u64 handle
Handle.
Definition: hiddbg.h:184
AbstractedPadState.
Definition: hiddbg.h:188
u8 npadInterfaceType
See HiddbgHdlsDeviceInfo::npadInterfaceType.
Definition: hiddbg.h:195
u32 type
Type. Converted to HiddbgHdlsDeviceInfoV7::type internally by hiddbgSetAutoPilotVirtualPadState....
Definition: hiddbg.h:189
u32 singleColorButtons
RGBA Single Buttons Color.
Definition: hiddbg.h:194
HiddbgHdlsStateV7 state
State.
Definition: hiddbg.h:198
u32 singleColorBody
RGBA Single Body Color.
Definition: hiddbg.h:193
u8 flags
Flags. Only bit0 is used by hiddbgSetAutoPilotVirtualPadState, when clear it will skip using the rest...
Definition: hiddbg.h:190
State for overriding HidDebugPadState.
Definition: hiddbg.h:25
HidAnalogStickState analog_stick_l
AnalogStickL.
Definition: hiddbg.h:28
u32 attributes
Bitfield of HidDebugPadAttribute.
Definition: hiddbg.h:26
u32 buttons
Bitfield of HidDebugPadButton.
Definition: hiddbg.h:27
HidAnalogStickState analog_stick_r
AnalogStickR.
Definition: hiddbg.h:29
HdlsDeviceInfo, for [7.0.0-8.1.0].
Definition: hiddbg.h:65
u32 singleColorButtons
RGBA Single Buttons Color.
Definition: hiddbg.h:68
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
u8 npadInterfaceType
HidNpadInterfaceType. Additional type field used with the above type field (only applies to type bit0...
Definition: hiddbg.h:69
u32 singleColorBody
RGBA Single Body Color.
Definition: hiddbg.h:67
HdlsDeviceInfo, for [9.0.0+]. Converted to/from HiddbgHdlsDeviceInfoV7 on prior sysvers.
Definition: hiddbg.h:74
u32 singleColorBody
RGBA Single Body Color.
Definition: hiddbg.h:78
u32 singleColorButtons
RGBA Single Buttons Color.
Definition: hiddbg.h:79
u8 npadInterfaceType
HidNpadInterfaceType. Additional type field used with the above type field (only applies to HidDevice...
Definition: hiddbg.h:76
u32 colorLeftGrip
[9.0.0+] RGBA Left Grip Color.
Definition: hiddbg.h:80
u8 deviceType
HidDeviceType
Definition: hiddbg.h:75
u32 colorRightGrip
[9.0.0+] RGBA Right Grip Color.
Definition: hiddbg.h:81
HdlsHandle.
Definition: hiddbg.h:55
u64 handle
Handle.
Definition: hiddbg.h:56
HdlsNpadAssignmentEntry.
Definition: hiddbg.h:123
HiddbgHdlsHandle handle
HiddbgHdlsHandle
Definition: hiddbg.h:124
u8 unk_x18
Unknown.
Definition: hiddbg.h:128
u32 unk_xc
Unknown.
Definition: hiddbg.h:126
u64 unk_x10
Unknown.
Definition: hiddbg.h:127
u32 unk_x8
Unknown.
Definition: hiddbg.h:125
HdlsNpadAssignment. Same controllers as HiddbgHdlsStateList, with different entry data.
Definition: hiddbg.h:133
s32 total_entries
Total entries for the below entries.
Definition: hiddbg.h:134
u32 pad
Padding.
Definition: hiddbg.h:135
HdlsSessionId, returned by hiddbgAttachHdlsWorkBuffer.
Definition: hiddbg.h:60
u64 id
Id.
Definition: hiddbg.h:61
HdlsStateListEntryV7, for [7.0.0-8.1.0].
Definition: hiddbg.h:140
HiddbgHdlsDeviceInfoV7 device
HiddbgHdlsDeviceInfoV7. With hiddbgApplyHdlsStateList this is only used when creating new devices.
Definition: hiddbg.h:142
HiddbgHdlsHandle handle
HiddbgHdlsHandle
Definition: hiddbg.h:141
HiddbgHdlsStateV7 state
HiddbgHdlsStateV7
Definition: hiddbg.h:143
HdlsStateListEntry, for [9.0.0-11.0.1].
Definition: hiddbg.h:154
HiddbgHdlsHandle handle
HiddbgHdlsHandle
Definition: hiddbg.h:155
HiddbgHdlsDeviceInfo device
HiddbgHdlsDeviceInfo. With hiddbgApplyHdlsStateList this is only used when creating new devices.
Definition: hiddbg.h:156
HdlsStateListEntry, for [12.0.0+].
Definition: hiddbg.h:168
HiddbgHdlsDeviceInfo device
HiddbgHdlsDeviceInfo. With hiddbgApplyHdlsStateList this is only used when creating new devices.
Definition: hiddbg.h:170
HiddbgHdlsHandle handle
HiddbgHdlsHandle
Definition: hiddbg.h:169
HdlsStateListV7, for [7.0.0-8.1.0]. This contains a list of all controllers, including non-virtual co...
Definition: hiddbg.h:147
s32 total_entries
Total entries for the below entries.
Definition: hiddbg.h:148
u32 pad
Padding.
Definition: hiddbg.h:149
HdlsStateList, for [9.0.0-11.0.1].
Definition: hiddbg.h:161
u32 pad
Padding.
Definition: hiddbg.h:163
s32 total_entries
Total entries for the below entries.
Definition: hiddbg.h:162
HdlsStateList, for [12.0.0+].
Definition: hiddbg.h:176
s32 total_entries
Total entries for the below entries.
Definition: hiddbg.h:177
u32 pad
Padding.
Definition: hiddbg.h:178
HdlsState, for [7.0.0-8.1.0].
Definition: hiddbg.h:85
HidAnalogStickState analog_stick_r
AnalogStickR.
Definition: hiddbg.h:92
u8 flags
ORRed with IsPowered to set the value of the first byte for HidNpadSystemProperties....
Definition: hiddbg.h:87
u8 is_powered
IsPowered for the main PowerInfo, see HidNpadSystemProperties.
Definition: hiddbg.h:86
HidAnalogStickState analog_stick_l
AnalogStickL.
Definition: hiddbg.h:91
u32 battery_level
BatteryLevel for the main PowerInfo, see HidPowerInfo.
Definition: hiddbg.h:89
u32 buttons
See HiddbgNpadButton.
Definition: hiddbg.h:90
u8 indicator
Indicator. Unused for input. Set with output from hiddbgDumpHdlsStates. Not set by hiddbgGetAbstracte...
Definition: hiddbg.h:93
HdlsState, for [9.0.0-11.0.1].
Definition: hiddbg.h:98
HidAnalogStickState analog_stick_l
AnalogStickL.
Definition: hiddbg.h:102
u8 indicator
Indicator. Unused for input. Set with output from hiddbgDumpHdlsStates.
Definition: hiddbg.h:104
u32 battery_level
BatteryLevel for the main PowerInfo, see HidPowerInfo.
Definition: hiddbg.h:99
HidAnalogStickState analog_stick_r
AnalogStickR.
Definition: hiddbg.h:103
u32 flags
Used to set the main PowerInfo for HidNpadSystemProperties. BIT(0) -> IsPowered, BIT(1) -> IsCharging...
Definition: hiddbg.h:100
u64 buttons
See HiddbgNpadButton. [9.0.0+] Masked with 0xfffffffff00fffff.
Definition: hiddbg.h:101
HdlsState, for [12.0.0+].
Definition: hiddbg.h:109
u8 indicator
Indicator. Unused for input.
Definition: hiddbg.h:118
u32 battery_level
BatteryLevel for the main PowerInfo, see HidPowerInfo.
Definition: hiddbg.h:110
HidVector six_axis_sensor_angle
VirtualSixAxisSensorAngle.
Definition: hiddbg.h:116
HidAnalogStickState analog_stick_l
AnalogStickL.
Definition: hiddbg.h:113
u32 flags
Used to set the main PowerInfo for HidNpadSystemProperties. BIT(0) -> IsPowered, BIT(1) -> IsCharging...
Definition: hiddbg.h:111
u32 attribute
Bitfield of HiddbgHdlsAttribute.
Definition: hiddbg.h:117
HidAnalogStickState analog_stick_r
AnalogStickR.
Definition: hiddbg.h:114
u64 buttons
See HiddbgNpadButton. [9.0.0+] Masked with 0xfffffffff00fffff.
Definition: hiddbg.h:112
HidVector six_axis_sensor_acceleration
VirtualSixAxisSensorAcceleration.
Definition: hiddbg.h:115
State for overriding HidKeyboardState.
Definition: hiddbg.h:44
u64 modifiers
Bitfield of HidKeyboardModifier.
Definition: hiddbg.h:45
State for overriding HidMouseState.
Definition: hiddbg.h:33
s32 delta_y
DeltaY.
Definition: hiddbg.h:37
s32 y
Y.
Definition: hiddbg.h:35
s32 delta_x
DeltaX.
Definition: hiddbg.h:36
u32 buttons
Bitfield of HidMouseButton.
Definition: hiddbg.h:39
u32 attributes
Bitfield of HidMouseAttribute.
Definition: hiddbg.h:40
s32 wheel_delta
WheelDelta.
Definition: hiddbg.h:38
s32 x
X.
Definition: hiddbg.h:34
UniquePadId for a controller.
Definition: hidsys.h:57
Service object structure.
Definition: service.h:14
#define BIT(n)
Creates a bitmask from a bit number.
Definition: types.h:54
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22
uint8_t u8
8-bit unsigned integer.
Definition: types.h:19
int8_t s8
8-bit signed integer.
Definition: types.h:25
u32 Result
Function error code result type.
Definition: types.h:44
int32_t s32
32-bit signed integer.
Definition: types.h:27
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21