From 065d772696fd66720574fadbcbf4ce8190ff5d20 Mon Sep 17 00:00:00 2001 From: Matthew Parlane Date: Sun, 19 May 2013 14:45:24 +1200 Subject: [PATCH] Windows should have support for Balance Board now. Needs to be tested. --- Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp | 25 +++++++++++++++---- Source/Core/InputCommon/Src/InputConfig.cpp | 4 +-- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp index 4aae05fa3a..cf47315066 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp @@ -183,7 +183,7 @@ void WiimoteScanner::Update() // Does not replace already found wiimotes even if they are disconnected. // wm is an array of max_wiimotes wiimotes // Returns the total number of found and connected wiimotes. -std::vector WiimoteScanner::FindWiimotes() +void WiimoteScanner::FindWiimotes(std::vector & found_wiimotes, Wiimote* & found_board) { ProcessWiimotes(true, [](HANDLE hRadio, const BLUETOOTH_RADIO_INFO& rinfo, BLUETOOTH_DEVICE_INFO_STRUCT& btdi) { @@ -198,8 +198,6 @@ std::vector WiimoteScanner::FindWiimotes() // Get all hid devices connected HDEVINFO const device_info = SetupDiGetClassDevs(&device_id, NULL, NULL, (DIGCF_DEVICEINTERFACE | DIGCF_PRESENT)); - std::vector wiimotes; - SP_DEVICE_INTERFACE_DATA device_data; device_data.cbSize = sizeof(device_data); PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data = NULL; @@ -217,7 +215,25 @@ std::vector WiimoteScanner::FindWiimotes() { auto const wm = new Wiimote; wm->devicepath = detail_data->DevicePath; - wiimotes.push_back(wm); + + TCHAR name[128] = {}; + HANDLE dev_handle = CreateFile(wm->devicepath.c_str(), + GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); + + if (dev_handle != INVALID_HANDLE_VALUE && HidD_GetProductString(dev_handle, name, 128) && IsBalanceBoardName(TStrToUTF8(name))) + { + found_board = wm; + } + else + { + found_wiimotes.push_back(wm); + } + + if(dev_handle != INVALID_HANDLE_VALUE) + { + CloseHandle(dev_handle); + } } free(detail_data); @@ -229,7 +245,6 @@ std::vector WiimoteScanner::FindWiimotes() //if (!wiimotes.empty()) // SLEEP(2000); - return wiimotes; } bool WiimoteScanner::IsReady() const diff --git a/Source/Core/InputCommon/Src/InputConfig.cpp b/Source/Core/InputCommon/Src/InputConfig.cpp index e1af00f41d..96fc6205db 100644 --- a/Source/Core/InputCommon/Src/InputConfig.cpp +++ b/Source/Core/InputCommon/Src/InputConfig.cpp @@ -3,8 +3,8 @@ // Refer to the license.txt file included. #include "InputConfig.h" -#include "../Src/ConfigManager.h" -#include "../Src/HW/Wiimote.h" +#include "../../Core/Src/ConfigManager.h" +#include "../../Core/Src/HW/Wiimote.h" InputPlugin::~InputPlugin() {