Difference between revisions of "HID Shared Memory"
Jump to navigation
Jump to search
(10 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
HID shared memory is a 0x40000 byte read-only segment of memory shared between applications for input. The segment contains structures for most if not all input methods available to applications. | HID shared memory is a 0x40000 byte read-only segment of memory shared between applications for input. The segment contains structures for most if not all input methods available to applications. | ||
+ | |||
+ | In sdknso this is "nn::hid::detail::SharedMemoryFormat". | ||
= Memory Map = | = Memory Map = | ||
Line 10: | Line 12: | ||
| 0x0 | | 0x0 | ||
| 0x400 | | 0x400 | ||
− | | DebugPad | + | | [[#DebugPad]] |
|- | |- | ||
| 0x400 | | 0x400 | ||
Line 25: | Line 27: | ||
|- | |- | ||
| 0x3C00 | | 0x3C00 | ||
− | | 0x400 | + | | 0x1000 (0x400 * 0x04) |
− | | BasicXpad | + | | [[#BasicXpad]] |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
| 0x4C00 | | 0x4C00 | ||
| 0x200 | | 0x200 | ||
− | | HomeButton | + | | [[#HomeButton]] |
|- | |- | ||
| 0x4E00 | | 0x4E00 | ||
| 0x200 | | 0x200 | ||
− | | SleepButton | + | | [[#SleepButton]] |
|- | |- | ||
| 0x5000 | | 0x5000 | ||
| 0x200 | | 0x200 | ||
− | | CaptureButton | + | | [[#CaptureButton]] |
|- | |- | ||
| 0x5200 | | 0x5200 | ||
− | | 0x800 | + | | 0x800 (0x80 * 0x10) |
− | | InputDetector | + | | [[#InputDetector]] |
|- | |- | ||
| 0x5A00 | | 0x5A00 | ||
− | | 0x4000 | + | | 0x4000 (0x400 * 0x10) |
− | | | + | | [1.0.0-4.1.0] [[#UniquePad]] |
|- | |- | ||
| 0x9A00 | | 0x9A00 | ||
− | | 0x32000 | + | | 0x32000 (0x5000 * 0x0A) |
− | | Npad | + | | [[#Npad]] |
|- | |- | ||
| 0x3BA00 | | 0x3BA00 | ||
− | | | + | | 0x800 |
− | | Gesture | + | | [[#Gesture]] |
|- | |- | ||
| 0x3C200 | | 0x3C200 | ||
− | | | + | | 0x20 |
− | | [5.0.0+] ConsoleSixAxisSensor | + | | [5.0.0+] [[#ConsoleSixAxisSensor]] |
|} | |} | ||
− | == | + | == DebugPad == |
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
Line 81: | Line 71: | ||
|- | |- | ||
| 0x0 | | 0x0 | ||
− | | | + | | 0x20 |
− | | [[# | + | | [[#DebugPadHeader]] |
|- | |- | ||
− | | | + | | 0x20 |
− | | | + | | 0x28 * 17 |
− | | Array of [[# | + | | Array of [[#DebugPadState]] |
|} | |} | ||
− | === | + | === DebugPadHeader === |
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
Line 98: | Line 88: | ||
| 0x0 | | 0x0 | ||
| 0x8 | | 0x8 | ||
− | | Timestamp in ticks | + | | Timestamp in ticks |
|- | |- | ||
| 0x8 | | 0x8 | ||
| 0x8 | | 0x8 | ||
− | | Number of Entries | + | | Number of Entries (always 17) |
|- | |- | ||
| 0x10 | | 0x10 | ||
Line 110: | Line 100: | ||
| 0x18 | | 0x18 | ||
| 0x8 | | 0x8 | ||
− | | Maximum Entry Index | + | | Maximum Entry Index (always 16) |
+ | |} | ||
+ | |||
+ | === DebugPadState === | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x8 | ||
+ | | Timestamp in samples (global) | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x20 | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | == TouchScreen == | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x20 | ||
+ | | [[#TouchScreenHeader]] | ||
|- | |- | ||
| 0x20 | | 0x20 | ||
− | | | + | | 0x298 * 17 |
− | | | + | | Array of [[#TouchScreenState]] |
|} | |} | ||
− | === | + | === TouchScreenHeader === |
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
Line 125: | Line 143: | ||
|- | |- | ||
| 0x0 | | 0x0 | ||
+ | | 0x8 | ||
+ | | Timestamp in ticks | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x8 | ||
+ | | Number of Entries (always 17) | ||
+ | |- | ||
| 0x10 | | 0x10 | ||
− | | | + | | 0x8 |
+ | | Latest Entry Index | ||
|- | |- | ||
− | | | + | | 0x18 |
− | | | + | | 0x8 |
− | | | + | | Maximum Entry Index (always 16) |
|} | |} | ||
− | === | + | === TouchScreenState === |
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
Line 141: | Line 167: | ||
|- | |- | ||
| 0x0 | | 0x0 | ||
+ | | 0x8 | ||
+ | | Timestamp in samples (global) | ||
+ | |- | ||
+ | | 0x8 | ||
| 0x8 | | 0x8 | ||
| Timestamp in samples | | Timestamp in samples | ||
|- | |- | ||
− | | | + | | 0x10 |
| 0x8 | | 0x8 | ||
| Touch count | | Touch count | ||
+ | |- | ||
+ | | 0x18 | ||
+ | | 0x28 * 16 | ||
+ | | [[#TouchScreenStateData]] | ||
|} | |} | ||
Line 218: | Line 252: | ||
| 0x0 | | 0x0 | ||
| 0x8 | | 0x8 | ||
− | | Timestamp in ticks | + | | Timestamp in ticks |
|- | |- | ||
| 0x8 | | 0x8 | ||
| 0x8 | | 0x8 | ||
− | | Number of Entries | + | | Number of Entries (always 17) |
|- | |- | ||
| 0x10 | | 0x10 | ||
Line 230: | Line 264: | ||
| 0x18 | | 0x18 | ||
| 0x8 | | 0x8 | ||
− | | Maximum Entry Index | + | | Maximum Entry Index (always 16) |
|} | |} | ||
Line 242: | Line 276: | ||
| 0x0 | | 0x0 | ||
| 0x8 | | 0x8 | ||
− | | Timestamp in samples | + | | Timestamp in samples (global) |
|- | |- | ||
| 0x8 | | 0x8 | ||
| 0x8 | | 0x8 | ||
− | | Timestamp in samples | + | | Timestamp in samples |
|- | |- | ||
| 0x10 | | 0x10 | ||
Line 302: | Line 336: | ||
| 0x0 | | 0x0 | ||
| 0x8 | | 0x8 | ||
− | | Timestamp in ticks | + | | Timestamp in ticks |
|- | |- | ||
| 0x8 | | 0x8 | ||
| 0x8 | | 0x8 | ||
− | | Number of Entries | + | | Number of Entries (always 17) |
|- | |- | ||
| 0x10 | | 0x10 | ||
Line 314: | Line 348: | ||
| 0x18 | | 0x18 | ||
| 0x8 | | 0x8 | ||
− | | Maximum Entry Index | + | | Maximum Entry Index (always 16) |
|} | |} | ||
Line 326: | Line 360: | ||
| 0x0 | | 0x0 | ||
| 0x8 | | 0x8 | ||
− | | Timestamp in samples | + | | Timestamp in samples (global) |
|- | |- | ||
| 0x8 | | 0x8 | ||
| 0x8 | | 0x8 | ||
− | | Timestamp in samples | + | | Timestamp in samples |
|- | |- | ||
| 0x10 | | 0x10 | ||
Line 341: | Line 375: | ||
|} | |} | ||
− | == | + | == BasicXpad == |
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x20 | ||
+ | | [[#BasicXpadHeader]] | ||
+ | |- | ||
+ | | 0x20 | ||
+ | | 0x28 * 17 | ||
+ | | Array of [[#BasicXpadState]] | ||
+ | |} | ||
+ | |||
+ | === BasicXpadHeader === | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x8 | ||
+ | | Timestamp in ticks | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x8 | ||
+ | | Number of Entries (always 17) | ||
+ | |- | ||
+ | | 0x10 | ||
+ | | 0x8 | ||
+ | | Latest Entry Index | ||
+ | |- | ||
+ | | 0x18 | ||
+ | | 0x8 | ||
+ | | Maximum Entry Index (always 16) | ||
+ | |} | ||
+ | |||
+ | === BasicXpadState === | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x8 | ||
+ | | Timestamp in samples (global) | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x20 | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | == HomeButton == | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x20 | ||
+ | | [[#HomeButtonHeader]] | ||
+ | |- | ||
+ | | 0x20 | ||
+ | | 0x18 * 17 | ||
+ | | Array of [[#HomeButtonState]] | ||
+ | |} | ||
+ | |||
+ | === HomeButtonHeader === | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x8 | ||
+ | | Timestamp in ticks | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x8 | ||
+ | | Number of Entries (always 17) | ||
+ | |- | ||
+ | | 0x10 | ||
+ | | 0x8 | ||
+ | | Latest Entry Index | ||
+ | |- | ||
+ | | 0x18 | ||
+ | | 0x8 | ||
+ | | Maximum Entry Index (always 16) | ||
+ | |} | ||
+ | |||
+ | === HomeButtonState === | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x8 | ||
+ | | Timestamp in samples (global) | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x10 | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | == SleepButton == | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x20 | ||
+ | | [[#SleepButtonHeader]] | ||
+ | |- | ||
+ | | 0x20 | ||
+ | | 0x18 * 17 | ||
+ | | Array of [[#SleepButtonState]] | ||
+ | |} | ||
+ | |||
+ | === SleepButtonHeader === | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x8 | ||
+ | | Timestamp in ticks | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x8 | ||
+ | | Number of Entries (always 17) | ||
+ | |- | ||
+ | | 0x10 | ||
+ | | 0x8 | ||
+ | | Latest Entry Index | ||
+ | |- | ||
+ | | 0x18 | ||
+ | | 0x8 | ||
+ | | Maximum Entry Index (always 16) | ||
+ | |} | ||
+ | |||
+ | === SleepButtonState === | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x8 | ||
+ | | Timestamp in samples (global) | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x10 | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | == CaptureButton == | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x20 | ||
+ | | [[#CaptureButtonHeader]] | ||
+ | |- | ||
+ | | 0x20 | ||
+ | | 0x18 * 17 | ||
+ | | Array of [[#CaptureButtonState]] | ||
+ | |} | ||
+ | |||
+ | === CaptureButtonHeader === | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x8 | ||
+ | | Timestamp in ticks | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x8 | ||
+ | | Number of Entries (always 17) | ||
+ | |- | ||
+ | | 0x10 | ||
+ | | 0x8 | ||
+ | | Latest Entry Index | ||
+ | |- | ||
+ | | 0x18 | ||
+ | | 0x8 | ||
+ | | Maximum Entry Index (always 16) | ||
+ | |} | ||
+ | |||
+ | === CaptureButtonState === | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x8 | ||
+ | | Timestamp in samples (global) | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x10 | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | == InputDetector == | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x20 | ||
+ | | [[#InputDetectorHeader]] | ||
+ | |- | ||
+ | | 0x20 | ||
+ | | 0x18 * 2 | ||
+ | | Array of [[#InputDetectorState]] | ||
+ | |} | ||
+ | |||
+ | === InputDetectorHeader === | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x8 | ||
+ | | Timestamp in ticks | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x8 | ||
+ | | Number of Entries (always 17) | ||
+ | |- | ||
+ | | 0x10 | ||
+ | | 0x8 | ||
+ | | Latest Entry Index | ||
+ | |- | ||
+ | | 0x18 | ||
+ | | 0x8 | ||
+ | | Maximum Entry Index (always 16) | ||
+ | |} | ||
+ | |||
+ | === InputDetectorState === | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x8 | ||
+ | | Timestamp in samples (global) | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x10 | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | == UniquePad == | ||
This section contains a series of 16 structures 0x400 bytes large. | This section contains a series of 16 structures 0x400 bytes large. | ||
+ | [5.0.0+] This section has been removed from SharedMemoryFormat. [[#UniquePad]] is now a specialization of [[#Npad]]. | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x80 | ||
+ | | [[#UniquePadConfig]] | ||
+ | |- | ||
+ | | 0x80 | ||
+ | | 0x70 * 2 | ||
+ | | Array of [[#AnalogStickCalibration]] | ||
+ | |} | ||
+ | |||
+ | === UniquePadConfig === | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x20 | ||
+ | | [[#UniquePadConfigHeader]] | ||
+ | |- | ||
+ | | 0x20 | ||
+ | | 0x30 * 2 | ||
+ | | Array of [[#UniquePadConfigState]] | ||
+ | |} | ||
+ | |||
+ | ==== UniquePadConfigHeader ==== | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x8 | ||
+ | | Timestamp in ticks | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x8 | ||
+ | | Number of Entries (always 17) | ||
+ | |- | ||
+ | | 0x10 | ||
+ | | 0x8 | ||
+ | | Latest Entry Index | ||
+ | |- | ||
+ | | 0x18 | ||
+ | | 0x8 | ||
+ | | Maximum Entry Index (always 16) | ||
+ | |} | ||
+ | |||
+ | ==== UniquePadConfigState ==== | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
− | ! | + | ! Offset |
− | ! | + | ! Size |
− | ! | + | ! Description |
|- | |- | ||
− | | | + | | 0x0 |
− | | | + | | 0x8 |
− | | | + | | Timestamp in samples (global) |
|- | |- | ||
− | | | + | | 0x8 |
− | | | + | | 0x8 |
− | | | + | | |
|- | |- | ||
+ | | 0x10 | ||
+ | | 0x20 | ||
+ | | Controller Serial | ||
+ | |} | ||
+ | |||
+ | === AnalogStickCalibration === | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x20 | ||
+ | | [[#AnalogStickCalibrationHeader]] | ||
+ | |- | ||
+ | | 0x20 | ||
+ | | 0x28 * 2 | ||
+ | | Array of [[#AnalogStickCalibrationState]] | ||
+ | |} | ||
+ | |||
+ | ==== AnalogStickCalibrationHeader ==== | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x8 | ||
+ | | Timestamp in ticks | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x8 | ||
+ | | Number of Entries (always 17) | ||
+ | |- | ||
+ | | 0x10 | ||
+ | | 0x8 | ||
+ | | Latest Entry Index | ||
+ | |- | ||
+ | | 0x18 | ||
+ | | 0x8 | ||
+ | | Maximum Entry Index (always 16) | ||
+ | |} | ||
+ | |||
+ | ==== AnalogStickCalibrationState ==== | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x8 | ||
+ | | Timestamp in samples (global) | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x28 | ||
+ | | | ||
|} | |} | ||
Line 378: | Line 809: | ||
|} | |} | ||
− | === | + | === NpadState === |
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
Line 387: | Line 818: | ||
| 0x0 | | 0x0 | ||
| 0x28 | | 0x28 | ||
− | | [[# | + | | [[#NpadStateHeader]] |
|- | |- | ||
| 0x28 | | 0x28 | ||
Line 511: | Line 942: | ||
| 0x419C | | 0x419C | ||
| 0x4 | | 0x4 | ||
− | | | + | | BatteryIndex0 state (must be 0-4) |
|- | |- | ||
| 0x41A0 | | 0x41A0 | ||
| 0x4 | | 0x4 | ||
− | | | + | | BatteryIndex1 state (must be 0-4) |
|- | |- | ||
| 0x41A4 | | 0x41A4 | ||
| 0x4 | | 0x4 | ||
− | | | + | | BatteryIndex2 state (must be 0-4) |
|- | |- | ||
| 0x41A8 | | 0x41A8 | ||
Line 542: | Line 973: | ||
|} | |} | ||
− | ==== | + | ==== NpadStateHeader ==== |
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
Line 599: | Line 1,030: | ||
| 0x0 | | 0x0 | ||
| 0x8 | | 0x8 | ||
− | | Timestamp in ticks | + | | Timestamp in ticks |
|- | |- | ||
| 0x8 | | 0x8 | ||
| 0x8 | | 0x8 | ||
− | | Number of entries | + | | Number of entries (always 17) |
|- | |- | ||
| 0x10 | | 0x10 | ||
Line 611: | Line 1,042: | ||
| 0x18 | | 0x18 | ||
| 0x8 | | 0x8 | ||
− | | Maximum Entry Index | + | | Maximum Entry Index (always 16) |
|} | |} | ||
Line 623: | Line 1,054: | ||
| 0x0 | | 0x0 | ||
| 0x8 | | 0x8 | ||
− | | Timestamp in samples | + | | Timestamp in samples (global) |
|- | |- | ||
| 0x8 | | 0x8 | ||
| 0x8 | | 0x8 | ||
− | | Timestamp in samples | + | | Timestamp in samples |
|- | |- | ||
| 0x10 | | 0x10 | ||
| 0x8 | | 0x8 | ||
− | | [[# | + | | [[#NpadButton]] |
|- | |- | ||
| 0x18 | | 0x18 | ||
Line 654: | Line 1,085: | ||
|} | |} | ||
− | ===== | + | ===== NpadButton ===== |
+ | This is the u64 bitmask for "nn::hid::NpadButton". | ||
+ | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
|- | |- | ||
Line 748: | Line 1,181: | ||
| 0x0 | | 0x0 | ||
| 0x8 | | 0x8 | ||
− | | Timestamp in ticks | + | | Timestamp in ticks |
|- | |- | ||
| 0x8 | | 0x8 | ||
| 0x8 | | 0x8 | ||
− | | Number of entries | + | | Number of entries (always 17) |
|- | |- | ||
| 0x10 | | 0x10 | ||
Line 760: | Line 1,193: | ||
| 0x18 | | 0x18 | ||
| 0x8 | | 0x8 | ||
− | | Maximum Entry Index | + | | Maximum Entry Index (up to 16) |
|} | |} | ||
Line 772: | Line 1,205: | ||
| 0x0 | | 0x0 | ||
| 0x8 | | 0x8 | ||
− | | Timestamp in samples | + | | Timestamp in samples (global) |
|- | |- | ||
| 0x8 | | 0x8 | ||
Line 780: | Line 1,213: | ||
| 0x10 | | 0x10 | ||
| 0x8 | | 0x8 | ||
− | | Timestamp in samples | + | | Timestamp in samples |
|- | |- | ||
| 0x1C | | 0x1C | ||
Line 865: | Line 1,298: | ||
| 0 | | 0 | ||
| UnintendedHomeButtonInputProtectionEnabled (if cleared) | | UnintendedHomeButtonInputProtectionEnabled (if cleared) | ||
+ | |} | ||
+ | |||
+ | == Gesture == | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x20 | ||
+ | | [[#GestureHeader]] | ||
+ | |- | ||
+ | | 0x20 | ||
+ | | 0x68 * 17 | ||
+ | | Array of [[#GestureState]] | ||
+ | |} | ||
+ | |||
+ | === GestureHeader === | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x8 | ||
+ | | Timestamp in ticks | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x8 | ||
+ | | Number of Entries (always 17) | ||
+ | |- | ||
+ | | 0x10 | ||
+ | | 0x8 | ||
+ | | Latest Entry Index | ||
+ | |- | ||
+ | | 0x18 | ||
+ | | 0x8 | ||
+ | | Maximum Entry Index (always 16) | ||
+ | |} | ||
+ | |||
+ | === GestureState === | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x8 | ||
+ | | Timestamp in samples (global) | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x60 | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | == ConsoleSixAxisSensor == | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Offset | ||
+ | ! Size | ||
+ | ! Description | ||
+ | |- | ||
+ | | 0x0 | ||
+ | | 0x8 | ||
+ | | Timestamp in samples | ||
+ | |- | ||
+ | | 0x8 | ||
+ | | 0x1 | ||
+ | | IsSevenSixAxisSensorAtRest | ||
+ | |- | ||
+ | | 0x9 | ||
+ | | 0x3 | ||
+ | | Padding | ||
+ | |- | ||
+ | | 0xC | ||
+ | | 0x4 | ||
+ | | VerticalizationError | ||
+ | |- | ||
+ | | 0x10 | ||
+ | | 0xC | ||
+ | | GyroBias | ||
+ | |- | ||
+ | | 0x1C | ||
+ | | 0x4 | ||
+ | | Padding | ||
|} | |} |
Revision as of 19:55, 17 January 2020
HID shared memory is a 0x40000 byte read-only segment of memory shared between applications for input. The segment contains structures for most if not all input methods available to applications.
In sdknso this is "nn::hid::detail::SharedMemoryFormat".
Memory Map
Offset | Size | Description |
---|---|---|
0x0 | 0x400 | #DebugPad |
0x400 | 0x3000 | #TouchScreen |
0x3400 | 0x400 | #Mouse |
0x3800 | 0x400 | #Keyboard |
0x3C00 | 0x1000 (0x400 * 0x04) | #BasicXpad |
0x4C00 | 0x200 | #HomeButton |
0x4E00 | 0x200 | #SleepButton |
0x5000 | 0x200 | #CaptureButton |
0x5200 | 0x800 (0x80 * 0x10) | #InputDetector |
0x5A00 | 0x4000 (0x400 * 0x10) | [1.0.0-4.1.0] #UniquePad |
0x9A00 | 0x32000 (0x5000 * 0x0A) | #Npad |
0x3BA00 | 0x800 | #Gesture |
0x3C200 | 0x20 | [5.0.0+] #ConsoleSixAxisSensor |
DebugPad
Offset | Size | Description |
---|---|---|
0x0 | 0x20 | #DebugPadHeader |
0x20 | 0x28 * 17 | Array of #DebugPadState |
DebugPadHeader
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in ticks |
0x8 | 0x8 | Number of Entries (always 17) |
0x10 | 0x8 | Latest Entry Index |
0x18 | 0x8 | Maximum Entry Index (always 16) |
DebugPadState
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in samples (global) |
0x8 | 0x20 |
TouchScreen
Offset | Size | Description |
---|---|---|
0x0 | 0x20 | #TouchScreenHeader |
0x20 | 0x298 * 17 | Array of #TouchScreenState |
TouchScreenHeader
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in ticks |
0x8 | 0x8 | Number of Entries (always 17) |
0x10 | 0x8 | Latest Entry Index |
0x18 | 0x8 | Maximum Entry Index (always 16) |
TouchScreenState
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in samples (global) |
0x8 | 0x8 | Timestamp in samples |
0x10 | 0x8 | Touch count |
0x18 | 0x28 * 16 | #TouchScreenStateData |
TouchScreenStateData
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in samples |
0x8 | 0x4 | Padding |
0xC | 0x4 | Touch Index |
0x10 | 0x4 | Touch X |
0x14 | 0x4 | Touch Y |
0x18 | 0x4 | Touch Diameter X |
0x1C | 0x4 | Touch Diameter Y |
0x20 | 0x4 | Angle |
0x24 | 0x4 | Padding |
Mouse
Offset | Size | Description |
---|---|---|
0x0 | 0x20 | #MouseHeader |
0x20 | 0x30 * 17 | Array of #MouseState |
MouseHeader
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in ticks |
0x8 | 0x8 | Number of Entries (always 17) |
0x10 | 0x8 | Latest Entry Index |
0x18 | 0x8 | Maximum Entry Index (always 16) |
MouseState
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in samples (global) |
0x8 | 0x8 | Timestamp in samples |
0x10 | 0x4 | Mouse X |
0x14 | 0x4 | Mouse Y |
0x18 | 0x4 | Mouse X Change |
0x1C | 0x4 | Mouse Y Change |
0x20 | 0x4 | Scroll Change Y |
0x24 | 0x4 | Scroll Change X |
0x28 | 0x8 | Mouse Buttons |
Keyboard
Offset | Size | Description |
---|---|---|
0x0 | 0x20 | #KeyboardHeader |
0x20 | 0x38 * 17 | Array of #KeyboardState |
KeyboardHeader
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in ticks |
0x8 | 0x8 | Number of Entries (always 17) |
0x10 | 0x8 | Latest Entry Index |
0x18 | 0x8 | Maximum Entry Index (always 16) |
KeyboardState
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in samples (global) |
0x8 | 0x8 | Timestamp in samples |
0x10 | 0x8 | Modifier Mask |
0x18 | 0x20 | Keys Down, each key gets one bit based on the HID keyboard scan code (F1 is 0x3A, bit 0x3A is set) |
BasicXpad
Offset | Size | Description |
---|---|---|
0x0 | 0x20 | #BasicXpadHeader |
0x20 | 0x28 * 17 | Array of #BasicXpadState |
BasicXpadHeader
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in ticks |
0x8 | 0x8 | Number of Entries (always 17) |
0x10 | 0x8 | Latest Entry Index |
0x18 | 0x8 | Maximum Entry Index (always 16) |
BasicXpadState
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in samples (global) |
0x8 | 0x20 |
HomeButton
Offset | Size | Description |
---|---|---|
0x0 | 0x20 | #HomeButtonHeader |
0x20 | 0x18 * 17 | Array of #HomeButtonState |
HomeButtonHeader
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in ticks |
0x8 | 0x8 | Number of Entries (always 17) |
0x10 | 0x8 | Latest Entry Index |
0x18 | 0x8 | Maximum Entry Index (always 16) |
HomeButtonState
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in samples (global) |
0x8 | 0x10 |
SleepButton
Offset | Size | Description |
---|---|---|
0x0 | 0x20 | #SleepButtonHeader |
0x20 | 0x18 * 17 | Array of #SleepButtonState |
SleepButtonHeader
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in ticks |
0x8 | 0x8 | Number of Entries (always 17) |
0x10 | 0x8 | Latest Entry Index |
0x18 | 0x8 | Maximum Entry Index (always 16) |
SleepButtonState
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in samples (global) |
0x8 | 0x10 |
CaptureButton
Offset | Size | Description |
---|---|---|
0x0 | 0x20 | #CaptureButtonHeader |
0x20 | 0x18 * 17 | Array of #CaptureButtonState |
CaptureButtonHeader
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in ticks |
0x8 | 0x8 | Number of Entries (always 17) |
0x10 | 0x8 | Latest Entry Index |
0x18 | 0x8 | Maximum Entry Index (always 16) |
CaptureButtonState
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in samples (global) |
0x8 | 0x10 |
InputDetector
Offset | Size | Description |
---|---|---|
0x0 | 0x20 | #InputDetectorHeader |
0x20 | 0x18 * 2 | Array of #InputDetectorState |
InputDetectorHeader
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in ticks |
0x8 | 0x8 | Number of Entries (always 17) |
0x10 | 0x8 | Latest Entry Index |
0x18 | 0x8 | Maximum Entry Index (always 16) |
InputDetectorState
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in samples (global) |
0x8 | 0x10 |
UniquePad
This section contains a series of 16 structures 0x400 bytes large.
[5.0.0+] This section has been removed from SharedMemoryFormat. #UniquePad is now a specialization of #Npad.
Offset | Size | Description |
---|---|---|
0x0 | 0x80 | #UniquePadConfig |
0x80 | 0x70 * 2 | Array of #AnalogStickCalibration |
UniquePadConfig
Offset | Size | Description |
---|---|---|
0x0 | 0x20 | #UniquePadConfigHeader |
0x20 | 0x30 * 2 | Array of #UniquePadConfigState |
UniquePadConfigHeader
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in ticks |
0x8 | 0x8 | Number of Entries (always 17) |
0x10 | 0x8 | Latest Entry Index |
0x18 | 0x8 | Maximum Entry Index (always 16) |
UniquePadConfigState
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in samples (global) |
0x8 | 0x8 | |
0x10 | 0x20 | Controller Serial |
AnalogStickCalibration
Offset | Size | Description |
---|---|---|
0x0 | 0x20 | #AnalogStickCalibrationHeader |
0x20 | 0x28 * 2 | Array of #AnalogStickCalibrationState |
AnalogStickCalibrationHeader
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in ticks |
0x8 | 0x8 | Number of Entries (always 17) |
0x10 | 0x8 | Latest Entry Index |
0x18 | 0x8 | Maximum Entry Index (always 16) |
AnalogStickCalibrationState
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in samples (global) |
0x8 | 0x28 |
Npad
This section contains a series of 10 0x5000 byte structures describing each available controller.
Index | Description |
---|---|
0 to 7 | Players 1 to 8 |
8 | Handheld Mode |
9 | Unknown |
NpadState
Offset | Size | Description |
---|---|---|
0x0 | 0x28 | #NpadStateHeader |
0x28 | 0x20 | NpadFullKeyHeader |
0x48 | 0x30 * 17 | Array of NpadFullKeyState |
0x378 | 0x20 | #NpadHandheldHeader |
0x398 | 0x30 * 17 | Array of #NpadHandheldState |
0x6C8 | 0x20 | NpadJoyDualHeader |
0x6E8 | 0x30 * 17 | Array of NpadJoyDualState |
0xA18 | 0x20 | NpadJoyLeftHeader |
0xA38 | 0x30 * 17 | Array of NpadJoyLeftState |
0xD68 | 0x20 | NpadJoyRightHeader |
0xD88 | 0x30 * 17 | Array of NpadJoyRightState |
0x10B8 | 0x20 | NpadPalmaHeader |
0x12B8 | 0x30 * 17 | Array of NpadPalmaState |
0x1408 | 0x20 | NpadSystemExtHeader |
0x1428 | 0x30 * 17 | Array of NpadSystemExtState |
0x1758 | 0x20 | NpadSixAxisSensorFullKeyHeader |
0x1778 | 0x68 * 17 | Array of NpadSixAxisSensorFullKeyState |
0x1E60 | 0x20 | NpadSixAxisSensorHandheldHeader |
0x1E80 | 0x68 * 17 | Array of NpadSixAxisSensorHandheldState |
0x2568 | 0x20 | NpadSixAxisSensorJoyLeftDualHeader |
0x2588 | 0x68 * 17 | Array of NpadSixAxisSensorJoyLeftDualState |
0x2C70 | 0x20 | NpadSixAxisSensorJoyRightDualHeader |
0x2C90 | 0x68 * 17 | Array of NpadSixAxisSensorJoyRightDualState |
0x3378 | 0x20 | NpadSixAxisSensorJoyLeftHeader |
0x3398 | 0x68 * 17 | Array of NpadSixAxisSensorJoyLeftState |
0x3A80 | 0x20 | NpadSixAxisSensorJoyRightHeader |
0x3AA0 | 0x68 * 17 | Array of NpadSixAxisSensorJoyRightState |
0x4188 | 0x4 | DeviceType |
0x418C | 0x4 | Padding |
0x4190 | 0x8 | #NpadSystemProperties |
0x4198 | 0x4 | #NpadSystemButtonProperties |
0x419C | 0x4 | BatteryIndex0 state (must be 0-4) |
0x41A0 | 0x4 | BatteryIndex1 state (must be 0-4) |
0x41A4 | 0x4 | BatteryIndex2 state (must be 0-4) |
0x41A8 | 0x20 | NfcXcdDeviceHandleHeader |
0x41C8 | 0x20 * 2 | Array of NfcXcdDeviceHandleState |
0x4208 | 0x8 | Mutex |
0x4248 | 0x20 | NpadGcTriggerHeader |
0x4268 | 0x18 * 17 | Array of NpadGcTriggerState |
NpadStateHeader
Offset | Size | Description |
---|---|---|
0x0 | 0x4 | Status, bit0 Pro Controller/HID controller, bit1 wired for handheld, bit2 pair, bit3 left, bit4 right |
0x4 | 0x4 | Is Joy-Con Half |
0x8 | 0x4 | bit1 color set does not exist |
0xC | 0x4 | RGBA Body Color (single Joy-Con or Pro Controller) |
0x10 | 0x4 | RGBA Button Color (single Joy-Con or Pro Controller) |
0x14 | 0x4 | bit1 color set does not exist |
0x18 | 0x4 | RGBA Body Color (right Joy-Con) |
0x1C | 0x4 | RGBA Button Color (right Joy-Con) |
0x20 | 0x4 | RGBA Body Color (left Joy-Con) |
0x24 | 0x4 | RGBA Button Color (left Joy-Con) |
NpadHandheldHeader
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in ticks |
0x8 | 0x8 | Number of entries (always 17) |
0x10 | 0x8 | Latest Entry Index |
0x18 | 0x8 | Maximum Entry Index (always 16) |
NpadHandheldState
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in samples (global) |
0x8 | 0x8 | Timestamp in samples |
0x10 | 0x8 | #NpadButton |
0x18 | 0x4 | Left Joystick X |
0x1C | 0x4 | Left Joystick Y |
0x20 | 0x4 | Right Joystick X |
0x24 | 0x4 | Right Joystick Y |
0x28 | 0x8 | Controller State (bit0 connected, bit1 wired) |
NpadButton
This is the u64 bitmask for "nn::hid::NpadButton".
Bit | Button |
---|---|
0 | A |
1 | B |
2 | X |
3 | Y |
4 | Left Stick Pressed |
5 | Right Stick Pressed |
6 | L |
7 | R |
8 | ZL |
9 | ZR |
10 | Plus |
11 | Minus |
12 | Left |
13 | Up |
14 | Right |
15 | Down |
16 | Left Stick Left |
17 | Left Stick Up |
18 | Left Stick Right |
19 | Left Stick Down |
20 | Right Stick Left |
21 | Right Stick Up |
22 | Right Stick Right |
23 | Right Stick Down |
24 | SL |
25 | SR |
NpadSixAxisSensorHandheldHeader
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in ticks |
0x8 | 0x8 | Number of entries (always 17) |
0x10 | 0x8 | Latest Entry Index |
0x18 | 0x8 | Maximum Entry Index (up to 16) |
NpadSixAxisSensorHandheldState
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in samples (global) |
0x8 | 0x8 | Unknown |
0x10 | 0x8 | Timestamp in samples |
0x1C | 0x4 * 3 | Accelerometer data as 3 floats |
0x24 | 0x4 * 3 | Gyroscope data as 3 floats |
0x30 | 0x4 * 3 | Unknown sensor data as 3 floats |
0x3C | 0x4 * 9 | Orientation basis as 3x3 matrix of floats |
0x60 | 0x8 | Unknown, always 1 |
Official sw copies the data from offset 0x8 size 0x60 to the final output state.
NpadSystemProperties
Bit | Description |
---|---|
0 | PowerInfo0 isCharging |
1 | PowerInfo1 isCharging |
2 | PowerInfo2 isCharging |
3 | PowerInfo0 powerConnected |
4 | PowerInfo1 powerConnected |
5 | PowerInfo2 powerConnected |
6-8 | Unused |
9 | UnsupportedButtonPressed_NpadSystem |
10 | UnsupportedButtonPressed_NpadSystemExt |
11 | AbxyButtonOriented |
12 | SlSrButtonOriented |
13 | [4.0.0+] PlusButtonCapability |
14 | [4.0.0+] MinusButtonCapability |
15 | [8.0.0+] DirectionalButtonsSupported |
16-63 | Unused |
NpadSystemButtonProperties
Bit | Description |
---|---|
0 | UnintendedHomeButtonInputProtectionEnabled (if cleared) |
Gesture
Offset | Size | Description |
---|---|---|
0x0 | 0x20 | #GestureHeader |
0x20 | 0x68 * 17 | Array of #GestureState |
GestureHeader
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in ticks |
0x8 | 0x8 | Number of Entries (always 17) |
0x10 | 0x8 | Latest Entry Index |
0x18 | 0x8 | Maximum Entry Index (always 16) |
GestureState
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in samples (global) |
0x8 | 0x60 |
ConsoleSixAxisSensor
Offset | Size | Description |
---|---|---|
0x0 | 0x8 | Timestamp in samples |
0x8 | 0x1 | IsSevenSixAxisSensorAtRest |
0x9 | 0x3 | Padding |
0xC | 0x4 | VerticalizationError |
0x10 | 0xC | GyroBias |
0x1C | 0x4 | Padding |