HID services: Difference between revisions
No edit summary |
No edit summary |
||
(41 intermediate revisions by 2 users not shown) | |||
Line 1,148: | Line 1,148: | ||
= irs = | = irs = | ||
This is "nn::irsensor::IIrSensorServer". | This is "nn::irsensor::IIrSensorServer". | ||
This was added to sdknso with 3.x. | |||
With sdknso versions pre-4.x PointingProcessor used to be DpdProcessor. The [[#PackedPointingProcessorConfig|packed-config]] with DpdProcessor (besides RequiredMcuVersion) used to be initialized from user-specified config, now it's hard-coded. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,199: | Line 1,203: | ||
Takes a PID-descriptor and an [[AM_services|AppletResourceUserId]]. Returns a SharedMemory handle. | Takes a PID-descriptor and an [[AM_services|AppletResourceUserId]]. Returns a SharedMemory handle. | ||
The SharedMemory is mapped with | The SharedMemory is "nn::irsensor::detail::StatusManager". It's mapped with permission read-only and size 0x8000. | ||
It's structure is as follows: | |||
== | {| class="wikitable" border="1" | ||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x7FB0 || Array of [[#DeviceFormat]] | |||
|- | |||
| 0x7FB0 || 0x50 || Array of [[#AruidFormat]] | |||
|} | |||
The array of [[#DeviceFormat]] is indexed by [[#IrCameraHandle|PlayerNumber]] and can hold up to 9 entries. The array of [[#AruidFormat]] can only hold up to 5 entries. | |||
== | === DeviceFormat === | ||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x4 || [[#IrCameraStatus]] | |||
|- | |||
| 0x4 || 0x4 || [[#IrCameraInternalStatus]] | |||
|- | |||
| 0x8 || 0x8 || [[#IrSensorMode]] | |||
|- | |||
| 0x10 || 0xE20 || [[#ProcessorStateRingLifo]] | |||
|} | |||
==== ProcessorStateRingLifo ==== | |||
This is "nn::irsensor::detail::RingLifo<X,Y>" where "X" is a specialized processor state (e.g.: "nn::irsensor::MomentProcessorState") and "Y" is the maximum element count (e.g.: 5). | |||
== | {| class="wikitable" border="1" | ||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x8 || Start | |||
|- | |||
| 0x8 || 0x4 || Count | |||
|- | |||
| 0xC || 0x4 || Padding | |||
|- | |||
| 0x10 || Variable || ProcessorState | |||
|} | |||
The maximum element count is 6 for [[#PointingProcessorMarkerState]] or 5 for any of the other states. | |||
ProcessorState is specialized depending on the value of [[#IrSensorMode]]. | |||
== | ===== MomentProcessorState ===== | ||
This is "nn::irsensor::MomentProcessorState". | |||
== | {| class="wikitable" border="1" | ||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x8 || SamplingNumber | |||
|- | |||
| 0x8 || 0x8 || TimeStamp | |||
|- | |||
| 0x10 || 0x4 || AmbientNoiseLevel | |||
|- | |||
| 0x14 || 0x4 || Reserved | |||
|- | |||
| 0x18 || 0x240 || Array of [[#MomentStatistic]] | |||
|} | |||
The array of [[#MomentStatistic]] can hold up to 48 entries. This array can be accessed as [y + x*8] (this is a 6x8 array). region_x = image_x/6, region_y = image_y/8. | |||
== | ====== MomentStatistic ====== | ||
In sdknso GetMomentProcessorStates, this loops through each MomentProcessorState->MomentStatistic entry: <code>AverageIntensity *= scale;</code> The scale is calculated with: <code>scale = 76800.0f / (float)([[#PackedMomentProcessorConfig|WindowOfInterest]].width * [[#PackedMomentProcessorConfig|WindowOfInterest]].height);</code> Note that <code>76800 == 320*240</code>, hence with the default width/height the calculated scale is 1.0f. | |||
== | |||
== | |||
== | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! | ! Offset || Size || Description | ||
|- | |- | ||
| | | 0x0 || 0x4 || float AverageIntensity | ||
|- | |- | ||
| | | 0x4 || 0x4 || float CentroidX | ||
| | |||
| | |||
|- | |- | ||
| | | 0x8 || 0x4 || float CentroidY | ||
|} | |} | ||
== | ===== ClusteringProcessorState ===== | ||
This is "nn::irsensor::ClusteringProcessorState". | |||
== | |||
This is "nn:: | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! | ! Offset || Size || Description | ||
|- | |||
| 0x0 || 0x8 || SamplingNumber | |||
|- | |- | ||
| | | 0x8 || 0x8 || TimeStamp | ||
|- | |- | ||
| | | 0x10 || 0x1 || ObjectCount | ||
|- | |- | ||
| | | 0x11 || 0x3 || Reserved | ||
|- | |- | ||
| | | 0x14 || 0x4 || AmbientNoiseLevel | ||
|- | |- | ||
| | | 0x18 || 0x180 || Array of [[#ClusteringData]] | ||
|} | |} | ||
The array of [[#ClusteringData]] can hold up to 16 entries. | |||
====== ClusteringData ====== | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! | ! Offset || Size || Description | ||
|- | |- | ||
| | | 0x0 || 0x4 || float AverageIntensity | ||
|- | |- | ||
| | | 0x4 || 0x4 || float CentroidX | ||
|- | |- | ||
| | | 0x8 || 0x4 || float CentroidY | ||
|- | |- | ||
| | | 0xC || 0x4 || PixelCount | ||
|- | |- | ||
| | | 0x10 || 0x2 || BoundX | ||
|- | |- | ||
| | | 0x12 || 0x2 || BoundY | ||
|- | |- | ||
| | | 0x14 || 0x2 || BoundtWidth | ||
|- | |- | ||
| | | 0x16 || 0x2 || BoundHeight | ||
|} | |||
===== PointingProcessorMarkerState ===== | |||
This is "nn::irsensor::PointingProcessorMarkerState". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x8 || SamplingNumber | |||
|- | |||
| 0x8 || 0x8 || TimeStamp | |||
|- | |||
| 0x10 || 0x1 || PointingStatus | |||
|- | |||
| 0x11 || 0xB || Reserved | |||
|- | |||
| 0x1C || 0x4 || float PositionX | |||
|- | |||
| 0x20 || 0x4 || float PositionY | |||
|- | |||
| 0x24 || 0xC || Reserved | |||
|- | |||
| 0x30 || 0x1 || PointingStatus | |||
|- | |||
| 0x31 || 0xB || Reserved | |||
|- | |||
| 0x3C || 0x4 || float PositionX | |||
|- | |||
| 0x40 || 0x4 || float PositionY | |||
|- | |||
| 0x44 || 0xC || Reserved | |||
|- | |- | ||
| | | 0x50 || 0x1 || PointingStatus | ||
|- | |- | ||
| | | 0x51 || 0xB || Reserved | ||
|- | |- | ||
| | | 0x5C || 0x4 || float PositionX | ||
|- | |- | ||
| | | 0x60 || 0x4 || float PositionY | ||
|- | |- | ||
| | | 0x64 || 0xC || Reserved | ||
|} | |} | ||
===== PointingProcessorState ===== | |||
This is "nn::irsensor::PointingProcessorState". | |||
This is created from [[#PointingProcessorMarkerState]]. | |||
This is | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! | ! Offset || Size || Description | ||
|- | |||
| 0x0 || 0x8 || SamplingNumber | |||
|- | |||
| 0x8 || 0x8 || TimeStamp | |||
|- | |||
| 0x10 || 0x4 || PointingStatus | |||
|- | |||
| 0x14 || 0x4 || float PositionX | |||
|- | |||
| 0x18 || 0x4 || float PositionY | |||
|- | |- | ||
| | | 0x1C || 0x4 || Reserved | ||
|} | |} | ||
=== | ===== TeraPluginProcessorState ===== | ||
This is "nn::irsensor::TeraPluginProcessorState". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x8 || SamplingNumber | |||
|- | |||
| 0x8 || 0x8 || TimeStamp | |||
|- | |||
| 0x10 || 0x4 || AmbientNoiseLevel | |||
|- | |||
| 0x14 || 0x12C || PluginData | |||
|} | |||
== | ===== AdaptiveClusteringProcessorState ===== | ||
This is "nn:: | This is "nn::irsensor::AdaptiveClusteringProcessorState". | ||
This | This is created from [[#TeraPluginProcessorState]]. | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! | ! Offset || Size || Description | ||
|- | |- | ||
| | | 0x0 || 0x8 || SamplingNumber | ||
| | |||
|- | |- | ||
| 0x8 || 0x8 || TimeStamp | |||
|- | |- | ||
| | | 0x10 || 0x4 || AmbientNoiseLevel | ||
|- | |- | ||
| | | 0x14 || 0x4 || AccuracyLevel | ||
|- | |- | ||
| | | 0x18 || 0x1 || ObjectCount | ||
|- | |- | ||
| | | 0x19 || 0x1 || BackgroundIntensity | ||
|- | |- | ||
| | | 0x1A || 0x6 || Reserved | ||
|- | |- | ||
| | | 0x20 || 0x200 || Array of [[#AdaptiveClusteringData]] | ||
|} | |} | ||
The array of [[#AdaptiveClusteringData]] can hold up to 16 entries. | |||
====== AdaptiveClusteringData ====== | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! | ! Offset || Size || Description | ||
|- | |- | ||
| | | 0x0 || 0x4 || float CentroidX | ||
|- | |- | ||
| | | 0x4 || 0x4 || float CentroidY | ||
|- | |- | ||
| | | 0x8 || 0x4 || float Area | ||
|- | |- | ||
| | | 0xC || 0x4 || IsIncomplete | ||
|} | |||
===== HandAnalysisImageState ===== | |||
This is "nn::irsensor::HandAnalysisImageState". | |||
This is created from [[#TeraPluginProcessorState]]. | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Offset || Size || Description | ||
|- | |- | ||
| | | 0x0 || 0x8 || SamplingNumber | ||
|- | |- | ||
| | | 0x8 || 0x4 || AmbientNoiseLevel | ||
|- | |- | ||
| | | 0xC || 0x960 || Image | ||
|- | |- | ||
| | | 0x96C || 0x4 || Reserved | ||
|} | |||
===== HandAnalysisSilhouetteState ===== | |||
This is "nn::irsensor::HandAnalysisSilhouetteState". | |||
This is created from [[#TeraPluginProcessorState]]. | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Offset || Size || Description | ||
|- | |- | ||
| | | 0x0 || 0x8 || SamplingNumber | ||
|- | |- | ||
| | | 0x8 || 0x4 || AmbientNoiseLevel | ||
|- | |- | ||
| | | 0xC || 0x1354 || Unknown | ||
|} | |||
===== HandAnalysisSilhouetteStateWithFullFrameShape ===== | |||
This is "nn::irsensor::HandAnalysisSilhouetteStateWithFullFrameShape". | |||
This is created from [[#TeraPluginProcessorState]]. | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Offset || Size || Description | ||
|- | |- | ||
| | | 0x0 || 0x8 || SamplingNumber | ||
|- | |- | ||
| | | 0x8 || 0x4 || AmbientNoiseLevel | ||
|- | |- | ||
| | | 0xC || 0x156C || Unknown | ||
|} | |||
=== AruidFormat === | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Offset || Size || Description | ||
|- | |- | ||
| | | 0x0 || 0x8 || IrSensorAruid | ||
|- | |- | ||
| | | 0x8 || 0x8 || IrSensorAruidStatus | ||
|} | |} | ||
[ | == StopImageProcessor == | ||
Takes a PID-descriptor, an [[#IrCameraHandle]], and an [[AM_services|AppletResourceUserId]]. No output. | |||
[ | == RunMomentProcessor == | ||
Takes a PID-descriptor, an [[#IrCameraHandle]], an [[AM_services|AppletResourceUserId]], and a [[#PackedMomentProcessorConfig]]. No output. | |||
= | == RunClusteringProcessor == | ||
Takes a PID-descriptor, an [[#IrCameraHandle]], an [[AM_services|AppletResourceUserId]], and a [[#PackedClusteringProcessorConfig]]. No output. | |||
== RunImageTransferProcessor == | |||
Takes a PID-descriptor, an [[#IrCameraHandle]], an [[AM_services|AppletResourceUserId]], a [[#PackedImageTransferProcessorConfig]], an u64 for the TransferMemory's size, and a TransferMemory handle. No output. | |||
The TransferMemory is created with an user specified buffer and permission none. | |||
== GetImageTransferProcessorState == | |||
Takes a PID-descriptor, a type-0x6 output buffer, an [[#IrCameraHandle]], and an [[AM_services|AppletResourceUserId]]. Returns an [[#ImageTransferProcessorState]]. No output. | |||
== RunTeraPluginProcessor== | |||
Takes a PID-descriptor, an [[#IrCameraHandle]], a [[#PackedTeraPluginProcessorConfig]] (immediately after the previous word), and an [[AM_services|AppletResourceUserId]]. No output. | |||
== GetNpadIrCameraHandle == | |||
Takes an input [[#NpadIdType]]. Returns an output [[#IrCameraHandle]]. | |||
== RunPointingProcessor == | |||
Takes a PID-descriptor, an [[#IrCameraHandle]], a [[#PackedPointingProcessorConfig]] (immediately after the previous word), and an [[AM_services|AppletResourceUserId]]. No output. | |||
== SuspendImageProcessor == | |||
Takes a PID-descriptor, an [[#IrCameraHandle]], and an [[AM_services|AppletResourceUserId]]. No output. | |||
| | |||
sdknso | sdknso uses this from the Run*Processor funcs to suspend the current Processor when the current [[#PackedFunctionLevel|FunctionLevel]] is >= 0x1, prior to starting another Processor if needed (depending on what Processor was already active via a state field). Hence, this cmd is only used with [4.0.0+]. | ||
== | == CheckFirmwareVersion == | ||
Takes an | Takes a PID-descriptor, an [[#IrCameraHandle]], a [[#PackedMcuVersion]], and an [[AM_services|AppletResourceUserId]]. No output. | ||
sdknso didn't actually use this until 4.x (the RequiredMcuVersion was also updated with that version). | |||
== SetFunctionLevel == | |||
Takes a PID-descriptor, an [[#IrCameraHandle]], a [[#PackedFunctionLevel]], and an [[AM_services|AppletResourceUserId]]. No output. | |||
== RunImageTransferExProcessor == | |||
Takes a PID-descriptor, an [[#IrCameraHandle]], an [[AM_services|AppletResourceUserId]], a [[#PackedImageTransferProcessorExConfig]], an u64 for the TransferMemory's size, and a TransferMemory handle. No output. | |||
The TransferMemory is created with an user specified buffer and permission none. | |||
== RunIrLedProcessor == | |||
Takes a PID-descriptor, an [[#IrCameraHandle]], a [[#PackedIrLedProcessorConfig]] (immediately after the previous word), and an [[AM_services|AppletResourceUserId]]. No output. | |||
== | == StopImageProcessorAsync == | ||
Takes an | Takes a PID-descriptor, an [[#IrCameraHandle]], and an [[AM_services|AppletResourceUserId]]. No output. | ||
== ActivateIrsensorWithFunctionLevel == | |||
Takes a PID-descriptor, an [[#PackedFunctionLevel]], and an [[AM_services|AppletResourceUserId]]. No output. | |||
= | = irs:sys = | ||
This is "nn::irsensor::IIrSensorSystemServer". | |||
== | {| class="wikitable" border="1" | ||
|- | |||
! Cmd || Name | |||
|- | |||
| 500 || [[#SetAppletResourceUserId]] | |||
|- | |||
| 501 || [[#RegisterAppletResourceUserId]] | |||
|- | |||
| 502 || [[#UnregisterAppletResourceUserId]] | |||
|- | |||
| 503 || [[#EnableAppletToGetInput]] | |||
|} | |||
== SetAppletResourceUserId == | |||
Takes an [[AM_services|AppletResourceUserId]]. No output. | |||
== RegisterAppletResourceUserId == | |||
Takes a bool and an [[AM_services|AppletResourceUserId]]. No output. | |||
== | == UnregisterAppletResourceUserId == | ||
Takes an | Takes an [[AM_services|AppletResourceUserId]]. No output. | ||
== | == EnableAppletToGetInput == | ||
Takes a | Takes a bool and an [[AM_services|AppletResourceUserId]]. No output. | ||
= | = ahid:cd = | ||
This is "nn::ahid::IServerSession". | |||
Used for USB HID devices. | |||
This service no longer exists in [9.0.0+]. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! | ! Cmd || Name | ||
|- | |- | ||
| | | 0 || [[#AcquireDevice]] | ||
|- | |- | ||
| | | 1 || [[#ReleaseDevice]] | ||
|- | |- | ||
| | | 2 || [[#GetCtrlSession]] | ||
|- | |- | ||
| | | 3 || [[#GetReadSession]] | ||
|- | |- | ||
| | | 4 || [1.0.0-2.3.0] [[#GetWriteSession]] | ||
|} | |} | ||
== | == AcquireDevice == | ||
Takes | Takes an input s32, no output. | ||
== ReleaseDevice == | |||
Takes an input s32, no output. | |||
== GetCtrlSession == | |||
Takes an input u32, returns an [[#ICtrlSession]]. | |||
== GetReadSession == | |||
Takes an input u32, returns an [[#IReadSession]]. | |||
== GetWriteSession == | |||
Takes an input u32, returns an [[#IWriteSession]]. | |||
== ICtrlSession == | |||
This is "nn::ahid::ICtrlSession". | |||
This no longer exists in [9.0.0+]. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! | ! Cmd || Name | ||
|- | |- | ||
| | | 0 || GetString | ||
|- | |- | ||
| | | 1 || GetCodeBook | ||
|- | |- | ||
| | | 2 || GetReport | ||
|- | |- | ||
| | | 3 || SetReport | ||
|- | |- | ||
| 4 || GetIdle | |||
|- | |- | ||
| | | 5 || SetIdle | ||
|- | |- | ||
| | | 6 || GetProtocol | ||
|- | |- | ||
| | | 7 || SetProtocol | ||
|- | |- | ||
| | | 8 || GetDescriptor | ||
|- | |- | ||
| 9 || SetDescriptor | |||
|- | |- | ||
| | | 10 || GetStateChangeEvent | ||
|- | |- | ||
| | | 11 || SignalStateChangeEvent | ||
|- | |- | ||
| | | 12 || [3.0.0+] Write | ||
|} | |} | ||
All of these use USB [[USB_services|CtrlXfer]], except for GetStateChangeEvent and SignalStateChangeEvent, and GetCodeBook which copies 0x4000-bytes from state to output. | |||
== | == IReadSession == | ||
This is "nn::ahid::IReadSession". | |||
This | This no longer exists in [9.0.0+]. | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
| | ! Cmd || Name | ||
|- | |- | ||
| | | 0 || [[#Read]] | ||
|} | |} | ||
= | === Read === | ||
This is "nn:: | Uses [[USB_services|PostBufferAsync]] etc with the INPUT endpoint. The size must be <=0x1000. The actual transfer size is returned in an output u64. The data is copied from the tmpbuf to the output buffer using the actual-transfer-size. | ||
[3.0.0+] Now takes a total of 8-bytes of input. | |||
== IWriteSession == | |||
This is "nn::ahid::IWriteSession". | |||
This was removed with [3.0.0+]. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
| | ! Cmd || Name | ||
| | |||
|- | |- | ||
| | | 0 || [[#Write]] | ||
| | |} | ||
| | === Write === | ||
| | This is the inverse of [[#IReadSession]] cmd0. Uses the OUTPUT endpoint with an input buffer. | ||
| | |||
| | = ahid:hdr = | ||
This is "nn::ahid::hdr::ISession". | |||
Used internally for USB HID devices. | |||
This service no longer exists in [9.0.0+]. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Cmd || Name | |||
|- | |- | ||
| | | 0 || GetDeviceEntries | ||
| | |||
| | |||
|- | |- | ||
| | | 1 || GetDeviceList | ||
| | |||
| | |||
|- | |- | ||
| | | 2 || GetDeviceParameters | ||
| | |||
| | |||
|- | |- | ||
| | | 3 || AttachDevice | ||
| | |||
| | |||
|- | |- | ||
| | | 4 || DetachDevice | ||
| | |||
| | |||
|- | |- | ||
| | | 5 || [6.0.0+] SetDeviceFilter | ||
| | |} | ||
| | |||
= xcd:sys = | |||
This is "nn::xcd::detail::ISystemServer". | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Cmd || Name | ||
| | |||
|- | |- | ||
| | | 0 || GetDataFormat | ||
| | |||
| | |||
|- | |- | ||
| | | 1 || SetDataFormat | ||
| | |||
| | |||
|- | |- | ||
| | | 2 || GetMcuState | ||
| | |||
| | |||
|- | |- | ||
| | | 3 || SetMcuState | ||
| | |||
| | |||
|- | |- | ||
| | | 4 || GetMcuVersionForNfc | ||
|- | |- | ||
| | | 5 || CheckNfcDevicePower | ||
|- | |- | ||
| | | 6 || [5.0.0+] SetMcuStateImmediate | ||
|- | |- | ||
| | | 10 || SetNfcEvent | ||
|- | |- | ||
| | | 11 || GetNfcInfo | ||
|- | |- | ||
| | | 12 || StartNfcDiscovery | ||
|- | |- | ||
| | | 13 || StopNfcDiscovery | ||
|- | |||
| 14 || StartNtagRead | |||
|- | |||
| 15 || StartNtagWrite | |||
|- | |- | ||
| | | 16 || SendNfcRawData | ||
|- | |- | ||
| | | 17 || RegisterMifareKey | ||
|- | |- | ||
| | | 18 || ClearMifareKey | ||
|- | |- | ||
| | | 19 || StartMifareRead | ||
|- | |- | ||
| | | 20 || StartMifareWrite | ||
|- | |- | ||
| | | 101 || GetAwakeTriggerReasonForLeftRail | ||
|- | |- | ||
| | | 102 || GetAwakeTriggerReasonForRightRail | ||
|} | |} | ||
= | [5.0.0+] SetDataFormat, SetMcuState, and ClearMifareKey: now takes a total of 0xC-bytes of input instead of 0x10. | ||
[6.0.0+]: The buffer type used by GetNfcInfo is now 0x32 instead of 0x1A. | |||
= hidbus = | |||
This is "nn::hidbus::IHidbusServer". | |||
This was added with [5.0.0+]. | |||
Official sw opens a temporary service-session for each func using this, with it being closed once done: no global session is kept open. | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! | ! Cmd || Name | ||
|- | |- | ||
| | | 1 || [[#GetBusHandle]] | ||
|- | |- | ||
| | | 2 || [[#IsExternalDeviceConnected]] | ||
|- | |- | ||
| | | 3 || [[#Initialize]] | ||
|- | |- | ||
| | | 4 || [[#Finalize]] | ||
|- | |- | ||
| | | 5 || [[#EnableExternalDevice]] | ||
|- | |- | ||
| | | 6 || [[#GetExternalDeviceId]] | ||
|- | |- | ||
| | | 7 || [[#SendCommandAsync]] | ||
|- | |- | ||
| | | 8 || [[#GetSendCommandAsynceResult]] | ||
|- | |- | ||
| | | 9 || [[#SetEventForSendCommandAsycResult]] | ||
|- | |- | ||
| | | 10 || [[#GetSharedMemoryHandle]] | ||
|- | |- | ||
| | | 11 || [[#EnableJoyPollingReceiveMode]] | ||
|- | |- | ||
| | | 12 || [[#DisableJoyPollingReceiveMode]] | ||
|- | |- | ||
| | | 13 || [5.0.0-6.2.0] GetPollingData | ||
|- | |- | ||
| 14 || [6.0.0+] [[#SetStatusManagerType]] | |||
|} | |||
|} | |||
sdknso doesn't use the GetPollingData cmd. | |||
= | == GetBusHandle == | ||
This is | Takes an input u32 [[#NpadIdType]], an u64 [[#BusType]], an u64 [[AM_services|AppletResourceUserId]], returns an output u8 bool and a [[#BusHandle]]. | ||
The bool indicates whether the [[#BusHandle]] is valid. | |||
Official sw will assert when [[#BusHandle]] InternalIndex is >=0x11 (>=0x13 with [6.0.0+]). This same check is also done for all funcs using [[#BusHandle]] as input. | |||
This cmd will throw an error when [[#BusType]] is invalid. | |||
= | == IsExternalDeviceConnected == | ||
Takes an input [[#BusHandle]], returns an output u8 bool. | |||
This is not used by sdknso. | |||
== Initialize == | |||
Takes an input [[#BusHandle]], an u64 [[AM_services|AppletResourceUserId]], no output. | |||
| | |||
Prior to using this cmd, sdknso handles [[#GetSharedMemoryHandle|sharedmem]] mapping if not done previously. | |||
[ | == Finalize == | ||
Takes an input [[#BusHandle]], an u64 [[AM_services|AppletResourceUserId]], no output. | |||
== EnableExternalDevice == | |||
Takes an input u8 bool, a [[#BusHandle]], an u64, an u64 [[AM_services|AppletResourceUserId]], no output. | |||
sdknso passes value 0x38900050018 (0x3A600050018 with 7.x+) for the u64. | |||
The bool flag indicates whether to enable the device (true = enable, false = disable). When false, this will use [[#DisableJoyPollingReceiveMode]] if needed. | |||
== GetExternalDeviceId == | |||
Takes an input [[#BusHandle]], returns an output u32 ExternalDeviceId. | |||
= | == SendCommandAsync == | ||
Takes a type-0x21 input buffer and a [[#BusHandle]], no output. | |||
[ | == GetSendCommandAsynceResult == | ||
Takes a type-0x22 output buffer and a [[#BusHandle]], returns an output u32. | |||
Official sw copies the u32 to an output u64, for the actual output size. | |||
== SetEventForSendCommandAsycResult == | |||
Takes an input [[#BusHandle]], returns an output Event handle with EventClearMode=0. | |||
Official sw with SendAndReceive clears this event (6.x+ sdknso), uses [[#SendCommandAsync]], waits on + clears this event, then uses [[#GetSendCommandAsynceResult]]. | |||
== GetSharedMemoryHandle == | |||
No input, returns an output SharedMemory handle. | |||
The SharedMemory is mapped with size 0x1000 and permissions=R--. | |||
See also [[#SetStatusManagerType]]. | |||
This sharedmem is the StatusManager. This sharedmem contains an array of 0x100-byte (0x80-byte with [[#SetStatusManagerType|[6.0.0+]]]) entries, with entry-count {max [[#GetBusHandle|BusHandles]]}. | |||
sdknso only uses the first 0x10-bytes of these entries, the rest is the ignored. Entry structure: | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,928: | Line 1,878: | ||
! Offset || Size || Description | ! Offset || Size || Description | ||
|- | |- | ||
| 0x0 || | | 0x0 || 0x1 || Bool flag | ||
|- | |- | ||
| 0x4 || 0x4 || | | 0x1 || 0x3 || Padding | ||
|- | |||
| 0x4 || 0x4 || Result | |||
|- | |||
| 0x8 || 0x1 || DeviceEnabled. Bool flag indicating whether a device is [[#EnableExternalDevice|enabled]]. | |||
|- | |||
| 0x9 || 0x1 || IsValid. Bool flag indicating whether this entry is valid. | |||
|- | |- | ||
| | | 0xA || 0x1 || PollingEnabled. Bool flag indicating whether polling is [[#EnableJoyPollingReceiveMode|enabled]]. | ||
|- | |- | ||
| | | 0xB || 0x1 || Unknown / padding? | ||
|- | |- | ||
| | | 0xC || 0x4 || [[#JoyPollingMode]] | ||
|} | |} | ||
[ | == EnableJoyPollingReceiveMode == | ||
Takes a type-0x21 input buffer, a TransferMemory handle, an u32 tmem_size, an u32 [[#JoyPollingMode]], a [[#BusHandle]], no output. | |||
The TransferMemory is created with an user-specified output buffer, with permissions=R--. | |||
The content of the TransferMemory depends of the [[#JoyPollingMode]]. This is used by GetJoyPollingReceivedData. Structure of the TransferMemory (DisableSixAxisPollingDataAccessor, EnableSixAxisPollingDataAccessor, JoyButtonOnlyPollingDataAccessor): | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 1,945: | Line 1,906: | ||
! Offset || Size || Description | ! Offset || Size || Description | ||
|- | |- | ||
| 0x0 || | | 0x0 || 0x4 || Result. | ||
|- | |- | ||
| | | 0x0 || 0x4 || Padding. | ||
|- | |- | ||
| | | 0x8 || 0x18 || Initialized sysmodule-side, not used by sdknso. | ||
|- | |- | ||
| | | 0x20 || 0x8 || Latest entry. | ||
|- | |- | ||
| | | 0x28 || 0x8 || Total entries. | ||
|} | |} | ||
The entries specific to the [[#JoyPollingMode]] follow, with 0xA entries total. Each entry starts with an u64 timestamp. Structure for each mode, after the timestamp: | |||
DisableSixAxisPollingDataAccessor: | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
| | ! Offset || Size || Description | ||
| | |||
|- | |- | ||
| | | 0x0 || 0x26 || Data | ||
| | |||
|- | |- | ||
| | | 0x26 || 0x1 || Size of data. | ||
| | |||
|- | |- | ||
| | | 0x27 || 0x1 || Padding | ||
| | |||
|- | |- | ||
| | | 0x28 || 0x8 || Timestamp | ||
| | |} | ||
JoyEnableSixAxisPollingDataAccessor: | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Offset || Size || Description | ||
| | |||
|- | |- | ||
| | | 0x0 || 0x8 || Data | ||
| | |||
|- | |- | ||
| | | 0x8 || 0x1 || Size of data. | ||
| | |||
|- | |- | ||
| | | 0x9 || 0x7 || Padding | ||
| | |||
|- | |- | ||
| | | 0x10 || 0x8 || Timestamp | ||
| | |||
|} | |} | ||
JoyButtonOnlyPollingDataAccessor: | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
| | ! Offset || Size || Description | ||
|- | |||
| 0x0 || 0x2C || Data | |||
|- | |- | ||
| | | 0x2C || 0x1 || Size of data. | ||
|- | |- | ||
| | | 0x2D || 0x3 || Padding | ||
|- | |- | ||
| | | 0x30 || 0x8 || Timestamp | ||
|} | |||
== DisableJoyPollingReceiveMode == | |||
Takes an input [[#BusHandle]], no output. | |||
== SetStatusManagerType == | |||
Takes an input u32, no output. | |||
This is used by sdknso immediately after mapping [[#GetSharedMemoryHandle|sharedmem]] (before [[#Initialize]]) with hard-coded value 0x2. | |||
= GyroscopeZeroDriftMode = | |||
This is "nn::hid::GyroscopeZeroDriftMode". | |||
{| class="wikitable" border="1" | |||
! Value | |||
! Description | |||
|- | |- | ||
| | | 0 || Loose | ||
|- | |- | ||
| | | 1 || Standard | ||
|- | |- | ||
| | | 2 || Tight | ||
|} | |||
= NpadStyleTag = | |||
This is "nn::hid::NpadStyleTag". | |||
{| class="wikitable" border="1" | |||
! Bits | |||
! Description | |||
! Notes | |||
|- | |- | ||
| | | 0 | ||
| NpadFullKey | |||
| Pro Controller | |||
|- | |- | ||
| | | 1 | ||
| NpadHandheld | |||
| Joy-Con controller in handheld mode | |||
|- | |- | ||
| | | 2 | ||
| NpadJoyDual | |||
| Joy-Con controller in dual mode | |||
|- | |- | ||
| | | 3 | ||
| NpadJoyLeft | |||
| Joy-Con left controller in single mode | |||
|- | |- | ||
| | | 4 | ||
| NpadJoyRight | |||
| Joy-Con right controller in single mode | |||
|- | |- | ||
| | | 5 | ||
| NpadGc | |||
| GameCube controller | |||
|- | |- | ||
| | | 6 | ||
| NpadPalma | |||
| Poké Ball Plus controller | |||
|- | |- | ||
| | | 7 | ||
| NpadLark | |||
| NES/Famicom controller | |||
|- | |- | ||
| | | 8 | ||
| NpadHandheldLark | |||
| NES/Famicom controller in handheld mode | |||
|- | |- | ||
| | | 9 | ||
| NpadLucia | |||
| SNES controller | |||
|- | |- | ||
| | | 10-28 | ||
| Reserved | |||
| | |||
|- | |- | ||
| | | 29 | ||
| NpadSystemExt | |||
| Generic external controller | |||
|- | |- | ||
| | | 30 | ||
| NpadSystem | |||
| Generic controller | |||
|- | |- | ||
| | | 31 | ||
| Reserved | |||
| | |||
|} | |} | ||
= | = NpadIdType = | ||
This is | This is "nn::hid::NpadIdType". This is the controller index used in [[HID_Shared_Memory#Controllers|sharedmem]]. | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
! Value | |||
! Description | |||
|- | |- | ||
| 0x0 || No1 | |||
|- | |- | ||
| 0x1 || No2 | |||
|- | |- | ||
| | | 0x2 || No3 | ||
|- | |||
| 0x3 || No4 | |||
|- | |- | ||
| | | 0x4 || No5 | ||
|- | |- | ||
| | | 0x5 || No6 | ||
|- | |- | ||
| | | 0x6 || No7 | ||
|- | |- | ||
| | | 0x7 || No8 | ||
|- | |- | ||
| | | 0x10 || Other | ||
|- | |- | ||
| | | 0x20 || Handheld | ||
|} | |} | ||
= NpadInterfaceType = | |||
This is "nn::hid::NpadInterfaceType". | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
! Value | |||
! Description | |||
|- | |- | ||
| 1 || Bluetooth | |||
|- | |- | ||
| | | 2 || Rail | ||
|- | |- | ||
| | | 3 || USB | ||
|- | |- | ||
| | | 4 || Unknown | ||
|} | |} | ||
= | = AbstractedPadState = | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Offset || Size | ! Offset || Size || Description | ||
|- | |- | ||
| 0x0 || | | 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 || See [[#HiddbgHdlsDeviceInfo]]::[[#NpadInterfaceType]]. | ||
|- | |- | ||
| | | 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 = | |||
This is a 0x208-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Offset || Size || Description | ||
|- | |- | ||
| | | 0x0 || 0x4 || s32 Total entries | ||
|- | |- | ||
| | | 0x4 || 0x4 || Padding | ||
|- | |- | ||
| | | 0x8 || 0x200(0x20*0x10) || Array of [[#HdlsNpadAssignmentEntry]]. | ||
|} | |||
= HdlsNpadAssignmentEntry = | |||
This is a 0x20-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Offset || Size || Description | ||
|- | |- | ||
| | | 0x0 || 0x8 || HdlsHandle | ||
|- | |- | ||
| | | 0x8 || 0x4 || ? | ||
|- | |- | ||
| | | 0xC || 0x4 || ? | ||
|- | |- | ||
| | | 0x10 || 0x8 || ? | ||
|- | |- | ||
| | | 0x18 || 0x1 || ? | ||
|- | |- | ||
| | | 0x19 || 0x7 || Padding | ||
|} | |||
= HdlsStateList = | |||
This is a 0x408-byte struct. | |||
[9.0.0+] This is a 0x488-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Offset || Size || Description | ||
|- | |- | ||
| | | 0x0 || 0x4 || s32 Total entries | ||
|- | |- | ||
| | | 0x4 || 0x4 || Padding | ||
|- | |- | ||
| | | 0x8 || <[[#HdlsStateListEntry]] size>*0x10 || Array of [[#HdlsStateListEntry]]. | ||
|} | |||
| | |||
This contains a list of all controllers, including non-virtual controllers. | |||
= HdlsStateListEntry = | |||
This is a 0x40-byte struct. | |||
[9.0.0+] This is a 0x48-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Offset || Size || Description | ||
|- | |- | ||
| | | 0x0 || 0x8 || HdlsHandle | ||
|- | |- | ||
| | | 0x8 || [[#HdlsDeviceInfo]] size || [[#HdlsDeviceInfo]]. With [[#ApplyHdlsStateList]] this is only used when creating new devices. | ||
|- | |- | ||
| | | 0x8 + [[#HdlsDeviceInfo]] size, with 8-byte alignment || 0x24 || [[#HdlsState]] | ||
|- | |- | ||
| | | <Immediately following the above> || 0x4 || Padding | ||
|} | |||
= HdlsDeviceInfo = | |||
This is a 0x10-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Offset || Size || Description | ||
|- | |- | ||
| | | 0x0 || 0x4 || [[#DeviceTypeInternal]] | ||
|- | |- | ||
| | | 0x4 || 0x4 || RGBA Single Body Color | ||
|- | |- | ||
| | | 0x8 || 0x4 || RGBA Single Buttons Color | ||
|- | |- | ||
| | | 0xC || 0x1 || [[#NpadInterfaceType]]. 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 | ||
|} | |||
[9.0.0+] This is a 0x14-byte struct. | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Offset || Size || Description | ||
|- | |- | ||
| | | 0x0 || 0x1 || [[#DeviceTypeInternal]] | ||
|- | |- | ||
| | | 0x1 || 0x1 || [[#NpadInterfaceType]]. Similar to the field from the old struct. | ||
|- | |- | ||
| | | 0x2 || 0x2 || Padding | ||
|- | |- | ||
| | | 0x4 || 0x4 || RGBA Single Body Color | ||
|- | |- | ||
| | | 0x8 || 0x4 || RGBA Single Buttons Color | ||
|- | |- | ||
| | | 0xC || 0x4 || RGBA Unknown Body Color | ||
|- | |- | ||
| | | 0x10 || 0x4 || RGBA Unknown Buttons Color | ||
|} | |||
= DeviceTypeInternal = | |||
This is "nn::hid::detail::DeviceTypeInternal". | |||
{| class="wikitable" border="1" | |||
! Bits | |||
! Description | |||
|- | |- | ||
| | | 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 | |||
|} | |} | ||
This is "nn:: | [9.0.0+] This is "nn::hidtypes::DeviceType". | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
! Value | |||
! [[#DeviceType|DeviceType]] | |||
! [[#UniquePadType|UniquePadType]] | |||
! Description | |||
|- | |- | ||
| 1 || JoyRight, HandheldRight || JoyRight || Joy-Con right controller | |||
|- | |- | ||
| | | 2 || JoyLeft, HandheldLeft || JoyLeft || Joy-Con left controller | ||
|- | |- | ||
| | | 3 || FullKey || FullKey || Pro Controller | ||
|- | |- | ||
| | | 4 || JoyLeft || JoyLeft || Reserved | ||
|- | |- | ||
| | | 5 || JoyRight || JoyRight || Reserved | ||
|- | |- | ||
| | | 6 || FullKey || FullKey || Reserved | ||
|- | |- | ||
| | | 7 || LarkHvcLeft, HandheldLarkHvcLeft || JoyLeft || Famicom left controller | ||
| | |||
|- | |- | ||
| | | 8 || LarkHvcRight, HandheldLarkHvcRight || JoyRight || Famicom right controller (with microphone) | ||
| | |||
|- | |- | ||
| | | 9 || LarkNesLeft, HandheldLarkNesLeft || JoyLeft || NES left controller | ||
| | |||
|- | |- | ||
| | | 10 || LarkNesRight, HandheldLarkNesRight || JoyRight || NES right controller | ||
| | |||
|- | |- | ||
| | | 11 || Lucia || FullKey || SNES controller | ||
| | |||
|- | |- | ||
| | | 12 || Palma || Other || Poké Ball Plus controller | ||
| | |||
|- | |- | ||
| | | 13 || FullKey || FullKey || Gc controller | ||
| | |||
|- | |- | ||
| | | 14 || HandheldLeft || JoyLeft || Reserved | ||
| | |||
|- | |- | ||
| | | 15 || FullKey || FullKey || Reserved | ||
| | |||
|- | |- | ||
| | | 16 || FullKey || FullKey || Reserved | ||
| | |||
|- | |- | ||
| | | 17 || DebugPad || DebugPad || Debug controller | ||
| | |||
|- | |- | ||
| | | 18 || HandheldRight || JoyRight || Reserved | ||
| | |||
|- | |- | ||
| | | 19 || System || Other || Unknown (has [[#NpadStyleTag|NpadFullKey]] style tag) | ||
| | |||
|- | |- | ||
| | | 20 || System || Other || Unknown (has [[#NpadStyleTag|NpadJoyDual]] style tag) | ||
| | |||
|- | |- | ||
| | | 21 || System || Other || Unknown (has [[#NpadStyleTag|NpadJoyDual]] style tag) | ||
| | |||
| | |||
| | |||
| | |||
| | |||
| | |||
| | |||
|} | |} | ||
= | = HdlsState = | ||
This is | This is a 0x24-byte struct. | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
| 0x0 || | ! Offset || Size || Description | ||
|- | |||
| 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]]. | |||
|- | |- | ||
| | | 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" | {| class="wikitable" border="1" | ||
|- | |- | ||
! Offset || Size || Description | ! Offset || Size || Description | ||
|- | |- | ||
| 0x0 || | | 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]]. | ||
|- | |- | ||
| | | 0x20 || 0x1 || Unused for input. Set with output from [[#DumpHdlsStates]] (zero in some cases). | ||
|- | |- | ||
| | | 0x21 || 0x3 || Padding | ||
|} | |||
= NotificationLedPattern = | |||
{| class="wikitable" border="1" | |||
|- | |- | ||
| | ! Offset || Size || Subcommand argdata bytepos || Subcommand argdata nibble || Description | ||
|- | |- | ||
| | | 0x0 || 0x1 || 0x0 || Low || Mini Cycle Base Duration. Value 0x1-0xF: 12.5ms - 187.5ms. Value 0x0 = 0ms/OFF. | ||
|- | |- | ||
| | | 0x1 || 0x1 || 0x0 || High || Number of Mini Cycles + 1. Value 0x0-0xF: 1 - 16 mini cycles. | ||
|- | |- | ||
| | | 0x2 || 0x1 || 0x1 || Low || Number of Full Cycles. Value 0x1-0xF: 1 - 15 full cycles. Value 0x0 is repeat forever, but if Mini Cycle Base Duration is set to 0x0, it does the 1st Mini Cycle with a 12.5ms base duration and then the LED stays on with LED Start Intensity. | ||
|- | |- | ||
| | | 0x3 || 0x1 || 0x1 || High || LED Start Intensity. Value 0x0-0xF: 0% - 100%. (In HW, 1 - 241 duty) | ||
|- | |- | ||
| | | 0x4 || 0x1 || 0x2 || High || Mini Cycle 1 LED Intensity. Value 0x0-0xF: 0% - 100%. (In HW, 1 - 241 duty) | ||
|- | |- | ||
| | | 0x5 || 0x1 || 0x3 || High || Fading Transition Steps to Mini Cycle 1 (Uses PWM). Value 0x0: Instant. Each step duration is based on Mini Cycle Step Duration Multiplier. | ||
| | |||
|- | |- | ||
| 0x6 || 0x1 || 0x3 || Low || Final Step Duration Multiplier of Mini Cycle 1. Value is a Multiplier of Mini Cycle Base Duration. Value 0x0: 12.5ms, 0x1 - xF: 1x - 15x. | |||
|- | |- | ||
| | | 0x7 || 0x1 || || || Unused | ||
|- | |- | ||
| 0x8 || 0x1 || | | 0x8 || 0x1 || 0x2 || Low || Mini Cycle 2 LED Intensity. | ||
|- | |- | ||
| 0x9 || 0x1 || | | 0x9 || 0x1 || 0x4 || High || Fading Transition Steps to Mini Cycle 2 (see above). | ||
|- | |- | ||
| 0xA || 0x1 || | | 0xA || 0x1 || 0x4 || Low || Final Step Duration Multiplier of Mini Cycle 2 (see above). | ||
|- | |- | ||
| 0xB || | | 0xB || 0x1 || || || Unused | ||
|- | |- | ||
| | | 0xC || 0x1 || 0x5 || High || Mini Cycle 3 LED Intensity. | ||
|- | |- | ||
| | | 0xD || 0x1 || 0x6 || High || Fading Transition Steps to Mini Cycle 3 (see above). | ||
|- | |- | ||
| | | 0xE || 0x1 || 0x6 || Low || Final Step Duration Multiplier of Mini Cycle 3 (see above). | ||
|- | |- | ||
| | | 0xF || 0x1 || || || Unused | ||
|- | |- | ||
| | | 0x10 || 0x1 || 0x5 || Low || Mini Cycle 4 LED Intensity. | ||
|- | |- | ||
| | | 0x11 || 0x1 || 0x7 || High || Fading Transition Duration to Mini Cycle 4 (see above). | ||
|- | |- | ||
| | | 0x12 || 0x1 || 0x7 || Low || Final Step Duration Multiplier of Mini Cycle 4 (see above). | ||
|- | |- | ||
| | | 0x13 || 0x1 || || || Unused | ||
|- | |- | ||
| | | 0x14 || 0x1 || 0x8 || High || Mini Cycle 5 LED Intensity. | ||
|- | |- | ||
| | | 0x15 || 0x1 || 0x9 || High || Fading Transition Steps to Mini Cycle 5 (see above). | ||
| | |||
|- | |- | ||
| 0x16 || 0x1 || 0x9 || Low || Final Step Duration Multiplier of Mini Cycle 5 (see above). | |||
|- | |- | ||
| | | 0x17 || 0x1 || || || Unused | ||
|- | |- | ||
| 0x8 || | | 0x18 || 0x1 || 0x8 || Low || Mini Cycle 6 LED Intensity. | ||
|- | |- | ||
| | | 0x19 || 0x1 || 0xA || High || Fading Transition Steps to Mini Cycle 6 (see above). | ||
|- | |- | ||
| 0xA || | | 0x1A || 0x1 || 0xA || Low || Final Step Duration Multiplier of Mini Cycle 6 (see above). | ||
|- | |- | ||
| | | 0x1B || 0x1 || || || Unused | ||
|- | |- | ||
| | | 0x1C || 0x1 || 0xB || High || Mini Cycle 7 LED Intensity. | ||
|- | |- | ||
| | | 0x1D || 0x1 || 0xC || High || Fading Transition Steps to Mini Cycle 7 (see above). | ||
|- | |- | ||
| | | 0x1E || 0x1 || 0xC || Low || Final Step Duration Multiplier of Mini Cycle 7 (see above). | ||
| | |||
|- | |- | ||
| 0x1F || 0x1 || || || Unused | |||
|- | |- | ||
| | | 0x20 || 0x1 || 0xB || Low || Mini Cycle 8 LED Intensity. | ||
|- | |- | ||
| | | 0x21 || 0x1 || 0xD || Low || Fading Transition Steps to Mini Cycle 8 (see above). | ||
|- | |- | ||
| | | 0x22 || 0x1 || 0xD || High || Final Step Duration Multiplier of Mini Cycle 8 (see above). | ||
| | |||
|- | |- | ||
| 0x23 || 0x1 || || || Unused | |||
|- | |- | ||
| | | 0x24 || 0x1 || 0xE || High || Mini Cycle 9 LED Intensity. | ||
|- | |- | ||
| | | 0x25 || 0x1 || 0xF || High || Fading Transition Steps to Mini Cycle 9 (see above). | ||
|- | |- | ||
| 0x9 || 0x1 || Gain | | 0x26 || 0x1 || 0xF || Low || Final Step Duration Multiplier of Mini Cycle 9 (see above). | ||
|- | |- | ||
| 0xA || 0x1 || IsNegativeImageUsed | | 0x27 || 0x1 || || || Unused | ||
|- | |- | ||
| 0xB || 0x5 || | | 0x28 || 0x1 || 0xE || Low || Mini Cycle 10 LED Intensity. | ||
|- | |- | ||
| 0x10 || 0x4 || | | 0x29 || 0x1 || 0x10 || High || Fading Transition Steps to Mini Cycle 10 (see above). | ||
|- | |- | ||
| 0x14 || 0x1 || OrigFormat | | 0x2A || 0x1 || 0x10 || Low || Final Step Duration Multiplier of Mini Cycle 10 (see above). | ||
|- | |- | ||
| 0x15 || 0x1 || TrimmingFormat | | 0x2B || 0x1 || || || Unused | ||
|- | |- | ||
| 0x16 || 0x2 || TrimmingStartX | | 0x2C || 0x1 || 0x11 || High || Mini Cycle 11 LED Intensity. | ||
|- | |- | ||
| 0x18 || 0x2 || TrimmingStartY | | 0x2D || 0x1 || 0x12 || High || Fading Transition Steps to Mini Cycle 11 (see above). | ||
|- | |- | ||
| 0x1A || 0x1 || IsExternalLightFilterEnabled | | 0x2E || 0x1 || 0x12 || Low || Final Step Duration Multiplier of Mini Cycle 11 (see above). | ||
|- | |- | ||
| 0x1B || 0x5 || | | 0x2F || 0x1 || || || Unused | ||
|} | |- | ||
| 0x30 || 0x1 || 0x11 || Low || Mini Cycle 12 LED Intensity. | |||
= PackedIrLedProcessorConfig = | |- | ||
This is "nn::irsensor::PackedIrLedProcessorConfig". This is | | 0x31 || 0x1 || 0x13 || High || Fading Transition Steps to Mini Cycle 12 (see above). | ||
|- | |||
= | | 0x32 || 0x1 || 0x13 || Low || Final Step Duration Multiplier of Mini Cycle 12 (see above). | ||
This is "nn:: | |- | ||
| 0x33 || 0x1 || || || Unused | |||
{| class="wikitable" border="1" | |- | ||
|- | | 0x34 || 0x1 || 0x14 || High || Mini Cycle 13 LED Intensity. | ||
! Offset || Size || Description | |- | ||
|- | | 0x35 || 0x1 || 0x15 || High || Fading Transition Steps to Mini Cycle 13 (see above). | ||
| 0x0 || 0x4 || AbstractedPadId | |- | ||
|- | | 0x36 || 0x1 || 0x15 || Low || Final Step Duration Multiplier of Mini Cycle 13 (see above). | ||
| 0x4 || 0x1 || InternalIndex | |- | ||
|- | | 0x37 || 0x1 || || || Unused | ||
| 0x5 || 0x1 || PlayerNumber | |- | ||
| 0x38 || 0x1 || 0x14 || Low || Mini Cycle 14 LED Intensity. | |||
|- | |||
| 0x39 || 0x1 || 0x16 || High || Fading Transition Steps to Mini Cycle 14 (see above). | |||
|- | |||
| 0x3A || 0x1 || 0x16 || Low || Final Step Duration Multiplier of Mini Cycle 14 (see above). | |||
|- | |||
| 0x3B || 0x1 || || || Unused | |||
|- | |||
| 0x3C || 0x1 || 0x17 || High || Mini Cycle 15 LED Intensity. | |||
|- | |||
| 0x3D || 0x1 || 0x18 || High || Fading Transition Steps to Mini Cycle 15 (see above). | |||
|- | |||
| 0x3E || 0x1 || 0x18 || Low || Final Step Duration Multiplier of Mini Cycle 15 (see above). | |||
|- | |||
| 0x3F || 0x1 || || || Unused | |||
|- | |||
| 0x40 || 0x1 || 0x17 || Low || Mini Cycle 16 LED Intensity. | |||
|- | |||
| 0x41 || 0x1 || 0x19 || High || Fading Transition Steps to Mini Cycle 16 (see above). (Unused in older Joy-Con / Pro-Con FW. Unknown for new.) | |||
|- | |||
| 0x42 || 0x1 || 0x19 || Low || Final Step Duration Multiplier of Mini Cycle 16 (see above). (Unused in older Joy-Con / Pro-Con FW. Unknown for new.) | |||
|- | |||
| 0x43 || 0x1 || || || Unused | |||
|- | |||
| 0x44 || 0x1 || 0x1A || High || Unknown (Unused in older Joy-Con / Pro-Con FW. Unknown for new.) | |||
|- | |||
| 0x45 || 0x1 || 0x1A || Low || Unknown (Unused in older Joy-Con / Pro-Con FW. Unknown for new.) | |||
|- | |||
| 0x46 || 0x1 || || || Padding | |||
|- | |||
| 0x47 || 0x1 || || || Padding | |||
|- | |||
|} | |||
This is "nn::hid::system::NotificationLedPattern". | |||
This is a 0x48-byte struct. | |||
The above descriptions in the table are based on the info from [https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/bluetooth_hid_subcommands_notes.md here]. | |||
argdata in the subcommand is initialized as follows: <code>((u8*)cmd_argdata)[pos] = u8_in[pos2] | u8_in[pos3]<<4;</code> Hence, 4bits from pairs of 2-bytes of the input struct are combined to write to the subcommand. Only the low 4bits of each used byte in the struct is used. This is written to stack initially, then copied to the actual cmd_argdata (the data immediately following the subcommandID byte). There's a total of 0x1B-bytes of cmd_argdata initialized from this. | |||
The layout of cmd_argdata is as follows: | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x1B || See above. | |||
|- | |||
| 0x1B || 0xB || Cleared to zero. | |||
|- | |||
| 0x26 || 0x5 || Unused | |||
|- | |||
| 0x2B || 0x8 || Set to an input value, which is hard-coded 0. | |||
|- | |||
| 0x33 || 0x2 || Set to value 0. | |||
|- | |||
| 0x35 || 0x1 || Set to value 1. | |||
|} | |||
= DeviceType = | |||
This is "nn::hid::system::DeviceType". | |||
{| class="wikitable" border="1" | |||
! Bits | |||
! Description | |||
|- | |||
| 0 | |||
| FullKey | |||
|- | |||
| 1 | |||
| DebugPad | |||
|- | |||
| 2 | |||
| HandheldLeft | |||
|- | |||
| 3 | |||
| HandheldRight | |||
|- | |||
| 4 | |||
| JoyLeft | |||
|- | |||
| 5 | |||
| JoyRight | |||
|- | |||
| 6 | |||
| Palma | |||
|- | |||
| 7 | |||
| LarkHvcLeft | |||
|- | |||
| 8 | |||
| LarkHvcRight | |||
|- | |||
| 9 | |||
| LarkNesLeft | |||
|- | |||
| 10 | |||
| LarkNesRight | |||
|- | |||
| 11 | |||
| HandheldLarkHvcLeft | |||
|- | |||
| 12 | |||
| HandheldLarkHvcRight | |||
|- | |||
| 13 | |||
| HandheldLarkNesLeft | |||
|- | |||
| 14 | |||
| HandheldLarkNesRight | |||
|- | |||
| 15 | |||
| Lucia | |||
|- | |||
| 16-30 | |||
| Reserved | |||
|- | |||
| 31 | |||
| System | |||
|} | |||
= UniquePadType = | |||
This is "nn::hid::system::UniquePadType". | |||
{| class="wikitable" border="1" | |||
! Value | |||
! Description | |||
|- | |||
| 0x0 || Other | |||
|- | |||
| 0x1 || FullKey | |||
|- | |||
| 0x2 || JoyRight | |||
|- | |||
| 0x3 || JoyLeft | |||
|- | |||
| 0x4 || DebugPad | |||
|} | |||
= IrCameraHandle = | |||
This is "nn::irsensor::IrCameraHandle". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x1 || PlayerNumber | |||
|- | |||
| 0x1 || 0x1 || DeviceType | |||
|- | |||
| 0x2 || 0x2 || Reserved | |||
|} | |||
= IrCameraStatus = | |||
This is "nn::irsensor::IrCameraStatus". | |||
{| class="wikitable" border="1" | |||
! Value | |||
! Description | |||
|- | |||
| 0 || Available | |||
|- | |||
| 1 || Unsupported | |||
|- | |||
| 2 || Unconnected | |||
|} | |||
= IrCameraInternalStatus = | |||
This is "nn::irsensor::IrCameraInternalStatus". | |||
{| class="wikitable" border="1" | |||
! Value | |||
! Description | |||
|- | |||
| 0 || Stopped | |||
|- | |||
| 1 || FirmwareUpdateNeeded | |||
|- | |||
| 2 || | |||
|- | |||
| 3 || | |||
|- | |||
| 4 || | |||
|- | |||
| 5 || FirmwareVersionRequested | |||
|- | |||
| 6 || FirmwareVersionIsInvalid | |||
|- | |||
| 7 || [4.0.0+] Ready | |||
|- | |||
| 8 || [4.0.0+] Setting | |||
|} | |||
= IrSensorMode = | |||
This is "nn::irsensor::detail::StatusManager::IrSensorMode". | |||
{| class="wikitable" border="1" | |||
! Value | |||
! Description | |||
|- | |||
| 0 || None | |||
|- | |||
| 1 || [[#MomentProcessorState|MomentProcessor]] | |||
|- | |||
| 2 || [[#ClusteringProcessorState|ClusteringProcessor]] | |||
|- | |||
| 3 || [[#ImageTransferProcessorState|ImageTransferProcessor]] | |||
|- | |||
| 4 || [[#PointingProcessorMarkerState|PointingProcessorMarker]] | |||
|- | |||
| 5 || [[#TeraPluginProcessorState|TeraPluginProcessor]] | |||
|- | |||
| 6 || Unknown | |||
|} | |||
= ImageProcessorStatus = | |||
This is "nn::irsensor::ImageProcessorStatus". | |||
{| class="wikitable" border="1" | |||
! Value | |||
! Description | |||
|- | |||
| 0 || Stopped | |||
|- | |||
| 1 || Running | |||
|} | |||
= ImageTransferProcessorFormat = | |||
This is "nn::irsensor::ImageTransferProcessorFormat". | |||
This controls the IR Sensor image resolution. | |||
{| class="wikitable" border="1" | |||
! Value | |||
! Description | |||
|- | |||
| 0 || 320x240 | |||
|- | |||
| 1 || 160x120 | |||
|- | |||
| 2 || 80x60 | |||
|- | |||
| 3 || [4.0.0+] 40x30 | |||
|- | |||
| 4 || [4.0.0+] 20x15 | |||
|} | |||
= MomentProcessorConfig = | |||
This is "nn::irsensor::MomentProcessorConfig". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x8 || ExposureTime (default is 0x493E0) | |||
|- | |||
| 0x8 || 0x4 || LightTarget (default is 0) | |||
|- | |||
| 0xC || 0x4 || Gain (default is 0x8) | |||
|- | |||
| 0x10 || 0x1 || IsNegativeImageUsed (default is 0) | |||
|- | |||
| 0x11 || 0x7 || Reserved | |||
|- | |||
| 0x18 || 0x2 || WindowOfInterestX (default is 0) | |||
|- | |||
| 0x1A || 0x2 || WindowOfInterestY (default is 0) | |||
|- | |||
| 0x1C || 0x2 || WindowOfInterestWidth (default is 0x140) | |||
|- | |||
| 0x1E || 0x2 || WindowOfInterestHeight (default is 0xF0) | |||
|- | |||
| 0x20 || 0x4 || Preprocess (default is 0x1) | |||
|- | |||
| 0x24 || 0x4 || PreprocessIntensityThreshold (default is 0x50) | |||
|} | |||
= PackedMomentProcessorConfig = | |||
This is "nn::irsensor::PackedMomentProcessorConfig". | |||
This is converted from [[#MomentProcessorConfig]]. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x8 || ExposureTime (default is 0x493E0) | |||
|- | |||
| 0x8 || 0x1 || LightTarget (default is 0) | |||
|- | |||
| 0x9 || 0x1 || Gain (default is 0x8) | |||
|- | |||
| 0xA || 0x1 || IsNegativeImageUsed (default is 0) | |||
|- | |||
| 0xB || 0x5 || Reserved | |||
|- | |||
| 0x10 || 0x2 || WindowOfInterestX (default is 0) | |||
|- | |||
| 0x12 || 0x2 || WindowOfInterestY (default is 0) | |||
|- | |||
| 0x14 || 0x2 || WindowOfInterestWidth (default is 0x140) | |||
|- | |||
| 0x16 || 0x2 || WindowOfInterestHeight (default is 0xF0) | |||
|- | |||
| 0x18 || 0x4 || [[#PackedMcuVersion|RequiredMcuVersion]] | |||
|- | |||
| 0x1C || 0x1 || Preprocess (default is 0x1) | |||
|- | |||
| 0x1D || 0x1 || PreprocessIntensityThreshold (default is 0x50) | |||
|- | |||
| 0x1E || 0x2 || Reserved | |||
|} | |||
= ClusteringProcessorConfig = | |||
This is "nn::irsensor::ClusteringProcessorConfig". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x8 || ExposureTime (default is 200000) | |||
|- | |||
| 0x8 || 0x4 || LightTarget (default is 0) | |||
|- | |||
| 0xC || 0x4 || Gain (default is 0x2) | |||
|- | |||
| 0x10 || 0x1 || IsNegativeImageUsed (default is 0) | |||
|- | |||
| 0x11 || 0x7 || Reserved | |||
|- | |||
| 0x18 || 0x2 || WindowOfInterestX (default is 0) | |||
|- | |||
| 0x1A || 0x2 || WindowOfInterestY (default is 0) | |||
|- | |||
| 0x1C || 0x2 || WindowOfInterestWidth (default is 320) | |||
|- | |||
| 0x1E || 0x2 || WindowOfInterestHeight (default is 240) | |||
|- | |||
| 0x20 || 0x4 || ObjectPixelCountMin (default is 0x3) | |||
|- | |||
| 0x24 || 0x4 || ObjectPixelCountMax (default is 0x12C00) | |||
|- | |||
| 0x28 || 0x4 || ObjectIntensityMin (default is 150) | |||
|- | |||
| 0x2C || 0x1 || IsExternalLightFilterEnabled (default is 0x1) | |||
|} | |||
= PackedClusteringProcessorConfig = | |||
This is "nn::irsensor::PackedClusteringProcessorConfig". | |||
This is converted from [[#ClusteringProcessorConfig]]. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x8 || ExposureTime | |||
|- | |||
| 0x8 || 0x1 || LightTarget | |||
|- | |||
| 0x9 || 0x1 || Gain | |||
|- | |||
| 0xA || 0x1 || IsNegativeImageUsed | |||
|- | |||
| 0xB || 0x5 || Reserved | |||
|- | |||
| 0x10 || 0x2 || WindowOfInterestX | |||
|- | |||
| 0x12 || 0x2 || WindowOfInterestY | |||
|- | |||
| 0x14 || 0x2 || WindowOfInterestWidth | |||
|- | |||
| 0x16 || 0x2 || WindowOfInterestHeight | |||
|- | |||
| 0x18 || 0x4 || [[#PackedMcuVersion|RequiredMcuVersion]] | |||
|- | |||
| 0x1C || 0x4 || ObjectPixelCountMin | |||
|- | |||
| 0x20 || 0x4 || ObjectPixelCountMax | |||
|- | |||
| 0x24 || 0x1 || ObjectIntensityMin | |||
|- | |||
| 0x25 || 0x1 || IsExternalLightFilterEnabled | |||
|- | |||
| 0x26 || 0x2 || Reserved | |||
|} | |||
= ImageTransferProcessorConfig = | |||
This is "nn::irsensor::ImageTransferProcessorConfig". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x8 || ExposureTime | |||
|- | |||
| 0x8 || 0x4 || LightTarget | |||
|- | |||
| 0xC || 0x4 || Gain | |||
|- | |||
| 0x10 || 0x1 || IsNegativeImageUsed | |||
|- | |||
| 0x11 || 0x7 || Reserved | |||
|- | |||
| 0x18 || 0x4 || [[#ImageTransferProcessorFormat|Format]] | |||
|} | |||
= PackedImageTransferProcessorConfig = | |||
This is "nn::irsensor::PackedImageTransferProcessorConfig". | |||
This is converted from [[#ImageTransferProcessorConfig]]. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x8 || ExposureTime | |||
|- | |||
| 0x8 || 0x1 || LightTarget | |||
|- | |||
| 0x9 || 0x1 || Gain | |||
|- | |||
| 0xA || 0x1 || IsNegativeImageUsed | |||
|- | |||
| 0xB || 0x5 || Reserved | |||
|- | |||
| 0x10 || 0x4 || [[#PackedMcuVersion|RequiredMcuVersion]] | |||
|- | |||
| 0x14 || 0x1 || [[#ImageTransferProcessorFormat|Format]] | |||
|- | |||
| 0x15 || 0x3 || Reserved | |||
|} | |||
= ImageTransferProcessorState = | |||
This is "nn::irsensor::ImageTransferProcessorState". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x8 || SamplingNumber | |||
|- | |||
| 0x8 || 0x4 || AmbientNoiseLevel | |||
|- | |||
| 0xC || 0x4 || Reserved | |||
|} | |||
= TeraPluginProcessorConfig = | |||
This is "nn::irsensor::TeraPluginProcessorConfig". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x1 || Mode | |||
|- | |||
| 0x1 || 0x1 || | |||
|- | |||
| 0x2 || 0x1 || | |||
|- | |||
| 0x3 || 0x1 || | |||
|} | |||
= PackedTeraPluginProcessorConfig = | |||
This is "nn::irsensor::PackedTeraPluginProcessorConfig". | |||
This is converted from [[#TeraPluginProcessorConfig]]. The data starting at offset 0x5 is only initialized by the user-process with [6.0.0+]. | |||
[[#TeraPluginProcessorConfig]] +0x0, +0x2, and +0x3 are copied to +0x4, 0x6, and +0x7 here. +0x5 here is set to 0x2 | ([[#TeraPluginProcessorConfig]]+0x1 << 7). | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x4 || [[#PackedMcuVersion|RequiredMcuVersion]] | |||
|- | |||
| 0x4 || 0x1 || Mode | |||
|- | |||
| 0x5 || 0x1 || | |||
|- | |||
| 0x6 || 0x1 || | |||
|- | |||
| 0x7 || 0x1 || | |||
|} | |||
= PointingProcessorConfig = | |||
This is "nn::irsensor::PointingProcessorConfig". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x2 || WindowOfInterestX (default is 0) | |||
|- | |||
| 0x2 || 0x2 || WindowOfInterestY (default is 0) | |||
|- | |||
| 0x4 || 0x2 || WindowOfInterestWidth (default is 320) | |||
|- | |||
| 0x6 || 0x2 || WindowOfInterestHeight (default is 240) | |||
|} | |||
= PackedPointingProcessorConfig = | |||
This is "nn::irsensor::PackedPointingProcessorConfig". | |||
This is converted from [[#PointingProcessorConfig]]. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x2 || WindowOfInterestX (default is 0) | |||
|- | |||
| 0x2 || 0x2 || WindowOfInterestY (default is 0) | |||
|- | |||
| 0x4 || 0x2 || WindowOfInterestWidth (default is 320) | |||
|- | |||
| 0x6 || 0x2 || WindowOfInterestHeight (default is 240) | |||
|- | |||
| 0x8 || 0x4 || [[#PackedMcuVersion|RequiredMcuVersion]] | |||
|} | |||
= PackedMcuVersion = | |||
This is "nn::irsensor::PackedMcuVersion". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x2 || MajorVersion | |||
|- | |||
| 0x2 || 0x2 || MinorVersion | |||
|} | |||
== Versions == | |||
{| class="wikitable" border="1" | |||
|- | |||
! MajorVersion || MinorVersion || SystemVersion | |||
|- | |||
| 0x3 || 0xB || [1.0.0+] | |||
|- | |||
| 0x4 || 0x12 || [4.0.0+] | |||
|- | |||
| 0x5 || 0x18 || [5.0.0+] | |||
|- | |||
| 0x6 || 0x1A || [6.0.0+] | |||
|- | |||
| 0x8 || 0x1B || [8.0.0+] | |||
|} | |||
= PackedFunctionLevel = | |||
This is nn::irsensor::PackedFunctionLevel. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x1 || [[#IrSensorFunctionLevel]] | |||
|- | |||
| 0x1 || 0x3 || Reserved | |||
|} | |||
== IrSensorFunctionLevel == | |||
This is "nn::irsensor::IrSensorFunctionLevel". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Value || SystemVersion | |||
|- | |||
| 0 || [1.0.0+] | |||
|- | |||
| 1 || [4.0.0+] | |||
|- | |||
| 2 || [5.0.0+] | |||
|- | |||
| 3 || [6.0.0+] | |||
|- | |||
| 4 || [8.0.0+] | |||
|} | |||
= ImageTransferProcessorExConfig = | |||
This is "nn::irsensor::ImageTransferProcessorExConfig". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x8 || ExposureTime | |||
|- | |||
| 0x8 || 0x4 || LightTarget | |||
|- | |||
| 0xC || 0x4 || Gain | |||
|- | |||
| 0x10 || 0x1 || IsNegativeImageUsed | |||
|- | |||
| 0x11 || 0x7 || Reserved | |||
|- | |||
| 0x18 || 0x4 || [[#ImageTransferProcessorFormat|OrigFormat]] | |||
|- | |||
| 0x1C || 0x4 || [[#ImageTransferProcessorFormat|TrimmingFormat]] | |||
|- | |||
| 0x20 || 0x2 || TrimmingStartX | |||
|- | |||
| 0x22 || 0x2 || TrimmingStartY | |||
|- | |||
| 0x24 || 0x1 || IsExternalLightFilterEnabled | |||
|} | |||
= PackedImageTransferProcessorExConfig = | |||
This is "nn::irsensor::PackedImageTransferProcessorExConfig". | |||
This is converted from [[#ImageTransferProcessorExConfig]]. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x8 || ExposureTime | |||
|- | |||
| 0x8 || 0x1 || LightTarget | |||
|- | |||
| 0x9 || 0x1 || Gain | |||
|- | |||
| 0xA || 0x1 || IsNegativeImageUsed | |||
|- | |||
| 0xB || 0x5 || Reserved | |||
|- | |||
| 0x10 || 0x4 || [[#PackedMcuVersion|RequiredMcuVersion]] | |||
|- | |||
| 0x14 || 0x1 || [[#ImageTransferProcessorFormat|OrigFormat]] | |||
|- | |||
| 0x15 || 0x1 || [[#ImageTransferProcessorFormat|TrimmingFormat]] | |||
|- | |||
| 0x16 || 0x2 || TrimmingStartX | |||
|- | |||
| 0x18 || 0x2 || TrimmingStartY | |||
|- | |||
| 0x1A || 0x1 || IsExternalLightFilterEnabled | |||
|- | |||
| 0x1B || 0x5 || Reserved | |||
|} | |||
= IrLedProcessorConfig = | |||
This is "nn::irsensor::IrLedProcessorConfig". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x4 || LightTarget | |||
|} | |||
= PackedIrLedProcessorConfig = | |||
This is "nn::irsensor::PackedIrLedProcessorConfig". | |||
This is converted from [[#IrLedProcessorConfig]]. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x4 || [[#PackedMcuVersion|RequiredMcuVersion]] | |||
|- | |||
| 0x4 || 0x1 || LightTarget | |||
|- | |||
| 0x5 || 0x3 || Padding | |||
|} | |||
= AdaptiveClusteringProcessorConfig = | |||
This is "nn::irsensor::AdaptiveClusteringProcessorConfig". | |||
AdaptiveClusteringProcessor was added with [5.0.0+]. | |||
This is converted to [[#TeraPluginProcessorConfig]] by the user-process. [[#TeraPluginProcessorConfig]]+0x3 is zero. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x4 || [[#AdaptiveClusteringMode]] | |||
|- | |||
| 0x4 || 0x4 || [6.0.0+] [[#AdaptiveClusteringTargetDistance]] | |||
|} | |||
== AdaptiveClusteringMode == | |||
{| class="wikitable" border="1" | |||
! Value | |||
! Description | |||
|- | |||
| 0 || StaticFov | |||
|- | |||
| 1 || DynamicFov | |||
|} | |||
Controls the mode for [[#TeraPluginProcessorConfig]] (DynamicFov -> 0x10; StaticFov -> 0x0F). | |||
== AdaptiveClusteringTargetDistance == | |||
{| class="wikitable" border="1" | |||
! Value | |||
! Description | |||
|- | |||
| 0 || Near | |||
|- | |||
| 1 || Middle | |||
|- | |||
| 2 || Far | |||
|} | |||
Controls the second and third bytes for [[#TeraPluginProcessorConfig]] (Near-> 0x00, 0x00; Middle -> 0x01, 0x03; Far -> 0x01, 0x08). | |||
= HandAnalysisConfig = | |||
This is "nn::irsensor::HandAnalysisConfig". | |||
This is converted to [[#TeraPluginProcessorConfig]] by the user-process, which is all-zero except the mode. | |||
* pre-4.0.0: [[#TeraPluginProcessorConfig]] mode = [[#HandAnalysisMode]] - 1. | |||
* [4.0.0+]: Silhouette = 0x5, Image = 0x6, SilhouetteAndImage = 0x7, SilhouetteOnly = 0xA. | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x4 || [[#HandAnalysisMode]] | |||
|} | |||
== HandAnalysisMode == | |||
{| class="wikitable" border="1" | |||
! Value | |||
! Description | |||
|- | |||
| 0 || None (invalid) | |||
|- | |||
| 1 || Silhouette | |||
|- | |||
| 2 || Image | |||
|- | |||
| 3 || SilhouetteAndImage | |||
|- | |||
| 4 || [4.0.0+] SilhouetteOnly | |||
|} | |||
= BusHandle = | |||
This is "nn::hidbus::BusHandle". | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x4 || AbstractedPadId | |||
|- | |||
| 0x4 || 0x1 || InternalIndex | |||
|- | |||
| 0x5 || 0x1 || PlayerNumber | |||
|- | |- | ||
| 0x6 || 0x1 || BusTypeId | | 0x6 || 0x1 || BusTypeId | ||
Line 2,527: | Line 3,282: | ||
= JoyPollingReceivedData = | = JoyPollingReceivedData = | ||
This is "nn::hidbus::JoyPollingReceivedData" | This is "nn::hidbus::JoyPollingReceivedData". | ||
This is copied from the entries in [[#EnableJoyPollingReceiveMode|TransferMemory]] by GetJoyPollingReceivedData. | This is copied from the entries in [[#EnableJoyPollingReceiveMode|TransferMemory]] by GetJoyPollingReceivedData. | ||
Line 2,543: | Line 3,298: | ||
= BusType = | = BusType = | ||
This is "nn::hidbus::BusType" | This is "nn::hidbus::BusType". | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 2,557: | Line 3,312: | ||
= JoyPollingMode = | = JoyPollingMode = | ||
This is "nn::hidbus::JoyPollingMode" | This is "nn::hidbus::JoyPollingMode". | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 2,569: | Line 3,324: | ||
| 2 || [6.0.0+] sdknso uses <code>GetJoyButtonOnlyPollingDataAccessor</code> with this. | | 2 || [6.0.0+] sdknso uses <code>GetJoyButtonOnlyPollingDataAccessor</code> with this. | ||
|} | |} | ||
Other values causes [[#EnableJoyPollingReceiveMode]] to assert. | |||
= ExternalDevices = | = ExternalDevices = |