(Apple) hid_device_input_callback - cleanup
This commit is contained in:
parent
4a4888dda9
commit
03378289d7
|
@ -80,19 +80,19 @@ static void hid_device_input_callback(void* context, IOReturn result,
|
||||||
|
|
||||||
for (i = 0; i < 4; i ++)
|
for (i = 0; i < 4; i ++)
|
||||||
{
|
{
|
||||||
if (use == axis_use_ids[i])
|
CFIndex min, max, state;
|
||||||
{
|
float val;
|
||||||
CFIndex min, max, state;
|
|
||||||
float val;
|
|
||||||
|
|
||||||
min = IOHIDElementGetPhysicalMin(element);
|
if (use != axis_use_ids[i])
|
||||||
max = IOHIDElementGetPhysicalMax(element) - min;
|
continue;
|
||||||
state = IOHIDValueGetIntegerValue(value) - min;
|
|
||||||
|
|
||||||
val = (float)state / (float)max;
|
min = IOHIDElementGetPhysicalMin(element);
|
||||||
apple->axes[connection->slot][i] =
|
max = IOHIDElementGetPhysicalMax(element) - min;
|
||||||
((val * 2.0f) - 1.0f) * 32767.0f;
|
state = IOHIDValueGetIntegerValue(value) - min;
|
||||||
}
|
|
||||||
|
val = (float)state / (float)max;
|
||||||
|
apple->axes[connection->slot][i] =
|
||||||
|
((val * 2.0f) - 1.0f) * 32767.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue