X-Git-Url: https://git.yukkurigames.com/?a=blobdiff_plain;f=Joystick.m;h=d6c436224221dd25787c1a15ddcc7109f19a7481;hb=9ba68ad5a4378bd897fc611929f201681bc71c16;hp=8fa67919789fde788b7c9bd807e787d63f21146a;hpb=530009447c5bbd360ac5023979cffc6d32a28df3;p=enjoyable.git diff --git a/Joystick.m b/Joystick.m index 8fa6791..d6c4362 100644 --- a/Joystick.m +++ b/Joystick.m @@ -15,9 +15,9 @@ children = [[NSMutableArray alloc]init]; device = newDevice; - productName = (NSString*)IOHIDDeviceGetProperty( device, CFSTR(kIOHIDProductKey) ); - vendorId = [(NSNumber*)IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVendorIDKey)) intValue]; - productId = [(NSNumber*)IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVendorIDKey)) intValue]; + productName = (__bridge NSString*)IOHIDDeviceGetProperty( device, CFSTR(kIOHIDProductKey) ); + vendorId = [(__bridge NSNumber*)IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVendorIDKey)) intValue]; + productId = [(__bridge NSNumber*)IOHIDDeviceGetProperty(device, CFSTR(kIOHIDVendorIDKey)) intValue]; name = productName; } @@ -42,13 +42,13 @@ } -(void) populateActions { - NSArray* elements = (NSArray*)IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone); + NSArray* elements = (NSArray*)CFBridgingRelease(IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone)); int buttons = 0; int axes = 0; for(int i=0; i<[elements count]; i++) { - IOHIDElementRef element = (IOHIDElementRef)[elements objectAtIndex: i]; + IOHIDElementRef element = (__bridge IOHIDElementRef)elements[i]; int type = IOHIDElementGetType(element); int usage = IOHIDElementGetUsage(element); int usagePage = IOHIDElementGetUsagePage(element); @@ -70,7 +70,7 @@ } if((max - min == 1) || usagePage == kHIDPage_Button || type == kIOHIDElementTypeInput_Button) { - action = [[JSActionButton alloc] initWithIndex: buttons++ andName: (NSString *)elName]; + action = [[JSActionButton alloc] initWithIndex: buttons++ andName: (__bridge NSString *)elName]; [(JSActionButton*)action setMax: max]; } else if(usage == 0x39) action = [[JSActionHat alloc] init]; @@ -96,8 +96,8 @@ - (JSAction*) findActionByCookie: (void*) cookie { for(int i=0; i<[children count]; i++) - if([[children objectAtIndex:i]cookie] == cookie) - return (JSAction*)[children objectAtIndex:i]; + if([children[i]cookie] == cookie) + return (JSAction*)children[i]; return NULL; }