X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=Joystick.m;h=ae278b30b3094527adaee68d0efa9ba818df55be;hp=c86a3637a19a6460df653108bf0d835664056834;hb=320e3065d251e11370e571df5705675937b76521;hpb=2fb801b58b29997f54443d9879d2e20ae8b169ad diff --git a/Joystick.m b/Joystick.m index c86a363..ae278b3 100644 --- a/Joystick.m +++ b/Joystick.m @@ -43,10 +43,9 @@ static NSArray *ActionsForElement(IOHIDDeviceRef device, id base) { } else if (usage == kHIDUsage_GD_Hatswitch) { action = [[JSActionHat alloc] initWithIndex:++hats]; } else if (usage >= kHIDUsage_GD_X && usage <= kHIDUsage_GD_Rz) { - // TODO(jfw): Scaling equation doesn't seem right if min != 0. action = [[JSActionAnalog alloc] initWithIndex:++axes - offset:-1.f - scale:2.f / (max - min)]; + rawMin:min + rawMax:max]; } else { continue; } @@ -56,6 +55,8 @@ static NSArray *ActionsForElement(IOHIDDeviceRef device, id base) { action.cookie = IOHIDElementGetCookie(element); [children addObject:action]; } + + CFRelease(elements); return children; }