mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Should hopefully fix most of the remaining issues
This commit is contained in:
parent
d6901685f7
commit
8ce882c829
@ -1112,13 +1112,15 @@ static int16_t android_input_state(void *data,
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
if (binds[port][id].valid)
|
||||
if (binds[port] && binds[port][id].valid)
|
||||
return input_joypad_pressed(android->joypad, port, binds[port], id) ||
|
||||
android_keyboard_port_input_pressed(binds[port],id);
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
return input_joypad_analog(android->joypad, port, idx, id,
|
||||
binds[port]);
|
||||
if (binds[port])
|
||||
return input_joypad_analog(android->joypad, port, idx, id,
|
||||
binds[port]);
|
||||
break;
|
||||
case RETRO_DEVICE_POINTER:
|
||||
switch (id)
|
||||
{
|
||||
|
@ -277,7 +277,7 @@ static int16_t cocoa_input_state(void *data,
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
if (binds[port][id].valid)
|
||||
if (binds[port] && binds[port][id].valid)
|
||||
{
|
||||
return apple_input_is_pressed(port, binds[port], id) ||
|
||||
input_joypad_pressed(apple->joypad, port, binds[port], id)
|
||||
@ -291,7 +291,7 @@ static int16_t cocoa_input_state(void *data,
|
||||
#ifdef HAVE_MFI
|
||||
ret = input_joypad_analog(apple->sec_joypad, port,
|
||||
idx, id, binds[port]);
|
||||
if (!ret)
|
||||
if (!ret && binds[port])
|
||||
#endif
|
||||
ret = input_joypad_analog(apple->joypad, port,
|
||||
idx, id, binds[port]);
|
||||
|
@ -57,11 +57,13 @@ static int16_t ctr_input_state(void *data, const struct retro_keybind **binds,
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
if (binds[port][id].valid)
|
||||
if (binds[port] && binds[port][id].valid)
|
||||
return input_joypad_pressed(ctr->joypad, port, binds[port], id);
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
return input_joypad_analog(ctr->joypad, port, idx, id, binds[port]);
|
||||
if (binds[port])
|
||||
return input_joypad_analog(ctr->joypad, port, idx, id, binds[port]);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -281,7 +281,7 @@ static bool dinput_is_pressed(struct dinput_input *di,
|
||||
|
||||
if (!di->blocked && dinput_keyboard_pressed(di, bind->key))
|
||||
return true;
|
||||
if (binds[id].valid && input_joypad_pressed(di->joypad, port, binds, id))
|
||||
if (binds && binds[id].valid && input_joypad_pressed(di->joypad, port, binds, id))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -486,14 +486,15 @@ static int16_t dinput_input_state(void *data,
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
return dinput_is_pressed(di, binds[port], port, id);
|
||||
|
||||
if (binds[port])
|
||||
return dinput_is_pressed(di, binds[port], port, id);
|
||||
break;
|
||||
case RETRO_DEVICE_KEYBOARD:
|
||||
return dinput_keyboard_pressed(di, id);
|
||||
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
ret = dinput_pressed_analog(di, binds[port], idx, id);
|
||||
if (!ret)
|
||||
if (!ret && binds[port])
|
||||
ret = input_joypad_analog(di->joypad, port,
|
||||
idx, id, settings->input.binds[port]);
|
||||
return ret;
|
||||
|
@ -51,11 +51,13 @@ static int16_t gx_input_state(void *data, const struct retro_keybind **binds,
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
if (binds[port][id].valid)
|
||||
if (binds[port] && binds[port][id].valid)
|
||||
return input_joypad_pressed(gx->joypad, port, binds[port], id);
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
return input_joypad_analog(gx->joypad, port, idx, id, binds[port]);
|
||||
if (binds[port])
|
||||
return input_joypad_analog(gx->joypad, port, idx, id, binds[port]);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -82,12 +82,12 @@ static bool linuxraw_key_pressed(linuxraw_input_t *linuxraw, int key)
|
||||
static bool linuxraw_is_pressed(linuxraw_input_t *linuxraw,
|
||||
const struct retro_keybind *binds, unsigned id)
|
||||
{
|
||||
const struct retro_keybind *bind = &binds[id];
|
||||
const struct retro_keybind *bind = binds ? &binds[id] : NULL;
|
||||
|
||||
if (id >= RARCH_BIND_LIST_END)
|
||||
return false;
|
||||
|
||||
return bind->valid && linuxraw_key_pressed(linuxraw, binds[id].key);
|
||||
return bind && bind->valid && linuxraw_key_pressed(linuxraw, binds[id].key);
|
||||
}
|
||||
|
||||
static int16_t linuxraw_analog_pressed(linuxraw_input_t *linuxraw,
|
||||
@ -148,13 +148,13 @@ static int16_t linuxraw_input_state(void *data,
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
if (binds[port][id].valid)
|
||||
if (binds[port] && binds[port][id].valid)
|
||||
return linuxraw_is_pressed(linuxraw, binds[port], id) ||
|
||||
input_joypad_pressed(linuxraw->joypad, port, binds[port], id);
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
ret = linuxraw_analog_pressed(linuxraw, binds[port], idx, id);
|
||||
if (!ret)
|
||||
if (!ret && binds[port])
|
||||
ret = input_joypad_analog(linuxraw->joypad, port, idx, id, binds[port]);
|
||||
return ret;
|
||||
}
|
||||
|
@ -112,11 +112,13 @@ static int16_t ps3_input_state(void *data,
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
if (binds[port][id].valid)
|
||||
if (binds[port] && binds[port][id].valid)
|
||||
return input_joypad_pressed(ps3->joypad, port, binds[port], id);
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
return input_joypad_analog(ps3->joypad, port, idx, id, binds[port]);
|
||||
if (binds[port])
|
||||
return input_joypad_analog(ps3->joypad, port, idx, id, binds[port]);
|
||||
break;
|
||||
#if 0
|
||||
case RETRO_DEVICE_SENSOR_ACCELEROMETER:
|
||||
switch (id)
|
||||
|
@ -74,11 +74,13 @@ static int16_t psp_input_state(void *data, const struct retro_keybind **binds,
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
if (binds[port][id].valid)
|
||||
if (binds[port] && binds[port][id].valid)
|
||||
return input_joypad_pressed(psp->joypad, port, binds[port], id);
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
return input_joypad_analog(psp->joypad, port, idx, id, binds[port]);
|
||||
if (binds[port])
|
||||
return input_joypad_analog(psp->joypad, port, idx, id, binds[port]);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -780,7 +780,7 @@ static int16_t qnx_input_state(void *data,
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
if (binds[port][id].valid)
|
||||
if (binds[port] && binds[port][id].valid)
|
||||
return input_joypad_pressed(qnx->joypad, port, binds[port], id);
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
|
@ -149,7 +149,7 @@ static int16_t rwebinput_input_state(void *data, const struct retro_keybind **bi
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
if (binds[port][id].valid)
|
||||
if (binds[port] && binds[port][id].valid)
|
||||
return rwebinput_is_pressed(rwebinput, binds[port], id);
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
|
@ -147,12 +147,13 @@ static int16_t sdl_joypad_device_state(sdl_input_t *sdl, const struct retro_keyb
|
||||
if (id < RARCH_BIND_LIST_END)
|
||||
{
|
||||
const struct retro_keybind *binds = binds_[port_num];
|
||||
if (binds[id].valid && sdl_is_pressed(sdl, port_num, binds, id))
|
||||
if (binds && binds[id].valid && sdl_is_pressed(sdl, port_num, binds, id))
|
||||
{
|
||||
*device = INPUT_DEVICE_TYPE_KEYBOARD;
|
||||
return 1;
|
||||
}
|
||||
if (binds[id].valid && input_joypad_pressed(sdl->joypad, 0, binds, id))
|
||||
|
||||
if (binds && binds[id].valid && input_joypad_pressed(sdl->joypad, 0, binds, id))
|
||||
{
|
||||
*device = INPUT_DEVICE_TYPE_JOYPAD;
|
||||
return 1;
|
||||
@ -165,7 +166,7 @@ static int16_t sdl_analog_device_state(sdl_input_t *sdl, const struct retro_keyb
|
||||
unsigned port_num, unsigned idx, unsigned id)
|
||||
{
|
||||
int16_t ret = sdl_analog_pressed(sdl, binds[port_num], idx, id);
|
||||
if (!ret)
|
||||
if (!ret && binds[port_num])
|
||||
ret = input_joypad_analog(sdl->joypad, port_num, idx, id, binds[port_num]);
|
||||
return ret;
|
||||
}
|
||||
|
@ -59,11 +59,13 @@ static int16_t xdk_input_state(void *data, const struct retro_keybind **binds,
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
if (binds[port][id].valid)
|
||||
if (binds[port] && binds[port][id].valid)
|
||||
return input_joypad_pressed(xdk->joypad, port, binds[port], id);
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
return input_joypad_analog(xdk->joypad, port, index, id, binds[port]);
|
||||
if (binds[port])
|
||||
return input_joypad_analog(xdk->joypad, port, index, id, binds[port]);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user