Removed the VID/PID validation for Wiimotes allowing Dolphin to detect third party wiimotes with a VID/PID that is different to Nintendo's.
Checked for timeouts reported by the bluetooth stack. Added RVL-CNT-01-TR detection.
This commit is contained in:
parent
1df7af35e9
commit
f7ef58ff9a
|
@ -124,11 +124,6 @@ inline void init_lib()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// VID = Nintendo, PID = Wiimote
|
|
||||||
static int VIDLength = 3;
|
|
||||||
static int VID[3] = {0x057E, 0x0001, 0x0002};
|
|
||||||
static int PID[3] = {0x0306, 0x0002, 0x00F7};
|
|
||||||
|
|
||||||
namespace WiimoteReal
|
namespace WiimoteReal
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -210,19 +205,6 @@ int FindWiimotes(Wiimote** wm, int max_wiimotes)
|
||||||
attr.Size = sizeof(attr);
|
attr.Size = sizeof(attr);
|
||||||
HidD_GetAttributes(dev, &attr);
|
HidD_GetAttributes(dev, &attr);
|
||||||
|
|
||||||
bool foundWiimote = false;
|
|
||||||
for (int i = 0; i < VIDLength; i++)
|
|
||||||
{
|
|
||||||
if (attr.VendorID == VID[i] && attr.ProductID == PID[i])
|
|
||||||
{
|
|
||||||
foundWiimote = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (foundWiimote)
|
|
||||||
{
|
|
||||||
// This is a wiimote
|
|
||||||
// Find an unused slot
|
// Find an unused slot
|
||||||
unsigned int k = 0;
|
unsigned int k = 0;
|
||||||
for (; k < MAX_WIIMOTES && !(WIIMOTE_SRC_REAL & g_wiimote_sources[k] && !wm[k]); ++k);
|
for (; k < MAX_WIIMOTES && !(WIIMOTE_SRC_REAL & g_wiimote_sources[k] && !wm[k]); ++k);
|
||||||
|
@ -235,14 +217,11 @@ int FindWiimotes(Wiimote** wm, int max_wiimotes)
|
||||||
ERROR_LOG(WIIMOTE, "Unable to connect to wiimote %i.", wm[k]->index + 1);
|
ERROR_LOG(WIIMOTE, "Unable to connect to wiimote %i.", wm[k]->index + 1);
|
||||||
delete wm[k];
|
delete wm[k];
|
||||||
wm[k] = NULL;
|
wm[k] = NULL;
|
||||||
}
|
CloseHandle(dev);
|
||||||
else
|
|
||||||
++found_wiimotes;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Not a wiimote
|
++found_wiimotes;
|
||||||
CloseHandle(dev);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,28 +378,16 @@ int Wiimote::IOWrite(unsigned char* buf, int len)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
dw = GetLastError();
|
dw = GetLastError();
|
||||||
// Checking for 121 = timeout on semaphore/device off/disconnected to
|
// Checking for 121 = timeout on semaphore/device off/disconnected to
|
||||||
// avoid trouble with other stacks toshiba/widcomm
|
// avoid trouble with other stacks toshiba/widcomm
|
||||||
// 995 = The I/O operation has been aborted because of a thread exit or
|
if (dw == 121)
|
||||||
// an application request.
|
|
||||||
|
|
||||||
if ( (dw == 121) || (dw == 995) )
|
|
||||||
{
|
{
|
||||||
NOTICE_LOG(WIIMOTE, "IOWrite[MSBT_STACK_UNKNOWN]");
|
NOTICE_LOG(WIIMOTE, "IOWrite[MSBT_STACK_UNKNOWN]: Timeout");
|
||||||
RealDisconnect();
|
RealDisconnect();
|
||||||
}
|
}
|
||||||
else ERROR_LOG(WIIMOTE,
|
else ERROR_LOG(WIIMOTE,
|
||||||
"IOWrite[MSBT_STACK_UNKNOWN]: ERROR: %08x", dw);
|
"IOWrite[MSBT_STACK_UNKNOWN]: ERROR: %08x", dw);
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// If the part below causes trouble on WIDCOMM/TOSHIBA stack uncomment
|
|
||||||
// the lines above, and comment out the 3 lines below instead.
|
|
||||||
|
|
||||||
NOTICE_LOG(WIIMOTE, "IOWrite[MSBT_STACK_UNKNOWN]");
|
|
||||||
RealDisconnect();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,8 +423,8 @@ int PairUp(bool unpair)
|
||||||
{
|
{
|
||||||
init_lib();
|
init_lib();
|
||||||
|
|
||||||
// match strings like "Nintendo RVL-WBC-01", "Nintendo RVL-CNT-01"
|
// match strings like "Nintendo RVL-WBC-01", "Nintendo RVL-CNT-01", "Nintendo RVL-CNT-01-TR"
|
||||||
const std::wregex wiimote_device_name(L"Nintendo RVL-\\w{3}-\\d{2}");
|
const std::wregex wiimote_device_name(L"Nintendo RVL-\\w{3}-\\d{2}(-\\w{2})?");
|
||||||
|
|
||||||
int nPaired = 0;
|
int nPaired = 0;
|
||||||
|
|
||||||
|
|
|
@ -142,23 +142,6 @@ void Wiimote::InterruptChannel(const u16 channel, const void* const data, const
|
||||||
rpt.second = (u8)size;
|
rpt.second = (u8)size;
|
||||||
memcpy(rpt.first, (u8*)data, size);
|
memcpy(rpt.first, (u8*)data, size);
|
||||||
|
|
||||||
// some hax, since we just send the last data report to Dolphin on each Update() call
|
|
||||||
// , make the wiimote only send updated data reports when data changes
|
|
||||||
// == less bt traffic, eliminates some unneeded packets
|
|
||||||
//if (WM_REPORT_MODE == ((u8*)data)[1])
|
|
||||||
//{
|
|
||||||
// // also delete the last data report
|
|
||||||
// if (m_last_data_report.first)
|
|
||||||
// {
|
|
||||||
// delete[] m_last_data_report.first;
|
|
||||||
// m_last_data_report.first = NULL;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // nice var names :p, this seems to be this one
|
|
||||||
// ((wm_report_mode*)(rpt.first + 2))->all_the_time = false;
|
|
||||||
// //((wm_report_mode*)(data + 2))->continuous = false;
|
|
||||||
//}
|
|
||||||
|
|
||||||
// Convert output DATA packets to SET_REPORT packets.
|
// Convert output DATA packets to SET_REPORT packets.
|
||||||
// Nintendo Wiimotes work without this translation, but 3rd
|
// Nintendo Wiimotes work without this translation, but 3rd
|
||||||
// party ones don't.
|
// party ones don't.
|
||||||
|
|
Loading…
Reference in New Issue