summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorMatthew Parlane <parlane@gmail.com>2013-05-19 14:45:24 +1200
committerMatthew Parlane <parlane@gmail.com>2013-05-19 14:45:24 +1200
commit065d772696fd66720574fadbcbf4ce8190ff5d20 (patch)
treef9557299aaec29b0457016dd75071f3a398117ee /Source
parent7208823396762ae9659ec03addabe696fa93256b (diff)
Windows should have support for Balance Board now.
Needs to be tested.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp25
-rw-r--r--Source/Core/InputCommon/Src/InputConfig.cpp4
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<Wiimote*> WiimoteScanner::FindWiimotes()
+void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & 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<Wiimote*> WiimoteScanner::FindWiimotes()
// Get all hid devices connected
HDEVINFO const device_info = SetupDiGetClassDevs(&device_id, NULL, NULL, (DIGCF_DEVICEINTERFACE | DIGCF_PRESENT));
- std::vector<Wiimote*> 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<Wiimote*> 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<Wiimote*> 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()
{