diff --git a/input/apple_joypad_hid.c b/input/apple_joypad_hid.c index 79fee752e5..e16c9876d1 100644 --- a/input/apple_joypad_hid.c +++ b/input/apple_joypad_hid.c @@ -102,11 +102,12 @@ static void hid_device_input_callback(void* context, IOReturn result, case kIOHIDElementTypeInput_Button: { CFIndex state = IOHIDValueGetIntegerValue(value); + unsigned id = use - 1; if (state) - apple->buttons[connection->slot] |= (1 << (use - 1)); + apple->buttons[connection->slot] |= (1 << id); else - apple->buttons[connection->slot] &= ~(1 << (use - 1)); + apple->buttons[connection->slot] &= ~(1 << id); } break; }