Line 15:
Line 15:
===VPAD Data===
===VPAD Data===
Can be gotten using VPADRead(), length seems to control the max amount of "datasets" to keep. A single dataset containing raw controller data is 0xAC bytes.
Can be gotten using VPADRead(), length seems to control the max amount of "datasets" to keep. A single dataset containing raw controller data is 0xAC bytes.
−
{| class="wikitable"
+
−
!Offset
+
<syntaxhighlight lang="C">
−
!Length
+
typedef struct
−
!Description
+
{
−
|-
+
uint16_t x, y; /* Touch coordinates */
−
|2
+
uint16_t touched; /* 1 = Touched, 0 = Not touched */
−
|2
+
uint16_t validity; /* 0 = All valid, 1 = X invalid, 2 = Y invalid, 3 = Both invalid? */
−
|Buttons, ABXY, Left, Right, Up, Down in that order (bits)
+
} VPADTPData;
−
|-
+
−
|3
+
typedef struct
−
|1
+
{
−
|Buttons, ZL, ZR, L, R, +, -, Power/Home, Sync in that order (bits)
+
char unknown0[0x2 - 0x0];
−
|-
+
uint16_t buttons; /* Bitmask of button flags below */
−
|12
+
char unknown4[0xc - 0x4];
−
|8
+
Vec2D lstick, rstick; /* Each contains 4-byte X and Y components */
−
|Left Joystick, vectors for X and Y
+
char unknown1c[0x52 - 0x1c];
−
|-
+
VPADTPData tpdata; /* Normal touchscreen data */
−
|20
+
VPADTPData tpdata1; /* Modified touchscreen data 1 */
−
|8
+
VPADTPData tpdata2; /* Modified touchscreen data 2 */
−
|Right Joystick, vectors for X and Y
+
char unknown6a[0xa0 - 0x6a];
−
|-
+
uint8_t volume;
−
!colspan="3"|Touchscreen Input
+
uint8_t battery; /* 0 to 6 */
−
|-
+
uint8_t unk_volume; /* One less than volume */
−
|82
+
char unknowna4[0xac - 0xa4];
−
|2
+
} VPADData;
−
|Touchscreen X
+
</syntaxhighlight>
−
|-
−
|84
−
|2
−
|Touchscreen Y
−
|-
−
|86
−
|2
−
|Flag for if touchscreen is currently being touched (1 = Yes, 0 = No)
−
|-
−
|88
−
|2
−
|Coordinate validation (0 = All Valid, 1 = Invalid X, 2 = Invalid Y, 3 = Both Invalid)
−
|-
−
|90
−
|2
−
|Modified Touchscreen X?
−
|-
−
|92
−
|2
−
|Modified Touchscreen Y?
−
|-
−
|94
−
|2
−
|Modified Flag for if touchscreen is currently being touched (1 = Yes, 0 = No)?
−
|-
−
|96
−
|2
−
|Modified Coordinate validation (0 = All Valid, 1 = Invalid X, 2 = Invalid Y, 3 = Both Invalid)?
−
|-
−
|98
−
|2
−
|Modified Touchscreen X?
−
|-
−
|100
−
|2
−
|Modified Touchscreen Y?
−
|-
−
|102
−
|2
−
|Modified Flag for if touchscreen is currently being touched (1 = Yes, 0 = No)?
−
|-
−
|104
−
|2
−
|Modified Coordinate validation (0 = All Valid, 1 = Invalid X, 2 = Invalid Y, 3 = Both Invalid)?
−
|-
−
!colspan="3"|Other Data
−
|-
−
|160
−
|1
−
|Something related to volume slider
−
|-
−
|161
−
|1
−
|Battery related. Charge level? out of 6
−
|-
−
|163
−
|1
−
|Something related to volume slider(one less than 0xA0)
−
|-
−
|164
−
|8
−
|Padding?
−
|}
== Defines ==
== Defines ==