wut  1.0.0-beta9
Wii U Toolchain
wpad.h
Go to the documentation of this file.
1 #pragma once
2 #include <wut.h>
3 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
14 typedef struct WPADVec2D WPADVec2D;
15 
16 typedef enum WPADChan
17 {
22 } WPADChan;
23 
24 typedef enum WPADDataFormat
25 {
28 
29 typedef enum WPADExtensionType
30 {
39 
40 typedef enum WPADButton
41 {
42  WPAD_BUTTON_LEFT = 0x0001,
44  WPAD_BUTTON_DOWN = 0x0004,
45  WPAD_BUTTON_UP = 0x0008,
46  WPAD_BUTTON_PLUS = 0x0010,
47  WPAD_BUTTON_2 = 0x0100,
48  WPAD_BUTTON_1 = 0x0200,
49  WPAD_BUTTON_B = 0x0400,
50  WPAD_BUTTON_A = 0x0800,
52  WPAD_BUTTON_Z = 0x2000,
53  WPAD_BUTTON_C = 0x4000,
54  WPAD_BUTTON_HOME = 0x8000,
55 } WPADButton;
56 
57 typedef enum WPADClassicButton
58 {
75 
76 typedef enum WPADProButton
77 {
78  WPAD_PRO_BUTTON_UP = 0x00000001,
79  WPAD_PRO_BUTTON_LEFT = 0x00000002,
80  WPAD_PRO_TRIGGER_ZR = 0x00000004,
81  WPAD_PRO_BUTTON_X = 0x00000008,
82  WPAD_PRO_BUTTON_A = 0x00000010,
83  WPAD_PRO_BUTTON_Y = 0x00000020,
84  WPAD_PRO_BUTTON_B = 0x00000040,
85  WPAD_PRO_TRIGGER_ZL = 0x00000080,
86  WPAD_PRO_RESERVED = 0x00000100,
87  WPAD_PRO_TRIGGER_R = 0x00000200,
88  WPAD_PRO_BUTTON_PLUS = 0x00000400,
89  WPAD_PRO_BUTTON_HOME = 0x00000800,
90  WPAD_PRO_BUTTON_MINUS = 0x00001000,
91  WPAD_PRO_TRIGGER_L = 0x00002000,
92  WPAD_PRO_BUTTON_DOWN = 0x00004000,
93  WPAD_PRO_BUTTON_RIGHT = 0x00008000,
104 } WPADProButton;
105 
106 struct WPADVec2D
107 {
108  int16_t x;
109  int16_t y;
110 };
111 WUT_CHECK_OFFSET(WPADVec2D, 0x00, x);
112 WUT_CHECK_OFFSET(WPADVec2D, 0x02, y);
113 WUT_CHECK_SIZE(WPADVec2D, 0x04);
114 
116 {
117  WUT_UNKNOWN_BYTES(0x28);
118 
120  uint8_t extensionType;
121 
122  uint8_t err;
123  WUT_PADDING_BYTES(2);
124  uint32_t buttons;
127  WUT_UNKNOWN_BYTES(8);
129 };
130 WUT_CHECK_OFFSET(WPADStatusProController, 0x28, extensionType);
131 WUT_CHECK_OFFSET(WPADStatusProController, 0x29, err);
132 WUT_CHECK_OFFSET(WPADStatusProController, 0x2C, buttons);
133 WUT_CHECK_OFFSET(WPADStatusProController, 0x30, leftStick);
134 WUT_CHECK_OFFSET(WPADStatusProController, 0x34, rightStick);
135 WUT_CHECK_OFFSET(WPADStatusProController, 0x40, dataFormat);
136 WUT_CHECK_SIZE(WPADStatusProController, 0x44);
137 
138 typedef void (*WPADSamplingCallback)(WPADChan chan);
139 typedef void (*WPADExtensionCallback)(WPADChan chan, int32_t status);
140 typedef void (*WPADConnectCallback)(WPADChan chan, int32_t status);
141 
142 void
143 WPADInit();
144 
145 void
146 WPADShutdown();
147 
148 int32_t
149 WPADProbe(WPADChan chan,
150  WPADExtensionType *outExtensionType);
151 
152 int32_t
154  WPADDataFormat format);
155 
156 void
157 WPADEnableURCC(int32_t enable);
158 
159 void
160 WPADEnableWiiRemote(int32_t enable);
161 
162 void
163 WPADRead(WPADChan chan,
164  void *data);
165 
166 void
167 WPADSetAutoSleepTime(uint8_t time);
168 
169 void
171 
174  WPADConnectCallback callback);
175 
178  WPADExtensionCallback callback);
179 
182  WPADSamplingCallback callback);
183 
184 #ifdef __cplusplus
185 }
186 #endif
187 
WPADChan
WPADChan
Definition: wpad.h:16
WPADSetDataFormat
int32_t WPADSetDataFormat(WPADChan chan, WPADDataFormat format)
WPADButton
WPADButton
Definition: wpad.h:40
WPAD_BUTTON_Z
@ WPAD_BUTTON_Z
Definition: wpad.h:52
WPAD_PRO_BUTTON_X
@ WPAD_PRO_BUTTON_X
Definition: wpad.h:81
WPADConnectCallback
void(* WPADConnectCallback)(WPADChan chan, int32_t status)
Definition: wpad.h:140
WPADStatusProController::buttons
uint32_t buttons
Definition: wpad.h:124
WPAD_BUTTON_LEFT
@ WPAD_BUTTON_LEFT
Definition: wpad.h:42
WPAD_PRO_BUTTON_STICK_R
@ WPAD_PRO_BUTTON_STICK_R
Definition: wpad.h:94
WPAD_EXT_PRO_CONTROLLER
@ WPAD_EXT_PRO_CONTROLLER
Definition: wpad.h:37
WPAD_CLASSIC_BUTTON_ZR
@ WPAD_CLASSIC_BUTTON_ZR
Definition: wpad.h:61
WPADStatusProController
Definition: wpad.h:115
WPAD_BUTTON_A
@ WPAD_BUTTON_A
Definition: wpad.h:50
WPADRead
void WPADRead(WPADChan chan, void *data)
WPADInit
void WPADInit()
WPAD_PRO_BUTTON_B
@ WPAD_PRO_BUTTON_B
Definition: wpad.h:84
WPAD_BUTTON_1
@ WPAD_BUTTON_1
Definition: wpad.h:48
WPADStatusProController::leftStick
WPADVec2D leftStick
Definition: wpad.h:125
WPADClassicButton
WPADClassicButton
Definition: wpad.h:57
WPADStatusProController::rightStick
WPADVec2D rightStick
Definition: wpad.h:126
WPADStatusProController::dataFormat
WPADDataFormat dataFormat
Definition: wpad.h:128
WPAD_BUTTON_DOWN
@ WPAD_BUTTON_DOWN
Definition: wpad.h:44
WPAD_CLASSIC_BUTTON_UP
@ WPAD_CLASSIC_BUTTON_UP
Definition: wpad.h:59
WPADStatusProController::extensionType
uint8_t extensionType
A value from WPADExtensionType.
Definition: wpad.h:120
WPADSetAutoSleepTime
void WPADSetAutoSleepTime(uint8_t time)
WPAD_PRO_BUTTON_Y
@ WPAD_PRO_BUTTON_Y
Definition: wpad.h:83
WPADExtensionType
WPADExtensionType
Definition: wpad.h:29
WPAD_PRO_STICK_L_EMULATION_DOWN
@ WPAD_PRO_STICK_L_EMULATION_DOWN
Definition: wpad.h:97
WPAD_PRO_RESERVED
@ WPAD_PRO_RESERVED
Definition: wpad.h:86
WPADExtensionCallback
void(* WPADExtensionCallback)(WPADChan chan, int32_t status)
Definition: wpad.h:139
WPAD_CLASSIC_BUTTON_RIGHT
@ WPAD_CLASSIC_BUTTON_RIGHT
Definition: wpad.h:73
WPADShutdown
void WPADShutdown()
WPAD_CLASSIC_BUTTON_PLUS
@ WPAD_CLASSIC_BUTTON_PLUS
Definition: wpad.h:68
WPAD_PRO_BUTTON_LEFT
@ WPAD_PRO_BUTTON_LEFT
Definition: wpad.h:79
WPAD_CLASSIC_BUTTON_HOME
@ WPAD_CLASSIC_BUTTON_HOME
Definition: wpad.h:69
WPADEnableURCC
void WPADEnableURCC(int32_t enable)
WPAD_PRO_STICK_R_EMULATION_UP
@ WPAD_PRO_STICK_R_EMULATION_UP
Definition: wpad.h:100
WPAD_PRO_BUTTON_HOME
@ WPAD_PRO_BUTTON_HOME
Definition: wpad.h:89
wut.h
WPAD_PRO_BUTTON_MINUS
@ WPAD_PRO_BUTTON_MINUS
Definition: wpad.h:90
WPAD_BUTTON_PLUS
@ WPAD_BUTTON_PLUS
Definition: wpad.h:46
WPAD_EXT_CLASSIC
@ WPAD_EXT_CLASSIC
Definition: wpad.h:33
WPAD_PRO_TRIGGER_ZR
@ WPAD_PRO_TRIGGER_ZR
Definition: wpad.h:80
WPADEnableWiiRemote
void WPADEnableWiiRemote(int32_t enable)
WPAD_PRO_TRIGGER_L
@ WPAD_PRO_TRIGGER_L
Definition: wpad.h:91
WPAD_CLASSIC_BUTTON_R
@ WPAD_CLASSIC_BUTTON_R
Definition: wpad.h:67
WPAD_EXT_MPLUS
@ WPAD_EXT_MPLUS
Definition: wpad.h:34
WPAD_CLASSIC_BUTTON_B
@ WPAD_CLASSIC_BUTTON_B
Definition: wpad.h:65
WPADSetExtensionCallback
WPADExtensionCallback WPADSetExtensionCallback(WPADChan chan, WPADExtensionCallback callback)
WPAD_BUTTON_MINUS
@ WPAD_BUTTON_MINUS
Definition: wpad.h:51
WPAD_CLASSIC_BUTTON_X
@ WPAD_CLASSIC_BUTTON_X
Definition: wpad.h:62
WPAD_CLASSIC_BUTTON_LEFT
@ WPAD_CLASSIC_BUTTON_LEFT
Definition: wpad.h:60
WPAD_BUTTON_UP
@ WPAD_BUTTON_UP
Definition: wpad.h:45
WPAD_CLASSIC_BUTTON_A
@ WPAD_CLASSIC_BUTTON_A
Definition: wpad.h:63
WPAD_PRO_STICK_L_EMULATION_RIGHT
@ WPAD_PRO_STICK_L_EMULATION_RIGHT
Definition: wpad.h:99
WPAD_PRO_STICK_R_EMULATION_DOWN
@ WPAD_PRO_STICK_R_EMULATION_DOWN
Definition: wpad.h:101
WPAD_CHAN_1
@ WPAD_CHAN_1
Definition: wpad.h:19
WPAD_PRO_BUTTON_A
@ WPAD_PRO_BUTTON_A
Definition: wpad.h:82
WPAD_PRO_TRIGGER_R
@ WPAD_PRO_TRIGGER_R
Definition: wpad.h:87
WPAD_CLASSIC_BUTTON_Y
@ WPAD_CLASSIC_BUTTON_Y
Definition: wpad.h:64
WPADVec2D::x
int16_t x
Definition: wpad.h:108
WPAD_PRO_STICK_L_EMULATION_UP
@ WPAD_PRO_STICK_L_EMULATION_UP
Definition: wpad.h:96
WPAD_CLASSIC_BUTTON_DOWN
@ WPAD_CLASSIC_BUTTON_DOWN
Definition: wpad.h:72
WPAD_CLASSIC_BUTTON_L
@ WPAD_CLASSIC_BUTTON_L
Definition: wpad.h:71
WPAD_CLASSIC_BUTTON_ZL
@ WPAD_CLASSIC_BUTTON_ZL
Definition: wpad.h:66
WPAD_PRO_BUTTON_RIGHT
@ WPAD_PRO_BUTTON_RIGHT
Definition: wpad.h:93
WPAD_CHAN_0
@ WPAD_CHAN_0
Definition: wpad.h:18
WPAD_BUTTON_HOME
@ WPAD_BUTTON_HOME
Definition: wpad.h:54
WPAD_EXT_NUNCHUK
@ WPAD_EXT_NUNCHUK
Definition: wpad.h:32
WPAD_PRO_BUTTON_STICK_L
@ WPAD_PRO_BUTTON_STICK_L
Definition: wpad.h:95
WPADDataFormat
WPADDataFormat
Definition: wpad.h:24
WPAD_EXT_MPLUS_NUNCHUK
@ WPAD_EXT_MPLUS_NUNCHUK
Definition: wpad.h:35
WPAD_PRO_TRIGGER_ZL
@ WPAD_PRO_TRIGGER_ZL
Definition: wpad.h:85
WPAD_PRO_BUTTON_PLUS
@ WPAD_PRO_BUTTON_PLUS
Definition: wpad.h:88
WPAD_BUTTON_RIGHT
@ WPAD_BUTTON_RIGHT
Definition: wpad.h:43
WPAD_PRO_STICK_R_EMULATION_RIGHT
@ WPAD_PRO_STICK_R_EMULATION_RIGHT
Definition: wpad.h:103
WPADStatusProController::err
uint8_t err
Definition: wpad.h:122
WPAD_BUTTON_B
@ WPAD_BUTTON_B
Definition: wpad.h:49
WPADDisconnect
void WPADDisconnect(WPADChan chan)
WPAD_EXT_CORE
@ WPAD_EXT_CORE
Definition: wpad.h:31
WPAD_BUTTON_C
@ WPAD_BUTTON_C
Definition: wpad.h:53
WPADSetSamplingCallback
WPADSamplingCallback WPADSetSamplingCallback(WPADChan chan, WPADSamplingCallback callback)
WPADVec2D
Definition: wpad.h:106
WPAD_CHAN_3
@ WPAD_CHAN_3
Definition: wpad.h:21
WPADSamplingCallback
void(* WPADSamplingCallback)(WPADChan chan)
Definition: wpad.h:138
WPAD_EXT_MPLUS_CLASSIC
@ WPAD_EXT_MPLUS_CLASSIC
Definition: wpad.h:36
WPADSetConnectCallback
WPADConnectCallback WPADSetConnectCallback(WPADChan chan, WPADConnectCallback callback)
WPAD_PRO_BUTTON_DOWN
@ WPAD_PRO_BUTTON_DOWN
Definition: wpad.h:92
WPAD_PRO_STICK_R_EMULATION_LEFT
@ WPAD_PRO_STICK_R_EMULATION_LEFT
Definition: wpad.h:102
WPADProbe
int32_t WPADProbe(WPADChan chan, WPADExtensionType *outExtensionType)
WPAD_BUTTON_2
@ WPAD_BUTTON_2
Definition: wpad.h:47
WPAD_CLASSIC_BUTTON_MINUS
@ WPAD_CLASSIC_BUTTON_MINUS
Definition: wpad.h:70
WPAD_PRO_BUTTON_UP
@ WPAD_PRO_BUTTON_UP
Definition: wpad.h:78
WPAD_FMT_PRO_CONTROLLER
@ WPAD_FMT_PRO_CONTROLLER
Definition: wpad.h:26
WPADVec2D::y
int16_t y
Definition: wpad.h:109
WPAD_PRO_STICK_L_EMULATION_LEFT
@ WPAD_PRO_STICK_L_EMULATION_LEFT
Definition: wpad.h:98
WPAD_CHAN_2
@ WPAD_CHAN_2
Definition: wpad.h:20
WPADProButton
WPADProButton
Definition: wpad.h:76