wut  v1.5.0
Wii U Toolchain
input.h
Go to the documentation of this file.
1 #pragma once
2 #include <wut.h>
3 #include <vpadbase/base.h>
4 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 typedef struct VPADAccStatus VPADAccStatus;
16 typedef struct VPADDirection VPADDirection;
17 typedef struct VPADGyroStatus VPADGyroStatus;
18 typedef struct VPADStatus VPADStatus;
20 typedef struct VPADTouchData VPADTouchData;
21 typedef struct VPADVec2D VPADVec2D;
22 typedef struct VPADVec3D VPADVec3D;
23 
25 typedef enum VPADButtons
26 {
28  VPAD_BUTTON_A = 0x8000,
30  VPAD_BUTTON_B = 0x4000,
32  VPAD_BUTTON_X = 0x2000,
34  VPAD_BUTTON_Y = 0x1000,
36  VPAD_BUTTON_LEFT = 0x0800,
40  VPAD_BUTTON_UP = 0x0200,
42  VPAD_BUTTON_DOWN = 0x0100,
44  VPAD_BUTTON_ZL = 0x0080,
46  VPAD_BUTTON_ZR = 0x0040,
48  VPAD_BUTTON_L = 0x0020,
50  VPAD_BUTTON_R = 0x0010,
52  VPAD_BUTTON_PLUS = 0x0008,
56  VPAD_BUTTON_HOME = 0x0002,
58  VPAD_BUTTON_SYNC = 0x0001,
60  VPAD_BUTTON_STICK_R = 0x00020000,
62  VPAD_BUTTON_STICK_L = 0x00040000,
64  VPAD_BUTTON_TV = 0x00010000,
82 
85 {
87  VPAD_VALID = 0x0,
88 
91 
95 
98 {
106 
108 typedef enum VPADReadError
109 {
121 
123 typedef enum VPADLcdMode
124 {
130  VPAD_LCD_ON = 0xFF,
132 
135 {
141 
143 struct VPADVec2D
144 {
146  float x;
148  float y;
149 };
150 WUT_CHECK_OFFSET(VPADVec2D, 0x00, x);
151 WUT_CHECK_OFFSET(VPADVec2D, 0x04, y);
152 WUT_CHECK_SIZE(VPADVec2D, 0x08);
153 
155 struct VPADVec3D
156 {
158  float x;
160  float y;
162  float z;
163 };
164 WUT_CHECK_OFFSET(VPADVec3D, 0x00, x);
165 WUT_CHECK_OFFSET(VPADVec3D, 0x04, y);
166 WUT_CHECK_OFFSET(VPADVec3D, 0x08, z);
167 WUT_CHECK_SIZE(VPADVec3D, 0x0C);
168 
171 {
178 };
179 WUT_CHECK_OFFSET(VPADDirection, 0x00, x);
180 WUT_CHECK_OFFSET(VPADDirection, 0x0C, y);
181 WUT_CHECK_OFFSET(VPADDirection, 0x18, z);
182 WUT_CHECK_SIZE(VPADDirection, 0x24);
183 
186 {
188  uint16_t adjustX;
190  uint16_t adjustY;
192  float scaleX;
194  float scaleY;
195 };
196 WUT_CHECK_OFFSET(VPADTouchCalibrationParam, 0x00, adjustX);
197 WUT_CHECK_OFFSET(VPADTouchCalibrationParam, 0x02, adjustY);
198 WUT_CHECK_OFFSET(VPADTouchCalibrationParam, 0x04, scaleX);
199 WUT_CHECK_OFFSET(VPADTouchCalibrationParam, 0x08, scaleY);
200 WUT_CHECK_SIZE(VPADTouchCalibrationParam, 0x0C);
201 
204 {
206  uint16_t x;
208  uint16_t y;
209 
211  uint16_t touched;
212 
214  uint16_t validity;
215 };
216 WUT_CHECK_OFFSET(VPADTouchData, 0x00, x);
217 WUT_CHECK_OFFSET(VPADTouchData, 0x02, y);
218 WUT_CHECK_OFFSET(VPADTouchData, 0x04, touched);
219 WUT_CHECK_OFFSET(VPADTouchData, 0x06, validity);
220 WUT_CHECK_SIZE(VPADTouchData, 0x08);
221 
223 {
225  float magnitude;
226  float variation;
228 };
229 WUT_CHECK_OFFSET(VPADAccStatus, 0x00, acc);
230 WUT_CHECK_OFFSET(VPADAccStatus, 0x0C, magnitude);
231 WUT_CHECK_OFFSET(VPADAccStatus, 0x10, variation);
232 WUT_CHECK_OFFSET(VPADAccStatus, 0x14, vertical);
233 WUT_CHECK_SIZE(VPADAccStatus, 0x1c);
234 
236 {
238  uint32_t hold;
239 
241  uint32_t trigger;
242 
244  uint32_t release;
245 
248 
251 
254 
257 
260 
261  uint8_t error;
262 
263  WUT_UNKNOWN_BYTES(0x01);
264 
267 
270 
273 
274  WUT_UNKNOWN_BYTES(0x02);
275 
277 
280 
283 
285  uint8_t slideVolume;
286 
288  uint8_t battery;
289 
291  uint8_t micStatus;
292 
294  uint8_t slideVolumeEx;
295 
296  WUT_UNKNOWN_BYTES(0x8);
297 };
298 WUT_CHECK_OFFSET(VPADStatus, 0x00, hold);
299 WUT_CHECK_OFFSET(VPADStatus, 0x04, trigger);
300 WUT_CHECK_OFFSET(VPADStatus, 0x08, release);
301 WUT_CHECK_OFFSET(VPADStatus, 0x0C, leftStick);
302 WUT_CHECK_OFFSET(VPADStatus, 0x14, rightStick);
303 WUT_CHECK_OFFSET(VPADStatus, 0x1C, accelorometer);
304 WUT_CHECK_OFFSET(VPADStatus, 0x38, gyro);
305 WUT_CHECK_OFFSET(VPADStatus, 0x44, angle);
306 WUT_CHECK_OFFSET(VPADStatus, 0x50, error);
307 WUT_CHECK_OFFSET(VPADStatus, 0x52, tpNormal);
308 WUT_CHECK_OFFSET(VPADStatus, 0x5A, tpFiltered1);
309 WUT_CHECK_OFFSET(VPADStatus, 0x62, tpFiltered2);
310 WUT_CHECK_OFFSET(VPADStatus, 0x6C, direction);
311 WUT_CHECK_OFFSET(VPADStatus, 0x94, mag);
312 WUT_CHECK_OFFSET(VPADStatus, 0xA0, slideVolume);
313 WUT_CHECK_OFFSET(VPADStatus, 0xA1, battery);
314 WUT_CHECK_OFFSET(VPADStatus, 0xA2, micStatus);
315 WUT_CHECK_OFFSET(VPADStatus, 0xA3, slideVolumeEx);
316 WUT_CHECK_SIZE(VPADStatus, 0xAC);
317 
318 typedef void(*VPADSamplingCallback)(VPADChan chan);
319 
330 void
332 
343 void
345 
375 int32_t
377  VPADStatus *buffers,
378  uint32_t count,
379  VPADReadError *outError);
380 
394 void
396  VPADTouchCalibrationParam *outParam);
397 
411 void
413  const VPADTouchCalibrationParam *param);
414 
436 void
438  VPADTouchData *calibratedData,
439  const VPADTouchData *uncalibratedData);
440 
463 void
465  VPADTouchPadResolution tpResolution,
466  VPADTouchData *calibratedData,
467  const VPADTouchData *uncalibratedData);
468 
469 void
471  float playRadius,
472  float sensitivity);
473 
474 void
476  float *outPlayRadius,
477  float *outSensitivity);
478 
499 void
501  float delaySec,
502  float pulseSec);
503 
504 void
506 
507 void
509 
510 void
512  int32_t max,
513  int32_t min);
514 
515 void
517  int32_t max,
518  int32_t min);
519 
520 void
522  float *param);
523 
524 void
526  VPADGyroZeroDriftMode *mode);
527 
528 void
530  int32_t *max,
531  int32_t *min);
532 
533 void
535  int32_t *max,
536  int32_t *min);
537 
538 void
540 
541 void
543 
544 void
546 
547 void
549 
550 void
552 
553 void
555  float rotationDegree,
556  float range,
557  float radius);
558 
559 void
561  float rotationDegree,
562  float range,
563  float radius);
564 
565 void
567  float *outRotationDegree,
568  float *outRange,
569  float *outRadius);
570 
571 void
573  float *outRotationDegree,
574  float *outRange,
575  float *outRadius);
576 
577 void
579  float ax,
580  float ay,
581  float az);
582 
583 void
585  VPADDirection *base);
586 
587 void
589  float param);
590 
591 void
593  VPADDirection *dir);
594 
595 void
597  float mag);
598 
599 void
601  float pitch,
602  float yaw,
603  float roll);
604 
605 void
607  VPADGyroZeroDriftMode mode);
608 
609 void
611 
612 void
614 
615 void
617 
618 void
620 
621 void
623 
624 void
626 
627 
628 float
630 
631 float
633 
634 float
636 
637 float
639 
640 void
642  float radius);
643 
644 void
646 
647 void
649 
650 void
652 
653 void
655 
656 void
658 
669 void
671 
685 BOOL
687 
701 void
703  BOOL invalid);
704 
715 void
717 
728 void
730 
754 int32_t
756  uint8_t *pattern,
757  uint8_t length);
758 
770 void
772 
790 int32_t
792  VPADLcdMode lcdMode);
793 
810 int32_t
812  VPADLcdMode *outLcdMode);
813 
831 int32_t
833  BOOL on);
834 
837  VPADSamplingCallback callback);
838 
839 
840 
841 #ifdef __cplusplus
842 }
843 #endif
844 
VPADAccStatus accelorometer
Status of DRC accelorometer.
Definition: input.h:253
VPADVec3D y
y.
Definition: input.h:175
uint8_t micStatus
Status of DRC microphone.
Definition: input.h:291
float scaleY
Y scale.
Definition: input.h:194
uint16_t validity
Bitfield of VPADTouchPadValidity to indicate how touch sample accuracy.
Definition: input.h:214
uint16_t touched
0 if screen is not currently being touched.
Definition: input.h:211
VPADVec2D rightStick
Position of right analog stick.
Definition: input.h:250
VPADTouchData tpNormal
Current touch position on DRC.
Definition: input.h:263
VPADVec3D mag
Status of DRC magnetometer.
Definition: input.h:282
uint16_t x
The x-coordinate of a touched point.
Definition: input.h:206
uint16_t adjustX
X offset.
Definition: input.h:188
uint8_t slideVolumeEx
Unknown volume related value.
Definition: input.h:294
uint32_t hold
Indicates what VPADButtons are held down.
Definition: input.h:238
float variation
Definition: input.h:226
uint16_t adjustY
Y offset.
Definition: input.h:190
uint8_t battery
Battery level of controller.
Definition: input.h:288
float magnitude
Definition: input.h:225
VPADVec2D vertical
Definition: input.h:227
float y
y.
Definition: input.h:148
uint32_t release
Indicates what VPADButtons have been released since last sample.
Definition: input.h:244
BOOL usingHeadphones
Set to 1 if headphones are plugged in, 0 otherwise.
Definition: input.h:279
VPADVec3D gyro
Status of DRC gyro.
Definition: input.h:256
uint16_t y
The y-coordinate of a touched point.
Definition: input.h:208
VPADTouchData tpFiltered1
Filtered touch position, first level of smoothing.
Definition: input.h:269
VPADVec3D z
z.
Definition: input.h:177
uint32_t trigger
Indicates what VPADButtons have been pressed since last sample.
Definition: input.h:241
float x
x.
Definition: input.h:146
VPADVec3D angle
Status of DRC angle.
Definition: input.h:259
VPADVec3D acc
Definition: input.h:224
uint8_t error
Definition: input.h:261
VPADVec2D leftStick
Position of left analog stick.
Definition: input.h:247
float scaleX
X scale.
Definition: input.h:192
VPADTouchData tpFiltered2
Filtered touch position, second level of smoothing.
Definition: input.h:272
VPADVec3D x
x.
Definition: input.h:173
uint8_t slideVolume
Current volume set by the slide control.
Definition: input.h:285
float z
z.
Definition: input.h:162
VPADDirection direction
Definition: input.h:274
void VPADInitGyroAccReviseParam(VPADChan chan)
void VPADSetGyroDirReviseParam(VPADChan chan, float param)
void VPADDisableStickCrossClamp(VPADChan chan)
int32_t VPADSetSensorBar(VPADChan chan, BOOL on)
Turn the given Gamepad's sensor bar on or off.
void VPADGetTPCalibratedPoint(VPADChan chan, VPADTouchData *calibratedData, const VPADTouchData *uncalibratedData)
Transform touch data according to the current calibration data.
VPADTouchPadValidity
Touch pad validity.
Definition: input.h:85
void VPADEnableStickCrossClamp(VPADChan chan)
void VPADSetLStickClampThreshold(VPADChan chan, int32_t max, int32_t min)
void VPADEnableGyroDirRevise(VPADChan chan)
void VPADSetAccParam(VPADChan chan, float playRadius, float sensitivity)
void VPADDisablePowerButton(VPADChan chan)
Disable the power button.
int32_t VPADRead(VPADChan chan, VPADStatus *buffers, uint32_t count, VPADReadError *outError)
Read controller data from the desired Gamepad.
void VPADSetGyroMagnification(VPADChan chan, float pitch, float yaw, float roll)
void VPADShutdown()
Cleans up and frees the VPAD library.
float VPADIsEnableGyroZeroDrift(VPADChan chan)
void VPADGetGyroDirReviseParam(VPADChan chan, float *param)
void VPADEnableGyroZeroPlay(VPADChan chan)
void VPADEnableLStickZeroClamp(VPADChan chan)
void VPADStartGyroMagRevise(VPADChan chan)
void VPADDisableGyroZeroPlay(VPADChan chan)
int32_t VPADControlMotor(VPADChan chan, uint8_t *pattern, uint8_t length)
Turns on the rumble motor on the desired Gamepad.
VPADLcdMode
LCD mode.
Definition: input.h:124
void VPADSetStickOrigin(VPADChan chan)
int32_t VPADGetLcdMode(VPADChan chan, VPADLcdMode *outLcdMode)
Get the current status of the given Gamepad's display.
int32_t VPADSetLcdMode(VPADChan chan, VPADLcdMode lcdMode)
Sets the current mode of the display on the given Gamepad.
void VPADSetGyroZeroPlayParam(VPADChan chan, float radius)
void VPADGetTPCalibrationParam(VPADChan chan, VPADTouchCalibrationParam *outParam)
Get touch pad calibration parameters.
void VPADSetCrossStickEmulationParamsR(VPADChan chan, float rotationDegree, float range, float radius)
void VPADDisableRStickZeroClamp(VPADChan chan)
void VPADSetRStickClampThreshold(VPADChan chan, int32_t max, int32_t min)
float VPADIsEnableGyroZeroPlay(VPADChan chan)
struct VPADGyroStatus VPADGyroStatus
Definition: input.h:17
void VPADSetGyroDirReviseBase(VPADChan chan, VPADDirection *base)
void VPADDisableGyroDirRevise(VPADChan chan)
void VPADSetGyroZeroDriftMode(VPADChan chan, VPADGyroZeroDriftMode mode)
void VPADInitGyroZeroDriftMode(VPADChan chan)
Initializes the zero drift mode on the desired Gamepad.
void VPADGetTPCalibratedPointEx(VPADChan chan, VPADTouchPadResolution tpResolution, VPADTouchData *calibratedData, const VPADTouchData *uncalibratedData)
Transform touch data according to the current calibration data.
float VPADIsEnableGyroDirRevise(VPADChan chan)
void VPADSetTPCalibrationParam(VPADChan chan, const VPADTouchCalibrationParam *param)
Set touch pad calibration parameters.
void VPADGetCrossStickEmulationParamsL(VPADChan chan, float *outRotationDegree, float *outRange, float *outRadius)
VPADTouchPadResolution
Touch pad resolution.
Definition: input.h:98
void VPADGetLStickClampThreshold(VPADChan chan, int32_t *max, int32_t *min)
VPADSamplingCallback VPADSetSamplingCallback(VPADChan chan, VPADSamplingCallback callback)
void VPADGetRStickClampThreshold(VPADChan chan, int32_t *max, int32_t *min)
void VPADEnableRStickZeroClamp(VPADChan chan)
void VPADInit()
Initialises the VPAD library for use.
void VPADEnablePowerButton(VPADChan chan)
Enable the power button.
VPADButtons
Wii U GamePad buttons.
Definition: input.h:26
void VPADSetCrossStickEmulationParamsL(VPADChan chan, float rotationDegree, float range, float radius)
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...
void VPADDisableGyroAccRevise(VPADChan chan)
void VPADStopGyroMagRevise(VPADChan chan)
void(* VPADSamplingCallback)(VPADChan chan)
Definition: input.h:318
VPADGyroZeroDriftMode
Gyro zero drift mode.
Definition: input.h:135
void VPADGetAccParam(VPADChan chan, float *outPlayRadius, float *outSensitivity)
void VPADStopMotor(VPADChan chan)
Stops the desired Gamepad's rumble motor and cancels any ongoing rumble pattern.
float VPADIsEnableGyroAccRevise(VPADChan chan)
void VPADGetCrossStickEmulationParamsR(VPADChan chan, float *outRotationDegree, float *outRange, float *outRadius)
void VPADSetGyroDirectionMag(VPADChan chan, float mag)
void VPADInitGyroZeroPlayParam(VPADChan chan)
void VPADInitGyroDirReviseParam(VPADChan chan)
void VPADGetGyroZeroDriftMode(VPADChan chan, VPADGyroZeroDriftMode *mode)
void VPADSetGyroAngle(VPADChan chan, float ax, float ay, float az)
void VPADSetGyroDirection(VPADChan chan, VPADDirection *dir)
void VPADDisableLStickZeroClamp(VPADChan chan)
void VPADEnableGyroAccRevise(VPADChan chan)
BOOL VPADGetTVMenuStatus(VPADChan chan)
Get the TV menu status.
void VPADSetTVMenuInvalid(VPADChan chan, BOOL invalid)
Enable or disable the TV menu.
VPADReadError
Read error.
Definition: input.h:109
@ VPAD_INVALID_X
X position is inaccurate.
Definition: input.h:90
@ VPAD_VALID
Both X and Y touchpad positions are accurate.
Definition: input.h:87
@ VPAD_INVALID_Y
Y position is inaccurate.
Definition: input.h:93
@ VPAD_LCD_ON
Display is on as normal.
Definition: input.h:130
@ VPAD_LCD_STANDBY
Display is in standby and will turn back on if any buttons are pressed.
Definition: input.h:126
@ VPAD_LCD_OFF
Display is completely off and will remain so until explicitly changed.
Definition: input.h:128
@ VPAD_TP_1920X1080
1920 x 1080 resolution.
Definition: input.h:100
@ VPAD_TP_854X480
854 x 480 resolution.
Definition: input.h:104
@ VPAD_TP_1280X720
1280 x 720 resolution.
Definition: input.h:102
@ VPAD_BUTTON_X
The X button.
Definition: input.h:32
@ VPAD_STICK_R_EMULATION_RIGHT
The emulated right button on the right stick.
Definition: input.h:68
@ VPAD_STICK_L_EMULATION_RIGHT
The emulated right button on the left stick.
Definition: input.h:76
@ VPAD_BUTTON_SYNC
The SYNC button.
Definition: input.h:58
@ VPAD_BUTTON_B
The B button.
Definition: input.h:30
@ VPAD_BUTTON_L
The L button.
Definition: input.h:48
@ VPAD_BUTTON_STICK_L
The left stick button.
Definition: input.h:62
@ VPAD_BUTTON_PLUS
The + button.
Definition: input.h:52
@ VPAD_BUTTON_ZR
The ZR button.
Definition: input.h:46
@ VPAD_BUTTON_ZL
The ZL button.
Definition: input.h:44
@ VPAD_BUTTON_LEFT
The left button of the D-pad.
Definition: input.h:36
@ VPAD_STICK_L_EMULATION_UP
The emulated up button on the left stick.
Definition: input.h:78
@ VPAD_STICK_L_EMULATION_LEFT
The emulated left button on the left stick.
Definition: input.h:74
@ VPAD_BUTTON_MINUS
The - button.
Definition: input.h:54
@ VPAD_BUTTON_UP
The up button of the D-pad.
Definition: input.h:40
@ VPAD_BUTTON_A
The A button.
Definition: input.h:28
@ VPAD_BUTTON_R
The R button.
Definition: input.h:50
@ VPAD_BUTTON_Y
The Y button.
Definition: input.h:34
@ VPAD_BUTTON_HOME
The HOME button.
Definition: input.h:56
@ VPAD_STICK_R_EMULATION_DOWN
The emulated down button on the right stick.
Definition: input.h:72
@ VPAD_STICK_L_EMULATION_DOWN
The emulated down button on the left stick.
Definition: input.h:80
@ VPAD_BUTTON_RIGHT
The right button of the D-pad.
Definition: input.h:38
@ VPAD_STICK_R_EMULATION_LEFT
The emulated left button on the right stick.
Definition: input.h:66
@ VPAD_STICK_R_EMULATION_UP
The emulated up button on the right stick.
Definition: input.h:70
@ VPAD_BUTTON_TV
The TV button.
Definition: input.h:64
@ VPAD_BUTTON_DOWN
The down button of the D-pad.
Definition: input.h:42
@ VPAD_BUTTON_STICK_R
The right stick button.
Definition: input.h:60
@ VPAD_GYRO_ZERODRIFT_STANDARD
Definition: input.h:137
@ VPAD_GYRO_ZERODRIFT_NONE
Definition: input.h:139
@ VPAD_GYRO_ZERODRIFT_TIGHT
Definition: input.h:138
@ VPAD_GYRO_ZERODRIFT_LOOSE
Definition: input.h:136
@ VPAD_READ_SUCCESS
No error occurred, and data was written to the buffers.
Definition: input.h:111
@ VPAD_READ_BUSY
VPAD channel is busy, perhaps being accessed by another thread.
Definition: input.h:117
@ VPAD_READ_NO_SAMPLES
There was no sample new data available to write.
Definition: input.h:113
@ VPAD_READ_UNINITIALIZED
VPAD is uninitialized, need to call VPADInit()
Definition: input.h:119
@ VPAD_READ_INVALID_CONTROLLER
The requested controller or channel was invalid.
Definition: input.h:115
Direction.
Definition: input.h:171
Touch calibration parameter.
Definition: input.h:186
Touch data.
Definition: input.h:204
2D vector.
Definition: input.h:144
3D vector.
Definition: input.h:156
VPADChan
Wii U GamePad channel.
Definition: base.h:16
int32_t BOOL
Definition: wut_types.h:7