2014-02-10 18:54:46 +00:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
2010-07-05 10:46:32 +00:00
|
|
|
|
|
|
|
#include <string>
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Common/Common.h"
|
2010-07-05 10:46:32 +00:00
|
|
|
|
|
|
|
#define UDPWM_B1 (1<<0)
|
|
|
|
#define UDPWM_B2 (1<<1)
|
|
|
|
#define UDPWM_BA (1<<2)
|
|
|
|
#define UDPWM_BB (1<<3)
|
|
|
|
#define UDPWM_BP (1<<4)
|
|
|
|
#define UDPWM_BM (1<<5)
|
|
|
|
#define UDPWM_BH (1<<6)
|
|
|
|
#define UDPWM_BU (1<<7)
|
|
|
|
#define UDPWM_BD (1<<8)
|
|
|
|
#define UDPWM_BL (1<<9)
|
|
|
|
#define UDPWM_BR (1<<10)
|
|
|
|
#define UDPWM_SK (1<<11)
|
|
|
|
#define UDPWM_NC (1<<0)
|
|
|
|
#define UDPWM_NZ (1<<1)
|
|
|
|
|
|
|
|
class UDPWiimote
|
|
|
|
{
|
|
|
|
public:
|
2010-07-19 10:36:30 +00:00
|
|
|
UDPWiimote(const char * port, const char * name, int index);
|
2010-07-05 10:46:32 +00:00
|
|
|
virtual ~UDPWiimote();
|
|
|
|
void getAccel(float &x, float &y, float &z);
|
|
|
|
u32 getButtons();
|
|
|
|
void getNunchuck(float &x, float &y, u8 &mask);
|
|
|
|
void getIR(float &x, float &y);
|
2010-07-14 17:33:14 +00:00
|
|
|
void getNunchuckAccel(float &x, float &y, float &z);
|
2010-07-05 10:46:32 +00:00
|
|
|
int getErrNo() {return err;};
|
|
|
|
const char * getPort();
|
2010-07-19 10:36:30 +00:00
|
|
|
void changeName(const char * name);
|
2011-01-31 08:19:27 +00:00
|
|
|
|
|
|
|
void mainThread();
|
2010-07-05 10:46:32 +00:00
|
|
|
private:
|
2010-07-19 10:36:30 +00:00
|
|
|
std::string port,displayName;
|
2010-07-05 10:46:32 +00:00
|
|
|
int pharsePacket(u8 * data, size_t size);
|
2013-04-19 13:21:45 +00:00
|
|
|
struct _d; //using pimpl because Winsock2.h doesn't have include guards -_-
|
2013-10-29 05:23:17 +00:00
|
|
|
_d *d;
|
2010-07-05 10:46:32 +00:00
|
|
|
double x,y,z;
|
2010-07-14 17:33:14 +00:00
|
|
|
double naX,naY,naZ;
|
2010-07-05 10:46:32 +00:00
|
|
|
double nunX,nunY;
|
|
|
|
double pointerX,pointerY;
|
|
|
|
u8 nunMask;
|
|
|
|
u32 mask;
|
2010-07-19 10:36:30 +00:00
|
|
|
u16 bcastMagic;
|
2010-07-05 10:46:32 +00:00
|
|
|
int err;
|
2010-07-19 10:36:30 +00:00
|
|
|
int index;
|
|
|
|
int int_port;
|
2010-07-05 10:46:32 +00:00
|
|
|
static int noinst;
|
|
|
|
void broadcastPresence();
|
2010-07-19 10:36:30 +00:00
|
|
|
void broadcastIPv4(const void * data, size_t size);
|
|
|
|
void broadcastIPv6(const void * data, size_t size);
|
|
|
|
void initBroadcastIPv4();
|
|
|
|
void initBroadcastIPv6();
|
2010-07-05 10:46:32 +00:00
|
|
|
};
|