Changes

Jump to navigation Jump to search
7,576 bytes added ,  21:48, 29 July 2019
Line 265: Line 265:     
== SetSupportedNpadStyleSet ==
 
== SetSupportedNpadStyleSet ==
Takes an u32 [[#NpadStyleTag]].
+
Takes a PID-descriptor, an u32 [[#NpadStyleTag]], and an u64 [[AM_services|AppletResourceUserId]], no output.
    
== GetSupportedNpadStyleSet ==
 
== GetSupportedNpadStyleSet ==
Returns an u32 [[#NpadStyleTag]].
+
Takes a PID-descriptor and an u64 [[AM_services|AppletResourceUserId]], returns an u32 [[#NpadStyleTag]].
    
== SetSupportedNpadIdType ==
 
== SetSupportedNpadIdType ==
Line 421: Line 421:  
| 7
 
| 7
 
| NpadLark
 
| NpadLark
| NES controller.
+
| NES/Famicom controller.
 
|-
 
|-
 
| 8
 
| 8
 
| NpadHandheldLark
 
| NpadHandheldLark
| NES controller in handheld mode.
+
| NES/Famicom controller in handheld mode.
 
|-
 
|-
| 9-28
+
| 9
 +
| NpadLucia
 +
| Unknown.
 +
|-
 +
| 10-28
 
| Reserved
 
| Reserved
 
|
 
|
Line 433: Line 437:  
| 29
 
| 29
 
| NpadSystemExt
 
| NpadSystemExt
|
+
| Generic external controller.
 
|-
 
|-
 
| 30
 
| 30
 
| NpadSystem
 
| NpadSystem
|
+
| Generic controller.
 
|-
 
|-
 
| 31
 
| 31
Line 582: Line 586:  
| 228 || [6.0.0+] AcquireOperationEventHandle
 
| 228 || [6.0.0+] AcquireOperationEventHandle
 
|-
 
|-
| 229 || [6.0.0+] ReadSerialFlash
+
| 229 || [6.0.0+] [[#ReadSerialFlash]]
 
|-
 
|-
 
| 230 || [6.0.0+] WriteSerialFlash
 
| 230 || [6.0.0+] WriteSerialFlash
Line 596: Line 600:  
| 235 || [7.0.0+] EnableAnalogStickPower
 
| 235 || [7.0.0+] EnableAnalogStickPower
 
|-
 
|-
| 301 || [5.0.0+] GetAbstractedPadHandles
+
| 301 || [5.0.0+] [[#GetAbstractedPadHandles]]
 
|-
 
|-
| 302 || [5.0.0+] GetAbstractedPadState
+
| 302 || [5.0.0+] [[#GetAbstractedPadState]]
 
|-
 
|-
| 303 || [5.0.0+] GetAbstractedPadsState
+
| 303 || [5.0.0+] [[#GetAbstractedPadsState]]
 
|-
 
|-
| 321 || [5.0.0+] SetAutoPilotVirtualPadState
+
| 321 || [5.0.0+] [[#SetAutoPilotVirtualPadState]]
 
|-
 
|-
| 322 || [5.0.0+] UnsetAutoPilotVirtualPadState
+
| 322 || [5.0.0+] [[#UnsetAutoPilotVirtualPadState]]
 
|-
 
|-
| 323 || [5.0.0+] UnsetAllAutoPilotVirtualPadState
+
| 323 || [5.0.0+] [[#UnsetAllAutoPilotVirtualPadState]]
 
|-
 
|-
 
| 324 || [7.0.0+] [[#AttachHdlsWorkBuffer]]
 
| 324 || [7.0.0+] [[#AttachHdlsWorkBuffer]]
Line 670: Line 674:     
Sends the spi-write subcommand to the specified controller, for writing to offset 0x6050 size 0xD. The first 3-bytes from each u32 is used for the spi-write-data, with the u8 being copied immediately afterwards the color data.
 
Sends the spi-write subcommand to the specified controller, for writing to offset 0x6050 size 0xD. The first 3-bytes from each u32 is used for the spi-write-data, with the u8 being copied immediately afterwards the color data.
 +
 +
== ReadSerialFlash ==
 +
Takes an input TransferMemory handle, an input u32 offset, an input u64 size, and an u64 '''UniquePadId''', no output.
 +
 +
Reads from the specified controller's spi-flash. The input size is the original size without page-alignment. The TransferMemory permissions is RW-.
 +
 +
This doesn't seem to be usable?
 +
 +
== GetAbstractedPadHandles ==
 +
Takes a type-0xA output buffer containing an array of u64 '''AbstractedPadHandle''' and returns an output s32 for total entries.
 +
 +
Returns a handle for each controller detected by the system.
 +
 +
== GetAbstractedPadState ==
 +
Takes an input u64 '''AbstractedPadHandle''', returns an output [[#AbstractedPadState]].
 +
 +
== GetAbstractedPadsState ==
 +
Takes a type-0xA output buffer containing an array of u64 '''AbstractedPadHandle''', a type-0x22 output buffer containing an array of [[#AbstractedPadState]], and returns an output s32 for total entries.
 +
 +
== SetAutoPilotVirtualPadState ==
 +
Takes an input s8 '''AbstractedVirtualPadId''' and an input [[#AbstractedPadState]], no output.
 +
 +
== UnsetAutoPilotVirtualPadState ==
 +
Takes an input s8 '''AbstractedVirtualPadId''', no output.
 +
 +
Clears AutoPilot state for the specified pad.
 +
 +
== UnsetAllAutoPilotVirtualPadState ==
 +
No input/output.
 +
 +
Same as [[#UnsetAutoPilotVirtualPadState]] except this clears state for every pad.
    
== AttachHdlsWorkBuffer ==
 
== AttachHdlsWorkBuffer ==
Line 713: Line 748:  
== SetHdlsState ==
 
== SetHdlsState ==
 
Takes an input [[#HdlsState]] and an input 8-byte '''HdlsHandle''', no output.
 
Takes an input [[#HdlsState]] and an input 8-byte '''HdlsHandle''', no output.
 +
 +
== AbstractedPadState ==
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset || Size || Description
 +
|-
 +
| 0x0 || 0x4 || Type, only 1 bit can be set. Converted to [[#HdlsDeviceInfo]]::type internally by [[#SetAutoPilotVirtualPadState]].
 +
|-
 +
| 0x4 || 0x1 || Flags. [[#SetAutoPilotVirtualPadState]] only uses bit0: when clear it will skip using the rest of the input and run [[#UnsetAutoPilotVirtualPadState]] internally.
 +
|-
 +
| 0x5 || 0x3 || Padding
 +
|-
 +
| 0x8 || 0x4 || RGBA Single Body Color
 +
|-
 +
| 0xC || 0x4 || RGBA Single Buttons Color
 +
|-
 +
| 0x10 || 0x1 || Type2. See [[#HiddbgHdlsDeviceInfo]]::type2.
 +
|-
 +
| 0x11 || 0x3 || Padding
 +
|-
 +
| 0x14 || 0x24 || [[#HdlsState]]. Unknown if the last 4-bytes are included in this struct, [[#SetAutoPilotVirtualPadState]]/[[#hiddbgGetAbstractedPadsState]] only uses the first 0x20-bytes.
 +
|-
 +
| 0x38 || 0x60 || Unused with [[#SetAutoPilotVirtualPadState]]/[[#GetAbstractedPadsState]].
 +
|}
 +
 +
Normally the input state is merged with an existing controller selected by Type. However in some cases (BIT(2-5) with type2!=0x2 and BIT(31)) it's detected as a dedicated controller.
 +
 +
Type:
 +
{| class="wikitable" border="1"
 +
!  Bits
 +
!  [[#HdlsDeviceInfo]]::type bits
 +
!  Description
 +
!  Notes
 +
|-
 +
| 0 || 0 || ||
 +
|-
 +
| 1 || 15 || || [[#DeviceType]] |= BIT(1)
 +
|-
 +
| 2 || 1 || ||
 +
|-
 +
| 3 || 2 || ||
 +
|-
 +
| 4 || 1 || ||
 +
|-
 +
| 5 || 2 || ||
 +
|-
 +
| 6 || 3 || ||
 +
|-
 +
| 7 || 11 || || [[#DeviceType]] |= BIT(11)
 +
|-
 +
| 8 || 12 || || [[#DeviceType]] |= BIT(12)
 +
|-
 +
| 9 || 13 || || [[#DeviceType]] |= BIT(13)
 +
|-
 +
| 10 || 14 || || [[#DeviceType]] |= BIT(14)
 +
|-
 +
| 11 || 15 || || [[#DeviceType]] |= BIT(11)
 +
|-
 +
| 12 || 12 || || [[#DeviceType]] |= BIT(12)
 +
|-
 +
| 13 || 13 || || [[#DeviceType]] |= BIT(13)
 +
|-
 +
| 14 || 14 || || [[#DeviceType]] |= BIT(14)
 +
|-
 +
| 15 || 17 || ||
 +
|-
 +
| 31 || 21 || || [[#DeviceType]] = BIT(31)
 +
|-
 +
|}
 +
 +
The above "[[#DeviceType]] |=" notes only apply when type2 is 0x2.
    
== HdlsNpadAssignment ==
 
== HdlsNpadAssignment ==
This is a 0x208-byte struct. This seems to be an array, structure unknown.
+
{| class="wikitable" border="1"
 +
|-
 +
! Offset || Size || Description
 +
|-
 +
| 0x0 || 0x4 || s32 Total entries
 +
|-
 +
| 0x4 || 0x4 || Padding
 +
|-
 +
| 0x8 || 0x200(0x20*0x10) || Array of [[#HdlsNpadAssignmentEntry]].
 +
|}
 +
 
 +
This is a 0x208-byte struct.
 +
 
 +
=== HdlsNpadAssignmentEntry ===
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset || Size || Description
 +
|-
 +
| 0x0 || 0x8 || HdlsHandle
 +
|-
 +
| 0x8 || 0x4 || ?
 +
|-
 +
| 0xC || 0x4 || ?
 +
|-
 +
| 0x10 || 0x8 || ?
 +
|-
 +
| 0x18 || 0x1 || ?
 +
|-
 +
| 0x19 || 0x7 || Padding
 +
|}
 +
 
 +
This is a 0x20-byte struct.
    
== HdlsStateList ==
 
== HdlsStateList ==
Line 722: Line 859:  
! Offset || Size || Description
 
! Offset || Size || Description
 
|-
 
|-
| 0x0 || 0x4 || Total entries
+
| 0x0 || 0x4 || s32 Total entries
 
|-
 
|-
 
| 0x4 || 0x4 || Padding
 
| 0x4 || 0x4 || Padding
Line 754: Line 891:  
! Offset || Size || Description
 
! Offset || Size || Description
 
|-
 
|-
| 0x0 || 0x4 || [[#NpadStyleTag]], only one bit can be set.
+
| 0x0 || 0x4 || Only one bit can be set, see below.
 
|-
 
|-
 
| 0x4 || 0x4 || RGBA Single Body Color
 
| 0x4 || 0x4 || RGBA Single Body Color
Line 760: Line 897:  
| 0x8 || 0x4 || RGBA Single Buttons Color
 
| 0x8 || 0x4 || RGBA Single Buttons Color
 
|-
 
|-
| 0xC || 0x1 || Unknown
+
| 0xC || 0x1 || Additional type field used with the above type field, 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 bit21: 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.
 
|-
 
|-
 
| 0xD || 0x3 || Padding
 
| 0xD || 0x3 || Padding
Line 766: Line 903:     
This is a 0x10-byte struct.
 
This is a 0x10-byte struct.
 +
 +
Bits for the above type field:
 +
 +
{| class="wikitable" border="1"
 +
!  Bits
 +
!  Description
 +
!  Notes
 +
|-
 +
| 0-7
 +
|
 +
| 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.
 +
|-
 +
| 8-10
 +
|
 +
| Pro Controller
 +
|-
 +
| 11
 +
|
 +
| Famicom left controller
 +
|-
 +
| 12
 +
|
 +
| Famicom right controller (with microphone)
 +
|-
 +
| 13
 +
|
 +
| NES left controller
 +
|-
 +
| 14
 +
|
 +
| NES right controller
 +
|-
 +
| 15-16
 +
|
 +
| Invalid
 +
|-
 +
| 17
 +
|
 +
| Generic external controller
 +
|-
 +
| 18-20
 +
|
 +
| Invalid
 +
|-
 +
| 21-23
 +
|
 +
| Generic controller
 +
|}
    
== HdlsState ==
 
== HdlsState ==
Line 772: Line 957:  
! Offset || Size || Description
 
! Offset || Size || Description
 
|-
 
|-
| 0x0 || 0x8 || Unknown
+
| 0x0 || 0x1 || powerConnected for the main [[HID_Shared_Memory#Controllers|PowerInfo]].
 +
|-
 +
| 0x1 || 0x1 || ORRed with powerConnected to set the value of the first byte for the controller [[HID_Shared_Memory#Flags|flags]].
 +
|-
 +
| 0x2 || 0x6 || Unknown
 
|-
 
|-
 
| 0x8 || 0x4 || batteryCharge for the main [[HID_Shared_Memory#Controllers|PowerInfo]].
 
| 0x8 || 0x4 || batteryCharge for the main [[HID_Shared_Memory#Controllers|PowerInfo]].
 
|-
 
|-
| 0xC || 0x4 || Buttons
+
| 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]].
 
| 0x10 || 0x10(4*2*2) || Joystick data, see [[HID_Shared_Memory#Controller_State]].
 
|-
 
|-
| 0x20 || 0x4 || Unused
+
| 0x20 || 0x1 || Unused for input. Set with output from [[#DumpHdlsStates]] (zero in some cases).
 +
|-
 +
| 0x21 || 0x3 || Padding
 
|}
 
|}
   Line 840: Line 1,031:  
| 309 || [5.0.0+] GetNpadFullKeyGripColor
 
| 309 || [5.0.0+] GetNpadFullKeyGripColor
 
|-
 
|-
| 310 || [6.0.0+] GetMaskedSupportedNpadStyleSet
+
| 310 || [6.0.0+] [[#GetMaskedSupportedNpadStyleSet]]
 
|-
 
|-
 
| 311 || SetNpadPlayerLedBlinkingDevice
 
| 311 || SetNpadPlayerLedBlinkingDevice
Line 1,010: Line 1,201:  
| 1150 || [8.0.0+] SetTouchScreenMagnification
 
| 1150 || [8.0.0+] SetTouchScreenMagnification
 
|}
 
|}
 +
 +
== GetMaskedSupportedNpadStyleSet ==
 +
Takes an input u64 AppletResourceUserId, returns an output u32 [[#NpadStyleTag]].
 +
 +
Official sw uses the output from [[Applet_Manager_services|GetAppletResourceUserIdOfCallerApplet]] with this.
    
== GetUniquePadsFromNpad ==
 
== GetUniquePadsFromNpad ==
Line 1,214: Line 1,410:  
|-
 
|-
 
| 0x35 || 0x1 || Set to value 1.
 
| 0x35 || 0x1 || Set to value 1.
 +
|}
 +
 +
== DeviceType ==
 +
This is a bitmask describing the controller device type.
 +
 +
{| class="wikitable" border="1"
 +
!  Bits
 +
!  Description
 +
!  Notes
 +
|-
 +
| 0
 +
| FullKey
 +
| Pro Controller and Gc controller.
 +
|-
 +
| 1
 +
|
 +
| Unknown
 +
|-
 +
| 2
 +
| HandheldLeft
 +
| Joy-Con/Famicom/NES left controller in handheld mode.
 +
|-
 +
| 3
 +
| HandheldRight
 +
| Joy-Con/Famicom/NES right controller in handheld mode.
 +
|-
 +
| 4
 +
| JoyLeft
 +
| Joy-Con left controller.
 +
|-
 +
| 5
 +
| JoyRight
 +
| Joy-Con right controller.
 +
|-
 +
| 6
 +
| Palma
 +
| Poké Ball Plus controller.
 +
|-
 +
| 7
 +
| LarkLeft (HVC)
 +
| Famicom left controller.
 +
|-
 +
| 8
 +
| LarkRight (HVC)
 +
| Famicom right controller (with microphone).
 +
|-
 +
| 9
 +
| LarkLeft (NES)
 +
| NES left controller.
 +
|-
 +
| 10
 +
| LarkRight (NES)
 +
| NES right controller.
 +
|-
 +
| 11-14
 +
|
 +
| Reserved
 +
|-
 +
| 15
 +
| SystemExt
 +
| Generic external controller.
 +
|-
 +
| 16-30
 +
|
 +
| Reserved
 +
|-
 +
| 31
 +
| System
 +
| Generic controller.
 
|}
 
|}
   Line 1,320: Line 1,585:     
== GetNpadIrCameraHandle ==
 
== GetNpadIrCameraHandle ==
Takes an input u32. Returns an output [[#IrCameraHandle]].
+
Takes an input u32 NpadTypeId. Returns an output [[#IrCameraHandle]].
    
== RunPointingProcessor ==
 
== RunPointingProcessor ==
Line 1,596: Line 1,861:  
     ├── NTD_4CD_2602.fts256
 
     ├── NTD_4CD_2602.fts256
 
     ├── NTD_4CD_3801.fts256
 
     ├── NTD_4CD_3801.fts256
     └── NTD_4CD_xxxx.fts256
+
     └── NTD_4CD_xxxx.fts256 [7.0.0+]
    
These are firmware files for the touchscreen controller.
 
These are firmware files for the touchscreen controller.
    
= Firmware update =
 
= Firmware update =
Starting with [[3.0.0]] HID-sysmodule now contains strings for data stored in title [[Title_list|0100000000000822]].
+
HID-sysmodule mounts the contents of title [[Title_list|0100000000000822]] as "systemData" or the contents of title [[Title_list|010000000000B22B]] as "systemDataD". Both titles contain the same files, but [[Title_list|0100000000000822]] is used on retail units while [[Title_list|010000000000B22B]] is used for development.
 +
 
 +
These titles contain the following files:
 +
* '''ExpectVersionInfo.csv''' - List in the format "[device],[type],[version]" where "device" can be "JoyLeft", "JoyRight", "FullKey" or "Palma", "type" can be "BT", "MCU" or "USB" and "version" is the hexadecimal representation of the firmware file's version.
 +
* '''FirmwareInfo.csv''' - List in the format "[device],[type],[version],[file]" where "device", "type" and "version" should match the values from "ExpectVersionInfo" and "file" is the name of the firmware file.
 +
* '''ukyosakyo_ep2_ota.bin''' - Left/Right Joy-Con BT firmware.
 +
* '''raizo_ep2_ota.bin''' - Pro Controller BT firmware.
 +
* '''tera_ota.bin''' - Right Joy-Con MCU firmware.
 +
* '''tera_ota_iap.bin''' - Right Joy-Con MCU (IAP profile) firmware.
 +
* '''tera_fullkey_ota.bin''' - Pro Controller MCU firmware.
 +
* '''tera_fullkey_ota_iap.bin''' - Pro Controller MCU (IAP profile) firmware.
 +
* [6.0.0+] '''ProController.dfu''' - Pro Controller USB firmware.
 +
* [6.1.0+] '''PalmaFw.bin''' - Poké Ball Plus BT firmware.
    
[[Category:Services]]
 
[[Category:Services]]

Navigation menu