Futile attempts at fixing OS X.

This commit is contained in:
Jordan Woyak 2013-02-12 21:37:47 -06:00
parent 7f305ba822
commit 77381a1af2
1 changed files with 7 additions and 3 deletions

View File

@ -150,7 +150,8 @@ std::vector<Wiimote*> WiimoteScanner::FindWiimotes()
[bti stop]; [bti stop];
int found_devices = [[bti foundDevices] count]; int found_devices = [[bti foundDevices] count];
NOTICE_LOG(WIIMOTE, "Found %i bluetooth devices", found_devices); if (found_devices)
NOTICE_LOG(WIIMOTE, "Found %i bluetooth devices", found_devices);
en = [[bti foundDevices] objectEnumerator]; en = [[bti foundDevices] objectEnumerator];
for (int i = 0; i < found_devices; i++) for (int i = 0; i < found_devices; i++)
@ -180,11 +181,11 @@ bool WiimoteScanner::IsReady() const
// Connect to a wiimote with a known address. // Connect to a wiimote with a known address.
bool Wiimote::Connect() bool Wiimote::Connect()
{ {
ConnectBT *cbt = [[ConnectBT alloc] init];
if (IsConnected()) if (IsConnected())
return false; return false;
ConnectBT *cbt = [[ConnectBT alloc] init];
[btd openL2CAPChannelSync: &cchan [btd openL2CAPChannelSync: &cchan
withPSM: kBluetoothL2CAPPSMHIDControl delegate: cbt]; withPSM: kBluetoothL2CAPPSMHIDControl delegate: cbt];
[btd openL2CAPChannelSync: &ichan [btd openL2CAPChannelSync: &ichan
@ -215,6 +216,9 @@ bool Wiimote::Connect()
// Disconnect a wiimote. // Disconnect a wiimote.
void Wiimote::Disconnect() void Wiimote::Disconnect()
{ {
if (!IsConnected())
return;
NOTICE_LOG(WIIMOTE, "Disconnecting wiimote %i", index + 1); NOTICE_LOG(WIIMOTE, "Disconnecting wiimote %i", index + 1);
m_connected = false; m_connected = false;