(iOS) Update apple_joypad_ios.c same way

This commit is contained in:
twinaphex 2014-10-05 03:33:26 +02:00
parent aa5ae7fe85
commit 3a0327f67c

View File

@ -43,6 +43,7 @@ static void apple_joypad_destroy(void)
static bool apple_joypad_button(unsigned port, uint16_t joykey)
{
apple_input_data_t *apple = (apple_input_data_t*)driver.input_data;
uint32_t buttons = pad_connection_get_buttons(port);
if (!apple || joykey == NO_BTN)
return false;
@ -50,8 +51,10 @@ static bool apple_joypad_button(unsigned port, uint16_t joykey)
if (GET_HAT_DIR(joykey))
return false;
// Check the button
return (port < MAX_PLAYERS && joykey < 32) ?
(apple->buttons[port] & (1 << joykey)) != 0 : false;
if ((port < MAX_PLAYERS) && (joykey < 32))
return ((apple->buttons[port] & (1 << joykey)) != 0) ||
((buttons & (1 << joykey)) != 0);
return false;
}
static int16_t apple_joypad_axis(unsigned port, uint32_t joyaxis)
@ -65,11 +68,13 @@ static int16_t apple_joypad_axis(unsigned port, uint32_t joyaxis)
if (AXIS_NEG_GET(joyaxis) < 4)
{
val = apple->axes[port][AXIS_NEG_GET(joyaxis)];
val += pad_connection_get_axis(port, AXIS_NEG_GET(joyaxis));
val = (val < 0) ? val : 0;
}
else if(AXIS_POS_GET(joyaxis) < 4)
{
val = apple->axes[port][AXIS_POS_GET(joyaxis)];
val += pad_connection_get_axis(port, AXIS_POS_GET(joyaxis));
val = (val > 0) ? val : 0;
}