HID Shared Memory

From 3dbrew
Revision as of 16:48, 27 July 2014 by Ichfly (talk | contribs)
Jump to navigation Jump to search

This page describes the format of the HID shared memory.

The data for each of the below entries(PAD state, circle-pad, touch-screen, etc) is originally read by the HID module at different times per frame.

size: 0x2b0 (FIRM 4.4)

Offset 0x0

Relative offset Description
0x1C PAD state. Bit set = button pressed, bit clear = button not pressed.
0x28 Second PAD state entry.
0x34 This stores circle-pad info: the low s16 is the X coordinate, the high s16 is the Y coordinate. The circle-pad center is ~0 for these fields. The range for these fields is approximately: -0x9C(bottom/left) - 0x9C(top/right).
0x38 Third PAD state entry.
0x44 Second circle-pad info entry.
0x48 Fourth PAD state entry.
0x54 Third circle-pad info entry.
0x58 Fifth PAD state entry.
0x64 Fourth circle-pad info entry.
0x68 Sixth PAD state entry.
0x74 Fifth circle-pad info entry.
0x78 Seventh PAD state entry.
0x84 Sixth circle-pad info entry.
0x88 Eighth PAD state entry.
0x94 Seventh circle-pad info entry.
0x98 Ninth PAD state entry.
0xB8 first used entry number in the touch-screen position info buffer?

Offset 0xC0

This 0x48-byte region stores entries for touch-screen position info. Each entry is 0x8-bytes, there's a total of 9 entries. When the touch-screen is not being touched, this region is all-zero.

The last 8 entries contain the pixel coordinates, while the first entry seems to contain the raw coordinate data prior to being converted to pixel coordinates.

Entry format

Relative offset Size Description
0x0 0x2 X coordinate.
0x2 0x2 Y coordinate.
0x4 0x4 This is 0x0 when this entry doesn't contain any actual data, value 0x1 indicates that this entry contains actual data.