diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp index f862193ff9..e285a33729 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp @@ -151,13 +151,6 @@ std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data = NULL; HIDD_ATTRIBUTES attr; - // Count the number of already found wiimotes - for (int i = 0; i < MAX_WIIMOTES; ++i) - { - if (wm[i]) - found_wiimotes++; - } - device_data.cbSize = sizeof(device_data); // Get the device id @@ -187,19 +180,6 @@ std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) if (!SetupDiGetDeviceInterfaceDetail(device_info, &device_data, detail_data, len, NULL, NULL)) continue; - // Determine if this wiimote has already been found. - bool found = false; - for(int i = 0; i < MAX_WIIMOTES; i++) - { - if(wm[i] && strcmp(wm[i]->devicepath, detail_data->DevicePath) == 0) - { - found = true; - break; - } - } - if (found) - continue; - // Open new device dev = CreateFile(detail_data->DevicePath, (GENERIC_READ | GENERIC_WRITE), @@ -391,6 +371,26 @@ int Wiimote::IOWrite(unsigned char* buf, int len) return 0; } +// return true if a device using MS BT stack is available +bool CanPairUp() +{ + BLUETOOTH_FIND_RADIO_PARAMS radioParam; + radioParam.dwSize = sizeof(radioParam); + + HANDLE hRadio; + HBLUETOOTH_RADIO_FIND hFindRadio = Bth_BluetoothFindFirstRadio(&radioParam, &hRadio); + + if (NULL != hFindRadio) + { + Bth_BluetoothFindRadioClose(hFindRadio); + return true; + } + else + { + return false; + } +} + // WiiMote Pair-Up, function will return amount of either new paired or unpaired devices // negative number on failure int PairUp(bool unpair) @@ -409,7 +409,8 @@ int PairUp(bool unpair) srch.fReturnConnected = true; srch.fReturnUnknown = true; srch.fIssueInquiry = true; - srch.cTimeoutMultiplier = 2; // == (2 * 1.28) seconds + // multiple of 1.28 seconds + srch.cTimeoutMultiplier = 1; BLUETOOTH_FIND_RADIO_PARAMS radioParam; radioParam.dwSize = sizeof(radioParam); diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp index b259cde2b9..d38eadb0e1 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp @@ -71,11 +71,11 @@ WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin refresh_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &WiimoteConfigDiag::RefreshRealWiimotes, this); #ifdef _WIN32 - wxButton* const pairup_btn = new wxButton(this, -1, _("Pair Up"), wxDefaultPosition); - pairup_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &WiimoteConfigDiag::PairUpRealWiimotes, this); + //wxButton* const pairup_btn = new wxButton(this, -1, _("Pair Up"), wxDefaultPosition); + //pairup_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &WiimoteConfigDiag::PairUpRealWiimotes, this); + // TODO: text if can't Pair #endif - // "Real wiimotes" layout wxStaticBoxSizer* const real_wiimotes_group = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Real Wiimotes")); wxFlexGridSizer* const real_wiimotes_sizer = new wxFlexGridSizer(3, 5, 5); @@ -194,24 +194,6 @@ void WiimoteConfigDiag::UpdateGUI() connected_wiimotes_txt->SetLabel(ConnectedWiimotesString()); } -#ifdef _WIN32 -void WiimoteConfigDiag::PairUpRealWiimotes(wxCommandEvent&) -{ - const int paired = WiimoteReal::PairUp(); - - if (paired > 0) - { - // TODO: Maybe add a label of newly paired up wiimotes? - WiimoteReal::Refresh(); - UpdateGUI(); - } - else if (paired < 0) - PanicAlertT("A supported bluetooth device could not be found!\n" - "If you are not using Microsoft's bluetooth stack " - "you must manually pair your wiimotes and use only the \"Refresh\" button."); -} -#endif - void WiimoteConfigDiag::RefreshRealWiimotes(wxCommandEvent&) { WiimoteReal::Refresh(); diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h index 2b2e60de4a..fbd715bd40 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h @@ -24,9 +24,6 @@ class WiimoteConfigDiag : public wxDialog public: WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin); -#ifdef _WIN32 - void PairUpRealWiimotes(wxCommandEvent& event); -#endif void RefreshRealWiimotes(wxCommandEvent& event);