wut  1.0.0-beta8
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 
111 {
115 };
116 WUT_CHECK_OFFSET(VPADDirection, 0x00, x);
117 WUT_CHECK_OFFSET(VPADDirection, 0x0C, y);
118 WUT_CHECK_OFFSET(VPADDirection, 0x18, z);
119 WUT_CHECK_SIZE(VPADDirection, 0x24);
120 
122 {
124  uint16_t x;
126  uint16_t y;
127 
129  uint16_t touched;
130 
132  uint16_t validity;
133 };
134 WUT_CHECK_OFFSET(VPADTouchData, 0x00, x);
135 WUT_CHECK_OFFSET(VPADTouchData, 0x02, y);
136 WUT_CHECK_OFFSET(VPADTouchData, 0x04, touched);
137 WUT_CHECK_OFFSET(VPADTouchData, 0x06, validity);
138 WUT_CHECK_SIZE(VPADTouchData, 0x08);
139 
141 {
143  float magnitude;
144  float variation;
146 };
147 WUT_CHECK_OFFSET(VPADAccStatus, 0x00, acc);
148 WUT_CHECK_OFFSET(VPADAccStatus, 0x0C, magnitude);
149 WUT_CHECK_OFFSET(VPADAccStatus, 0x10, variation);
150 WUT_CHECK_OFFSET(VPADAccStatus, 0x14, vertical);
151 WUT_CHECK_SIZE(VPADAccStatus, 0x1c);
152 
153 struct WUT_PACKED VPADStatus
154 {
156  uint32_t hold;
157 
159  uint32_t trigger;
160 
162  uint32_t release;
163 
166 
169 
172 
175 
178 
179  uint8_t error;
180 
181  WUT_UNKNOWN_BYTES(0x01);
182 
185 
188 
191 
192  WUT_UNKNOWN_BYTES(0x02);
193 
195 
198 
201 
203  uint8_t slideVolume;
204 
206  uint8_t battery;
207 
209  uint8_t micStatus;
210 
212  uint8_t slideVolumeEx;
213 
214  WUT_UNKNOWN_BYTES(0x8);
215 };
216 WUT_CHECK_OFFSET(VPADStatus, 0x00, hold);
217 WUT_CHECK_OFFSET(VPADStatus, 0x04, trigger);
218 WUT_CHECK_OFFSET(VPADStatus, 0x08, release);
219 WUT_CHECK_OFFSET(VPADStatus, 0x0C, leftStick);
220 WUT_CHECK_OFFSET(VPADStatus, 0x14, rightStick);
221 WUT_CHECK_OFFSET(VPADStatus, 0x1C, accelorometer);
222 WUT_CHECK_OFFSET(VPADStatus, 0x38, gyro);
223 WUT_CHECK_OFFSET(VPADStatus, 0x44, angle);
224 WUT_CHECK_OFFSET(VPADStatus, 0x50, error);
225 WUT_CHECK_OFFSET(VPADStatus, 0x52, tpNormal);
226 WUT_CHECK_OFFSET(VPADStatus, 0x5A, tpFiltered1);
227 WUT_CHECK_OFFSET(VPADStatus, 0x62, tpFiltered2);
228 WUT_CHECK_OFFSET(VPADStatus, 0x6C, direction);
229 WUT_CHECK_OFFSET(VPADStatus, 0x94, mag);
230 WUT_CHECK_OFFSET(VPADStatus, 0xA0, slideVolume);
231 WUT_CHECK_OFFSET(VPADStatus, 0xA1, battery);
232 WUT_CHECK_OFFSET(VPADStatus, 0xA2, micStatus);
233 WUT_CHECK_OFFSET(VPADStatus, 0xA3, slideVolumeEx);
234 WUT_CHECK_SIZE(VPADStatus, 0xAC);
235 
246 void
247 VPADInit();
248 
259 void
260 VPADShutdown();
261 
291 int32_t
292 VPADRead(VPADChan chan,
293  VPADStatus *buffers,
294  uint32_t count,
295  VPADReadError *outError);
296 
318 void
320  VPADTouchData *calibratedData,
321  VPADTouchData *uncalibratedData);
322 
334 int32_t
336 
353 int32_t
355  int32_t counter);
356 
357 void
359  float playRadius,
360  float sensitivity);
361 
362 void
364  float *outPlayRadius,
365  float *outSensitivity);
366 
387 void
389  float delaySec,
390  float pulseSec);
391 
392 void
394 
395 void
397 
398 void
400  int32_t max,
401  int32_t min);
402 
403 void
405  int32_t max,
406  int32_t min);
407 
408 void
410  int32_t *max,
411  int32_t *min);
412 
413 void
415  int32_t *max,
416  int32_t *min);
417 
418 void
420 
421 void
423 
424 void
426 
427 void
429 
430 void
432 
433 void
435  float rotationDegree,
436  float range,
437  float radius);
438 
439 void
441  float rotationDegree,
442  float range,
443  float radius);
444 
445 void
447  float *outRotationDegree,
448  float *outRange,
449  float *outRadius);
450 
451 void
453  float *outRotationDegree,
454  float *outRange,
455  float *outRadius);
456 
457 void
459  float ax,
460  float ay,
461  float az);
462 
463 void
465  VPADDirection *dir);
466 
467 void
469  float mag);
470 
471 void
473  float pitch,
474  float yaw,
475  float roll);
476 
477 void
479 
480 void
482 
483 void
485 
486 void
488 
489 void
491 
492 void
494 
495 
496 float
498 
499 float
501 
502 float
504 
505 float
507 
508 void
510  float radius);
511 
512 void
514 
515 void
517 
518 void
520 
521 void
523 
547 int32_t
549  uint8_t *pattern,
550  uint8_t length);
551 
563 void
564 VPADStopMotor(VPADChan chan);
565 
583 int32_t
585  VPADLcdMode lcdMode);
586 
603 int32_t
605  VPADLcdMode *outLcdMode);
606 
607 void
609  int8_t setting);
610 
611 void
613  int8_t *outSetting);
614 
632 int32_t
634  BOOL on);
635 
636 #ifdef __cplusplus
637 }
638 #endif
639 
int32_t VPADBASESetMotorOnRemainingCount(VPADChan chan, int32_t counter)
Set a count representing the amount of time left for the given Gamepad's rumble pattern.
void VPADDisableGyroZeroPlay(VPADChan chan)
void VPADDisableRStickZeroClamp(VPADChan chan)
VPADVec3D y
Definition: input.h:113
void VPADSetCrossStickEmulationParamsL(VPADChan chan, float rotationDegree, float range, float radius)
VPADTouchData tpFiltered2
Filtered touch position, second level of smoothing.
Definition: input.h:190
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:124
VPADAccStatus accelorometer
Status of DRC accelorometer.
Definition: input.h:171
VPADVec3D gyro
Status of DRC gyro.
Definition: input.h:174
float variation
Definition: input.h:144
void VPADSetGyroAngle(VPADChan chan, float ax, float ay, float az)
float magnitude
Definition: input.h:143
int32_t VPADBASEGetMotorOnRemainingCount(VPADChan chan)
Return a count representing the amount of time left for the given Gamepad'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:197
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:156
void VPADStopMotor(VPADChan chan)
Stops the desired Gamepad's rumble motor and cancels any ongoing rumble pattern.
VPADTouchData tpNormal
Current touch position on DRC.
Definition: input.h:184
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:206
VPADVec3D acc
Definition: input.h:142
uint8_t error
Definition: input.h:179
void VPADInitGyroZeroDriftMode(VPADChan chan)
float z
Definition: input.h:103
VPADVec3D mag
Status of DRC magnetometer.
Definition: input.h:200
VPADVec3D angle
Status of DRC angle.
Definition: input.h:177
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:203
void VPADEnableStickCrossClamp(VPADChan chan)
void VPADGetCrossStickEmulationParamsL(VPADChan chan, float *outRotationDegree, float *outRange, float *outRadius)
VPADDirection direction
Definition: input.h:194
Display is on as normal.
Definition: input.h:87
VPADVec2D leftStick
Position of left analog stick.
Definition: input.h:165
VPADTouchData tpFiltered1
Filtered touch position, first level of smoothing.
Definition: input.h:187
int32_t VPADGetLcdMode(VPADChan chan, VPADLcdMode *outLcdMode)
Get the current status of the given Gamepad's display.
void VPADSetStickOrigin(VPADChan chan)
uint16_t touched
0 if screen is not currently being touched
Definition: input.h:129
uint32_t trigger
Indicates what VPADButtons have been pressed since last sample.
Definition: input.h:159
void VPADDisableGyroAccRevise(VPADChan chan)
VPADVec2D rightStick
Position of right analog stick.
Definition: input.h:168
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:162
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:114
VPADVec3D x
Definition: input.h:112
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:132
int32_t VPADSetSensorBar(VPADChan chan, BOOL on)
Turn the given Gamepad'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:145
uint16_t y
The y-coordinate of a touched point.
Definition: input.h:126
uint8_t slideVolumeEx
Unknown volume related value.
Definition: input.h:212
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:209
VPADLcdMode
Definition: input.h:80