summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorskidau <skidau@gmail.com>2010-12-24 02:21:09 +0000
committerskidau <skidau@gmail.com>2010-12-24 02:21:09 +0000
commitb5d482a0d37565e9a63dde16c148cbdd8270ca22 (patch)
treef6e74f073ca4d80d22e40485175b111611ed375b /Source/Core
parentb9d4534a351157c3f814645a2033a013409b9487 (diff)
Added support for a wider number of VID/PID reported by Wiimotes. Patch by palsch.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6654 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/wiiuse/Src/io_win.cpp49
1 files changed, 45 insertions, 4 deletions
diff --git a/Source/Core/wiiuse/Src/io_win.cpp b/Source/Core/wiiuse/Src/io_win.cpp
index 3a318f6596..fb0eb77231 100644
--- a/Source/Core/wiiuse/Src/io_win.cpp
+++ b/Source/Core/wiiuse/Src/io_win.cpp
@@ -62,6 +62,11 @@ HINSTANCE hid_lib = NULL;
static int initialized = 0;
+// VID = Nintendo, PID = Wiimote
+static int VIDLength = 3;
+static int VID[3] = {0x057E, 0x0001, 0x0002};
+static int PID[3] = {0x0306, 0x0002, 0x00F7};
+
inline void init_lib()
{
if (!initialized)
@@ -160,9 +165,25 @@ int wiiuse_find(struct wiimote_t** wm, int max_wiimotes, int wiimotes) {
attr.Size = sizeof(attr);
i = HidD_GetAttributes(dev, &attr);
- if ((attr.VendorID == WM_VENDOR_ID) && (attr.ProductID == WM_PRODUCT_ID)) {
-
+ bool foundWiimote = false;
+ if((attr.VendorID == WM_VENDOR_ID) && (attr.ProductID == WM_PRODUCT_ID))
+ {
+ foundWiimote = true;
+ }
+ else
+ {
+ 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
wm[wiimotes]->dev_handle = dev;
@@ -189,7 +210,9 @@ int wiiuse_find(struct wiimote_t** wm, int max_wiimotes, int wiimotes) {
NOTICE_LOG(WIIMOTE, "Connected to wiimote [id %i].", wm[wiimotes]->unid);
++wiimotes;
- } else {
+ }
+ else
+ {
// not a wiimote
CloseHandle(dev);
}
@@ -379,7 +402,25 @@ int wiiuse_check_system_notification(unsigned int nMsg, WPARAM wParam, LPARAM lP
HidD_GetAttributes(dev, &attr);
//Checking PID&VID
- if ((attr.VendorID == WM_VENDOR_ID) && (attr.ProductID == WM_PRODUCT_ID)) {
+ bool foundWiimote = false;
+ if((attr.VendorID == WM_VENDOR_ID) && (attr.ProductID == WM_PRODUCT_ID))
+ {
+ foundWiimote = true;
+ }
+ else
+ {
+ for (int i = 0; i < VIDLength; i++)
+ {
+ if (attr.VendorID == VID[i] && attr.ProductID == PID[i])
+ {
+ foundWiimote = true;
+ break;
+ }
+ }
+ }
+
+ if (foundWiimote)
+ {
CloseHandle(dev);
return 1;
}