Changes

2,192 bytes added ,  16:15, 12 October 2019
Line 196: Line 196:  
| 406 || [4.0.0+] GetNpadLeftRightInterfaceType
 
| 406 || [4.0.0+] GetNpadLeftRightInterfaceType
 
|-
 
|-
| 407 || [9.0.0+]  
+
| 407 || [9.0.0+] GetNpadOfHighestBatteryLevelForJoyLeft
 
|-
 
|-
| 408 || [9.0.0+]  
+
| 408 || [9.0.0+] GetNpadOfHighestBatteryLevelForJoyRight
 
|-
 
|-
 
| 500 || [5.0.0+] GetPalmaConnectionHandle
 
| 500 || [5.0.0+] GetPalmaConnectionHandle
Line 284: Line 284:     
== AcquireNpadStyleSetUpdateEventHandle ==
 
== AcquireNpadStyleSetUpdateEventHandle ==
Takes an input u32, an u64 [[AM_services|AppletResourceUserId]], and an u64. Returns an output event handle, autoclear for this is user-specified.
+
Takes a PID, an input u32, an u64 [[AM_services|AppletResourceUserId]], and an u64. Returns an output event handle, autoclear for this is user-specified.
    
The value for the last u64 doesn't seem to matter (?): official sw sets this to the address of the structure used for storing the event which is initialized after using this cmd.
 
The value for the last u64 doesn't seem to matter (?): official sw sets this to the address of the structure used for storing the event which is initialized after using this cmd.
Line 329: Line 329:     
== IsVibrationDeviceMounted ==
 
== IsVibrationDeviceMounted ==
Takes a total of 0x10-bytes of input and a PID, returns an output u8 bool.
+
Takes a PID, an [[#VibrationDeviceHandle]], and an u64 [[AM_services|AppletResourceUserId]], returns an output u8 bool.
    
== ActivateSevenSixAxisSensor ==
 
== ActivateSevenSixAxisSensor ==
Line 622: Line 622:  
| 229 || [6.0.0+] [[#ReadSerialFlash]]
 
| 229 || [6.0.0+] [[#ReadSerialFlash]]
 
|-
 
|-
| 230 || [6.0.0+] WriteSerialFlash
+
| 230 || [6.0.0+] [[#WriteSerialFlash]]
 
|-
 
|-
 
| 231 || [6.0.0+] GetOperationResult
 
| 231 || [6.0.0+] GetOperationResult
Line 753: Line 753:     
This doesn't seem to be usable?
 
This doesn't seem to be usable?
 +
 +
== WriteSerialFlash ==
 +
Takes an input TransferMemory handle, an input u32 offset, an input u64 tmem_size, an input u64 size, and an u64 '''UniquePadId''', no output.
 +
 +
Writes to the specified controller's spi-flash. The TransferMemory permissions is R--.
    
== GetUniquePadDeviceTypeSetInternal ==
 
== GetUniquePadDeviceTypeSetInternal ==
Takes a total of 8-bytes of input, returns a total of 4-bytes of output.
+
Takes an input u64 '''UniquePadId''', returns an [[#DeviceTypeInternal]].
 
  −
[9.0.0+] Now takes a total of 8-bytes of input, returns a total of 1-byte of output.
      
== GetAbstractedPadHandles ==
 
== GetAbstractedPadHandles ==
Line 970: Line 973:  
! Offset || Size || Description
 
! Offset || Size || Description
 
|-
 
|-
| 0x0 || 0x4 || Only one bit can be set, see below.
+
| 0x0 || 0x4 || [[#DeviceTypeInternal]]
 
|-
 
|-
 
| 0x4 || 0x4 || RGBA Single Body Color
 
| 0x4 || 0x4 || RGBA Single Body Color
Line 986: Line 989:  
! Offset || Size || Description
 
! Offset || Size || Description
 
|-
 
|-
| 0x0 || 0x1 || Type value, must match certain values (not used with the below table).
+
| 0x0 || 0x1 || [[#DeviceTypeInternal]]
 
|-
 
|-
 
| 0x1 || 0x1 || [[#NpadInterfaceType]]. Similar to the field from the old struct.
 
| 0x1 || 0x1 || [[#NpadInterfaceType]]. Similar to the field from the old struct.
Line 1,003: Line 1,006:  
This is a 0x10-byte struct. [9.0.0+] This is a 0x14-byte struct.
 
This is a 0x10-byte struct. [9.0.0+] This is a 0x14-byte struct.
   −
Bits for the above type field:
+
== DeviceTypeInternal ==
 +
This is an u32 "nn::hid::detail::DeviceTypeInternal".
 +
 
 +
[9.0.0+] This an u8 "nn::hidtypes::DeviceType".
 +
 
 +
Bits for "nn::hid::detail::DeviceTypeInternal", only 1 bit can be set:
    
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 1,049: Line 1,057:  
|  
 
|  
 
| Generic controller
 
| Generic controller
 +
|}
 +
 +
u8 values for "nn::hidtypes::DeviceType", must match one of the these values:
 +
 +
{| class="wikitable" border="1"
 +
!  Value
 +
!  Description
 +
!  Notes
 +
|-
 +
| 1 || JoyRight ||
 +
|-
 +
| 2 || JoyLeft ||
 +
|-
 +
| 3 || FullKey ||
 +
|-
 +
| 4 || JoyLeft ||
 +
|-
 +
| 5 || JoyRight ||
 +
|-
 +
| 6 || FullKey ||
 +
|-
 +
| 7 || LarkLeft (HVC) ||
 +
|-
 +
| 8 || LarkRight (HVC) ||
 +
|-
 +
| 9 || LarkLeft (NES) ||
 +
|-
 +
| 10 || LarkRight (NES) ||
 +
|-
 +
| 11 || Invalid ||
 +
|-
 +
| 12 || Palma ||
 +
|-
 +
| 13 || FullKey ||
 +
|-
 +
| 14 || Invalid ||
 +
|-
 +
| 15 || FullKey ||
 +
|-
 +
| 16 || Controller is missing in sharedmem.
 +
|-
 +
| 17-18 || Invalid ||
 +
|-
 +
| 19 || [[#DeviceType]] System with [[#NpadStyleTag]] |= NpadFullKey
 +
|-
 +
| 20 || [[#DeviceType]] System with [[#NpadStyleTag]] |= NpadJoyDual
 +
|-
 +
| 21 || [[#DeviceType]] System with [[#NpadStyleTag]] |= NpadJoyDual
 
|}
 
|}
    
== HdlsState ==
 
== HdlsState ==
 +
 +
Pre-9.0.0:
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
Line 1,065: Line 1,123:  
|-
 
|-
 
| 0xC || 0x4 || [[HID_Shared_Memory#Button_State|Buttons]]. Bit18 = HOME and bit19 = Capture.
 
| 0xC || 0x4 || [[HID_Shared_Memory#Button_State|Buttons]]. Bit18 = HOME and bit19 = Capture.
 +
|-
 +
| 0x10 || 0x10(4*2*2) || Joystick data, see [[HID_Shared_Memory#Controller_State]].
 +
|-
 +
| 0x20 || 0x1 || Unused for input. Set with output from [[#DumpHdlsStates]] (zero in some cases).
 +
|-
 +
| 0x21 || 0x3 || Padding
 +
|}
 +
 +
[9.0.0+]:
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset || Size || Description
 +
|-
 +
| 0x0 || 0x4 || batteryCharge for the main [[HID_Shared_Memory#Controllers|PowerInfo]].
 +
|-
 +
| 0x4 || 0x4 || Unknown
 +
|-
 +
| 0x8 || 0x8 || [[HID_Shared_Memory#Button_State|Buttons]], masked with 0xfffffffff00fffff. See above table regarding HOME/Capture buttons.
 
|-
 
|-
 
| 0x10 || 0x10(4*2*2) || Joystick data, see [[HID_Shared_Memory#Controller_State]].
 
| 0x10 || 0x10(4*2*2) || Joystick data, see [[HID_Shared_Memory#Controller_State]].
Line 1,250: Line 1,326:  
| 830 || [7.0.0+] [[#SetNotificationLedPattern]]
 
| 830 || [7.0.0+] [[#SetNotificationLedPattern]]
 
|-
 
|-
| 831 || [9.0.0+] SetNotificationLedPatternWithTimeout
+
| 831 || [9.0.0+] [[#SetNotificationLedPatternWithTimeout]]
 
|-
 
|-
| 832 || [9.0.0+] PrepareHidsForNotificationWake
+
| 832 || [9.0.0+] [[#PrepareHidsForNotificationWake]]
 
|-
 
|-
 
| 850 || [3.0.0+] IsUsbFullKeyControllerEnabled
 
| 850 || [3.0.0+] IsUsbFullKeyControllerEnabled
Line 1,324: Line 1,400:  
| 1155 || [9.0.0+] SetForceHandheldStyleVibration
 
| 1155 || [9.0.0+] SetForceHandheldStyleVibration
 
|-
 
|-
| 1156 || [9.0.0+]  
+
| 1156 || [9.0.0+] SendConnectionTriggerWithoutTimeoutEvent
 
|}
 
|}
   Line 1,333: Line 1,409:     
== GetUniquePadsFromNpad ==
 
== GetUniquePadsFromNpad ==
Takes an input u32 [[#NpadIdType]], a type-0xA output buffer, and returns an output u64 for total output entries.
+
Takes an input u32 [[#NpadIdType]], a type-0xA output buffer, and returns an output s64 for total output entries (which is copied to a s32 by official sw).
    
The output buffer contains an array of u64 '''UniquePadId'''.
 
The output buffer contains an array of u64 '''UniquePadId'''.
Line 1,341: Line 1,417:     
== GetUniquePadIds ==
 
== GetUniquePadIds ==
Takes a type-0xA output buffer, and returns an output u64 for total output entries.
+
Takes a type-0xA output buffer, and returns an output s64 for total output entries (which is copied to a s32 by official sw).
    
The output buffer contains an array of u64 '''UniquePadId'''.
 
The output buffer contains an array of u64 '''UniquePadId'''.
Line 1,356: Line 1,432:     
This sends subcommand 0x38 to the specified controller, for setting the pattern for the HOME button notification LED. The input structure is converted to the format used by this [https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/bluetooth_hid_subcommands_notes.md#subcommand-0x38-set-home-light subcommand].
 
This sends subcommand 0x38 to the specified controller, for setting the pattern for the HOME button notification LED. The input structure is converted to the format used by this [https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/bluetooth_hid_subcommands_notes.md#subcommand-0x38-set-home-light subcommand].
 +
 +
== SetNotificationLedPatternWithTimeout ==
 +
Takes an input [[#NotificationLedPattern]], an u64 '''UniquePadId''', and an s64 TimeSpan, no output.
 +
 +
== PrepareHidsForNotificationWake ==
 +
Takes a type-0x9 input buffer containing an array of u64 '''UniquePadId''', no output.
    
== GetHidbusSystemServiceObject ==
 
== GetHidbusSystemServiceObject ==