(Drivers joypad) Cleanups

This commit is contained in:
twinaphex 2019-07-16 14:41:09 +02:00
parent f1ea1f1845
commit 67c70de8f3
2 changed files with 16 additions and 13 deletions

View File

@ -65,11 +65,14 @@ static void apple_gamecontroller_joypad_poll_internal(GCController *controller)
buttons = &mfi_buttons[slot];
/* retain the values from the paused controller handler and pass them through */
if (@available(iOS 13, *)) {
if (@available(iOS 13, *))
{
// The menu button can be pressed/unpressed like any other button in iOS 13
// so no need to passthrough anything
*buttons = 0;
} else {
}
else
{
// Use the paused controller handler for iOS versions below 13
pause = *buttons & (1 << RETRO_DEVICE_ID_JOYPAD_START);
select = *buttons & (1 << RETRO_DEVICE_ID_JOYPAD_SELECT);
@ -103,7 +106,8 @@ static void apple_gamecontroller_joypad_poll_internal(GCController *controller)
#endif
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 || __TV_OS_VERSION_MAX_ALLOWED >= 130000
if (@available(iOS 13, *)) {
if (@available(iOS 13, *))
{
// Support "Options" button present in PS4 / XBox One controllers
*buttons |= gp.buttonOptions.pressed ? (1 << RETRO_DEVICE_ID_JOYPAD_SELECT) : 0;

View File

@ -47,19 +47,18 @@ static bool qnx_joypad_init(void *data)
static bool qnx_joypad_button(unsigned port_num, uint16_t joykey)
{
qnx_input_t *qnx = (qnx_input_t*)input_driver_get_data();
if (!qnx || port_num >= MAX_PADS)
return 0;
qnx_input_device_t* controller = NULL;
qnx_input_t *qnx = (qnx_input_t*)input_driver_get_data();
qnx_input_device_t* controller = NULL;
controller = (qnx_input_device_t*)&qnx->devices[port_num];
if (!qnx || port_num >= MAX_PADS)
return 0;
if(port_num < MAX_USERS && joykey <= 19)
{
return (controller->buttons & (1 << joykey)) != 0;
}
controller = (qnx_input_device_t*)&qnx->devices[port_num];
return false;
if(port_num < MAX_USERS && joykey <= 19)
return (controller->buttons & (1 << joykey)) != 0;
return false;
}
static int16_t qnx_joypad_axis(unsigned port_num, uint32_t joyaxis)