wut  1.0.0-alpha
Wii U Toolchain
input.h
Go to the documentation of this file.
1 #pragma once
2 #include <wut.h>
3 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
17 typedef struct VPADStatus VPADStatus;
19 typedef struct VPADVec2D VPADVec2D;
20 typedef struct VPADVec3D VPADVec3D;
21 
22 typedef enum VPADButtons
23 {
24  VPAD_BUTTON_A = 0x8000,
25  VPAD_BUTTON_B = 0x4000,
26  VPAD_BUTTON_X = 0x2000,
27  VPAD_BUTTON_Y = 0x1000,
28  VPAD_BUTTON_LEFT = 0x0800,
30  VPAD_BUTTON_UP = 0x0200,
31  VPAD_BUTTON_DOWN = 0x0100,
32  VPAD_BUTTON_ZL = 0x0080,
33  VPAD_BUTTON_ZR = 0x0040,
34  VPAD_BUTTON_L = 0x0020,
35  VPAD_BUTTON_R = 0x0010,
36  VPAD_BUTTON_PLUS = 0x0008,
38  VPAD_BUTTON_HOME = 0x0002,
39  VPAD_BUTTON_SYNC = 0x0001,
40  VPAD_BUTTON_STICK_R = 0x00020000,
41  VPAD_BUTTON_STICK_L = 0x00040000,
42  VPAD_BUTTON_TV = 0x00010000,
51 } VPADButtons;
52 
53 typedef enum VPADChan
54 {
56 } VPADChan;
57 
59 {
61  VPAD_VALID = 0x0,
62 
65 
69 
70 typedef enum VPADReadError
71 {
79 
80 typedef enum VPADLcdMode
81 {
87  VPAD_LCD_ON = 0xFF,
88 } VPADLcdMode;
89 
90 struct VPADVec2D
91 {
92  float x;
93  float y;
94 };
95 WUT_CHECK_OFFSET(VPADVec2D, 0x00, x);
96 WUT_CHECK_OFFSET(VPADVec2D, 0x04, y);
97 WUT_CHECK_SIZE(VPADVec2D, 0x08);
98 
99 struct VPADVec3D
100 {
101  float x;
102  float y;
103  float z;
104 };
105 WUT_CHECK_OFFSET(VPADVec3D, 0x00, x);
106 WUT_CHECK_OFFSET(VPADVec3D, 0x04, y);
107 WUT_CHECK_OFFSET(VPADVec3D, 0x08, z);
108 WUT_CHECK_SIZE(VPADVec3D, 0x0C);
109 
110 
112 {
116 };
117 WUT_CHECK_OFFSET(VPADDirection, 0x00, x);
118 WUT_CHECK_OFFSET(VPADDirection, 0x0C, y);
119 WUT_CHECK_OFFSET(VPADDirection, 0x18, z);
120 WUT_CHECK_SIZE(VPADDirection, 0x24);
121 
123 {
125  uint16_t x;
127  uint16_t y;
128 
130  uint16_t touched;
131 
133  uint16_t validity;
134 };
135 WUT_CHECK_OFFSET(VPADTouchData, 0x00, x);
136 WUT_CHECK_OFFSET(VPADTouchData, 0x02, y);
137 WUT_CHECK_OFFSET(VPADTouchData, 0x04, touched);
138 WUT_CHECK_OFFSET(VPADTouchData, 0x06, validity);
139 WUT_CHECK_SIZE(VPADTouchData, 0x08);
140 
142 {
144  float magnitude;
145  float variation;
147 };
148 WUT_CHECK_OFFSET(VPADAccStatus, 0x00, acc);
149 WUT_CHECK_OFFSET(VPADAccStatus, 0x0C, magnitude);
150 WUT_CHECK_OFFSET(VPADAccStatus, 0x10, variation);
151 WUT_CHECK_OFFSET(VPADAccStatus, 0x14, vertical);
152 WUT_CHECK_SIZE(VPADAccStatus, 0x1c);
153 
154 struct WUT_PACKED VPADStatus
155 {
157  uint32_t hold;
158 
160  uint32_t trigger;
161 
163  uint32_t release;
164 
167 
170 
173 
176 
179 
180  uint8_t error;
181 
182  WUT_UNKNOWN_BYTES(0x01);
183 
186 
189 
192 
193  WUT_UNKNOWN_BYTES(0x02);
194 
196 
199 
202 
204  uint8_t slideVolume;
205 
207  uint8_t battery;
208 
210  uint8_t micStatus;
211 
213  uint8_t slideVolumeEx;
214 
215  WUT_UNKNOWN_BYTES(0x8);
216 };
217 WUT_CHECK_OFFSET(VPADStatus, 0x00, hold);
218 WUT_CHECK_OFFSET(VPADStatus, 0x04, trigger);
219 WUT_CHECK_OFFSET(VPADStatus, 0x08, release);
220 WUT_CHECK_OFFSET(VPADStatus, 0x0C, leftStick);
221 WUT_CHECK_OFFSET(VPADStatus, 0x14, rightStick);
222 WUT_CHECK_OFFSET(VPADStatus, 0x1C, accelorometer);
223 WUT_CHECK_OFFSET(VPADStatus, 0x38, gyro);
224 WUT_CHECK_OFFSET(VPADStatus, 0x44, angle);
225 WUT_CHECK_OFFSET(VPADStatus, 0x50, error);
226 WUT_CHECK_OFFSET(VPADStatus, 0x52, tpNormal);
227 WUT_CHECK_OFFSET(VPADStatus, 0x5A, tpFiltered1);
228 WUT_CHECK_OFFSET(VPADStatus, 0x62, tpFiltered2);
229 WUT_CHECK_OFFSET(VPADStatus, 0x6C, direction);
230 WUT_CHECK_OFFSET(VPADStatus, 0x94, mag);
231 WUT_CHECK_OFFSET(VPADStatus, 0xA0, slideVolume);
232 WUT_CHECK_OFFSET(VPADStatus, 0xA1, battery);
233 WUT_CHECK_OFFSET(VPADStatus, 0xA2, micStatus);
234 WUT_CHECK_OFFSET(VPADStatus, 0xA3, slideVolumeEx);
235 WUT_CHECK_SIZE(VPADStatus, 0xAC);
236 
247 void
248 VPADInit();
249 
260 void
261 VPADShutdown();
262 
292 int32_t
293 VPADRead(VPADChan chan,
294  VPADStatus *buffers,
295  uint32_t count,
296  VPADReadError *outError);
297 
319 void
321  VPADTouchData *calibratedData,
322  VPADTouchData *uncalibratedData);
323 
335 int32_t
337 
354 int32_t
356  int32_t counter);
357 
358 void
360  float playRadius,
361  float sensitivity);
362 
363 void
365  float *outPlayRadius,
366  float *outSensitivity);
367 
388 void
390  float delaySec,
391  float pulseSec);
392 
393 void
395 
396 void
398 
399 void
401  int32_t max,
402  int32_t min);
403 
404 void
406  int32_t max,
407  int32_t min);
408 
409 void
411  int32_t *max,
412  int32_t *min);
413 
414 void
416  int32_t *max,
417  int32_t *min);
418 
419 void
421 
422 void
424 
425 void
427 
428 void
430 
431 void
433 
434 void
436  float rotationDegree,
437  float range,
438  float radius);
439 
440 void
442  float rotationDegree,
443  float range,
444  float radius);
445 
446 void
448  float *outRotationDegree,
449  float *outRange,
450  float *outRadius);
451 
452 void
454  float *outRotationDegree,
455  float *outRange,
456  float *outRadius);
457 
458 void
460  float ax,
461  float ay,
462  float az);
463 
464 void
466  VPADDirection *dir);
467 
468 void
470  float mag);
471 
472 void
474  float pitch,
475  float yaw,
476  float roll);
477 
478 void
480 
481 void
483 
484 void
486 
487 void
489 
490 void
492 
493 void
495 
496 
497 float
499 
500 float
502 
503 float
505 
506 float
508 
509 void
511  float radius);
512 
513 void
515 
516 void
518 
519 void
521 
522 void
524 
548 int32_t
550  uint8_t *pattern,
551  uint8_t length);
552 
564 void
565 VPADStopMotor(VPADChan chan);
566 
584 int32_t
586  VPADLcdMode lcdMode);
587 
604 int32_t
606  VPADLcdMode *outLcdMode);
607 
608 void
610  int8_t setting);
611 
612 void
614  int8_t *outSetting);
615 
633 int32_t
635  BOOL on);
636 
637 #ifdef __cplusplus
638 }
639 #endif
640 
int32_t VPADBASESetMotorOnRemainingCount(VPADChan chan, int32_t counter)
Set a count representing the amount of time left for the given Gamepad&#39;s rumble pattern.
void VPADDisableGyroZeroPlay(VPADChan chan)
void VPADDisableRStickZeroClamp(VPADChan chan)
VPADVec3D y
Definition: input.h:114
void VPADSetCrossStickEmulationParamsL(VPADChan chan, float rotationDegree, float range, float radius)
VPADTouchData tpFiltered2
Filtered touch position, second level of smoothing.
Definition: input.h:191
void VPADSetGyroMagnification(VPADChan chan, float pitch, float yaw, float roll)
void VPADBASEGetSensorBarSetting(VPADChan chan, int8_t *outSetting)
uint16_t x
The x-coordinate of a touched point.
Definition: input.h:125
VPADAccStatus accelorometer
Status of DRC accelorometer.
Definition: input.h:172
VPADVec3D gyro
Status of DRC gyro.
Definition: input.h:175
float variation
Definition: input.h:145
void VPADSetGyroAngle(VPADChan chan, float ax, float ay, float az)
float magnitude
Definition: input.h:144
int32_t VPADBASEGetMotorOnRemainingCount(VPADChan chan)
Return a count representing the amount of time left for the given Gamepad&#39;s rumble pattern...
int32_t VPADControlMotor(VPADChan chan, uint8_t *pattern, uint8_t length)
Turns on the rumble motor on the desired Gamepad.
void VPADEnableGyroAccRevise(VPADChan chan)
void VPADEnableLStickZeroClamp(VPADChan chan)
VPADReadError
Definition: input.h:70
void VPADBASESetSensorBarSetting(VPADChan chan, int8_t setting)
BOOL usingHeadphones
Set to 1 if headphones are plugged in, 0 otherwise.
Definition: input.h:198
void VPADDisableGyroDirRevise(VPADChan chan)
void VPADInitGyroAccReviseParam(VPADChan chan)
VPADButtons
Definition: input.h:22
void VPADGetTPCalibratedPoint(VPADChan chan, VPADTouchData *calibratedData, VPADTouchData *uncalibratedData)
Transform touch data according to the current calibration data.
int32_t VPADSetLcdMode(VPADChan chan, VPADLcdMode lcdMode)
Sets the current mode of the display on the given Gamepad.
uint32_t hold
Indicates what VPADButtons are held down.
Definition: input.h:157
void VPADStopMotor(VPADChan chan)
Stops the desired Gamepad&#39;s rumble motor and cancels any ongoing rumble pattern.
VPADTouchData tpNormal
Current touch position on DRC.
Definition: input.h:185
The requested controller or channel was invalid.
Definition: input.h:77
void VPADShutdown()
Cleans up and frees the VPAD library.
X position is inaccurate.
Definition: input.h:64
uint8_t battery
Battery level of controller.
Definition: input.h:207
VPADVec3D acc
Definition: input.h:143
uint8_t error
Definition: input.h:180
void VPADInitGyroZeroDriftMode(VPADChan chan)
float z
Definition: input.h:103
VPADVec3D mag
Status of DRC magnetometer.
Definition: input.h:201
VPADVec3D angle
Status of DRC angle.
Definition: input.h:178
float VPADIsEnableGyroZeroPlay(VPADChan chan)
void VPADSetCrossStickEmulationParamsR(VPADChan chan, float rotationDegree, float range, float radius)
void VPADInit()
Initialises the VPAD library for use.
uint8_t slideVolume
Current volume set by the slide control.
Definition: input.h:204
void VPADEnableStickCrossClamp(VPADChan chan)
void VPADGetCrossStickEmulationParamsL(VPADChan chan, float *outRotationDegree, float *outRange, float *outRadius)
VPADDirection direction
Definition: input.h:195
Display is on as normal.
Definition: input.h:87
VPADVec2D leftStick
Position of left analog stick.
Definition: input.h:166
VPADTouchData tpFiltered1
Filtered touch position, first level of smoothing.
Definition: input.h:188
int32_t VPADGetLcdMode(VPADChan chan, VPADLcdMode *outLcdMode)
Get the current status of the given Gamepad&#39;s display.
void VPADSetStickOrigin(VPADChan chan)
uint16_t touched
0 if screen is not currently being touched
Definition: input.h:130
uint32_t trigger
Indicates what VPADButtons have been pressed since last sample.
Definition: input.h:160
void VPADDisableGyroAccRevise(VPADChan chan)
VPADVec2D rightStick
Position of right analog stick.
Definition: input.h:169
Display is completely off and will remain so until explicitly changed.
Definition: input.h:85
void VPADDisableLStickZeroClamp(VPADChan chan)
float VPADIsEnableGyroDirRevise(VPADChan chan)
void VPADGetLStickClampThreshold(VPADChan chan, int32_t *max, int32_t *min)
int32_t VPADRead(VPADChan chan, VPADStatus *buffers, uint32_t count, VPADReadError *outError)
Read controller data from the desired Gamepad.
void VPADSetAccParam(VPADChan chan, float playRadius, float sensitivity)
void VPADEnableRStickZeroClamp(VPADChan chan)
void VPADGetRStickClampThreshold(VPADChan chan, int32_t *max, int32_t *min)
uint32_t release
Indicates what VPADButtons have been released since last sample.
Definition: input.h:163
Display is in standby and will turn back on if any buttons are pressed.
Definition: input.h:83
struct VPADGyroStatus VPADGyroStatus
Definition: input.h:16
void VPADSetRStickClampThreshold(VPADChan chan, int32_t max, int32_t min)
float VPADIsEnableGyroZeroDrift(VPADChan chan)
float x
Definition: input.h:92
No error occured, and data was written to the buffers.
Definition: input.h:73
There was no sample new data available to write.
Definition: input.h:75
float VPADIsEnableGyroAccRevise(VPADChan chan)
float y
Definition: input.h:93
VPADVec3D z
Definition: input.h:115
VPADVec3D x
Definition: input.h:113
Both X and Y touchpad positions are accurate.
Definition: input.h:61
void VPADInitGyroDirReviseParam(VPADChan chan)
void VPADSetBtnRepeat(VPADChan chan, float delaySec, float pulseSec)
Set a repeat for held buttons - instead of appearing to be continually held, repeated presses and rel...
uint16_t validity
Bitfield of VPADTouchPadValidity to indicate how touch sample accuracy.
Definition: input.h:133
int32_t VPADSetSensorBar(VPADChan chan, BOOL on)
Turn the given Gamepad&#39;s sensor bar on or off.
VPADChan
Definition: input.h:53
int32_t BOOL
Definition: wut_types.h:4
VPADTouchPadValidity
Definition: input.h:58
void VPADEnableGyroZeroPlay(VPADChan chan)
void VPADDisableStickCrossClamp(VPADChan chan)
void VPADGetCrossStickEmulationParamsR(VPADChan chan, float *outRotationDegree, float *outRange, float *outRadius)
void VPADInitGyroZeroPlayParam(VPADChan chan)
void VPADSetGyroDirectionMag(VPADChan chan, float mag)
VPADVec2D vertical
Definition: input.h:146
uint16_t y
The y-coordinate of a touched point.
Definition: input.h:127
uint8_t slideVolumeEx
Unknown volume related value.
Definition: input.h:213
void VPADSetGyroDirection(VPADChan chan, VPADDirection *dir)
void VPADSetLStickClampThreshold(VPADChan chan, int32_t max, int32_t min)
void VPADSetGyroZeroPlayParam(VPADChan chan, float radius)
Y position is inaccurate.
Definition: input.h:67
void VPADEnableGyroDirRevise(VPADChan chan)
void VPADGetAccParam(VPADChan chan, float *outPlayRadius, float *outSensitivity)
uint8_t micStatus
Status of DRC microphone.
Definition: input.h:210
VPADLcdMode
Definition: input.h:80