X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=JoystickController.m;h=15512956eb64ef04eeeb26eba2ce878be1a95e29;hp=976b531a01c89c61081fa84b2e97b4c6d94a8de3;hb=fc6d0fdabe55f8ae0c417f7c4be745d51a47e0bd;hpb=9a9baa70c635d3b1dd853aa51d1e4d8d4c522a9d diff --git a/JoystickController.m b/JoystickController.m index 976b531..1551295 100644 --- a/JoystickController.m +++ b/JoystickController.m @@ -148,10 +148,10 @@ void add_callback(void* inContext, IOReturn inResult, void* inSender, IOHIDDevic } -(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) {