wut  1.0.0-beta9
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 
VPADRead
int32_t VPADRead(VPADChan chan, VPADStatus *buffers, uint32_t count, VPADReadError *outError)
Read controller data from the desired Gamepad.
VPADReadError
VPADReadError
Definition: input.h:70
VPADStatus::hold
uint32_t hold
Indicates what VPADButtons are held down.
Definition: input.h:156
VPAD_BUTTON_ZR
@ VPAD_BUTTON_ZR
Definition: input.h:33
VPADInitGyroZeroPlayParam
void VPADInitGyroZeroPlayParam(VPADChan chan)
VPADSetSensorBar
int32_t VPADSetSensorBar(VPADChan chan, BOOL on)
Turn the given Gamepad's sensor bar on or off.
VPAD_LCD_ON
@ VPAD_LCD_ON
Display is on as normal.
Definition: input.h:87
VPADChan
VPADChan
Definition: input.h:53
VPADSetGyroZeroPlayParam
void VPADSetGyroZeroPlayParam(VPADChan chan, float radius)
VPADSetCrossStickEmulationParamsR
void VPADSetCrossStickEmulationParamsR(VPADChan chan, float rotationDegree, float range, float radius)
VPAD_BUTTON_DOWN
@ VPAD_BUTTON_DOWN
Definition: input.h:31
VPADGetLStickClampThreshold
void VPADGetLStickClampThreshold(VPADChan chan, int32_t *max, int32_t *min)
VPADEnableRStickZeroClamp
void VPADEnableRStickZeroClamp(VPADChan chan)
VPAD_INVALID_Y
@ VPAD_INVALID_Y
Y position is inaccurate.
Definition: input.h:67
VPAD_BUTTON_B
@ VPAD_BUTTON_B
Definition: input.h:25
VPADGetLcdMode
int32_t VPADGetLcdMode(VPADChan chan, VPADLcdMode *outLcdMode)
Get the current status of the given Gamepad's display.
VPADStatus::mag
VPADVec3D mag
Status of DRC magnetometer.
Definition: input.h:200
VPAD_READ_NO_SAMPLES
@ VPAD_READ_NO_SAMPLES
There was no sample new data available to write.
Definition: input.h:75
VPADShutdown
void VPADShutdown()
Cleans up and frees the VPAD library.
VPADAccStatus::acc
VPADVec3D acc
Definition: input.h:142
VPADStatus::rightStick
VPADVec2D rightStick
Position of right analog stick.
Definition: input.h:168
VPADStatus::release
uint32_t release
Indicates what VPADButtons have been released since last sample.
Definition: input.h:162
VPAD_CHAN_0
@ VPAD_CHAN_0
Definition: input.h:55
VPADStatus::error
uint8_t error
Definition: input.h:179
VPADTouchData::validity
uint16_t validity
Bitfield of VPADTouchPadValidity to indicate how touch sample accuracy.
Definition: input.h:132
VPAD_BUTTON_LEFT
@ VPAD_BUTTON_LEFT
Definition: input.h:28
VPADSetBtnRepeat
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...
VPADEnableGyroAccRevise
void VPADEnableGyroAccRevise(VPADChan chan)
VPADDirection::y
VPADVec3D y
Definition: input.h:113
VPADStatus
Definition: input.h:153
VPADIsEnableGyroDirRevise
float VPADIsEnableGyroDirRevise(VPADChan chan)
VPADStopMotor
void VPADStopMotor(VPADChan chan)
Stops the desired Gamepad's rumble motor and cancels any ongoing rumble pattern.
VPAD_STICK_L_EMULATION_RIGHT
@ VPAD_STICK_L_EMULATION_RIGHT
Definition: input.h:48
VPADVec2D::y
float y
Definition: input.h:93
VPAD_BUTTON_RIGHT
@ VPAD_BUTTON_RIGHT
Definition: input.h:29
VPADStatus::tpFiltered2
VPADTouchData tpFiltered2
Filtered touch position, second level of smoothing.
Definition: input.h:190
VPADDisableGyroDirRevise
void VPADDisableGyroDirRevise(VPADChan chan)
VPADVec3D::z
float z
Definition: input.h:103
VPADButtons
VPADButtons
Definition: input.h:22
VPADDisableRStickZeroClamp
void VPADDisableRStickZeroClamp(VPADChan chan)
VPADStatus::accelorometer
VPADAccStatus accelorometer
Status of DRC accelorometer.
Definition: input.h:171
VPADControlMotor
int32_t VPADControlMotor(VPADChan chan, uint8_t *pattern, uint8_t length)
Turns on the rumble motor on the desired Gamepad.
VPAD_BUTTON_UP
@ VPAD_BUTTON_UP
Definition: input.h:30
VPAD_BUTTON_STICK_L
@ VPAD_BUTTON_STICK_L
Definition: input.h:41
VPADStatus::angle
VPADVec3D angle
Status of DRC angle.
Definition: input.h:177
VPADStatus::tpFiltered1
VPADTouchData tpFiltered1
Filtered touch position, first level of smoothing.
Definition: input.h:187
VPADVec2D::x
float x
Definition: input.h:92
VPADDirection
Definition: input.h:110
VPAD_STICK_R_EMULATION_UP
@ VPAD_STICK_R_EMULATION_UP
Definition: input.h:45
VPAD_BUTTON_X
@ VPAD_BUTTON_X
Definition: input.h:26
wut.h
VPAD_LCD_STANDBY
@ VPAD_LCD_STANDBY
Display is in standby and will turn back on if any buttons are pressed.
Definition: input.h:83
VPADInitGyroDirReviseParam
void VPADInitGyroDirReviseParam(VPADChan chan)
VPAD_BUTTON_STICK_R
@ VPAD_BUTTON_STICK_R
Definition: input.h:40
VPAD_BUTTON_L
@ VPAD_BUTTON_L
Definition: input.h:34
VPADSetGyroAngle
void VPADSetGyroAngle(VPADChan chan, float ax, float ay, float az)
VPADIsEnableGyroAccRevise
float VPADIsEnableGyroAccRevise(VPADChan chan)
VPADGetCrossStickEmulationParamsL
void VPADGetCrossStickEmulationParamsL(VPADChan chan, float *outRotationDegree, float *outRange, float *outRadius)
VPADTouchData::y
uint16_t y
The y-coordinate of a touched point.
Definition: input.h:126
VPAD_BUTTON_Y
@ VPAD_BUTTON_Y
Definition: input.h:27
VPADEnableStickCrossClamp
void VPADEnableStickCrossClamp(VPADChan chan)
VPADInit
void VPADInit()
Initialises the VPAD library for use.
VPADGetAccParam
void VPADGetAccParam(VPADChan chan, float *outPlayRadius, float *outSensitivity)
VPADSetAccParam
void VPADSetAccParam(VPADChan chan, float playRadius, float sensitivity)
VPADBASEGetMotorOnRemainingCount
int32_t VPADBASEGetMotorOnRemainingCount(VPADChan chan)
Return a count representing the amount of time left for the given Gamepad's rumble pattern.
VPAD_STICK_R_EMULATION_RIGHT
@ VPAD_STICK_R_EMULATION_RIGHT
Definition: input.h:44
VPADStatus::usingHeadphones
BOOL usingHeadphones
Set to 1 if headphones are plugged in, 0 otherwise.
Definition: input.h:197
VPAD_VALID
@ VPAD_VALID
Both X and Y touchpad positions are accurate.
Definition: input.h:61
VPADStatus::micStatus
uint8_t micStatus
Status of DRC microphone.
Definition: input.h:209
VPADSetGyroMagnification
void VPADSetGyroMagnification(VPADChan chan, float pitch, float yaw, float roll)
VPAD_BUTTON_MINUS
@ VPAD_BUTTON_MINUS
Definition: input.h:37
VPADVec3D
Definition: input.h:99
VPADVec2D
Definition: input.h:90
VPADTouchData::touched
uint16_t touched
0 if screen is not currently being touched
Definition: input.h:129
VPAD_LCD_OFF
@ VPAD_LCD_OFF
Display is completely off and will remain so until explicitly changed.
Definition: input.h:85
VPADBASESetSensorBarSetting
void VPADBASESetSensorBarSetting(VPADChan chan, int8_t setting)
VPADStatus::slideVolume
uint8_t slideVolume
Current volume set by the slide control.
Definition: input.h:203
VPADEnableGyroDirRevise
void VPADEnableGyroDirRevise(VPADChan chan)
VPADAccStatus::magnitude
float magnitude
Definition: input.h:143
VPADTouchPadValidity
VPADTouchPadValidity
Definition: input.h:58
VPADGetRStickClampThreshold
void VPADGetRStickClampThreshold(VPADChan chan, int32_t *max, int32_t *min)
VPAD_READ_SUCCESS
@ VPAD_READ_SUCCESS
No error occured, and data was written to the buffers.
Definition: input.h:73
VPAD_INVALID_X
@ VPAD_INVALID_X
X position is inaccurate.
Definition: input.h:64
VPADBASEGetSensorBarSetting
void VPADBASEGetSensorBarSetting(VPADChan chan, int8_t *outSetting)
VPADSetRStickClampThreshold
void VPADSetRStickClampThreshold(VPADChan chan, int32_t max, int32_t min)
VPADEnableGyroZeroPlay
void VPADEnableGyroZeroPlay(VPADChan chan)
VPADStatus::slideVolumeEx
uint8_t slideVolumeEx
Unknown volume related value.
Definition: input.h:212
VPADBASESetMotorOnRemainingCount
int32_t VPADBASESetMotorOnRemainingCount(VPADChan chan, int32_t counter)
Set a count representing the amount of time left for the given Gamepad's rumble pattern.
VPAD_BUTTON_TV
@ VPAD_BUTTON_TV
Definition: input.h:42
VPADGyroStatus
struct VPADGyroStatus VPADGyroStatus
Definition: input.h:16
VPAD_STICK_R_EMULATION_DOWN
@ VPAD_STICK_R_EMULATION_DOWN
Definition: input.h:46
VPADIsEnableGyroZeroDrift
float VPADIsEnableGyroZeroDrift(VPADChan chan)
VPAD_STICK_L_EMULATION_LEFT
@ VPAD_STICK_L_EMULATION_LEFT
Definition: input.h:47
VPADGetTPCalibratedPoint
void VPADGetTPCalibratedPoint(VPADChan chan, VPADTouchData *calibratedData, VPADTouchData *uncalibratedData)
Transform touch data according to the current calibration data.
VPADInitGyroAccReviseParam
void VPADInitGyroAccReviseParam(VPADChan chan)
VPADLcdMode
VPADLcdMode
Definition: input.h:80
VPADAccStatus
Definition: input.h:140
VPADDisableGyroAccRevise
void VPADDisableGyroAccRevise(VPADChan chan)
VPADSetLStickClampThreshold
void VPADSetLStickClampThreshold(VPADChan chan, int32_t max, int32_t min)
VPADStatus::gyro
VPADVec3D gyro
Status of DRC gyro.
Definition: input.h:174
VPADStatus::tpNormal
VPADTouchData tpNormal
Current touch position on DRC.
Definition: input.h:184
VPAD_READ_INVALID_CONTROLLER
@ VPAD_READ_INVALID_CONTROLLER
The requested controller or channel was invalid.
Definition: input.h:77
VPADEnableLStickZeroClamp
void VPADEnableLStickZeroClamp(VPADChan chan)
VPADDisableGyroZeroPlay
void VPADDisableGyroZeroPlay(VPADChan chan)
VPAD_BUTTON_PLUS
@ VPAD_BUTTON_PLUS
Definition: input.h:36
VPADSetCrossStickEmulationParamsL
void VPADSetCrossStickEmulationParamsL(VPADChan chan, float rotationDegree, float range, float radius)
VPADStatus::battery
uint8_t battery
Battery level of controller.
Definition: input.h:206
VPADAccStatus::vertical
VPADVec2D vertical
Definition: input.h:145
VPAD_BUTTON_SYNC
@ VPAD_BUTTON_SYNC
Definition: input.h:39
VPADTouchData::x
uint16_t x
The x-coordinate of a touched point.
Definition: input.h:124
VPADDirection::x
VPADVec3D x
Definition: input.h:112
VPADSetGyroDirection
void VPADSetGyroDirection(VPADChan chan, VPADDirection *dir)
VPADStatus::leftStick
VPADVec2D leftStick
Position of left analog stick.
Definition: input.h:165
VPADTouchData
Definition: input.h:121
BOOL
int32_t BOOL
Definition: wut_types.h:4
VPAD_STICK_R_EMULATION_LEFT
@ VPAD_STICK_R_EMULATION_LEFT
Definition: input.h:43
VPAD_BUTTON_ZL
@ VPAD_BUTTON_ZL
Definition: input.h:32
VPADSetLcdMode
int32_t VPADSetLcdMode(VPADChan chan, VPADLcdMode lcdMode)
Sets the current mode of the display on the given Gamepad.
VPAD_STICK_L_EMULATION_DOWN
@ VPAD_STICK_L_EMULATION_DOWN
Definition: input.h:50
VPAD_BUTTON_R
@ VPAD_BUTTON_R
Definition: input.h:35
VPADStatus::trigger
uint32_t trigger
Indicates what VPADButtons have been pressed since last sample.
Definition: input.h:159
VPADInitGyroZeroDriftMode
void VPADInitGyroZeroDriftMode(VPADChan chan)
VPADStatus::direction
VPADDirection direction
Definition: input.h:194
VPADAccStatus::variation
float variation
Definition: input.h:144
VPADDisableStickCrossClamp
void VPADDisableStickCrossClamp(VPADChan chan)
VPAD_BUTTON_HOME
@ VPAD_BUTTON_HOME
Definition: input.h:38
VPAD_STICK_L_EMULATION_UP
@ VPAD_STICK_L_EMULATION_UP
Definition: input.h:49
VPADGetCrossStickEmulationParamsR
void VPADGetCrossStickEmulationParamsR(VPADChan chan, float *outRotationDegree, float *outRange, float *outRadius)
VPADDirection::z
VPADVec3D z
Definition: input.h:114
VPADSetStickOrigin
void VPADSetStickOrigin(VPADChan chan)
VPADDisableLStickZeroClamp
void VPADDisableLStickZeroClamp(VPADChan chan)
VPADSetGyroDirectionMag
void VPADSetGyroDirectionMag(VPADChan chan, float mag)
VPADIsEnableGyroZeroPlay
float VPADIsEnableGyroZeroPlay(VPADChan chan)
VPAD_BUTTON_A
@ VPAD_BUTTON_A
Definition: input.h:24