WiimoteReal for Mac: Send commands on interrupt channel.

There are two ways to send commands to Wii Remotes:

- On command channel, with a first byte of 0x52. This works on
  Nintendo RVL-CNT-01, but not Nintendo RVL-CNT-01-TR wiimotes.

- On interrupt channel, with a first byte of 0xa2. This works on
  Nintendo RVL-CNT-01 and Nintendo RVL-CNT-01-TR wiimotes.

This patch switches Mac from the former to the latter. Windows and
Linux remain unchanged.
This commit is contained in:
Andrew de los Reyes 2012-03-22 20:15:47 -07:00
parent af8690a7d8
commit 93b78d7139
3 changed files with 11 additions and 3 deletions

View File

@ -244,7 +244,7 @@ int Wiimote::IOWrite(unsigned char *buf, int len)
if (!IsConnected())
return 0;
ret = [cchan writeAsync: buf length: len refcon: nil];
ret = [ichan writeAsync: buf length: len refcon: nil];
if (ret == kIOReturnSuccess)
return len;

View File

@ -147,10 +147,11 @@ void Wiimote::InterruptChannel(const u16 channel, const void* const data, const
// party ones don't.
if (rpt.first[0] == 0xa2)
{
rpt.first[0] = 0x52;
rpt.first[0] = WM_SET_REPORT | WM_BT_OUTPUT;
}
if (rpt.first[0] == 0x52 && rpt.first[1] == 0x18 && rpt.second == 23)
if (rpt.first[0] == (WM_SET_REPORT | WM_BT_OUTPUT) &&
rpt.first[1] == 0x18 && rpt.second == 23)
{
m_audio_reports.Push(rpt);
return;

View File

@ -32,7 +32,14 @@
#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 we use interrupt channel; on Windows/Linux, command.
#ifndef __APPLE__
#define WM_SET_REPORT 0x50
#else
#define WM_SET_REPORT 0xA0
#endif
// Commands
#define WM_CMD_RUMBLE 0x10