From 4c493ae9b41ced76c6fd78a015bd7d5c9f288bdb Mon Sep 17 00:00:00 2001 From: meancoot Date: Tue, 10 Dec 2013 16:53:01 -0500 Subject: [PATCH] =?UTF-8?q?(Apple)=20Fix=20mapping=20of=20gamepad=20negati?= =?UTF-8?q?ve=20axis;=20the=20input=20binding=20menu=20now=20polls=20the?= =?UTF-8?q?=20proper=20gamepad=20rather=20than=20always=20polling=20player?= =?UTF-8?q?=201=E2=80=99s.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apple/OSX/settings.m | 7 ++++--- apple/iOS/menu.m | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) 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;