HID services: Difference between revisions

No edit summary
No edit summary
Line 938: Line 938:
Prior to using this cmd, the input [[#HdlsStateList]] is written to tmem+0 by the user-process.
Prior to using this cmd, the input [[#HdlsStateList]] is written to tmem+0 by the user-process.


The [[#HdlsState]] will be applied for each HdlsHandle. If a HdlsHandle is not found, code similar to [[#AttachHdlsVirtualDevice]] will run with the [[#HdlsDeviceInfo]], then it will continue with applying state with the new device.
The [[#HdlsState]] will be applied for each [[#HdlsHandle]]. If a [[#HdlsHandle]] is not found, code similar to [[#AttachHdlsVirtualDevice]] will run with the [[#HdlsDeviceInfo]], then it will continue with applying state with the new device.


== AttachHdlsVirtualDevice ==
== AttachHdlsVirtualDevice ==
Takes an [[#HdlsDeviceInfo]], returns a 8-byte '''HdlsHandle'''.
Takes an [[#HdlsDeviceInfo]], returns a [[#HdlsHandle]].


== DetachHdlsVirtualDevice ==
== DetachHdlsVirtualDevice ==
Takes an input 8-byte '''HdlsHandle''', no output.
Takes an input [[#HdlsHandle]], no output.


== SetHdlsState ==
== SetHdlsState ==
Takes an input [[#HdlsState]] and an input 8-byte '''HdlsHandle''', no output.
Takes an input [[#HdlsState]] and an input [[#HdlsHandle]], no output.


[9.0.0+] Input order was swapped: now takes an input 8-byte '''HdlsHandle''' and a [[#HdlsState]], no output.
[9.0.0+] Input order was swapped: now takes an input [[#HdlsHandle]] and a [[#HdlsState]], no output.


= hid:sys =
= hid:sys =
Line 6,142: Line 6,142:


The above "[[#DeviceType]] |=" notes only apply when type2 is 0x2.
The above "[[#DeviceType]] |=" notes only apply when type2 is 0x2.
= HdlsHandle =
This is "nn::hid::debug::HdlsHandle". This is a 0x8-byte struct with 8-byte alignment.


= HdlsNpadAssignment =
= HdlsNpadAssignment =
Line 6,164: Line 6,167:
! Offset || Size || Description
! Offset || Size || Description
|-
|-
| 0x0 || 0x8 || HdlsHandle
| 0x0 || 0x8 || [[#HdlsHandle]]
|-
|-
| 0x8 || 0x4 || ?
| 0x8 || 0x4 || ?
Line 6,204: Line 6,207:
! Offset || Size || Description
! Offset || Size || Description
|-
|-
| 0x0 || 0x8 || HdlsHandle
| 0x0 || 0x8 || [[#HdlsHandle]]
|-
|-
| 0x8 || [[#HdlsDeviceInfo]] size || [[#HdlsDeviceInfo]]. With [[#ApplyHdlsStateList]] this is only used when creating new devices.
| 0x8 || [[#HdlsDeviceInfo]] size || [[#HdlsDeviceInfo]]. With [[#ApplyHdlsStateList]] this is only used when creating new devices.
Line 6,247: Line 6,250:
| 0x8 || 0x4 || RGBA Single Buttons Color
| 0x8 || 0x4 || RGBA Single Buttons Color
|-
|-
| 0xC || 0x4 || RGBA Unknown Body Color
| 0xC || 0x4 || RGBA Left Grip Color
|-
|-
| 0x10 || 0x4 || RGBA Unknown Buttons Color
| 0x10 || 0x4 || RGBA Right Grip Color
|}
|}


Line 6,259: Line 6,262:
! Offset || Size || Description
! Offset || Size || Description
|-
|-
| 0x0 || 0x1 || powerConnected for the main PowerInfo.
| 0x0 || 0x1 || IsPowered for the main PowerInfo.
|-
|-
| 0x1 || 0x1 || ORRed with powerConnected to set the value of the first byte for the controller [[HID_Shared_Memory#Flags|flags]].
| 0x1 || 0x1 || ORRed with IsPowered to set the value of the first byte for the controller [[#NpadSystemProperties]].
|-
|-
| 0x2 || 0x6 || Unknown
| 0x2 || 0x6 || Unknown
|-
|-
| 0x8 || 0x4 || batteryCharge for the main PowerInfo.
| 0x8 || 0x4 || BatteryLevel for the main PowerInfo.
|-
|-
| 0xC || 0x4 || Buttons. Bit18 = HOME and bit19 = Capture.
| 0xC || 0x4 || [[#NpadButton|Buttons]]. Bit18 = HOME and bit19 = Capture.
|-
|-
| 0x10 || 0x10(4*2*2) || Joystick data.
| 0x10 || 0x10(4*2*2) || Joystick data.
Line 6,281: Line 6,284:
! Offset || Size || Description
! Offset || Size || Description
|-
|-
| 0x0 || 0x4 || batteryCharge for the main PowerInfo.
| 0x0 || 0x4 || BatteryLevel for the main PowerInfo.
|-
|-
| 0x4 || 0x4 || Unknown
| 0x4 || 0x4 || Flags. Used to set the main PowerInfo for [[#NpadSystemProperties]]. Bit0 -> IsPowered, bit1 -> IsCharging.
|-
|-
| 0x8 || 0x8 || Buttons, masked with 0xfffffffff00fffff. See above table regarding HOME/Capture buttons.
| 0x8 || 0x8 || [[#NpadButton|Buttons]], masked with 0xfffffffff00fffff. See above table regarding HOME/Capture buttons.
|-
|-
| 0x10 || 0x10(4*2*2) || Joystick data.
| 0x10 || 0x10(4*2*2) || Joystick data.