(OSX) Cleanups

This commit is contained in:
twinaphex 2020-06-12 00:30:24 +02:00
parent ecfdc867f8
commit 0b95a8838a

View File

@ -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: