From 0b95a8838aff721da64fd10a9e79b51101d3880e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 12 Jun 2020 00:30:24 +0200 Subject: [PATCH] (OSX) Cleanups --- input/drivers/cocoa_input.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/input/drivers/cocoa_input.c b/input/drivers/cocoa_input.c index 8bf97fd9b4..39b5181b5b 100644 --- a/input/drivers/cocoa_input.c +++ b/input/drivers/cocoa_input.c @@ -292,7 +292,6 @@ static int16_t cocoa_pointer_state(cocoa_input_data_t *apple, static int16_t cocoa_is_pressed( const input_device_driver_t *joypad, - const input_device_driver_t *sec_joypad, rarch_joypad_info_t *joypad_info, const struct retro_keybind *binds, unsigned port, unsigned id) @@ -308,14 +307,6 @@ static int16_t cocoa_is_pressed( if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis)) / 0x8000) > joypad_info->axis_threshold) return 1; -#ifdef HAVE_MFI - if ((uint16_t)joykey != NO_BTN && sec_joypad->button( - joypad_info->joy_idx, (uint16_t)joykey)) - return 1; - if (((float)abs(sec_joypad->axis(joypad_info->joy_idx, joyaxis)) - / 0x8000) > joypad_info->axis_threshold) - return 1; -#endif return 0; } @@ -336,11 +327,17 @@ static int16_t cocoa_input_state(void *data, for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) { if (apple_key_state[rarch_keysym_lut[binds[port][i].key]]) - return 1; - if (cocoa_is_pressed( - apple->joypad, apple->sec_joypad, + ret |= (1 << i); + else if (cocoa_is_pressed( + apple->joypad, joypad_info, binds[port], port, i)) ret |= (1 << i); +#ifdef HAVE_MFI + else if (cocoa_is_pressed( + apple->sec_joypad, + joypad_info, binds[port], port, i)) + ret |= (1 << i); +#endif } return ret; } @@ -349,9 +346,16 @@ static int16_t cocoa_input_state(void *data, if (id < RARCH_BIND_LIST_END) if (apple_key_state[rarch_keysym_lut[binds[port][id].key]]) return 1; - return cocoa_is_pressed( - apple->joypad, apple->sec_joypad, - joypad_info, binds[port], port, id); + if (cocoa_is_pressed( + apple->joypad, + joypad_info, binds[port], port, id)) + return 1; +#ifdef HAVE_MFI + if (cocoa_is_pressed( + apple->sec_joypad, + joypad_info, binds[port], port, id)) + return 1; +#endif } break; case RETRO_DEVICE_ANALOG: