WUT  0.1
Wii U Toolchain
input.h
Go to the documentation of this file.
1 #pragma once
2 #include <wut.h>
3 
10 #ifdef __cplusplus
11 "C" {
12 #endif
13 
14 typedef struct VPADVec2D VPADVec2D;
15 typedef struct VPADVec3D VPADVec3D;
19 typedef struct VPADStatus VPADStatus;
20 
21 typedef enum VPADButtons
22 {
23  VPAD_BUTTON_A = 0x8000,
24  VPAD_BUTTON_B = 0x4000,
25  VPAD_BUTTON_X = 0x2000,
26  VPAD_BUTTON_Y = 0x1000,
27  VPAD_BUTTON_LEFT = 0x0800,
29  VPAD_BUTTON_UP = 0x0200,
30  VPAD_BUTTON_DOWN = 0x0100,
31  VPAD_BUTTON_ZL = 0x0080,
32  VPAD_BUTTON_ZR = 0x0040,
33  VPAD_BUTTON_L = 0x0020,
34  VPAD_BUTTON_R = 0x0010,
35  VPAD_BUTTON_PLUS = 0x0008,
37  VPAD_BUTTON_HOME = 0x0002,
38  VPAD_BUTTON_SYNC = 0x0001,
39  VPAD_BUTTON_STICK_R = 0x00020000,
40  VPAD_BUTTON_STICK_L = 0x00040000,
41  VPAD_BUTTON_TV = 0x00010000,
42 } VPADButtons;
43 
45 {
47  VPAD_VALID = 0x0,
48 
51 
55 
56 
57 typedef enum VPADReadError
58 {
63 
64 struct VPADVec2D
65 {
66  float x;
67  float y;
68 };
69 CHECK_OFFSET(VPADVec2D, 0x00, x);
70 CHECK_OFFSET(VPADVec2D, 0x04, y);
71 CHECK_SIZE(VPADVec2D, 0x08);
72 
73 struct VPADVec3D
74 {
75  float x;
76  float y;
77  float z;
78 };
79 CHECK_OFFSET(VPADVec3D, 0x00, x);
80 CHECK_OFFSET(VPADVec3D, 0x04, y);
81 CHECK_OFFSET(VPADVec3D, 0x08, z);
82 CHECK_SIZE(VPADVec3D, 0x0C);
83 
85 {
86  uint16_t x;
87  uint16_t y;
88 
90  uint16_t touched;
91 
93  uint16_t validity;
94 };
95 CHECK_OFFSET(VPADTouchData, 0x00, x);
96 CHECK_OFFSET(VPADTouchData, 0x02, y);
97 CHECK_OFFSET(VPADTouchData, 0x04, touched);
98 CHECK_OFFSET(VPADTouchData, 0x06, validity);
99 CHECK_SIZE(VPADTouchData, 0x08);
100 
102 {
103  float unk1;
104  float unk2;
105  float unk3;
106  float unk4;
107  float unk5;
109 };
110 CHECK_OFFSET(VPADAccStatus, 0x14, vertical);
111 CHECK_SIZE(VPADAccStatus, 0x1c);
112 
114 {
115  float unk1;
116  float unk2;
117  float unk3;
118  float unk4;
119  float unk5;
120  float unk6;
121 };
122 CHECK_SIZE(VPADGyroStatus, 0x18);
123 
125 {
127  uint32_t hold;
128 
130  uint32_t trigger;
131 
133  uint32_t release;
134 
137 
140 
143 
146 
147  UNKNOWN(2);
148 
151 
154 
157 
158  UNKNOWN(0x28);
159 
162 
164  uint8_t slideVolume;
165 
167  uint8_t battery;
168 
170  uint8_t micStatus;
171 
173  uint8_t slideVolumeEx;
174 
175  UNKNOWN(0x7);
176 };
177 CHECK_OFFSET(VPADStatus, 0x00, hold);
178 CHECK_OFFSET(VPADStatus, 0x04, trigger);
179 CHECK_OFFSET(VPADStatus, 0x08, release);
180 CHECK_OFFSET(VPADStatus, 0x0C, leftStick);
181 CHECK_OFFSET(VPADStatus, 0x14, rightStick);
182 CHECK_OFFSET(VPADStatus, 0x1C, accelorometer);
183 CHECK_OFFSET(VPADStatus, 0x38, gyro);
184 CHECK_OFFSET(VPADStatus, 0x52, tpNormal);
185 CHECK_OFFSET(VPADStatus, 0x5A, tpFiltered1);
186 CHECK_OFFSET(VPADStatus, 0x62, tpFiltered2);
187 CHECK_OFFSET(VPADStatus, 0x94, mag);
188 CHECK_OFFSET(VPADStatus, 0xA0, slideVolume);
189 CHECK_OFFSET(VPADStatus, 0xA1, battery);
190 CHECK_OFFSET(VPADStatus, 0xA2, micStatus);
191 CHECK_OFFSET(VPADStatus, 0xA3, slideVolumeEx);
192 CHECK_SIZE(VPADStatus, 0xAC);
193 
195 void
196 VPADInit();
197 
198 int32_t
199 VPADRead(uint32_t chan,
200  VPADStatus *buffers,
201  uint32_t count,
202  VPADReadError *error);
203 
204 void
205 VPADGetTPCalibratedPoint(uint32_t chan,
206  VPADTouchData *calibratedData,
207  VPADTouchData *uncalibratedData);
208 
209 #ifdef __cplusplus
210 }
211 #endif
212 
float y
Definition: input.h:76
float unk5
Definition: input.h:119
uint32_t hold
Indicates what VPADButtons are held down.
Definition: input.h:127
float x
Definition: input.h:66
uint32_t release
Indicates what VPADButtons have been released since last sample.
Definition: input.h:133
void VPADGetTPCalibratedPoint(uint32_t chan, VPADTouchData *calibratedData, VPADTouchData *uncalibratedData)
float unk6
Definition: input.h:120
uint16_t validity
Bitfield of VPADTouchPadValidity to indicate how touch sample accuracy.
Definition: input.h:93
float unk2
Definition: input.h:104
VPADReadError
Definition: input.h:57
float unk1
Definition: input.h:103
VPADButtons
Definition: input.h:21
VPADVec2D rightStick
Position of right analog stick.
Definition: input.h:139
float unk4
Definition: input.h:118
VPADGyroStatus gyro
Status of DRC gyro.
Definition: input.h:145
X position is inaccurate.
Definition: input.h:50
uint16_t y
Definition: input.h:87
VPADVec2D leftStick
Position of left analog stick.
Definition: input.h:136
uint8_t micStatus
Status of DRC microphone.
Definition: input.h:170
uint8_t slideVolume
Current volume set by the slide control.
Definition: input.h:164
float z
Definition: input.h:77
float unk2
Definition: input.h:116
void VPADInit()
Deprecated.
VPADTouchData tpNormal
Current touch position on DRC.
Definition: input.h:150
uint8_t slideVolumeEx
Unknown volume related value.
Definition: input.h:173
VPADTouchData tpFiltered1
Filtered touch position, first level of smoothing.
Definition: input.h:153
float y
Definition: input.h:67
float unk3
Definition: input.h:117
float unk4
Definition: input.h:106
float x
Definition: input.h:75
float unk1
Definition: input.h:115
VPADTouchData tpFiltered2
Filtered touch position, second level of smoothing.
Definition: input.h:156
uint16_t x
Definition: input.h:86
Both X and Y touchpad positions are accurate.
Definition: input.h:47
VPADTouchPadValidity
Definition: input.h:44
VPADAccStatus accelorometer
Status of DRC accelorometer.
Definition: input.h:142
float unk5
Definition: input.h:107
float unk3
Definition: input.h:105
uint32_t trigger
Indicates what VPADButtons have been pressed since last sample.
Definition: input.h:130
VPADVec2D vertical
Definition: input.h:108
int32_t VPADRead(uint32_t chan, VPADStatus *buffers, uint32_t count, VPADReadError *error)
uint16_t touched
0 if screen is not currently being touched
Definition: input.h:90
VPADVec3D mag
Status of DRC magnetometer.
Definition: input.h:161
uint8_t battery
Battery level of controller.
Definition: input.h:167
Y position is inaccurate.
Definition: input.h:53