wut  1.0.0-beta8
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 
WPADConnectCallback WPADSetConnectCallback(WPADChan chan, WPADConnectCallback callback)
WPADProButton
Definition: wpad.h:76
int32_t WPADSetDataFormat(WPADChan chan, WPADDataFormat format)
void(* WPADConnectCallback)(WPADChan chan, int32_t status)
Definition: wpad.h:140
void WPADInit()
void(* WPADExtensionCallback)(WPADChan chan, int32_t status)
Definition: wpad.h:139
void WPADRead(WPADChan chan, void *data)
WPADVec2D leftStick
Definition: wpad.h:125
WPADClassicButton
Definition: wpad.h:57
uint8_t extensionType
A value from WPADExtensionType.
Definition: wpad.h:120
void WPADSetAutoSleepTime(uint8_t time)
void WPADShutdown()
WPADExtensionType
Definition: wpad.h:29
void WPADEnableURCC(int32_t enable)
WPADExtensionCallback WPADSetExtensionCallback(WPADChan chan, WPADExtensionCallback callback)
WPADDataFormat dataFormat
Definition: wpad.h:128
void WPADEnableWiiRemote(int32_t enable)
WPADDataFormat
Definition: wpad.h:24
void WPADDisconnect(WPADChan chan)
int16_t y
Definition: wpad.h:109
int16_t x
Definition: wpad.h:108
uint32_t buttons
Definition: wpad.h:124
int32_t WPADProbe(WPADChan chan, WPADExtensionType *outExtensionType)
WPADSamplingCallback WPADSetSamplingCallback(WPADChan chan, WPADSamplingCallback callback)
void(* WPADSamplingCallback)(WPADChan chan)
Definition: wpad.h:138
WPADVec2D rightStick
Definition: wpad.h:126
WPADButton
Definition: wpad.h:40
WPADChan
Definition: wpad.h:16