IOHIDDeviceRef device = IOHIDQueueGetDevice((IOHIDQueueRef) inSender);
Joystick* js = [self findJoystickByRef: device];
- if([[[NSApplication sharedApplication] delegate] active]) {
+ if([(ApplicationController *)[[NSApplication sharedApplication] delegate] active]) {
// for reals
JSAction* mainAction = [js actionForEvent: value];
if(!mainAction)
}
-(Joystick*) findJoystickByRef: (IOHIDDeviceRef) device {
- for(int i=0; i<[joysticks count]; i++)
- if([[joysticks objectAtIndex:i] device] == device)
- return [joysticks objectAtIndex:i];
- return NULL;
+ for (Joystick *js in joysticks)
+ if (js.device == device)
+ return js;
+ return nil;
}
void remove_callback(void* inContext, IOReturn inResult, void* inSender, IOHIDDeviceRef device) {