From 00bea7f3b2f3038ea01317743fd782431fd8a1ef Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 28 Aug 2020 16:47:20 +0200 Subject: [PATCH] (Cocoa) Optimize button bitmask code - do a bitwise OR on the output of both apple joypad drivers --- input/drivers/cocoa_input.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/input/drivers/cocoa_input.c b/input/drivers/cocoa_input.c index 369576c817..b80baedc70 100644 --- a/input/drivers/cocoa_input.c +++ b/input/drivers/cocoa_input.c @@ -209,22 +209,22 @@ static int16_t cocoa_input_state(void *data, { unsigned i; int16_t ret = 0; - for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) - { - if (binds[port][i].valid) - { - if (button_is_pressed( - apple->joypad, - joypad_info, binds[port], port, i)) - ret |= (1 << i); + int16_t ret = + apple->joypad->state( + joypad_info, binds[port], port) #ifdef HAVE_MFI - else if (button_is_pressed( - apple->sec_joypad, - joypad_info, binds[port], port, i)) - ret |= (1 << i); + | apple->sec_joypad->state( + joypad_info, binds[port], port) #endif - else if (apple_key_state[rarch_keysym_lut[binds[port][i].key]]) - ret |= (1 << i); + ; + + if (!input_dinput.keyboard_mapping_blocked) + { + for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++) + { + if ((binds[port][i].key < RETROK_LAST) && + apple_key_state[rarch_keysym_lut[binds[port][i].key]] & 0x80) + ret |= (1 << i); } } return ret;