wut  v1.5.0
Wii U Toolchain
wpad.h
Go to the documentation of this file.
1 #pragma once
2 #include <wut.h>
3 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
17 typedef struct WPADVec2D WPADVec2D;
18 
20 typedef enum WPADChan
21 {
37 
39 typedef enum WPADDataFormat
40 {
43 
45 typedef enum WPADExtensionType
46 {
62 
64 typedef enum WPADButton
65 {
67  WPAD_BUTTON_LEFT = 0x0001,
71  WPAD_BUTTON_DOWN = 0x0004,
73  WPAD_BUTTON_UP = 0x0008,
75  WPAD_BUTTON_PLUS = 0x0010,
77  WPAD_BUTTON_2 = 0x0100,
79  WPAD_BUTTON_1 = 0x0200,
81  WPAD_BUTTON_B = 0x0400,
83  WPAD_BUTTON_A = 0x0800,
87  WPAD_BUTTON_Z = 0x2000,
89  WPAD_BUTTON_C = 0x4000,
91  WPAD_BUTTON_HOME = 0x8000,
93 
95 typedef enum WPADNunchukButton
96 {
110 
112 typedef enum WPADClassicButton
113 {
121  WPAD_CLASSIC_BUTTON_X = 0x00000008,
123  WPAD_CLASSIC_BUTTON_A = 0x00000010,
125  WPAD_CLASSIC_BUTTON_Y = 0x00000020,
127  WPAD_CLASSIC_BUTTON_B = 0x00000040,
131  WPAD_CLASSIC_BUTTON_R = 0x00000200,
139  WPAD_CLASSIC_BUTTON_L = 0x00002000,
161 
163 typedef enum WPADProButton
164 {
166  WPAD_PRO_BUTTON_UP = 0x00000001,
168  WPAD_PRO_BUTTON_LEFT = 0x00000002,
170  WPAD_PRO_TRIGGER_ZR = 0x00000004,
172  WPAD_PRO_BUTTON_X = 0x00000008,
174  WPAD_PRO_BUTTON_A = 0x00000010,
176  WPAD_PRO_BUTTON_Y = 0x00000020,
178  WPAD_PRO_BUTTON_B = 0x00000040,
180  WPAD_PRO_TRIGGER_ZL = 0x00000080,
182  WPAD_PRO_RESERVED = 0x00000100,
184  WPAD_PRO_TRIGGER_R = 0x00000200,
186  WPAD_PRO_BUTTON_PLUS = 0x00000400,
188  WPAD_PRO_BUTTON_HOME = 0x00000800,
190  WPAD_PRO_BUTTON_MINUS = 0x00001000,
192  WPAD_PRO_TRIGGER_L = 0x00002000,
194  WPAD_PRO_BUTTON_DOWN = 0x00004000,
196  WPAD_PRO_BUTTON_RIGHT = 0x00008000,
218 
220 struct WPADVec2D
221 {
223  int16_t x;
225  int16_t y;
226 };
227 WUT_CHECK_OFFSET(WPADVec2D, 0x00, x);
228 WUT_CHECK_OFFSET(WPADVec2D, 0x02, y);
229 WUT_CHECK_SIZE(WPADVec2D, 0x04);
230 
232 {
233  WUT_UNKNOWN_BYTES(0x28);
234 
236  uint8_t extensionType;
237 
238  uint8_t err;
239  WUT_PADDING_BYTES(2);
240  uint32_t buttons;
243  WUT_UNKNOWN_BYTES(8);
245 };
246 WUT_CHECK_OFFSET(WPADStatusProController, 0x28, extensionType);
247 WUT_CHECK_OFFSET(WPADStatusProController, 0x29, err);
248 WUT_CHECK_OFFSET(WPADStatusProController, 0x2C, buttons);
249 WUT_CHECK_OFFSET(WPADStatusProController, 0x30, leftStick);
250 WUT_CHECK_OFFSET(WPADStatusProController, 0x34, rightStick);
251 WUT_CHECK_OFFSET(WPADStatusProController, 0x40, dataFormat);
252 WUT_CHECK_SIZE(WPADStatusProController, 0x44);
253 
254 typedef void (*WPADSamplingCallback)(WPADChan chan);
255 typedef void (*WPADExtensionCallback)(WPADChan chan, int32_t status);
256 typedef void (*WPADConnectCallback)(WPADChan chan, int32_t status);
257 
261 void
263 
267 void
269 
270 int32_t
272  WPADExtensionType *outExtensionType);
273 
274 int32_t
276  WPADDataFormat format);
277 
278 void
279 WPADEnableURCC(int32_t enable);
280 
281 void
282 WPADEnableWiiRemote(int32_t enable);
283 
284 void
286  void *data);
287 
291 void
293  BOOL motorEnabled);
294 
295 void
296 WPADSetAutoSleepTime(uint8_t time);
297 
298 void
300 
303  WPADConnectCallback callback);
304 
307  WPADExtensionCallback callback);
308 
311  WPADSamplingCallback callback);
312 
313 #ifdef __cplusplus
314 }
315 #endif
316 
uint8_t extensionType
A value from WPADExtensionType.
Definition: wpad.h:233
WPADVec2D rightStick
Definition: wpad.h:242
uint32_t buttons
Definition: wpad.h:239
WPADDataFormat dataFormat
Definition: wpad.h:243
WPADVec2D leftStick
Definition: wpad.h:241
int16_t x
x.
Definition: wpad.h:223
int16_t y
y.
Definition: wpad.h:225
void(* WPADExtensionCallback)(WPADChan chan, int32_t status)
Definition: wpad.h:255
WPADButton
Wii Remote buttons.
Definition: wpad.h:65
WPADDataFormat
Data format.
Definition: wpad.h:40
void WPADControlMotor(WPADChan chan, BOOL motorEnabled)
Controls the associated WPADChan's rumble motor.
WPADExtensionCallback WPADSetExtensionCallback(WPADChan chan, WPADExtensionCallback callback)
void WPADRead(WPADChan chan, void *data)
WPADChan
Wii Remote channel.
Definition: wpad.h:21
int32_t WPADSetDataFormat(WPADChan chan, WPADDataFormat format)
void WPADDisconnect(WPADChan chan)
void WPADEnableURCC(int32_t enable)
void WPADShutdown()
Cleans up and frees the WPAD library.
WPADClassicButton
Classic Controller buttons.
Definition: wpad.h:113
void WPADInit()
Initialises the WPAD library for use.
int32_t WPADProbe(WPADChan chan, WPADExtensionType *outExtensionType)
WPADSamplingCallback WPADSetSamplingCallback(WPADChan chan, WPADSamplingCallback callback)
void WPADSetAutoSleepTime(uint8_t time)
WPADExtensionType
Extension type.
Definition: wpad.h:46
void(* WPADSamplingCallback)(WPADChan chan)
Definition: wpad.h:254
WPADConnectCallback WPADSetConnectCallback(WPADChan chan, WPADConnectCallback callback)
void(* WPADConnectCallback)(WPADChan chan, int32_t status)
Definition: wpad.h:256
WPADNunchukButton
Nunchuk buttons.
Definition: wpad.h:96
WPADProButton
Pro Controller buttons.
Definition: wpad.h:164
void WPADEnableWiiRemote(int32_t enable)
@ WPAD_BUTTON_DOWN
The down button of the D-pad.
Definition: wpad.h:71
@ WPAD_BUTTON_A
The A button.
Definition: wpad.h:83
@ WPAD_BUTTON_C
The C button on the Nunchuk extension.
Definition: wpad.h:89
@ WPAD_BUTTON_LEFT
The left button of the D-pad.
Definition: wpad.h:67
@ WPAD_BUTTON_2
The 2 button.
Definition: wpad.h:77
@ WPAD_BUTTON_MINUS
The - button.
Definition: wpad.h:85
@ WPAD_BUTTON_Z
The Z button on the Nunchuk extension.
Definition: wpad.h:87
@ WPAD_BUTTON_UP
The up button of the D-pad.
Definition: wpad.h:73
@ WPAD_BUTTON_PLUS
The + button.
Definition: wpad.h:75
@ WPAD_BUTTON_1
The 1 button.
Definition: wpad.h:79
@ WPAD_BUTTON_RIGHT
The right button of the D-pad.
Definition: wpad.h:69
@ WPAD_BUTTON_HOME
The HOME button.
Definition: wpad.h:91
@ WPAD_BUTTON_B
The B button.
Definition: wpad.h:81
@ WPAD_FMT_PRO_CONTROLLER
Definition: wpad.h:41
@ WPAD_CHAN_2
Channel 2.
Definition: wpad.h:27
@ WPAD_CHAN_5
Channel 5.
Definition: wpad.h:33
@ WPAD_CHAN_6
Channel 6.
Definition: wpad.h:35
@ WPAD_CHAN_0
Channel 0.
Definition: wpad.h:23
@ WPAD_CHAN_4
Channel 4.
Definition: wpad.h:31
@ WPAD_CHAN_1
Channel 1.
Definition: wpad.h:25
@ WPAD_CHAN_3
Channel 3.
Definition: wpad.h:29
@ WPAD_CLASSIC_BUTTON_UP
The up button of the D-pad.
Definition: wpad.h:115
@ WPAD_CLASSIC_BUTTON_R
The R button.
Definition: wpad.h:131
@ WPAD_CLASSIC_BUTTON_ZL
The ZL button.
Definition: wpad.h:129
@ WPAD_CLASSIC_STICK_R_EMULATION_DOWN
The emulated down button on the right stick.
Definition: wpad.h:157
@ WPAD_CLASSIC_BUTTON_DOWN
The down button of the D-pad.
Definition: wpad.h:141
@ WPAD_CLASSIC_BUTTON_A
The A button.
Definition: wpad.h:123
@ WPAD_CLASSIC_BUTTON_ZR
The ZR button.
Definition: wpad.h:119
@ WPAD_CLASSIC_STICK_R_EMULATION_UP
The emulated up button on the right stick.
Definition: wpad.h:159
@ WPAD_CLASSIC_STICK_L_EMULATION_UP
The emulated up button on the left stick.
Definition: wpad.h:151
@ WPAD_CLASSIC_BUTTON_B
The B button.
Definition: wpad.h:127
@ WPAD_CLASSIC_BUTTON_Y
The Y button.
Definition: wpad.h:125
@ WPAD_CLASSIC_STICK_L_EMULATION_LEFT
The emulated left button on the left stick.
Definition: wpad.h:145
@ WPAD_CLASSIC_STICK_R_EMULATION_RIGHT
The emulated right button on the right stick.
Definition: wpad.h:155
@ WPAD_CLASSIC_STICK_L_EMULATION_RIGHT
The emulated right button on the left stick.
Definition: wpad.h:147
@ WPAD_CLASSIC_BUTTON_PLUS
The + button.
Definition: wpad.h:133
@ WPAD_CLASSIC_BUTTON_RIGHT
The right button of the D-pad.
Definition: wpad.h:143
@ WPAD_CLASSIC_STICK_R_EMULATION_LEFT
The emulated left button on the right stick.
Definition: wpad.h:153
@ WPAD_CLASSIC_BUTTON_LEFT
The left button of the D-pad.
Definition: wpad.h:117
@ WPAD_CLASSIC_BUTTON_L
The L button.
Definition: wpad.h:139
@ WPAD_CLASSIC_BUTTON_MINUS
The - button.
Definition: wpad.h:137
@ WPAD_CLASSIC_BUTTON_X
The X button.
Definition: wpad.h:121
@ WPAD_CLASSIC_STICK_L_EMULATION_DOWN
The emulated down button on the left stick.
Definition: wpad.h:149
@ WPAD_CLASSIC_BUTTON_HOME
The HOME button.
Definition: wpad.h:135
@ WPAD_EXT_MPLUS_CLASSIC
Motion Plus with Classic Controller.
Definition: wpad.h:58
@ WPAD_EXT_MPLUS_NUNCHUK
Motion Plus with Nunchuk.
Definition: wpad.h:56
@ WPAD_EXT_MPLUS
Motion Plus.
Definition: wpad.h:54
@ WPAD_EXT_NUNCHUK
Nunchuk.
Definition: wpad.h:50
@ WPAD_EXT_CLASSIC
Classic Controller.
Definition: wpad.h:52
@ WPAD_EXT_PRO_CONTROLLER
Pro Controller.
Definition: wpad.h:60
@ WPAD_EXT_CORE
Wii Remote with no extension.
Definition: wpad.h:48
@ WPAD_NUNCHUK_STICK_EMULATION_LEFT
The emulated left button on the Nunchuk stick or the left button of the D-pad on the Wii Remote.
Definition: wpad.h:98
@ WPAD_NUNCHUK_STICK_EMULATION_UP
The emulated up button on the Nunchuk stick or the up button of the D-pad on the Wii Remote.
Definition: wpad.h:104
@ WPAD_NUNCHUK_STICK_EMULATION_RIGHT
The emulated right button on the Nunchuk stick or the right button of the D-pad on the Wii Remote.
Definition: wpad.h:100
@ WPAD_NUNCHUK_BUTTON_Z
The Z button.
Definition: wpad.h:106
@ WPAD_NUNCHUK_BUTTON_C
The C button.
Definition: wpad.h:108
@ WPAD_NUNCHUK_STICK_EMULATION_DOWN
The emulated down button on the Nunchuk stick or the down button of the D-pad on the Wii Remote.
Definition: wpad.h:102
@ WPAD_PRO_BUTTON_PLUS
The + button.
Definition: wpad.h:186
@ WPAD_PRO_BUTTON_B
The B button.
Definition: wpad.h:178
@ WPAD_PRO_RESERVED
Reserved.
Definition: wpad.h:182
@ WPAD_PRO_BUTTON_DOWN
The down button of the D-pad.
Definition: wpad.h:194
@ WPAD_PRO_BUTTON_X
The X button.
Definition: wpad.h:172
@ WPAD_PRO_BUTTON_HOME
The HOME button.
Definition: wpad.h:188
@ WPAD_PRO_BUTTON_Y
The Y button.
Definition: wpad.h:176
@ WPAD_PRO_STICK_R_EMULATION_UP
The emulated up button on the right stick.
Definition: wpad.h:210
@ WPAD_PRO_STICK_L_EMULATION_UP
The emulated up button on the left stick.
Definition: wpad.h:202
@ WPAD_PRO_BUTTON_LEFT
The left button of the D-pad.
Definition: wpad.h:168
@ WPAD_PRO_STICK_L_EMULATION_DOWN
The emulated down button on the left stick.
Definition: wpad.h:204
@ WPAD_PRO_BUTTON_MINUS
The - button.
Definition: wpad.h:190
@ WPAD_PRO_STICK_R_EMULATION_DOWN
The emulated down button on the right stick.
Definition: wpad.h:212
@ WPAD_PRO_TRIGGER_R
The right trigger button.
Definition: wpad.h:184
@ WPAD_PRO_STICK_R_EMULATION_LEFT
The emulated left button on the right stick.
Definition: wpad.h:214
@ WPAD_PRO_STICK_L_EMULATION_RIGHT
The emulated right button on the left stick.
Definition: wpad.h:208
@ WPAD_PRO_BUTTON_STICK_L
The left stick button.
Definition: wpad.h:200
@ WPAD_PRO_STICK_L_EMULATION_LEFT
The emulated left button on the left stick.
Definition: wpad.h:206
@ WPAD_PRO_TRIGGER_L
The left trigger button.
Definition: wpad.h:192
@ WPAD_PRO_BUTTON_STICK_R
The right stick button.
Definition: wpad.h:198
@ WPAD_PRO_TRIGGER_ZL
The ZL button.
Definition: wpad.h:180
@ WPAD_PRO_TRIGGER_ZR
The ZR button.
Definition: wpad.h:170
@ WPAD_PRO_BUTTON_UP
The up button of the D-pad.
Definition: wpad.h:166
@ WPAD_PRO_STICK_R_EMULATION_RIGHT
The emulated right button on the right stick.
Definition: wpad.h:216
@ WPAD_PRO_BUTTON_A
The A button.
Definition: wpad.h:174
@ WPAD_PRO_BUTTON_RIGHT
The right button of the D-pad.
Definition: wpad.h:196
2D vector.
Definition: wpad.h:221
int32_t BOOL
Definition: wut_types.h:7