10 #elif defined(__linux__) 12 #include <bluetooth/bluetooth.h> 15 #ifdef WIIUSE_INTERNAL_H_INCLUDED 22 #define WIIMOTE_LED_NONE 0x00 23 #define WIIMOTE_LED_1 0x10 24 #define WIIMOTE_LED_2 0x20 25 #define WIIMOTE_LED_3 0x40 26 #define WIIMOTE_LED_4 0x80 29 #define WIIMOTE_BUTTON_TWO 0x0001 30 #define WIIMOTE_BUTTON_ONE 0x0002 31 #define WIIMOTE_BUTTON_B 0x0004 32 #define WIIMOTE_BUTTON_A 0x0008 33 #define WIIMOTE_BUTTON_MINUS 0x0010 34 #define WIIMOTE_BUTTON_ZACCEL_BIT6 0x0020 35 #define WIIMOTE_BUTTON_ZACCEL_BIT7 0x0040 36 #define WIIMOTE_BUTTON_HOME 0x0080 37 #define WIIMOTE_BUTTON_LEFT 0x0100 38 #define WIIMOTE_BUTTON_RIGHT 0x0200 39 #define WIIMOTE_BUTTON_DOWN 0x0400 40 #define WIIMOTE_BUTTON_UP 0x0800 41 #define WIIMOTE_BUTTON_PLUS 0x1000 42 #define WIIMOTE_BUTTON_ZACCEL_BIT4 0x2000 43 #define WIIMOTE_BUTTON_ZACCEL_BIT5 0x4000 44 #define WIIMOTE_BUTTON_UNKNOWN 0x8000 45 #define WIIMOTE_BUTTON_ALL 0x1F9F 48 #define NUNCHUK_BUTTON_Z 0x01 49 #define NUNCHUK_BUTTON_C 0x02 50 #define NUNCHUK_BUTTON_ALL 0x03 53 #define CLASSIC_CTRL_BUTTON_UP 0x0001 54 #define CLASSIC_CTRL_BUTTON_LEFT 0x0002 55 #define CLASSIC_CTRL_BUTTON_ZR 0x0004 56 #define CLASSIC_CTRL_BUTTON_X 0x0008 57 #define CLASSIC_CTRL_BUTTON_A 0x0010 58 #define CLASSIC_CTRL_BUTTON_Y 0x0020 59 #define CLASSIC_CTRL_BUTTON_B 0x0040 60 #define CLASSIC_CTRL_BUTTON_ZL 0x0080 61 #define CLASSIC_CTRL_BUTTON_FULL_R 0x0200 62 #define CLASSIC_CTRL_BUTTON_PLUS 0x0400 63 #define CLASSIC_CTRL_BUTTON_HOME 0x0800 64 #define CLASSIC_CTRL_BUTTON_MINUS 0x1000 65 #define CLASSIC_CTRL_BUTTON_FULL_L 0x2000 66 #define CLASSIC_CTRL_BUTTON_DOWN 0x4000 67 #define CLASSIC_CTRL_BUTTON_RIGHT 0x8000 68 #define CLASSIC_CTRL_BUTTON_ALL 0xFEFF 71 #define GUITAR_HERO_3_BUTTON_STRUM_UP 0x0001 72 #define GUITAR_HERO_3_BUTTON_YELLOW 0x0008 73 #define GUITAR_HERO_3_BUTTON_GREEN 0x0010 74 #define GUITAR_HERO_3_BUTTON_BLUE 0x0020 75 #define GUITAR_HERO_3_BUTTON_RED 0x0040 76 #define GUITAR_HERO_3_BUTTON_ORANGE 0x0080 77 #define GUITAR_HERO_3_BUTTON_PLUS 0x0400 78 #define GUITAR_HERO_3_BUTTON_MINUS 0x1000 79 #define GUITAR_HERO_3_BUTTON_STRUM_DOWN 0x4000 80 #define GUITAR_HERO_3_BUTTON_ALL 0xFEFF 83 #define GUITAR_HERO_3_TOUCH_AVAILABLE 0x1000 84 #define GUITAR_HERO_3_TOUCH_GREEN 0x1001 85 #define GUITAR_HERO_3_TOUCH_RED 0x1002 86 #define GUITAR_HERO_3_TOUCH_YELLOW 0x1004 87 #define GUITAR_HERO_3_TOUCH_BLUE 0x1008 88 #define GUITAR_HERO_3_TOUCH_ORANGE 0x1010 91 #define WIIUSE_SMOOTHING 0x01 92 #define WIIUSE_CONTINUOUS 0x02 93 #define WIIUSE_ACCEL_THRESH 0x04 94 #define WIIUSE_IR_THRESH 0x08 95 #define WIIUSE_JS_THRESH 0x10 96 #define WIIUSE_INIT_FLAGS WIIUSE_SMOOTHING 98 #define WIIUSE_ORIENT_PRECISION 100.0f 102 #define EXP_NUNCHUK 1 103 #define EXP_CLASSIC 2 104 #define EXP_GUITAR_HERO_3 3 105 #define EXP_WII_BOARD 4 106 #define EXP_MOTION_PLUS 5 120 #define IS_PRESSED(dev, button) ((dev->btns & button) == button) 128 #define IS_HELD(dev, button) ((dev->btns_held & button) == button) 139 #define IS_RELEASED(dev, button) ((dev->btns_released & button) == button) 147 #define IS_JUST_PRESSED(dev, button) (IS_PRESSED(dev, button) && !IS_HELD(dev, button)) 155 #define WIIUSE_GET_IR_SENSITIVITY(dev, lvl) \ 157 if ((wm->state & 0x01000) == 0x01000) *lvl = 1; \ 158 else if ((wm->state & 0x02000) == 0x02000) *lvl = 2; \ 159 else if ((wm->state & 0x04000) == 0x04000) *lvl = 3; \ 160 else if ((wm->state & 0x08000) == 0x08000) *lvl = 4; \ 161 else if ((wm->state & 0x10000) == 0x10000) *lvl = 5; \ 165 #define WIIUSE_USING_ACC(wm) ((wm->state & 0x00100) == 0x00100) 166 #define WIIUSE_USING_EXP(wm) ((wm->state & 0x00200) == 0x00200) 167 #define WIIUSE_USING_IR(wm) ((wm->state & 0x00400) == 0x00400) 168 #define WIIUSE_USING_SPEAKER(wm) ((wm->state & 0x00800) == 0x00800) 170 #define WIIUSE_IS_LED_SET(wm, num) ((wm->leds & WIIMOTE_LED_##num) == WIIMOTE_LED_##num) 176 #define MAX_PAYLOAD 32 183 #define WIIMOTE_DEFAULT_TIMEOUT 100 184 #define WIIMOTE_EXP_TIMEOUT 100 599 WCONST OVERLAPPED hid_overlap;
607 WCONST char bdaddr_str[18];
609 WCONST wii_event_cb event_cb;
612 WCONST char bdaddr_str[18];
662 typedef struct wiimote_listen_t {
677 #define WIIUSE_EXPORT_DECL __declspec(dllexport) 678 #define WIIUSE_IMPORT_DECL __declspec(dllimport) 680 #define WIIUSE_EXPORT_DECL 681 #define WIIUSE_IMPORT_DECL 684 #ifdef WIIUSE_COMPILE_LIB 685 #define WIIUSE_EXPORT WIIUSE_EXPORT_DECL 687 #define WIIUSE_EXPORT WIIUSE_IMPORT_DECL float whammy_bar
Definition: wiiuse.h:488
WIIUSE_EXPORT void wiiuse_cleanup(struct wiimote_t **wm, int wiimotes)
struct ir_dot_t dot[4]
Definition: wiiuse.h:378
lwp_node node
Definition: wiiuse.h:250
float st_roll
Definition: wiiuse.h:330
WIIUSE_EXPORT void wiiuse_set_bluetooth_stack(struct wiimote_t **wm, int wiimotes, enum win_bt_stack_t type)
GLbitfield GLuint64 timeout
Definition: glext.h:7831
short rx
Definition: wiiuse.h:343
ubyte visible
Definition: wiiuse.h:341
ubyte btns_released
Definition: wiiuse.h:447
enum aspect_t aspect
Definition: wiiuse.h:400
int32_t s32
32bit signed integer
Definition: gctypes.h:24
WIIUSE_EXPORT void wiiuse_disconnected(struct wiimote_t *wm)
float z
Definition: wiiuse.h:318
cmd_blk_s state
Definition: wiiuse.h:255
struct wii_board_t wii_board_t
Unsigned x,y,z byte vector.
Definition: wiiuse.h:275
short rtl
Definition: wiiuse.h:505
Definition: lwp_queue.h:21
float x
Definition: wiiuse.h:351
char sint
Definition: wiiuse.h:192
float l_shoulder
Definition: wiiuse.h:469
Guitar Hero 3 expansion device.
Definition: wiiuse.h:481
struct nunchuk_t nunchuk
Definition: wiiuse.h:532
Data read request structure.
Definition: wiiuse.h:230
short rz
Definition: wiiuse.h:519
short rbr
Definition: wiiuse.h:508
struct classic_ctrl_t classic
Definition: wiiuse.h:533
struct guitar_hero_3_t gh3
Definition: wiiuse.h:534
struct cmd_blk_t * next
Definition: wiiuse.h:258
float glitch_cnt
Definition: wiiuse.h:395
struct vec3w_t accel
Definition: wiiuse.h:560
WCONST struct orient_t orient
Definition: wiiuse.h:639
short btns_held
Definition: wiiuse.h:462
Wiimote structure.
Definition: wiiuse.h:594
short btns_last
Definition: wiiuse.h:483
WIIUSE_EXPORT void wiiuse_disconnect(struct wiimote_t *wm)
struct vec2b_t center
Definition: wiiuse.h:426
float a_roll
Definition: wiiuse.h:308
WCONST struct vec3w_t accel
Definition: wiiuse.h:638
Generic expansion device plugged into wiimote.
Definition: wiiuse.h:528
float st_pitch
Definition: wiiuse.h:331
float y
Definition: wiiuse.h:399
ubyte wb_raw
Definition: wiiuse.h:487
float score
Definition: wiiuse.h:360
data_req_s
Definition: wiiuse.h:219
float x
Definition: wiiuse.h:513
short btns_released
Definition: wiiuse.h:463
WCONST struct ir_t ir
Definition: wiiuse.h:642
#define WCONST
Definition: wiiuse.h:18
unsigned short btns
Definition: wiiuse.h:557
float y
Definition: wiiuse.h:318
Accelerometer struct. For any device with an accelerometer.
Definition: wiiuse.h:326
WIIUSE_EXPORT int wiiuse_write_streamdata(struct wiimote_t *wm, ubyte *data, ubyte len, cmd_blk_cb cb)
Definition: wiiuse.c:298
WCONST struct data_req_t * data_req
Definition: wiiuse.h:630
GLenum GLsizei len
Definition: glext.h:7389
WCONST unsigned short btns_last
Definition: wiiuse.h:645
Signed x,y,z float struct.
Definition: wiiuse.h:292
WIIUSE_EXPORT void wiiuse_status(struct wiimote_t *wm, cmd_blk_cb cb)
Definition: wiiuse.c:236
WIIUSE_EXPORT int wiiuse_connect(struct wiimote_t **wm, int wiimotes)
ubyte type
Definition: wiiuse.h:473
float sx
Definition: wiiuse.h:392
void(* wiiuse_data_cb)(struct wiimote_t *wm, ubyte *data, unsigned short len)
Callback that handles a read event.
Definition: wiiuse.h:217
Unsigned x,y byte vector.
Definition: wiiuse.h:266
Definition: lwp_queue.h:16
short rx
Definition: wiiuse.h:519
GLboolean enable
Definition: glext.h:12027
struct joystick_t js
Definition: wiiuse.h:440
struct bd_addr bdaddr
Definition: bte.h:108
WIIUSE_EXPORT void wiiuse_set_ir_sensitivity(struct wiimote_t *wm, int level)
Set the IR sensitivity.
Definition: ir.c:316
short cbl[3]
Definition: wiiuse.h:511
float tl
Definition: wiiuse.h:501
ubyte ext
Definition: wiiuse.h:521
struct joystick_t ljs
Definition: wiiuse.h:471
struct data_req_t * next
Definition: wiiuse.h:236
WIIUSE_EXPORT const char * wiiuse_version()
typedef void(__stdcall *PFN_DESTRUCTION_CALLBACK)(void *pData)
uword y
Definition: wiiuse.h:284
WIIUSE_EXPORT float wiiuse_set_smooth_alpha(struct wiimote_t *wm, float alpha)
WCONST ubyte event_buf[MAX_PAYLOAD]
Definition: wiiuse.h:652
Joystick calibration structure.
Definition: wiiuse.h:423
ubyte x
Definition: wiiuse.h:276
WIIUSE_EXPORT void wiiuse_set_timeout(struct wiimote_t **wm, int wiimotes, ubyte normal_timeout, ubyte exp_timeout)
struct vec3w_t cal_zero
Definition: wiiuse.h:327
struct motion_plus_t motion_plus_t
ubyte ls_raw
Definition: wiiuse.h:466
float ang
Definition: wiiuse.h:429
WCONST ubyte handshake_state
Definition: wiiuse.h:627
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:6303
Gravity force struct.
Definition: wiiuse.h:317
float br
Definition: wiiuse.h:504
int state
Definition: wiiuse.h:381
float a_pitch
Definition: wiiuse.h:309
float ay
Definition: wiiuse.h:386
WIIUSE_EXPORT void wiiuse_set_ir_position(struct wiimote_t *wm, enum ir_position_t pos)
Set the XY position for the IR cursor.
Definition: ir.c:251
WCONST unsigned short btns_released
Definition: wiiuse.h:647
WIIUSE_EXPORT int wiiuse_read_data(struct wiimote_t *wm, ubyte *buffer, unsigned int offset, unsigned short len, cmd_blk_cb cb)
Definition: wiiuse.c:246
struct vec3w_t cal_g
Definition: wiiuse.h:328
float x
Definition: wiiuse.h:293
WCONST unsigned short btns
Definition: wiiuse.h:644
unsigned int uint
Definition: wiiuse.h:191
wiimote_state wiimotes[WIIU_WIIMOTE_CHANNELS]
Definition: kpad_driver.c:49
Classic controller expansion device.
Definition: wiiuse.h:459
short cbr[3]
Definition: wiiuse.h:512
WCONST int flags
Definition: wiiuse.h:625
float z
Definition: wiiuse.h:293
ubyte btns_held
Definition: wiiuse.h:446
sb_t sensorbar
Definition: wiiuse.h:384
WCONST WIIUSE_EVENT_TYPE event
Definition: wiiuse.h:651
GLenum type
Definition: glext.h:6233
float x
Definition: wiiuse.h:398
ubyte tb_raw
Definition: wiiuse.h:490
unsigned int vres[2]
Definition: wiiuse.h:402
IR struct. Hold all data related to the IR tracking.
Definition: wiiuse.h:377
ubyte status
Definition: wiiuse.h:520
enum ir_position_t pos
Definition: wiiuse.h:401
A single IR source.
Definition: wiiuse.h:340
struct vec3w_t accel
Definition: wiiuse.h:449
float bl
Definition: wiiuse.h:503
WIIUSE_EVENT_TYPE
Events that wiiuse can generate from a poll.
Definition: wiiuse.h:569
float pitch
Definition: wiiuse.h:305
struct joystick_t rjs
Definition: wiiuse.h:472
struct guitar_hero_3_t guitar_hero_3_t
float x
Definition: wiiuse.h:318
WIIUSE_EXPORT int wiiuse_find(struct wiimote_t **wm, int max_wiimotes, int timeout)
short btns
Definition: wiiuse.h:460
WIIUSE_EXPORT void wiiuse_set_leds(struct wiimote_t *wm, int leds, cmd_blk_cb cb)
Toggle the state of the rumble.
Definition: wiiuse.c:195
struct expansion_t exp
Definition: wiiuse.h:561
uint len
Definition: wiiuse.h:253
int valid
Definition: wiiuse.h:397
GLenum const GLvoid * addr
Definition: glext.h:10528
WIIUSE_EXPORT void wiiuse_motion_sensing(struct wiimote_t *wm, int status)
Set if the wiimote should report motion sensing.
Definition: wiiuse.c:150
WIIUSE_EXPORT void wiiuse_toggle_rumble(struct wiimote_t *wm)
ubyte btns
Definition: wiiuse.h:444
WIIUSE_EXPORT int wiiuse_poll(struct wiimote_t **wm, int wiimotes)
win_bt_stack_t
Definition: wiiuse.h:545
cmd_blk_s
Definition: wiiuse.h:241
WCONST struct gforce_t gforce
Definition: wiiuse.h:640
ubyte y
Definition: wiiuse.h:267
GLint level
Definition: glext.h:6293
float y
Definition: wiiuse.h:351
fdot_t rot_dots[2]
Definition: wiiuse.h:357
float y
Definition: wiiuse.h:514
Wii Balance Board expansion device.
Definition: wiiuse.h:500
WCONST ubyte leds
Definition: wiiuse.h:618
float sy
Definition: wiiuse.h:393
ubyte x
Definition: wiiuse.h:267
struct expansion_t expansion_t
Nunchuk expansion device.
Definition: wiiuse.h:438
float tr
Definition: wiiuse.h:502
int raw_valid
Definition: wiiuse.h:383
WCONST ubyte expansion_state
Definition: wiiuse.h:628
GLint GLint GLint GLint GLint GLint y
Definition: glext.h:6295
fdot_t dots[2]
Definition: wiiuse.h:355
short btns
Definition: wiiuse.h:482
ubyte num_dots
Definition: wiiuse.h:379
ubyte size
Definition: wiiuse.h:346
float z
Definition: wiiuse.h:388
WCONST struct accel_t accel_calib
Definition: wiiuse.h:635
GLint GLint GLint GLint GLint x
Definition: glext.h:6295
float y
Definition: wiiuse.h:293
short ry
Definition: wiiuse.h:519
struct wii_board_t wb
Definition: wiiuse.h:535
WIIUSE_EXPORT void wiiuse_rumble(struct wiimote_t *wm, int status)
ubyte y
Definition: wiiuse.h:276
int * flags
Definition: wiiuse.h:442
float off_angle
Definition: wiiuse.h:359
short sword
Definition: wiiuse.h:190
WIIUSE_EXPORT void wiiuse_set_ir_mode(struct wiimote_t *wm)
Definition: ir.c:149
unsigned char ubyte
Definition: wiiuse.h:187
GLfloat GLfloat GLfloat alpha
Definition: glext.h:6290
unsigned int len
Definition: wiiuse.h:233
ir_position_t
Definition: wiiuse.h:109
data_req_s state
Definition: wiiuse.h:234
ubyte z
Definition: wiiuse.h:276
float ax
Definition: wiiuse.h:385
lwp_node node
Definition: wiiuse.h:231
WCONST int unid
Definition: wiiuse.h:595
float r_shoulder
Definition: wiiuse.h:468
uword z
Definition: wiiuse.h:284
#define WIIUSE_EXPORT
Definition: wiiuse.h:687
short ry
Definition: wiiuse.h:344
struct joystick_t js
Definition: wiiuse.h:493
ubyte rs_raw
Definition: wiiuse.h:465
Significant data from the previous event.
Definition: wiiuse.h:556
struct joystick_t joystick_t
char sbyte
Definition: wiiuse.h:188
short rbl
Definition: wiiuse.h:507
struct accel_t accel_calib
Definition: wiiuse.h:439
short btns_released
Definition: wiiuse.h:485
short ctr[3]
Definition: wiiuse.h:510
struct motion_plus_t mp
Definition: wiiuse.h:536
WIIUSE_EXPORT void wiiuse_set_ir(struct wiimote_t *wm, int status)
Definition: ir.c:161
fdot_t acc_dots[2]
Definition: wiiuse.h:356
struct vec2b_t pos
Definition: wiiuse.h:427
unsigned short uword
Definition: wiiuse.h:189
struct ir_t ir
Definition: wiiuse.h:559
float error_cnt
Definition: wiiuse.h:394
short rtr
Definition: wiiuse.h:506
struct nunchuk_t nunchuk_t
WIIUSE_EXPORT void wiiuse_set_motion_plus(struct wiimote_t *wm, int status)
Definition: motion_plus.c:60
float roll
Definition: wiiuse.h:304
float st_alpha
Definition: wiiuse.h:332
struct _cl_event * event
Definition: glext.h:8406
float aspect
Definition: ffmpeg_core.c:183
WIIUSE_EXPORT void wiiuse_set_speaker(struct wiimote_t *wm, int status)
Definition: speaker.c:68
float distance
Definition: wiiuse.h:387
struct orient_t orient
Definition: wiiuse.h:450
WCONST ubyte motion_plus_id[6]
Definition: wiiuse.h:654
float angle
Definition: wiiuse.h:389
WCONST unsigned short btns_held
Definition: wiiuse.h:646
WCONST struct cmd_blk_t * cmd_head
Definition: wiiuse.h:632
struct vec2b_t min
Definition: wiiuse.h:425
cmd_blk_cb cb
Definition: wiiuse.h:256
WIIUSE_EXPORT void wiiuse_set_ir_vres(struct wiimote_t *wm, unsigned int x, unsigned int y)
Set the virtual screen resolution for IR tracking.
Definition: ir.c:239
ubyte btns_last
Definition: wiiuse.h:445
float mag
Definition: wiiuse.h:430
struct vec2b_t max
Definition: wiiuse.h:424
int smooth_valid
Definition: wiiuse.h:391
Definition: video4linux2.c:51
GLintptr offset
Definition: glext.h:6560
WCONST int state
Definition: wiiuse.h:617
WCONST float battery_level
Definition: wiiuse.h:622
Orientation struct.
Definition: wiiuse.h:303
WIIUSE_EXPORT int wiiuse_write_data(struct wiimote_t *wm, unsigned int addr, ubyte *data, ubyte len, cmd_blk_cb cb)
Definition: wiiuse.c:271
WIIUSE_EXPORT struct wiimote_t * wiiuse_get_by_id(struct wiimote_t **wm, int wiimotes, int unid)
short btns_last
Definition: wiiuse.h:461
WCONST struct cmd_blk_t * cmd_tail
Definition: wiiuse.h:633
#define MAX_PAYLOAD
Definition: wiiuse.h:176
WCONST struct expansion_t exp
Definition: wiiuse.h:636
int touch_bar
Definition: wiiuse.h:491
WIIUSE_EXPORT struct wiimote_t ** wiiuse_init(int wiimotes)
Definition: wiiuse.c:59
WCONST struct wiimote_state_t lstate
Definition: wiiuse.h:649
uword x
Definition: wiiuse.h:284
WIIUSE_EXPORT void wiiuse_set_aspect_ratio(struct wiimote_t *wm, enum aspect_t aspect)
Set the aspect ratio of the TV/monitor.
Definition: ir.c:289
void(* cmd_blk_cb)(struct wiimote_t *wm, ubyte *data, uword len)
Definition: wiiuse.h:239
struct gforce_t gforce
Definition: wiiuse.h:451
struct classic_ctrl_t classic_ctrl_t
int type
Definition: wiiuse.h:529
WIIUSE_EXPORT void wiiuse_resync(struct wiimote_t *wm)
short ctl[3]
Definition: wiiuse.h:509
wiiuse_data_cb cb
Definition: wiiuse.h:235
WIIUSE_EXPORT int wiiuse_set_flags(struct wiimote_t *wm, int enable, int disable)
Set flags for the specified wiimote.
Definition: wiiuse.c:127
float yaw
Definition: wiiuse.h:306
struct wiimote_state_t wiimote_state_t
short btns_held
Definition: wiiuse.h:484
float angle
Definition: wiiuse.h:358
static int sock
Definition: ranetplayer.c:84
aspect_t
Screen aspect ratio.
Definition: wiiuse.h:367