summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorcomex <comexk@gmail.com>2013-09-04 01:03:44 -0400
committercomex <comexk@gmail.com>2013-09-04 01:04:51 -0400
commite0214b1a38aaa3cf2f796118fcd700b00587e423 (patch)
treec57b7c888b63ae8757a3ba583563746f9d9ff0da /Source/Core
parent1ea8b936676d5e0992a50cf4d0458658bf61978c (diff)
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.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm9
1 files 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<Wiimote*> & 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)