1 // Copyright (C) 2003 Dolphin Project.
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, version 2.0.
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU General Public License 2.0 for more details.
12 // A copy of the GPL 2.0 should have been included with the program.
13 // If not, see http://www.gnu.org/licenses/
15 // Official SVN repository and contact information can be found at
16 // http://code.google.com/p/dolphin-emu/
21 #include "CommonTypes.h"
25 #pragma warning(disable:4200)
29 // Source: HID_010_SPC_PFL/1.0 (official HID specification)
37 #define HID_TYPE_HANDSHAKE 0
38 #define HID_TYPE_SET_REPORT 5
39 #define HID_TYPE_DATA 0xA
41 #define HID_HANDSHAKE_SUCCESS 0
43 #define HID_PARAM_INPUT 1
44 #define HID_PARAM_OUTPUT 2
46 //source: http://wiibrew.org/wiki/Wiimote
55 // Four bytes for two objects. Filled with 0xFF if empty
68 // Three bytes for one object
80 u8 jx
; // joystick x, y
82 u8 ax
; // accelerometer
88 struct wm_classic_extension
102 struct wm_guitar_extension
105 u8 pad1
: 2; // 1 on gh3, 0 on ghwt
108 u8 pad2
: 2; // 1 on gh3, 0 on ghwt
110 u8 tb
: 5; // not used in gh3
111 u8 pad3
: 3; // always 0
114 u8 pad4
: 3; // always 0
119 struct wm_drums_extension
122 u8 pad1
: 2; // always 0
125 u8 pad2
: 2; // always 0
127 u8 pad3
: 1; // unknown
132 u8 pad4
: 1; // unknown
133 u8 velocity
: 4; // unknown
147 u8 rumble
: 1; // enable/disable rumble
148 // only valid for certain reports
149 u8 ack
: 1; // respond with an ack
150 u8 enable
: 1; // enable/disable certain features
155 #define WM_RUMBLE 0x10
164 #define WM_REPORT_MODE 0x12
165 struct wm_report_mode
{
167 u8 continuous
: 1; // these 2 seem to be named wrong
173 #define WM_IR_PIXEL_CLOCK 0x13
174 #define WM_IR_LOGIC 0x1A
176 #define WM_REQUEST_STATUS 0x15
177 struct wm_request_status
{
182 #define WM_STATUS_REPORT 0x20
183 struct wm_status_report
{
190 u8 padding2
[2]; // two 00, TODO: this needs more investigation
194 #define WM_WRITE_DATA 0x16
198 u8 space
: 2; //see WM_SPACE_*
205 #define WM_ACK_DATA 0x22
206 struct wm_acknowledge
213 #define WM_READ_DATA 0x17
214 struct wm_read_data
{
216 u8 space
: 2; //see WM_SPACE_*
222 #define WM_SPACE_EEPROM 0
223 #define WM_SPACE_REGS1 1
224 #define WM_SPACE_REGS2 2
225 #define WM_SPACE_INVALID 3
227 #define WM_READ_DATA_REPLY 0x21
228 struct wm_read_data_reply
{
230 u8 error
: 4; //see WM_RDERR_*
236 #define WM_RDERR_WOREG 7
237 #define WM_RDERR_NOMEM 8
242 #define WM_REPORT_CORE 0x30
243 struct wm_report_core
{
247 #define WM_REPORT_CORE_ACCEL 0x31
248 struct wm_report_core_accel
{
253 #define WM_REPORT_CORE_EXT8 0x32
255 #define WM_REPORT_CORE_ACCEL_IR12 0x33
256 struct wm_report_core_accel_ir12
{
259 wm_ir_extended ir
[4];
262 #define WM_REPORT_CORE_EXT19 0x34
263 #define WM_REPORT_CORE_ACCEL_EXT16 0x35
264 struct wm_report_core_accel_ext16
274 #define WM_REPORT_CORE_IR10_EXT9 0x36
276 #define WM_REPORT_CORE_ACCEL_IR10_EXT6 0x37
277 struct wm_report_core_accel_ir10_ext6
286 #define WM_REPORT_EXT21 0x3d // never used?
287 struct wm_report_ext21
292 #define WM_REPORT_INTERLEAVE1 0x3e
293 #define WM_REPORT_INTERLEAVE2 0x3f
295 #define WM_SPEAKER_ENABLE 0x14
296 #define WM_SPEAKER_MUTE 0x19
297 #define WM_WRITE_SPEAKER_DATA 0x18
298 struct wm_speaker_data
{
308 * @brief Accelerometer struct. For any device with an accelerometer.
337 wm_accel cal_zero
; // zero calibratio
338 wm_accel cal_g
; // g size
359 #endif //WIIMOTE_HID_H