From e0214b1a38aaa3cf2f796118fcd700b00587e423 Mon Sep 17 00:00:00 2001 From: comex Date: Wed, 4 Sep 2013 01:03:44 -0400 Subject: [PATCH] Fix syncing wiimotes on OS X. IOdarwin.mm was assuming that scanning was complete when the run loop was stopped (which the scan callback does), but somebody else was stopping the run loop first, causing the scan to be aborted. Wait until the scan is actually complete. --- Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm index 6e399f16ac..f0d285b274 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm @@ -7,6 +7,7 @@ @interface SearchBT: NSObject { @public unsigned int maxDevices; + bool done; } @end @@ -15,6 +16,7 @@ error: (IOReturn) error aborted: (BOOL) aborted { + done = true; CFRunLoopStop(CFRunLoopGetCurrent()); } @@ -144,9 +146,12 @@ void WiimoteScanner::FindWiimotes(std::vector & found_wiimotes, Wiimot else ERROR_LOG(WIIMOTE, "Unable to do bluetooth discovery"); - CFRunLoopRun(); + do + { + CFRunLoopRun(); + } + while(!sbt->done); - [bti stop]; int found_devices = [[bti foundDevices] count]; if (found_devices)