mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-26 21:36:26 +00:00
Merge pull request #3868 from libretro/master
Prevent more potential crashes
This commit is contained in:
commit
d1c04ad711
@ -142,7 +142,7 @@ static int16_t linuxraw_input_state(void *data,
|
||||
const struct retro_keybind **binds, unsigned port,
|
||||
unsigned device, unsigned idx, unsigned id)
|
||||
{
|
||||
int16_t ret;
|
||||
int16_t ret = 0;
|
||||
linuxraw_input_t *linuxraw = (linuxraw_input_t*)data;
|
||||
|
||||
switch (device)
|
||||
@ -153,7 +153,8 @@ static int16_t linuxraw_input_state(void *data,
|
||||
input_joypad_pressed(linuxraw->joypad, port, binds[port], id);
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
ret = linuxraw_analog_pressed(linuxraw, binds[port], idx, id);
|
||||
if (binds[port])
|
||||
ret = linuxraw_analog_pressed(linuxraw, binds[port], idx, id);
|
||||
if (!ret && binds[port])
|
||||
ret = input_joypad_analog(linuxraw->joypad, port, idx, id, binds[port]);
|
||||
return ret;
|
||||
|
@ -165,7 +165,7 @@ static int16_t sdl_joypad_device_state(sdl_input_t *sdl, const struct retro_keyb
|
||||
static int16_t sdl_analog_device_state(sdl_input_t *sdl, const struct retro_keybind **binds,
|
||||
unsigned port_num, unsigned idx, unsigned id)
|
||||
{
|
||||
int16_t ret = sdl_analog_pressed(sdl, binds[port_num], idx, id);
|
||||
int16_t ret = binds[port_num] ? sdl_analog_pressed(sdl, binds[port_num], idx, id) : 0;
|
||||
if (!ret && binds[port_num])
|
||||
ret = input_joypad_analog(sdl->joypad, port_num, idx, id, binds[port_num]);
|
||||
return ret;
|
||||
@ -272,7 +272,9 @@ static int16_t sdl_input_state(void *data_, const struct retro_keybind **binds,
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
return sdl_joypad_device_state(data, binds, port, id, &type);
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
return sdl_analog_device_state(data, binds, port, idx, id);
|
||||
{
|
||||
return sdl_analog_device_state(data, binds, port, idx, id);
|
||||
}
|
||||
case RETRO_DEVICE_MOUSE:
|
||||
return sdl_mouse_device_state(data, id);
|
||||
case RETRO_DEVICE_POINTER:
|
||||
|
@ -251,7 +251,7 @@ static int16_t x_input_state(void *data,
|
||||
const struct retro_keybind **binds, unsigned port,
|
||||
unsigned device, unsigned idx, unsigned id)
|
||||
{
|
||||
int16_t ret;
|
||||
int16_t ret = 0;
|
||||
x11_input_t *x11 = (x11_input_t*)data;
|
||||
|
||||
switch (device)
|
||||
@ -264,7 +264,8 @@ static int16_t x_input_state(void *data,
|
||||
case RETRO_DEVICE_KEYBOARD:
|
||||
return x_key_pressed(x11, id);
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
ret = x_pressed_analog(x11, binds[port], idx, id);
|
||||
if (binds[port])
|
||||
ret = x_pressed_analog(x11, binds[port], idx, id);
|
||||
if (!ret && binds[port] && binds[port])
|
||||
ret = input_joypad_analog(x11->joypad, port, idx,
|
||||
id, binds[port]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user