summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorskidau <skidau@gmail.com>2012-01-03 22:23:45 +1100
committerskidau <skidau@gmail.com>2012-01-03 22:23:45 +1100
commitebca41e78be58e9d3f17cc2b4457deb06479007e (patch)
treeef1a80492611ddf299fd10eb0843ec7671f8d008 /Source/Core
parent2c3a714e49f7c191810641363a30bdb47dceafaa (diff)
parentf7ef58ff9a44dff06be78a5c2dd34586ffa71591 (diff)
Merge branch 'Wiimote'
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp65
-rw-r--r--Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp17
2 files changed, 16 insertions, 66 deletions
diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp
index e7316a896d..c22e1972dc 100644
--- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp
+++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp
@@ -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
{
@@ -210,39 +205,23 @@ int FindWiimotes(Wiimote** wm, int max_wiimotes)
attr.Size = sizeof(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;
- }
- }
+ // Find an unused slot
+ unsigned int k = 0;
+ for (; k < MAX_WIIMOTES && !(WIIMOTE_SRC_REAL & g_wiimote_sources[k] && !wm[k]); ++k);
+ wm[k] = new Wiimote(k);
+ wm[k]->dev_handle = dev;
+ memcpy(wm[k]->devicepath, detail_data->DevicePath, 197);
- if (foundWiimote)
+ if (!wm[k]->Connect())
{
- // This is a wiimote
- // Find an unused slot
- unsigned int k = 0;
- for (; k < MAX_WIIMOTES && !(WIIMOTE_SRC_REAL & g_wiimote_sources[k] && !wm[k]); ++k);
- wm[k] = new Wiimote(k);
- wm[k]->dev_handle = dev;
- memcpy(wm[k]->devicepath, detail_data->DevicePath, 197);
-
- if (!wm[k]->Connect())
- {
- ERROR_LOG(WIIMOTE, "Unable to connect to wiimote %i.", wm[k]->index + 1);
- delete wm[k];
- wm[k] = NULL;
- }
- else
- ++found_wiimotes;
+ ERROR_LOG(WIIMOTE, "Unable to connect to wiimote %i.", wm[k]->index + 1);
+ delete wm[k];
+ wm[k] = NULL;
+ CloseHandle(dev);
}
else
{
- // Not a wiimote
- CloseHandle(dev);
+ ++found_wiimotes;
}
}
@@ -399,28 +378,16 @@ int Wiimote::IOWrite(unsigned char* buf, int len)
return i;
}
-#if 0
dw = GetLastError();
// Checking for 121 = timeout on semaphore/device off/disconnected to
// avoid trouble with other stacks toshiba/widcomm
- // 995 = The I/O operation has been aborted because of a thread exit or
- // an application request.
-
- if ( (dw == 121) || (dw == 995) )
+ if (dw == 121)
{
- NOTICE_LOG(WIIMOTE, "IOWrite[MSBT_STACK_UNKNOWN]");
+ NOTICE_LOG(WIIMOTE, "IOWrite[MSBT_STACK_UNKNOWN]: Timeout");
RealDisconnect();
}
else ERROR_LOG(WIIMOTE,
"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;
}
@@ -456,8 +423,8 @@ int PairUp(bool unpair)
{
init_lib();
- // match strings like "Nintendo RVL-WBC-01", "Nintendo RVL-CNT-01"
- const std::wregex wiimote_device_name(L"Nintendo RVL-\\w{3}-\\d{2}");
+ // 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}(-\\w{2})?");
int nPaired = 0;
diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp
index d1e2826ed3..f5ded4125d 100644
--- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp
+++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp
@@ -142,23 +142,6 @@ void Wiimote::InterruptChannel(const u16 channel, const void* const data, const
rpt.second = (u8)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.
// Nintendo Wiimotes work without this translation, but 3rd
// party ones don't.