input_state_wrap - do not attempt to access joypad or sec_joypad
pointers if non-NULL
This commit is contained in:
parent
cf7b30481b
commit
46fb61bede
41
retroarch.c
41
retroarch.c
|
@ -478,8 +478,9 @@ static int16_t input_state_wrap(
|
||||||
{
|
{
|
||||||
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
|
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
|
||||||
{
|
{
|
||||||
ret |= joypad->state(
|
if (joypad)
|
||||||
joypad_info, binds[port], port);
|
ret |= joypad->state(
|
||||||
|
joypad_info, binds[port], port);
|
||||||
#ifdef HAVE_MFI
|
#ifdef HAVE_MFI
|
||||||
if (sec_joypad)
|
if (sec_joypad)
|
||||||
ret |= sec_joypad->state(
|
ret |= sec_joypad->state(
|
||||||
|
@ -504,27 +505,33 @@ static int16_t input_state_wrap(
|
||||||
const uint32_t joyaxis = (bind_joyaxis != AXIS_NONE)
|
const uint32_t joyaxis = (bind_joyaxis != AXIS_NONE)
|
||||||
? bind_joyaxis : autobind_joyaxis;
|
? bind_joyaxis : autobind_joyaxis;
|
||||||
|
|
||||||
if ((uint16_t)joykey != NO_BTN && joypad->button(
|
if (joypad)
|
||||||
port, (uint16_t)joykey))
|
{
|
||||||
return 1;
|
if ((uint16_t)joykey != NO_BTN && joypad->button(
|
||||||
if (joyaxis != AXIS_NONE &&
|
port, (uint16_t)joykey))
|
||||||
((float)abs(joypad->axis(port, joyaxis))
|
return 1;
|
||||||
/ 0x8000) > axis_threshold)
|
if (joyaxis != AXIS_NONE &&
|
||||||
return 1;
|
((float)abs(joypad->axis(port, joyaxis))
|
||||||
|
/ 0x8000) > axis_threshold)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#ifdef HAVE_MFI
|
#ifdef HAVE_MFI
|
||||||
if ((uint16_t)joykey != NO_BTN && sec_joypad->button(
|
if (sec_joypad)
|
||||||
port, (uint16_t)joykey))
|
{
|
||||||
return 1;
|
if ((uint16_t)joykey != NO_BTN && sec_joypad->button(
|
||||||
if (joyaxis != AXIS_NONE &&
|
port, (uint16_t)joykey))
|
||||||
((float)abs(sec_joypad->axis(port, joyaxis))
|
return 1;
|
||||||
/ 0x8000) > axis_threshold)
|
if (joyaxis != AXIS_NONE &&
|
||||||
return 1;
|
((float)abs(sec_joypad->axis(port, joyaxis))
|
||||||
|
/ 0x8000) > axis_threshold)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_input->input_state)
|
if (current_input && current_input->input_state)
|
||||||
ret |= current_input->input_state(
|
ret |= current_input->input_state(
|
||||||
data,
|
data,
|
||||||
joypad,
|
joypad,
|
||||||
|
|
Loading…
Reference in New Issue