diff --git a/apple/OSX/settings.m b/apple/OSX/settings.m index 232cc5d686..5ddfc698da 100644 --- a/apple/OSX/settings.m +++ b/apple/OSX/settings.m @@ -137,13 +137,14 @@ static const void* associated_name_tag = (void*)&associated_name_tag; - (void)checkBind:(NSTimer*)send { int32_t value = 0; + int32_t index = _setting->index ? _setting->index - 1 : 0; if ((value = apple_input_find_any_key())) BINDFOR(*_setting).key = input_translate_keysym_to_rk(value); - else if ((value = apple_input_find_any_button(0)) >= 0) + else if ((value = apple_input_find_any_button(index)) >= 0) BINDFOR(*_setting).joykey = value; - else if ((value = apple_input_find_any_axis(0))) - BINDFOR(*_setting).joyaxis = (value > 0) ? AXIS_POS(value - 1) : AXIS_NEG(value - 1); + else if ((value = apple_input_find_any_axis(index))) + BINDFOR(*_setting).joyaxis = (value > 0) ? AXIS_POS(value - 1) : AXIS_NEG(abs(value) - 1); else return; diff --git a/apple/iOS/menu.m b/apple/iOS/menu.m index 4c9e3670c6..f28e96678a 100644 --- a/apple/iOS/menu.m +++ b/apple/iOS/menu.m @@ -400,13 +400,14 @@ static void RunActionSheet(const char* title, const struct string_list* items, U - (void)checkBind:(NSTimer*)send { int32_t value = 0; + int32_t index = self.setting->index ? self.setting->index - 1 : 0; if ((value = apple_input_find_any_key())) BINDFOR(*self.setting).key = input_translate_keysym_to_rk(value); - else if ((value = apple_input_find_any_button(0)) >= 0) + else if ((value = apple_input_find_any_button(index)) >= 0) BINDFOR(*self.setting).joykey = value; - else if ((value = apple_input_find_any_axis(0))) - BINDFOR(*self.setting).joyaxis = (value > 0) ? AXIS_POS(value - 1) : AXIS_NEG(value - 1); + else if ((value = apple_input_find_any_axis(index))) + BINDFOR(*self.setting).joyaxis = (value > 0) ? AXIS_POS(value - 1) : AXIS_NEG(abs(value) - 1); else return;