diff --git a/input/drivers_joypad/mfi_joypad.m b/input/drivers_joypad/mfi_joypad.m index 3926dadec5..db368027be 100644 --- a/input/drivers_joypad/mfi_joypad.m +++ b/input/drivers_joypad/mfi_joypad.m @@ -176,7 +176,7 @@ bool apple_gamecontroller_joypad_init(void *data) { static bool inited = false; if (inited) - return true; + return true; if (!apple_gamecontroller_available()) return false; @@ -196,7 +196,7 @@ bool apple_gamecontroller_joypad_init(void *data) } ]; #endif - return true; + return true; } static void apple_gamecontroller_joypad_destroy(void) @@ -205,21 +205,21 @@ static void apple_gamecontroller_joypad_destroy(void) static bool apple_gamecontroller_joypad_button(unsigned port, uint16_t joykey) { - driver_t *driver = driver_get_ptr(); - cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data; - - if (joykey == NO_BTN) - return false; - - /* Check hat. */ - if (GET_HAT_DIR(joykey)) - return false; - - /* Check the button. */ - if ((port < MAX_USERS) && (joykey < 32)) - return ((apple->mfi_buttons[port] & (1 << joykey)) != 0); - ; - return false; + driver_t *driver = driver_get_ptr(); + cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data; + + if (joykey == NO_BTN) + return false; + + /* Check hat. */ + if (GET_HAT_DIR(joykey)) + return false; + + /* Check the button. */ + if ((port < MAX_USERS) && (joykey < 32)) + return ((apple->mfi_buttons[port] & (1 << joykey)) != 0); + ; + return false; } static uint64_t apple_gamecontroller_joypad_get_buttons(unsigned port) @@ -233,31 +233,31 @@ static uint64_t apple_gamecontroller_joypad_get_buttons(unsigned port) static int16_t apple_gamecontroller_joypad_axis(unsigned port, uint32_t joyaxis) { - driver_t *driver = driver_get_ptr(); - cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data; - int16_t val = 0; - - if (joyaxis == AXIS_NONE) - return 0; - if (!apple) - return 0; - - if (AXIS_NEG_GET(joyaxis) < 4) - { - val += apple->axes[port][AXIS_NEG_GET(joyaxis)]; - - if (val >= 0) - val = 0; - } - else if(AXIS_POS_GET(joyaxis) < 4) - { - val += apple->axes[port][AXIS_POS_GET(joyaxis)]; - - if (val <= 0) - val = 0; - } - - return val; + driver_t *driver = driver_get_ptr(); + cocoa_input_data_t *apple = (cocoa_input_data_t*)driver->input_data; + int16_t val = 0; + + if (joyaxis == AXIS_NONE) + return 0; + if (!apple) + return 0; + + if (AXIS_NEG_GET(joyaxis) < 4) + { + val += apple->axes[port][AXIS_NEG_GET(joyaxis)]; + + if (val >= 0) + val = 0; + } + else if(AXIS_POS_GET(joyaxis) < 4) + { + val += apple->axes[port][AXIS_POS_GET(joyaxis)]; + + if (val <= 0) + val = 0; + } + + return val; } static bool apple_gamecontroller_joypad_query_pad(unsigned pad)