mirror of
https://github.com/libretro/RetroArch
synced 2025-04-25 09:02:44 +00:00
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
@ -478,6 +478,7 @@ static int16_t input_state_wrap(
|
|||||||
{
|
{
|
||||||
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
|
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
|
||||||
{
|
{
|
||||||
|
if (joypad)
|
||||||
ret |= joypad->state(
|
ret |= joypad->state(
|
||||||
joypad_info, binds[port], port);
|
joypad_info, binds[port], port);
|
||||||
#ifdef HAVE_MFI
|
#ifdef HAVE_MFI
|
||||||
@ -504,6 +505,8 @@ 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 (joypad)
|
||||||
|
{
|
||||||
if ((uint16_t)joykey != NO_BTN && joypad->button(
|
if ((uint16_t)joykey != NO_BTN && joypad->button(
|
||||||
port, (uint16_t)joykey))
|
port, (uint16_t)joykey))
|
||||||
return 1;
|
return 1;
|
||||||
@ -511,7 +514,10 @@ static int16_t input_state_wrap(
|
|||||||
((float)abs(joypad->axis(port, joyaxis))
|
((float)abs(joypad->axis(port, joyaxis))
|
||||||
/ 0x8000) > axis_threshold)
|
/ 0x8000) > axis_threshold)
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
#ifdef HAVE_MFI
|
#ifdef HAVE_MFI
|
||||||
|
if (sec_joypad)
|
||||||
|
{
|
||||||
if ((uint16_t)joykey != NO_BTN && sec_joypad->button(
|
if ((uint16_t)joykey != NO_BTN && sec_joypad->button(
|
||||||
port, (uint16_t)joykey))
|
port, (uint16_t)joykey))
|
||||||
return 1;
|
return 1;
|
||||||
@ -519,12 +525,13 @@ static int16_t input_state_wrap(
|
|||||||
((float)abs(sec_joypad->axis(port, joyaxis))
|
((float)abs(sec_joypad->axis(port, joyaxis))
|
||||||
/ 0x8000) > axis_threshold)
|
/ 0x8000) > axis_threshold)
|
||||||
return 1;
|
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…
x
Reference in New Issue
Block a user