This should fix wiimote extensions on linux. Now to figure out the windows issue, and then OSX ... Sigh!
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6702 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
bc78a98cbc
commit
4b3a6a6d47
|
@ -223,7 +223,7 @@ unsigned char *Wiimote::IORead()
|
||||||
|
|
||||||
// Read the pending message into the buffer
|
// Read the pending message into the buffer
|
||||||
unsigned char *buffer = new unsigned char[MAX_PAYLOAD];
|
unsigned char *buffer = new unsigned char[MAX_PAYLOAD];
|
||||||
r = read(in_sock, buffer, sizeof(buffer));
|
r = read(in_sock, buffer, sizeof(unsigned char) * MAX_PAYLOAD);
|
||||||
if (r == -1)
|
if (r == -1)
|
||||||
{
|
{
|
||||||
// Error reading data
|
// Error reading data
|
||||||
|
|
|
@ -51,11 +51,11 @@ Wiimote *g_wiimotes[MAX_WIIMOTES];
|
||||||
Wiimote::Wiimote(const unsigned int _index)
|
Wiimote::Wiimote(const unsigned int _index)
|
||||||
: index(_index)
|
: index(_index)
|
||||||
#if defined(__linux__) && HAVE_BLUEZ
|
#if defined(__linux__) && HAVE_BLUEZ
|
||||||
, out_sock(-1), in_sock(-1)
|
, out_sock(-1), in_sock(-1)
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
, dev_handle(0), stack(MSBT_STACK_UNKNOWN)
|
, dev_handle(0), stack(MSBT_STACK_UNKNOWN)
|
||||||
#endif
|
#endif
|
||||||
, leds(0) , m_last_data_report(NULL) , m_channel(0) , m_connected(false)
|
, leds(0), m_last_data_report(NULL), m_channel(0), m_connected(false)
|
||||||
{
|
{
|
||||||
#if defined(__linux__) && HAVE_BLUEZ
|
#if defined(__linux__) && HAVE_BLUEZ
|
||||||
bdaddr = (bdaddr_t){{0, 0, 0, 0, 0, 0}};
|
bdaddr = (bdaddr_t){{0, 0, 0, 0, 0, 0}};
|
||||||
|
|
|
@ -42,74 +42,74 @@ namespace WiimoteReal
|
||||||
|
|
||||||
class Wiimote
|
class Wiimote
|
||||||
{
|
{
|
||||||
friend class WiimoteEmu::Wiimote;
|
friend class WiimoteEmu::Wiimote;
|
||||||
public:
|
public:
|
||||||
Wiimote(const unsigned int _index);
|
Wiimote(const unsigned int _index);
|
||||||
~Wiimote();
|
~Wiimote();
|
||||||
|
|
||||||
void ControlChannel(const u16 channel, const void* const data, const u32 size);
|
void ControlChannel(const u16 channel, const void* const data, const u32 size);
|
||||||
void InterruptChannel(const u16 channel, const void* const data, const u32 size);
|
void InterruptChannel(const u16 channel, const void* const data, const u32 size);
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
u8* ProcessReadQueue();
|
u8* ProcessReadQueue();
|
||||||
|
|
||||||
bool Read();
|
bool Read();
|
||||||
bool Write();
|
bool Write();
|
||||||
bool Connect();
|
bool Connect();
|
||||||
bool IsConnected();
|
bool IsConnected();
|
||||||
void Disconnect();
|
void Disconnect();
|
||||||
void DisableDataReporting();
|
void DisableDataReporting();
|
||||||
void Rumble();
|
void Rumble();
|
||||||
void SendPacket(const u8 rpt_id, const void* const data, const unsigned int size);
|
void SendPacket(const u8 rpt_id, const void* const data, const unsigned int size);
|
||||||
|
|
||||||
// Pointer to data, and size of data
|
// Pointer to data, and size of data
|
||||||
typedef std::pair<u8*,u8> Report;
|
typedef std::pair<u8*,u8> Report;
|
||||||
|
|
||||||
const unsigned int index;
|
const unsigned int index;
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
IOBluetoothDevice *btd;
|
IOBluetoothDevice *btd;
|
||||||
IOBluetoothL2CAPChannel *ichan;
|
IOBluetoothL2CAPChannel *ichan;
|
||||||
IOBluetoothL2CAPChannel *cchan;
|
IOBluetoothL2CAPChannel *cchan;
|
||||||
#define QUEUE_SIZE 64
|
#define QUEUE_SIZE 64
|
||||||
struct qbuffer
|
struct qbuffer
|
||||||
{
|
{
|
||||||
char data[MAX_PAYLOAD];
|
char data[MAX_PAYLOAD];
|
||||||
int len;
|
int len;
|
||||||
} queue[QUEUE_SIZE];
|
} queue[QUEUE_SIZE];
|
||||||
int reader;
|
int reader;
|
||||||
int writer;
|
int writer;
|
||||||
int outstanding;
|
int outstanding;
|
||||||
int watermark;
|
int watermark;
|
||||||
#elif defined(__linux__) && HAVE_BLUEZ
|
#elif defined(__linux__) && HAVE_BLUEZ
|
||||||
bdaddr_t bdaddr; // Bluetooth address
|
bdaddr_t bdaddr; // Bluetooth address
|
||||||
int out_sock; // Output socket
|
int out_sock; // Output socket
|
||||||
int in_sock; // Input socket
|
int in_sock; // Input socket
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
char devicepath[255]; // Unique wiimote reference
|
char devicepath[255]; // Unique wiimote reference
|
||||||
//ULONGLONG btaddr; // Bluetooth address
|
//ULONGLONG btaddr; // Bluetooth address
|
||||||
HANDLE dev_handle; // HID handle
|
HANDLE dev_handle; // HID handle
|
||||||
OVERLAPPED hid_overlap; // Overlap handle
|
OVERLAPPED hid_overlap; // Overlap handle
|
||||||
enum win_bt_stack_t stack; // Type of bluetooth stack to use
|
enum win_bt_stack_t stack; // Type of bluetooth stack to use
|
||||||
#endif
|
#endif
|
||||||
unsigned char leds; // Currently lit leds
|
unsigned char leds; // Currently lit leds
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
u8 *m_last_data_report;
|
u8 *m_last_data_report;
|
||||||
u16 m_channel;
|
u16 m_channel;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ClearReadQueue();
|
void ClearReadQueue();
|
||||||
void RealDisconnect();
|
void RealDisconnect();
|
||||||
bool SendRequest(unsigned char report_type, unsigned char* data, int length);
|
bool SendRequest(unsigned char report_type, unsigned char* data, int length);
|
||||||
bool Handshake();
|
bool Handshake();
|
||||||
void SetLEDs(int leds);
|
void SetLEDs(int leds);
|
||||||
unsigned char *IORead();
|
unsigned char *IORead();
|
||||||
int IOWrite(unsigned char* buf, int len);
|
int IOWrite(unsigned char* buf, int len);
|
||||||
|
|
||||||
bool m_connected;
|
bool m_connected;
|
||||||
Common::FifoQueue<u8*> m_read_reports;
|
Common::FifoQueue<u8*> m_read_reports;
|
||||||
Common::FifoQueue<Report> m_write_reports;
|
Common::FifoQueue<Report> m_write_reports;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Common::CriticalSection g_refresh_critsec;
|
extern Common::CriticalSection g_refresh_critsec;
|
||||||
|
|
Loading…
Reference in New Issue