Move shared Wiimote files into WiimoteCommon

This commit is contained in:
spycrab 2017-04-26 19:30:14 +02:00
parent 4d52df150b
commit 823dba47f5
15 changed files with 216 additions and 187 deletions

View File

@ -0,0 +1,58 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
// Wiimote internal codes
// Communication channels
enum WiimoteChannel
{
WC_OUTPUT = 0x11,
WC_INPUT = 0x13
};
// The 4 most significant bits of the first byte of an outgoing command must be
// 0x50 if sending on the command channel and 0xA0 if sending on the interrupt
// channel. On Mac and Linux we use interrupt channel; on Windows, command.
enum WiimoteReport
{
#ifdef _WIN32
WR_SET_REPORT = 0x50
#else
WR_SET_REPORT = 0xA0
#endif
};
enum WiimoteBT
{
BT_INPUT = 0x01,
BT_OUTPUT = 0x02
};
// LED bit masks
enum WiimoteLED
{
LED_NONE = 0x00,
LED_1 = 0x10,
LED_2 = 0x20,
LED_3 = 0x40,
LED_4 = 0x80
};
enum WiimoteSpace
{
WS_EEPROM = 0x00,
WS_REGS1 = 0x01,
WS_REGS2 = 0x02
};
enum WiimoteReadError
{
RDERR_WOREG = 7,
RDERR_NOMEM = 8
};
constexpr u8 MAX_PAYLOAD = 23;
constexpr u32 WIIMOTE_DEFAULT_TIMEOUT = 1000;

View File

@ -0,0 +1,34 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "Common/CommonTypes.h"
// what is this ?
#ifdef _MSC_VER
#pragma warning(disable : 4200)
#endif
#pragma pack(push, 1)
// Source: HID_010_SPC_PFL/1.0 (official HID specification)
struct hid_packet
{
u8 param : 4;
u8 type : 4;
u8 data[0];
};
constexpr u8 HID_TYPE_HANDSHAKE = 0;
constexpr u8 HID_TYPE_SET_REPORT = 5;
constexpr u8 HID_TYPE_DATA = 0xA;
constexpr u8 HID_HANDSHAKE_SUCCESS = 0;
constexpr u8 HID_PARAM_INPUT = 1;
constexpr u8 HID_PARAM_OUTPUT = 2;
#pragma pack(pop)

View File

@ -1,37 +1,47 @@
// Copyright 2008 Dolphin Emulator Project // Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
#pragma once #pragma once
#include <vector>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
// what is this ? typedef std::vector<u8> Report;
#ifdef _MSC_VER
#pragma warning(disable : 4200)
#endif
#pragma pack(push, 1) // Report defines
enum ReportType
// Source: HID_010_SPC_PFL/1.0 (official HID specification)
struct hid_packet
{ {
u8 param : 4; RT_RUMBLE = 0x10,
u8 type : 4; RT_LEDS = 0x11,
u8 data[0]; RT_REPORT_MODE = 0x12,
RT_IR_PIXEL_CLOCK = 0x13,
RT_SPEAKER_ENABLE = 0x14,
RT_REQUEST_STATUS = 0x15,
RT_WRITE_DATA = 0x16,
RT_READ_DATA = 0x17,
RT_WRITE_SPEAKER_DATA = 0x18,
RT_SPEAKER_MUTE = 0x19,
RT_IR_LOGIC = 0x1A,
RT_STATUS_REPORT = 0x20,
RT_READ_DATA_REPLY = 0x21,
RT_ACK_DATA = 0x22,
RT_REPORT_CORE = 0x30,
RT_REPORT_CORE_ACCEL = 0x31,
RT_REPORT_CORE_EXT8 = 0x32,
RT_REPORT_CORE_ACCEL_IR12 = 0x33,
RT_REPORT_CORE_EXT19 = 0x34,
RT_REPORT_CORE_ACCEL_EXT16 = 0x35,
RT_REPORT_CORE_IR10_EXT9 = 0x36,
RT_REPORT_CORE_ACCEL_IR10_EXT6 = 0x37,
RT_REPORT_EXT21 = 0x3d, // never used?
RT_REPORT_INTERLEAVE1 = 0x3e,
RT_REPORT_INTERLEAVE2 = 0x3f
}; };
#define HID_TYPE_HANDSHAKE 0
#define HID_TYPE_SET_REPORT 5
#define HID_TYPE_DATA 0xA
#define HID_HANDSHAKE_SUCCESS 0
#define HID_PARAM_INPUT 1
#define HID_PARAM_OUTPUT 2
// Source: http://wiibrew.org/wiki/Wiimote // Source: http://wiibrew.org/wiki/Wiimote
// Custom structs
union wm_buttons // also just called "core data" union wm_buttons // also just called "core data"
{ {
@ -332,9 +342,6 @@ struct wm_report
}; };
}; };
#define WM_RUMBLE 0x10
#define WM_LEDS 0x11
struct wm_leds struct wm_leds
{ {
u8 rumble : 1; u8 rumble : 1;
@ -343,7 +350,6 @@ struct wm_leds
u8 leds : 4; u8 leds : 4;
}; };
#define WM_REPORT_MODE 0x12
struct wm_report_mode struct wm_report_mode
{ {
u8 rumble : 1; u8 rumble : 1;
@ -354,17 +360,12 @@ struct wm_report_mode
u8 mode; u8 mode;
}; };
#define WM_IR_PIXEL_CLOCK 0x13
#define WM_IR_LOGIC 0x1A
#define WM_REQUEST_STATUS 0x15
struct wm_request_status struct wm_request_status
{ {
u8 rumble : 1; u8 rumble : 1;
u8 : 7; u8 : 7;
}; };
#define WM_STATUS_REPORT 0x20
struct wm_status_report struct wm_status_report
{ {
wm_buttons buttons; wm_buttons buttons;
@ -377,7 +378,6 @@ struct wm_status_report
u8 battery; u8 battery;
}; };
#define WM_WRITE_DATA 0x16
struct wm_write_data struct wm_write_data
{ {
u8 rumble : 1; u8 rumble : 1;
@ -388,7 +388,6 @@ struct wm_write_data
u8 data[16]; u8 data[16];
}; };
#define WM_ACK_DATA 0x22
struct wm_acknowledge struct wm_acknowledge
{ {
wm_buttons buttons; wm_buttons buttons;
@ -396,7 +395,6 @@ struct wm_acknowledge
u8 errorID; u8 errorID;
}; };
#define WM_READ_DATA 0x17
struct wm_read_data struct wm_read_data
{ {
u8 rumble : 1; u8 rumble : 1;
@ -406,12 +404,6 @@ struct wm_read_data
u16 size; u16 size;
}; };
#define WM_SPACE_EEPROM 0
#define WM_SPACE_REGS1 1
#define WM_SPACE_REGS2 2
#define WM_SPACE_INVALID 3
#define WM_READ_DATA_REPLY 0x21
struct wm_read_data_reply struct wm_read_data_reply
{ {
wm_buttons buttons; wm_buttons buttons;
@ -421,27 +413,19 @@ struct wm_read_data_reply
u8 data[16]; u8 data[16];
}; };
#define WM_RDERR_WOREG 7
#define WM_RDERR_NOMEM 8
// Data reports // Data reports
#define WM_REPORT_CORE 0x30
struct wm_report_core struct wm_report_core
{ {
wm_buttons c; wm_buttons c;
}; };
#define WM_REPORT_CORE_ACCEL 0x31
struct wm_report_core_accel struct wm_report_core_accel
{ {
wm_buttons c; wm_buttons c;
wm_accel a; wm_accel a;
}; };
#define WM_REPORT_CORE_EXT8 0x32
#define WM_REPORT_CORE_ACCEL_IR12 0x33
struct wm_report_core_accel_ir12 struct wm_report_core_accel_ir12
{ {
wm_buttons c; wm_buttons c;
@ -449,8 +433,6 @@ struct wm_report_core_accel_ir12
wm_ir_extended ir[4]; wm_ir_extended ir[4];
}; };
#define WM_REPORT_CORE_EXT19 0x34
#define WM_REPORT_CORE_ACCEL_EXT16 0x35
struct wm_report_core_accel_ext16 struct wm_report_core_accel_ext16
{ {
wm_buttons c; wm_buttons c;
@ -460,9 +442,6 @@ struct wm_report_core_accel_ext16
u8 pad[10]; u8 pad[10];
}; };
#define WM_REPORT_CORE_IR10_EXT9 0x36
#define WM_REPORT_CORE_ACCEL_IR10_EXT6 0x37
struct wm_report_core_accel_ir10_ext6 struct wm_report_core_accel_ir10_ext6
{ {
wm_buttons c; wm_buttons c;
@ -472,25 +451,14 @@ struct wm_report_core_accel_ir10_ext6
wm_nc ext; // TODO: Does this make any sense? Shouldn't it be just a general "extension" field? wm_nc ext; // TODO: Does this make any sense? Shouldn't it be just a general "extension" field?
}; };
#define WM_REPORT_EXT21 0x3d // never used?
struct wm_report_ext21 struct wm_report_ext21
{ {
u8 ext[21]; u8 ext[21];
}; };
#define WM_REPORT_INTERLEAVE1 0x3e
#define WM_REPORT_INTERLEAVE2 0x3f
#define WM_SPEAKER_ENABLE 0x14
#define WM_SPEAKER_MUTE 0x19
#define WM_WRITE_SPEAKER_DATA 0x18
struct wm_speaker_data struct wm_speaker_data
{ {
u8 unknown : 3; u8 unknown : 3;
u8 length : 5; u8 length : 5;
u8 data[20]; u8 data[20];
}; };
// Custom structs
#pragma pack(pop)

View File

@ -27,9 +27,9 @@
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Common/Swap.h" #include "Common/Swap.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/HW/WiimoteCommon/WiimoteHid.h"
#include "Core/HW/WiimoteEmu/Attachment/Attachment.h" #include "Core/HW/WiimoteEmu/Attachment/Attachment.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h" #include "Core/HW/WiimoteEmu/WiimoteEmu.h"
#include "Core/HW/WiimoteEmu/WiimoteHid.h"
#include "Core/HW/WiimoteReal/WiimoteReal.h" #include "Core/HW/WiimoteReal/WiimoteReal.h"
#include "InputCommon/ControllerEmu/ControlGroup/Extension.h" #include "InputCommon/ControllerEmu/ControlGroup/Extension.h"
@ -53,7 +53,7 @@ void Wiimote::ReportMode(const wm_report_mode* const dr)
if (dr->mode > 0x37) if (dr->mode > 0x37)
PanicAlert("Wiimote: Unsupported Reporting mode."); PanicAlert("Wiimote: Unsupported Reporting mode.");
else if (dr->mode < WM_REPORT_CORE) else if (dr->mode < RT_REPORT_CORE)
PanicAlert("Wiimote: Reporting mode < 0x30."); PanicAlert("Wiimote: Reporting mode < 0x30.");
} }
@ -81,28 +81,28 @@ void Wiimote::HidOutputReport(const wm_report* const sr, const bool send_ack)
switch (sr->wm) switch (sr->wm)
{ {
case WM_RUMBLE: // 0x10 case RT_RUMBLE: // 0x10
// this is handled above // this is handled above
return; // no ack return; // no ack
break; break;
case WM_LEDS: // 0x11 case RT_LEDS: // 0x11
// INFO_LOG(WIIMOTE, "Set LEDs: 0x%02x", sr->data[0]); // INFO_LOG(WIIMOTE, "Set LEDs: 0x%02x", sr->data[0]);
m_status.leds = sr->data[0] >> 4; m_status.leds = sr->data[0] >> 4;
break; break;
case WM_REPORT_MODE: // 0x12 case RT_REPORT_MODE: // 0x12
ReportMode((wm_report_mode*)sr->data); ReportMode((wm_report_mode*)sr->data);
break; break;
case WM_IR_PIXEL_CLOCK: // 0x13 case RT_IR_PIXEL_CLOCK: // 0x13
// INFO_LOG(WIIMOTE, "WM IR Clock: 0x%02x", sr->data[0]); // INFO_LOG(WIIMOTE, "WM IR Clock: 0x%02x", sr->data[0]);
// m_ir_clock = sr->enable; // m_ir_clock = sr->enable;
if (false == sr->ack) if (false == sr->ack)
return; return;
break; break;
case WM_SPEAKER_ENABLE: // 0x14 case RT_SPEAKER_ENABLE: // 0x14
// ERROR_LOG(WIIMOTE, "WM Speaker Enable: %02x", sr->enable); // ERROR_LOG(WIIMOTE, "WM Speaker Enable: %02x", sr->enable);
// PanicAlert( "WM Speaker Enable: %d", sr->data[0] ); // PanicAlert( "WM Speaker Enable: %d", sr->data[0] );
m_status.speaker = sr->enable; m_status.speaker = sr->enable;
@ -110,32 +110,32 @@ void Wiimote::HidOutputReport(const wm_report* const sr, const bool send_ack)
return; return;
break; break;
case WM_REQUEST_STATUS: // 0x15 case RT_REQUEST_STATUS: // 0x15
if (WIIMOTE_SRC_EMU & g_wiimote_sources[m_index]) if (WIIMOTE_SRC_EMU & g_wiimote_sources[m_index])
RequestStatus((wm_request_status*)sr->data); RequestStatus((wm_request_status*)sr->data);
return; // sends its own ack return; // sends its own ack
break; break;
case WM_WRITE_DATA: // 0x16 case RT_WRITE_DATA: // 0x16
WriteData((wm_write_data*)sr->data); WriteData((wm_write_data*)sr->data);
break; break;
case WM_READ_DATA: // 0x17 case RT_READ_DATA: // 0x17
if (WIIMOTE_SRC_EMU & g_wiimote_sources[m_index]) if (WIIMOTE_SRC_EMU & g_wiimote_sources[m_index])
ReadData((wm_read_data*)sr->data); ReadData((wm_read_data*)sr->data);
return; // sends its own ack return; // sends its own ack
break; break;
case WM_WRITE_SPEAKER_DATA: // 0x18 case RT_WRITE_SPEAKER_DATA: // 0x18
// wm_speaker_data *spkz = (wm_speaker_data*)sr->data; // wm_speaker_data *spkz = (wm_speaker_data*)sr->data;
// ERROR_LOG(WIIMOTE, "WM_WRITE_SPEAKER_DATA len:%x %s", spkz->length, // ERROR_LOG(WIIMOTE, "RT_WRITE_SPEAKER_DATA len:%x %s", spkz->length,
// ArrayToString(spkz->data, spkz->length, 100, false).c_str()); // ArrayToString(spkz->data, spkz->length, 100, false).c_str());
if (WIIMOTE_SRC_EMU & g_wiimote_sources[m_index] && !m_speaker_mute) if (WIIMOTE_SRC_EMU & g_wiimote_sources[m_index] && !m_speaker_mute)
Wiimote::SpeakerData((wm_speaker_data*)sr->data); Wiimote::SpeakerData((wm_speaker_data*)sr->data);
return; // no ack return; // no ack
break; break;
case WM_SPEAKER_MUTE: // 0x19 case RT_SPEAKER_MUTE: // 0x19
// ERROR_LOG(WIIMOTE, "WM Speaker Mute: %02x", sr->enable); // ERROR_LOG(WIIMOTE, "WM Speaker Mute: %02x", sr->enable);
// PanicAlert( "WM Speaker Mute: %d", sr->data[0] & 0x04 ); // PanicAlert( "WM Speaker Mute: %d", sr->data[0] & 0x04 );
// testing // testing
@ -146,7 +146,7 @@ void Wiimote::HidOutputReport(const wm_report* const sr, const bool send_ack)
return; return;
break; break;
case WM_IR_LOGIC: // 0x1a case RT_IR_LOGIC: // 0x1a
// comment from old plugin: // comment from old plugin:
// This enables or disables the IR lights, we update the global variable g_IR // This enables or disables the IR lights, we update the global variable g_IR
// so that WmRequestStatus() knows about it // so that WmRequestStatus() knows about it
@ -177,7 +177,7 @@ void Wiimote::SendAck(u8 _reportID)
u8 data[6]; u8 data[6];
data[0] = 0xA1; data[0] = 0xA1;
data[1] = WM_ACK_DATA; data[1] = RT_ACK_DATA;
wm_acknowledge* const ack = (wm_acknowledge*)(data + 2); wm_acknowledge* const ack = (wm_acknowledge*)(data + 2);
@ -223,7 +223,7 @@ void Wiimote::RequestStatus(const wm_request_status* const rs)
// set up report // set up report
u8 data[8]; u8 data[8];
data[0] = 0xA1; data[0] = 0xA1;
data[1] = WM_STATUS_REPORT; data[1] = RT_STATUS_REPORT;
// status values // status values
*(wm_status_report*)(data + 2) = m_status; *(wm_status_report*)(data + 2) = m_status;
@ -238,7 +238,7 @@ void Wiimote::RequestStatus(const wm_request_status* const rs)
if (g_wiimotes[m_index]) if (g_wiimotes[m_index])
{ {
wm_request_status rpt = {}; wm_request_status rpt = {};
g_wiimotes[m_index]->QueueReport(WM_REQUEST_STATUS, &rpt, sizeof(rpt)); g_wiimotes[m_index]->QueueReport(RT_REQUEST_STATUS, &rpt, sizeof(rpt));
} }
return; return;
@ -264,7 +264,7 @@ void Wiimote::WriteData(const wm_write_data* const wd)
switch (wd->space) switch (wd->space)
{ {
case WM_SPACE_EEPROM: case WS_EEPROM:
{ {
// Write to EEPROM // Write to EEPROM
@ -290,8 +290,8 @@ void Wiimote::WriteData(const wm_write_data* const wd)
} }
break; break;
case WM_SPACE_REGS1: case WS_REGS1:
case WM_SPACE_REGS2: case WS_REGS2:
{ {
// Write to Control Register // Write to Control Register
@ -405,7 +405,7 @@ void Wiimote::ReadData(const wm_read_data* const rd)
switch (rd->space) switch (rd->space)
{ {
case WM_SPACE_EEPROM: case WS_EEPROM:
{ {
// PanicAlert("ReadData: reading from EEPROM: address: 0x%x size: 0x%x", address, size); // PanicAlert("ReadData: reading from EEPROM: address: 0x%x size: 0x%x", address, size);
// Read from EEPROM // Read from EEPROM
@ -438,8 +438,8 @@ void Wiimote::ReadData(const wm_read_data* const rd)
} }
break; break;
case WM_SPACE_REGS1: case WS_REGS1:
case WM_SPACE_REGS2: case WS_REGS2:
{ {
// Read from Control Register // Read from Control Register
@ -533,7 +533,7 @@ void Wiimote::SendReadDataReply(ReadRequest& _request)
{ {
u8 data[23]; u8 data[23];
data[0] = 0xA1; data[0] = 0xA1;
data[1] = WM_READ_DATA_REPLY; data[1] = RT_READ_DATA_REPLY;
wm_read_data_reply* const reply = (wm_read_data_reply*)(data + 2); wm_read_data_reply* const reply = (wm_read_data_reply*)(data + 2);
reply->buttons = m_status.buttons; reply->buttons = m_status.buttons;

View File

@ -15,13 +15,15 @@
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteCommon/WiimoteConstants.h"
#include "Core/HW/WiimoteCommon/WiimoteHid.h"
#include "Core/HW/WiimoteEmu/Attachment/Classic.h" #include "Core/HW/WiimoteEmu/Attachment/Classic.h"
#include "Core/HW/WiimoteEmu/Attachment/Drums.h" #include "Core/HW/WiimoteEmu/Attachment/Drums.h"
#include "Core/HW/WiimoteEmu/Attachment/Guitar.h" #include "Core/HW/WiimoteEmu/Attachment/Guitar.h"
#include "Core/HW/WiimoteEmu/Attachment/Nunchuk.h" #include "Core/HW/WiimoteEmu/Attachment/Nunchuk.h"
#include "Core/HW/WiimoteEmu/Attachment/Turntable.h" #include "Core/HW/WiimoteEmu/Attachment/Turntable.h"
#include "Core/HW/WiimoteEmu/MatrixMath.h" #include "Core/HW/WiimoteEmu/MatrixMath.h"
#include "Core/HW/WiimoteEmu/WiimoteHid.h"
#include "Core/HW/WiimoteReal/WiimoteReal.h" #include "Core/HW/WiimoteReal/WiimoteReal.h"
#include "Core/Host.h" #include "Core/Host.h"
#include "Core/Movie.h" #include "Core/Movie.h"
@ -195,7 +197,7 @@ static const char* const named_buttons[] = {
void Wiimote::Reset() void Wiimote::Reset()
{ {
m_reporting_mode = WM_REPORT_CORE; m_reporting_mode = RT_REPORT_CORE;
// i think these two are good // i think these two are good
m_reporting_channel = 0; m_reporting_channel = 0;
m_reporting_auto = false; m_reporting_auto = false;
@ -726,7 +728,7 @@ void Wiimote::Update()
m_status.battery = (u8)(m_battery_setting->GetValue() * 100); m_status.battery = (u8)(m_battery_setting->GetValue() * 100);
const ReportFeatures& rptf = reporting_mode_features[m_reporting_mode - WM_REPORT_CORE]; const ReportFeatures& rptf = reporting_mode_features[m_reporting_mode - RT_REPORT_CORE];
s8 rptf_size = rptf.size; s8 rptf_size = rptf.size;
if (Movie::IsPlayingInput() && if (Movie::IsPlayingInput() &&
Movie::PlayWiimote(m_index, data, rptf, m_extension->active_extension, m_ext_key)) Movie::PlayWiimote(m_index, data, rptf, m_extension->active_extension, m_ext_key))
@ -776,10 +778,10 @@ void Wiimote::Update()
{ {
// use data reports // use data reports
default: default:
if (real_data[1] >= WM_REPORT_CORE) if (real_data[1] >= RT_REPORT_CORE)
{ {
const ReportFeatures& real_rptf = const ReportFeatures& real_rptf =
reporting_mode_features[real_data[1] - WM_REPORT_CORE]; reporting_mode_features[real_data[1] - RT_REPORT_CORE];
// force same report type from real-Wiimote // force same report type from real-Wiimote
if (&real_rptf != &rptf) if (&real_rptf != &rptf)
@ -807,7 +809,7 @@ void Wiimote::Update()
memcpy(data + rptf.ext, real_data + real_rptf.ext, memcpy(data + rptf.ext, real_data + real_rptf.ext,
sizeof(wm_nc)); // TODO: Why NC specific? sizeof(wm_nc)); // TODO: Why NC specific?
} }
else if (WM_ACK_DATA != real_data[1] || m_extension->active_extension > 0) else if (real_data[1] != RT_ACK_DATA || m_extension->active_extension > 0)
rptf_size = 0; rptf_size = 0;
else else
// use real-acks if an emu-extension isn't chosen // use real-acks if an emu-extension isn't chosen
@ -815,7 +817,7 @@ void Wiimote::Update()
break; break;
// use all status reports, after modification of the extension bit // use all status reports, after modification of the extension bit
case WM_STATUS_REPORT: case RT_STATUS_REPORT:
// if (m_extension->switch_extension) // if (m_extension->switch_extension)
//((wm_status_report*)(real_data + 2))->extension = (m_extension->active_extension > 0); //((wm_status_report*)(real_data + 2))->extension = (m_extension->active_extension > 0);
if (m_extension->active_extension) if (m_extension->active_extension)
@ -824,7 +826,7 @@ void Wiimote::Update()
break; break;
// use all read-data replies // use all read-data replies
case WM_READ_DATA_REPLY: case RT_READ_DATA_REPLY:
rptf_size = -1; rptf_size = -1;
break; break;
} }
@ -851,7 +853,7 @@ void Wiimote::Update()
Movie::CheckWiimoteStatus(m_index, data, rptf, m_extension->active_extension, m_ext_key); Movie::CheckWiimoteStatus(m_index, data, rptf, m_extension->active_extension, m_ext_key);
// don't send a data report if auto reporting is off // don't send a data report if auto reporting is off
if (false == m_reporting_auto && data[1] >= WM_REPORT_CORE) if (false == m_reporting_auto && data[1] >= RT_REPORT_CORE)
return; return;
// send data report // send data report
@ -935,8 +937,8 @@ void Wiimote::InterruptChannel(const u16 _channelID, const void* _pData, u32 _Si
switch (sr->wm) switch (sr->wm)
{ {
// these two types are handled in RequestStatus() & ReadData() // these two types are handled in RequestStatus() & ReadData()
case WM_REQUEST_STATUS: case RT_REQUEST_STATUS:
case WM_READ_DATA: case RT_READ_DATA:
if (WIIMOTE_SRC_REAL == g_wiimote_sources[m_index]) if (WIIMOTE_SRC_REAL == g_wiimote_sources[m_index])
WiimoteReal::InterruptChannel(m_index, _channelID, _pData, _Size); WiimoteReal::InterruptChannel(m_index, _channelID, _pData, _Size);
break; break;

View File

@ -7,8 +7,9 @@
#include <queue> #include <queue>
#include <string> #include <string>
#include "Core/HW/WiimoteCommon/WiimoteHid.h"
#include "Core/HW/WiimoteCommon/WiimoteReport.h"
#include "Core/HW/WiimoteEmu/Encryption.h" #include "Core/HW/WiimoteEmu/Encryption.h"
#include "Core/HW/WiimoteEmu/WiimoteHid.h"
#include "InputCommon/ControllerEmu/ControllerEmu.h" #include "InputCommon/ControllerEmu/ControllerEmu.h"
// Registry sizes // Registry sizes

View File

@ -139,7 +139,7 @@ bool WiimoteLinux::ConnectInternal()
addr.l2_cid = 0; addr.l2_cid = 0;
// Output channel // Output channel
addr.l2_psm = htobs(WM_OUTPUT_CHANNEL); addr.l2_psm = htobs(WC_OUTPUT);
if ((m_cmd_sock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP)) == -1 || if ((m_cmd_sock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP)) == -1 ||
connect(m_cmd_sock, (sockaddr*)&addr, sizeof(addr)) < 0) connect(m_cmd_sock, (sockaddr*)&addr, sizeof(addr)) < 0)
{ {
@ -150,7 +150,7 @@ bool WiimoteLinux::ConnectInternal()
} }
// Input channel // Input channel
addr.l2_psm = htobs(WM_INPUT_CHANNEL); addr.l2_psm = htobs(WC_INPUT);
if ((m_int_sock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP)) == -1 || if ((m_int_sock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP)) == -1 ||
connect(m_int_sock, (sockaddr*)&addr, sizeof(addr)) < 0) connect(m_int_sock, (sockaddr*)&addr, sizeof(addr)) < 0)
{ {

View File

@ -26,6 +26,7 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/Thread.h" #include "Common/Thread.h"
#include "Core/HW/WiimoteCommon/WiimoteConstants.h"
#include "Core/HW/WiimoteReal/IOWin.h" #include "Core/HW/WiimoteReal/IOWin.h"
// Create func_t function pointer type and declare a nullptr-initialized static variable of that // Create func_t function pointer type and declare a nullptr-initialized static variable of that
@ -366,7 +367,7 @@ static bool IsWiimote(const std::basic_string<TCHAR>& device_path, WinWriteMetho
return false; return false;
u8 buf[MAX_PAYLOAD]; u8 buf[MAX_PAYLOAD];
u8 const req_status_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_REQUEST_STATUS, 0}; u8 const req_status_report[] = {WR_SET_REPORT | BT_OUTPUT, RT_REQUEST_STATUS, 0};
int invalid_report_count = 0; int invalid_report_count = 0;
int rc = WriteToHandle(dev_handle, method, req_status_report, sizeof(req_status_report)); int rc = WriteToHandle(dev_handle, method, req_status_report, sizeof(req_status_report));
while (rc > 0) while (rc > 0)
@ -377,7 +378,7 @@ static bool IsWiimote(const std::basic_string<TCHAR>& device_path, WinWriteMetho
switch (buf[1]) switch (buf[1])
{ {
case WM_STATUS_REPORT: case RT_STATUS_REPORT:
return true; return true;
default: default:
WARN_LOG(WIIMOTE, "IsWiimote(): Received unexpected report %02x", buf[1]); WARN_LOG(WIIMOTE, "IsWiimote(): Received unexpected report %02x", buf[1]);

View File

@ -8,7 +8,7 @@
#include <windows.h> #include <windows.h>
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/HW/WiimoteEmu/WiimoteHid.h" #include "Core/HW/WiimoteCommon/WiimoteHid.h"
#include "Core/HW/WiimoteReal/WiimoteReal.h" #include "Core/HW/WiimoteReal/WiimoteReal.h"
namespace WiimoteReal namespace WiimoteReal

View File

@ -3,7 +3,7 @@
#include "Core/HW/WiimoteReal/IOdarwin.h" #include "Core/HW/WiimoteReal/IOdarwin.h"
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Core/HW/WiimoteEmu/WiimoteHid.h" #include "Core/HW/WiimoteCommon/WiimoteHid.h"
#include "Core/HW/WiimoteReal/IOdarwin_private.h" #include "Core/HW/WiimoteReal/IOdarwin_private.h"
@interface SearchBT : NSObject @interface SearchBT : NSObject

View File

@ -7,7 +7,7 @@
#include "Common/Assert.h" #include "Common/Assert.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/HW/WiimoteEmu/WiimoteHid.h" #include "Core/HW/WiimoteCommon/WiimoteHid.h"
#include "Core/HW/WiimoteReal/IOhidapi.h" #include "Core/HW/WiimoteReal/IOhidapi.h"
static bool IsDeviceUsable(const std::string& device_path) static bool IsDeviceUsable(const std::string& device_path)
@ -23,7 +23,7 @@ static bool IsDeviceUsable(const std::string& device_path)
// Some third-party adapters (DolphinBar) always expose all four Wii Remotes as HIDs // Some third-party adapters (DolphinBar) always expose all four Wii Remotes as HIDs
// even when they are not connected, which causes an endless error loop when we try to use them. // even when they are not connected, which causes an endless error loop when we try to use them.
// Try to write a report to the device to see if this Wii Remote is really usable. // Try to write a report to the device to see if this Wii Remote is really usable.
static const u8 report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_REQUEST_STATUS, 0}; static const u8 report[] = {WR_SET_REPORT | BT_OUTPUT, RT_REQUEST_STATUS, 0};
const int result = hid_write(handle, report, sizeof(report)); const int result = hid_write(handle, report, sizeof(report));
// The DolphinBar uses EPIPE to signal the absence of a Wii Remote connected to this HID. // The DolphinBar uses EPIPE to signal the absence of a Wii Remote connected to this HID.
if (result == -1 && errno != EPIPE) if (result == -1 && errno != EPIPE)
@ -128,13 +128,13 @@ int WiimoteHidapi::IORead(u8* buf)
{ {
return -1; // didn't read packet return -1; // didn't read packet
} }
buf[0] = WM_SET_REPORT | WM_BT_INPUT; buf[0] = WR_SET_REPORT | BT_INPUT;
return result + 1; // number of bytes read return result + 1; // number of bytes read
} }
int WiimoteHidapi::IOWrite(const u8* buf, size_t len) int WiimoteHidapi::IOWrite(const u8* buf, size_t len)
{ {
_dbg_assert_(WIIMOTE, buf[0] == (WM_SET_REPORT | WM_BT_OUTPUT)); _dbg_assert_(WIIMOTE, buf[0] == (WR_SET_REPORT | BT_OUTPUT));
int result = hid_write(m_handle, buf + 1, len - 1); int result = hid_write(m_handle, buf + 1, len - 1);
if (result == -1) if (result == -1)
{ {

View File

@ -17,8 +17,8 @@
#include "Common/Thread.h" #include "Common/Thread.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/HW/WiimoteCommon/WiimoteHid.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h" #include "Core/HW/WiimoteEmu/WiimoteEmu.h"
#include "Core/HW/WiimoteEmu/WiimoteHid.h"
#include "Core/HW/WiimoteReal/IOAndroid.h" #include "Core/HW/WiimoteReal/IOAndroid.h"
#include "Core/HW/WiimoteReal/IOLinux.h" #include "Core/HW/WiimoteReal/IOLinux.h"
#include "Core/HW/WiimoteReal/IOWin.h" #include "Core/HW/WiimoteReal/IOWin.h"
@ -70,7 +70,7 @@ void Wiimote::WriteReport(Report rpt)
bool const new_rumble_state = (rpt[2] & 0x1) != 0; bool const new_rumble_state = (rpt[2] & 0x1) != 0;
// If this is a rumble report and the rumble state didn't change, ignore. // If this is a rumble report and the rumble state didn't change, ignore.
if (WM_RUMBLE == rpt[1] && new_rumble_state == m_rumble_state) if (rpt[1] == RT_RUMBLE && new_rumble_state == m_rumble_state)
return; return;
m_rumble_state = new_rumble_state; m_rumble_state = new_rumble_state;
@ -86,7 +86,7 @@ void Wiimote::QueueReport(u8 rpt_id, const void* _data, unsigned int size)
auto const data = static_cast<const u8*>(_data); auto const data = static_cast<const u8*>(_data);
Report rpt(size + 2); Report rpt(size + 2);
rpt[0] = WM_SET_REPORT | WM_BT_OUTPUT; rpt[0] = WR_SET_REPORT | BT_OUTPUT;
rpt[1] = rpt_id; rpt[1] = rpt_id;
std::copy_n(data, size, rpt.begin() + 2); std::copy_n(data, size, rpt.begin() + 2);
WriteReport(std::move(rpt)); WriteReport(std::move(rpt));
@ -98,11 +98,11 @@ void Wiimote::DisableDataReporting()
// This probably accomplishes nothing. // This probably accomplishes nothing.
wm_report_mode rpt = {}; wm_report_mode rpt = {};
rpt.mode = WM_REPORT_CORE; rpt.mode = RT_REPORT_CORE;
rpt.all_the_time = 0; rpt.all_the_time = 0;
rpt.continuous = 0; rpt.continuous = 0;
rpt.rumble = 0; rpt.rumble = 0;
QueueReport(WM_REPORT_MODE, &rpt, sizeof(rpt)); QueueReport(RT_REPORT_MODE, &rpt, sizeof(rpt));
} }
void Wiimote::EnableDataReporting(u8 mode) void Wiimote::EnableDataReporting(u8 mode)
@ -113,7 +113,7 @@ void Wiimote::EnableDataReporting(u8 mode)
rpt.mode = mode; rpt.mode = mode;
rpt.all_the_time = 1; rpt.all_the_time = 1;
rpt.continuous = 1; rpt.continuous = 1;
QueueReport(WM_REPORT_MODE, &rpt, sizeof(rpt)); QueueReport(RT_REPORT_MODE, &rpt, sizeof(rpt));
} }
void Wiimote::SetChannel(u16 channel) void Wiimote::SetChannel(u16 channel)
@ -173,12 +173,12 @@ void Wiimote::InterruptChannel(const u16 channel, const void* const _data, const
// party ones don't. // party ones don't.
if (rpt[0] == 0xa2) if (rpt[0] == 0xa2)
{ {
rpt[0] = WM_SET_REPORT | WM_BT_OUTPUT; rpt[0] = WR_SET_REPORT | BT_OUTPUT;
} }
// Disallow games from turning off all of the LEDs. // Disallow games from turning off all of the LEDs.
// It makes Wiimote connection status confusing. // It makes Wiimote connection status confusing.
if (rpt[1] == WM_LEDS) if (rpt[1] == RT_LEDS)
{ {
auto& leds_rpt = *reinterpret_cast<wm_leds*>(&rpt[2]); auto& leds_rpt = *reinterpret_cast<wm_leds*>(&rpt[2]);
if (0 == leds_rpt.leds) if (0 == leds_rpt.leds)
@ -187,11 +187,11 @@ void Wiimote::InterruptChannel(const u16 channel, const void* const _data, const
leds_rpt.leds = 0xf; leds_rpt.leds = 0xf;
} }
} }
else if (rpt[1] == WM_WRITE_SPEAKER_DATA && (!SConfig::GetInstance().m_WiimoteEnableSpeaker || else if (rpt[1] == RT_WRITE_SPEAKER_DATA && (!SConfig::GetInstance().m_WiimoteEnableSpeaker ||
(!wm->m_status.speaker || wm->m_speaker_mute))) (!wm->m_status.speaker || wm->m_speaker_mute)))
{ {
// Translate speaker data reports into rumble reports. // Translate speaker data reports into rumble reports.
rpt[1] = WM_RUMBLE; rpt[1] = RT_RUMBLE;
// Keep only the rumble bit. // Keep only the rumble bit.
rpt[2] &= 0x1; rpt[2] &= 0x1;
rpt.resize(3); rpt.resize(3);
@ -255,10 +255,10 @@ bool Wiimote::IsBalanceBoard()
return false; return false;
// Initialise the extension by writing 0x55 to 0xa400f0, then writing 0x00 to 0xa400fb. // Initialise the extension by writing 0x55 to 0xa400f0, then writing 0x00 to 0xa400fb.
static const u8 init_extension_rpt1[MAX_PAYLOAD] = { static const u8 init_extension_rpt1[MAX_PAYLOAD] = {
WM_SET_REPORT | WM_BT_OUTPUT, WM_WRITE_DATA, 0x04, 0xa4, 0x00, 0xf0, 0x01, 0x55}; WR_SET_REPORT | BT_OUTPUT, RT_WRITE_DATA, 0x04, 0xa4, 0x00, 0xf0, 0x01, 0x55};
static const u8 init_extension_rpt2[MAX_PAYLOAD] = { static const u8 init_extension_rpt2[MAX_PAYLOAD] = {
WM_SET_REPORT | WM_BT_OUTPUT, WM_WRITE_DATA, 0x04, 0xa4, 0x00, 0xfb, 0x01, 0x00}; WR_SET_REPORT | BT_OUTPUT, RT_WRITE_DATA, 0x04, 0xa4, 0x00, 0xfb, 0x01, 0x00};
static const u8 status_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_REQUEST_STATUS, 0}; static const u8 status_report[] = {WR_SET_REPORT | BT_OUTPUT, RT_REQUEST_STATUS, 0};
if (!IOWrite(init_extension_rpt1, sizeof(init_extension_rpt1)) || if (!IOWrite(init_extension_rpt1, sizeof(init_extension_rpt1)) ||
!IOWrite(init_extension_rpt2, sizeof(init_extension_rpt2))) !IOWrite(init_extension_rpt2, sizeof(init_extension_rpt2)))
{ {
@ -276,7 +276,7 @@ bool Wiimote::IsBalanceBoard()
switch (buf[1]) switch (buf[1])
{ {
case WM_STATUS_REPORT: case RT_STATUS_REPORT:
{ {
const auto* status = reinterpret_cast<wm_status_report*>(&buf[2]); const auto* status = reinterpret_cast<wm_status_report*>(&buf[2]);
// A Balance Board has a Balance Board extension. // A Balance Board has a Balance Board extension.
@ -284,11 +284,11 @@ bool Wiimote::IsBalanceBoard()
return false; return false;
// Read two bytes from 0xa400fe to identify the extension. // Read two bytes from 0xa400fe to identify the extension.
static const u8 identify_ext_rpt[] = { static const u8 identify_ext_rpt[] = {
WM_SET_REPORT | WM_BT_OUTPUT, WM_READ_DATA, 0x04, 0xa4, 0x00, 0xfe, 0x02, 0x00}; WR_SET_REPORT | BT_OUTPUT, RT_READ_DATA, 0x04, 0xa4, 0x00, 0xfe, 0x02, 0x00};
ret = IOWrite(identify_ext_rpt, sizeof(identify_ext_rpt)); ret = IOWrite(identify_ext_rpt, sizeof(identify_ext_rpt));
break; break;
} }
case WM_READ_DATA_REPLY: case RT_READ_DATA_REPLY:
{ {
const auto* reply = reinterpret_cast<wm_read_data_reply*>(&buf[2]); const auto* reply = reinterpret_cast<wm_read_data_reply*>(&buf[2]);
if (Common::swap16(reply->address) != 0x00fe) if (Common::swap16(reply->address) != 0x00fe)
@ -300,10 +300,10 @@ bool Wiimote::IsBalanceBoard()
// A Balance Board ext can be identified by checking for 0x0402. // A Balance Board ext can be identified by checking for 0x0402.
return reply->data[0] == 0x04 && reply->data[1] == 0x02; return reply->data[0] == 0x04 && reply->data[1] == 0x02;
} }
case WM_ACK_DATA: case RT_ACK_DATA:
{ {
const auto* ack = reinterpret_cast<wm_acknowledge*>(&buf[2]); const auto* ack = reinterpret_cast<wm_acknowledge*>(&buf[2]);
if (ack->reportID == WM_READ_DATA && ack->errorID != 0x00) if (ack->reportID == RT_READ_DATA && ack->errorID != 0x00)
{ {
WARN_LOG(WIIMOTE, "Failed to read from 0xa400fe, assuming Wiimote is not a Balance Board."); WARN_LOG(WIIMOTE, "Failed to read from 0xa400fe, assuming Wiimote is not a Balance Board.");
return false; return false;
@ -316,7 +316,7 @@ bool Wiimote::IsBalanceBoard()
static bool IsDataReport(const Report& rpt) static bool IsDataReport(const Report& rpt)
{ {
return rpt.size() >= 2 && rpt[1] >= WM_REPORT_CORE; return rpt.size() >= 2 && rpt[1] >= RT_REPORT_CORE;
} }
// Returns the next report that should be sent // Returns the next report that should be sent
@ -376,16 +376,16 @@ void Wiimote::ConnectOnInput()
{ {
switch (rpt[1]) switch (rpt[1])
{ {
case WM_REPORT_CORE: case RT_REPORT_CORE:
case WM_REPORT_CORE_ACCEL: case RT_REPORT_CORE_ACCEL:
case WM_REPORT_CORE_EXT8: case RT_REPORT_CORE_EXT8:
case WM_REPORT_CORE_ACCEL_IR12: case RT_REPORT_CORE_ACCEL_IR12:
case WM_REPORT_CORE_EXT19: case RT_REPORT_CORE_EXT19:
case WM_REPORT_CORE_ACCEL_EXT16: case RT_REPORT_CORE_ACCEL_EXT16:
case WM_REPORT_CORE_IR10_EXT9: case RT_REPORT_CORE_IR10_EXT9:
case WM_REPORT_CORE_ACCEL_IR10_EXT6: case RT_REPORT_CORE_ACCEL_IR10_EXT6:
case WM_REPORT_INTERLEAVE1: case RT_REPORT_INTERLEAVE1:
case WM_REPORT_INTERLEAVE2: case RT_REPORT_INTERLEAVE2:
// check any button without checking accelerometer data // check any button without checking accelerometer data
if ((rpt[2] & 0x1F) != 0 || (rpt[3] & 0x9F) != 0) if ((rpt[2] & 0x1F) != 0 || (rpt[3] & 0x9F) != 0)
{ {
@ -409,17 +409,17 @@ void Wiimote::Prepare()
bool Wiimote::PrepareOnThread() bool Wiimote::PrepareOnThread()
{ {
// core buttons, no continuous reporting // core buttons, no continuous reporting
u8 static const mode_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_REPORT_MODE, 0, WM_REPORT_CORE}; u8 static const mode_report[] = {WR_SET_REPORT | BT_OUTPUT, RT_REPORT_MODE, 0, RT_REPORT_CORE};
// Set the active LEDs and turn on rumble. // Set the active LEDs and turn on rumble.
u8 static led_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_LEDS, 0}; u8 static led_report[] = {WR_SET_REPORT | BT_OUTPUT, RT_LEDS, 0};
led_report[2] = u8(WIIMOTE_LED_1 << (m_index % WIIMOTE_BALANCE_BOARD) | 0x1); led_report[2] = u8(WiimoteLED::LED_1 << (m_index % WIIMOTE_BALANCE_BOARD) | 0x1);
// Turn off rumble // Turn off rumble
u8 static const rumble_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_RUMBLE, 0}; u8 static const rumble_report[] = {WR_SET_REPORT | BT_OUTPUT, RT_RUMBLE, 0};
// Request status report // Request status report
u8 static const req_status_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_REQUEST_STATUS, 0}; u8 static const req_status_report[] = {WR_SET_REPORT | BT_OUTPUT, RT_REQUEST_STATUS, 0};
// TODO: check for sane response? // TODO: check for sane response?
return (IOWrite(mode_report, sizeof(mode_report)) && IOWrite(led_report, sizeof(led_report)) && return (IOWrite(mode_report, sizeof(mode_report)) && IOWrite(led_report, sizeof(led_report)) &&
@ -455,7 +455,7 @@ void Wiimote::EmuResume()
rpt.mode = wm->m_reporting_mode; rpt.mode = wm->m_reporting_mode;
rpt.all_the_time = 1; rpt.all_the_time = 1;
rpt.continuous = 1; rpt.continuous = 1;
QueueReport(WM_REPORT_MODE, &rpt, sizeof(rpt)); QueueReport(RT_REPORT_MODE, &rpt, sizeof(rpt));
NOTICE_LOG(WIIMOTE, "Resuming Wiimote data reporting."); NOTICE_LOG(WIIMOTE, "Resuming Wiimote data reporting.");
@ -467,10 +467,10 @@ void Wiimote::EmuPause()
m_last_input_report.clear(); m_last_input_report.clear();
wm_report_mode rpt = {}; wm_report_mode rpt = {};
rpt.mode = WM_REPORT_CORE; rpt.mode = RT_REPORT_CORE;
rpt.all_the_time = 0; rpt.all_the_time = 0;
rpt.continuous = 0; rpt.continuous = 0;
QueueReport(WM_REPORT_MODE, &rpt, sizeof(rpt)); QueueReport(RT_REPORT_MODE, &rpt, sizeof(rpt));
NOTICE_LOG(WIIMOTE, "Pausing Wiimote data reporting."); NOTICE_LOG(WIIMOTE, "Pausing Wiimote data reporting.");

View File

@ -16,12 +16,12 @@
#include "Common/Flag.h" #include "Common/Flag.h"
#include "Common/NonCopyable.h" #include "Common/NonCopyable.h"
#include "Core/HW/Wiimote.h" #include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteReal/WiimoteRealBase.h" #include "Core/HW/WiimoteCommon/WiimoteConstants.h"
#include "Core/HW/WiimoteCommon/WiimoteHid.h"
#include "Core/HW/WiimoteCommon/WiimoteReport.h"
class PointerWrap; class PointerWrap;
typedef std::vector<u8> Report;
namespace WiimoteReal namespace WiimoteReal
{ {
class Wiimote : NonCopyable class Wiimote : NonCopyable

View File

@ -1,36 +0,0 @@
// Copyright 2010 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
// Wiimote internal codes
// Communication channels
#define WM_OUTPUT_CHANNEL 0x11
#define WM_INPUT_CHANNEL 0x13
// The 4 most significant bits of the first byte of an outgoing command must be
// 0x50 if sending on the command channel and 0xA0 if sending on the interrupt
// channel. On Mac and Linux we use interrupt channel; on Windows, command.
#ifdef _WIN32
#define WM_SET_REPORT 0x50
#else
#define WM_SET_REPORT 0xA0
#endif
#define WM_BT_INPUT 0x01
#define WM_BT_OUTPUT 0x02
// LED bit masks
#define WIIMOTE_LED_NONE 0x00
#define WIIMOTE_LED_1 0x10
#define WIIMOTE_LED_2 0x20
#define WIIMOTE_LED_3 0x40
#define WIIMOTE_LED_4 0x80
// End Wiimote internal codes
// It's 23. NOT 32!
#define MAX_PAYLOAD 23
#define WIIMOTE_DEFAULT_TIMEOUT 1000

View File

@ -33,8 +33,9 @@
#include "Core/HW/ProcessorInterface.h" #include "Core/HW/ProcessorInterface.h"
#include "Core/HW/SI/SI.h" #include "Core/HW/SI/SI.h"
#include "Core/HW/Wiimote.h" #include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteCommon/WiimoteHid.h"
#include "Core/HW/WiimoteCommon/WiimoteReport.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h" #include "Core/HW/WiimoteEmu/WiimoteEmu.h"
#include "Core/HW/WiimoteEmu/WiimoteHid.h"
#include "Core/IOS/USB/Bluetooth/BTEmu.h" #include "Core/IOS/USB/Bluetooth/BTEmu.h"
#include "Core/IOS/USB/Bluetooth/WiimoteDevice.h" #include "Core/IOS/USB/Bluetooth/WiimoteDevice.h"
#include "Core/NetPlayProto.h" #include "Core/NetPlayProto.h"