mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
More attempts at a Windows buildfix.
This commit is contained in:
parent
62f56eb731
commit
246b11791b
@ -151,13 +151,6 @@ std::vector<Wiimote*> WiimoteScanner::FindWiimotes(size_t max_wiimotes)
|
|||||||
PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data = NULL;
|
PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data = NULL;
|
||||||
HIDD_ATTRIBUTES attr;
|
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);
|
device_data.cbSize = sizeof(device_data);
|
||||||
|
|
||||||
// Get the device id
|
// Get the device id
|
||||||
@ -187,19 +180,6 @@ std::vector<Wiimote*> WiimoteScanner::FindWiimotes(size_t max_wiimotes)
|
|||||||
if (!SetupDiGetDeviceInterfaceDetail(device_info, &device_data, detail_data, len, NULL, NULL))
|
if (!SetupDiGetDeviceInterfaceDetail(device_info, &device_data, detail_data, len, NULL, NULL))
|
||||||
continue;
|
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
|
// Open new device
|
||||||
dev = CreateFile(detail_data->DevicePath,
|
dev = CreateFile(detail_data->DevicePath,
|
||||||
(GENERIC_READ | GENERIC_WRITE),
|
(GENERIC_READ | GENERIC_WRITE),
|
||||||
@ -391,6 +371,26 @@ int Wiimote::IOWrite(unsigned char* buf, int len)
|
|||||||
return 0;
|
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
|
// WiiMote Pair-Up, function will return amount of either new paired or unpaired devices
|
||||||
// negative number on failure
|
// negative number on failure
|
||||||
int PairUp(bool unpair)
|
int PairUp(bool unpair)
|
||||||
@ -409,7 +409,8 @@ int PairUp(bool unpair)
|
|||||||
srch.fReturnConnected = true;
|
srch.fReturnConnected = true;
|
||||||
srch.fReturnUnknown = true;
|
srch.fReturnUnknown = true;
|
||||||
srch.fIssueInquiry = true;
|
srch.fIssueInquiry = true;
|
||||||
srch.cTimeoutMultiplier = 2; // == (2 * 1.28) seconds
|
// multiple of 1.28 seconds
|
||||||
|
srch.cTimeoutMultiplier = 1;
|
||||||
|
|
||||||
BLUETOOTH_FIND_RADIO_PARAMS radioParam;
|
BLUETOOTH_FIND_RADIO_PARAMS radioParam;
|
||||||
radioParam.dwSize = sizeof(radioParam);
|
radioParam.dwSize = sizeof(radioParam);
|
||||||
|
@ -71,11 +71,11 @@ WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin
|
|||||||
refresh_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &WiimoteConfigDiag::RefreshRealWiimotes, this);
|
refresh_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &WiimoteConfigDiag::RefreshRealWiimotes, this);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
wxButton* const pairup_btn = new wxButton(this, -1, _("Pair Up"), wxDefaultPosition);
|
//wxButton* const pairup_btn = new wxButton(this, -1, _("Pair Up"), wxDefaultPosition);
|
||||||
pairup_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &WiimoteConfigDiag::PairUpRealWiimotes, this);
|
//pairup_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &WiimoteConfigDiag::PairUpRealWiimotes, this);
|
||||||
|
// TODO: text if can't Pair
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// "Real wiimotes" layout
|
// "Real wiimotes" layout
|
||||||
wxStaticBoxSizer* const real_wiimotes_group = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Real Wiimotes"));
|
wxStaticBoxSizer* const real_wiimotes_group = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Real Wiimotes"));
|
||||||
wxFlexGridSizer* const real_wiimotes_sizer = new wxFlexGridSizer(3, 5, 5);
|
wxFlexGridSizer* const real_wiimotes_sizer = new wxFlexGridSizer(3, 5, 5);
|
||||||
@ -194,24 +194,6 @@ void WiimoteConfigDiag::UpdateGUI()
|
|||||||
connected_wiimotes_txt->SetLabel(ConnectedWiimotesString());
|
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&)
|
void WiimoteConfigDiag::RefreshRealWiimotes(wxCommandEvent&)
|
||||||
{
|
{
|
||||||
WiimoteReal::Refresh();
|
WiimoteReal::Refresh();
|
||||||
|
@ -24,9 +24,6 @@ class WiimoteConfigDiag : public wxDialog
|
|||||||
public:
|
public:
|
||||||
WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin);
|
WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin);
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
void PairUpRealWiimotes(wxCommandEvent& event);
|
|
||||||
#endif
|
|
||||||
void RefreshRealWiimotes(wxCommandEvent& event);
|
void RefreshRealWiimotes(wxCommandEvent& event);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user