mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Actually use the timeout requested in Wiiuse in OSX, and if there is no BT device or it's disabled, catch it so we don't get stuck in an infinite loop
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5049 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
c2e0c75c93
commit
9272d3c628
24
Externals/WiiUseSrc/Src/io_osx.m
vendored
24
Externals/WiiUseSrc/Src/io_osx.m
vendored
@ -41,6 +41,7 @@
|
|||||||
#import <IOBluetooth/objc/IOBluetoothDevice.h>
|
#import <IOBluetooth/objc/IOBluetoothDevice.h>
|
||||||
#import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h>
|
#import <IOBluetooth/objc/IOBluetoothDeviceInquiry.h>
|
||||||
#import <IOBluetooth/objc/IOBluetoothL2CAPChannel.h>
|
#import <IOBluetooth/objc/IOBluetoothL2CAPChannel.h>
|
||||||
|
#import <IOBluetooth/objc/IOBluetoothHostController.h>
|
||||||
|
|
||||||
IOBluetoothDeviceInquiry *bti;
|
IOBluetoothDeviceInquiry *bti;
|
||||||
IOBluetoothDevice * btd;
|
IOBluetoothDevice * btd;
|
||||||
@ -183,10 +184,10 @@ static int wiiuse_connect_single(struct wiimote_t* wm, char* address);
|
|||||||
SearchBT *sbt;
|
SearchBT *sbt;
|
||||||
ConnectBT *cbt;
|
ConnectBT *cbt;
|
||||||
|
|
||||||
void detectWiimote() {
|
void detectWiimote(int timeout) {
|
||||||
|
|
||||||
[bti setDelegate: sbt];
|
[bti setDelegate: sbt];
|
||||||
[bti setInquiryLength:20];
|
[bti setInquiryLength:timeout];
|
||||||
[bti setSearchCriteria:kBluetoothServiceClassMajorAny majorDeviceClass:0x05 minorDeviceClass:0x01];
|
[bti setSearchCriteria:kBluetoothServiceClassMajorAny majorDeviceClass:0x05 minorDeviceClass:0x01];
|
||||||
[bti setUpdateNewDeviceNames:NO];
|
[bti setUpdateNewDeviceNames:NO];
|
||||||
|
|
||||||
@ -226,13 +227,22 @@ int wiiuse_find(struct wiimote_t** wm, int max_wiimotes, int timeout) {
|
|||||||
|
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
sbt = [[SearchBT alloc] init];
|
IOBluetoothHostController *bth = [[IOBluetoothHostController alloc] init];
|
||||||
cbt = [[ConnectBT alloc] init];
|
if([bth addressAsString] == nil)
|
||||||
bti = [[IOBluetoothDeviceInquiry alloc] init];
|
{
|
||||||
|
// Method addressAsString will return nil since it can't find a device
|
||||||
|
WIIUSE_INFO("No BT device");
|
||||||
|
[bth release];
|
||||||
|
[pool release];
|
||||||
|
return 0; // 0 Wiimotes found
|
||||||
|
}
|
||||||
|
sbt = [[SearchBT alloc] init];
|
||||||
|
cbt = [[ConnectBT alloc] init];
|
||||||
|
bti = [[IOBluetoothDeviceInquiry alloc] init];
|
||||||
|
|
||||||
detectWiimote();
|
detectWiimote(timeout);
|
||||||
|
|
||||||
CFRunLoopRun();
|
CFRunLoopRun();
|
||||||
|
|
||||||
found_wiimotes = 0;
|
found_wiimotes = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user