Remove conditionals for device JOYPAD from input_state callback functions

This commit is contained in:
twinaphex 2017-01-10 17:05:04 +01:00
parent b44b025eab
commit da4d2a9f42
15 changed files with 25 additions and 59 deletions

View File

@ -1122,11 +1122,9 @@ static int16_t android_input_state(void *data,
switch (device)
{
case RETRO_DEVICE_JOYPAD:
if (binds[port] && binds[port][id].valid)
return input_joypad_pressed(android->joypad, joypad_info,
port, binds[port], id) ||
android_keyboard_port_input_pressed(binds[port],id);
break;
return input_joypad_pressed(android->joypad, joypad_info,
port, binds[port], id) ||
android_keyboard_port_input_pressed(binds[port],id);
case RETRO_DEVICE_ANALOG:
if (binds[port])
return input_joypad_analog(android->joypad, joypad_info,

View File

@ -289,16 +289,12 @@ static int16_t cocoa_input_state(void *data,
switch (device)
{
case RETRO_DEVICE_JOYPAD:
if (binds[port] && binds[port][id].valid)
{
return apple_input_is_pressed(port, binds[port], id) ||
input_joypad_pressed(apple->joypad, joypad_info, port, binds[port], id)
return apple_input_is_pressed(port, binds[port], id) ||
input_joypad_pressed(apple->joypad, joypad_info, port, binds[port], id)
#ifdef HAVE_MFI
|| input_joypad_pressed(apple->sec_joypad, joypad_info, port, binds[port], id)
|| input_joypad_pressed(apple->sec_joypad, joypad_info, port, binds[port], id)
#endif
;
}
break;
;
case RETRO_DEVICE_ANALOG:
#ifdef HAVE_MFI
if (binds[port])

View File

@ -63,9 +63,7 @@ static int16_t ctr_input_state(void *data, const struct retro_keybind **binds,
switch (device)
{
case RETRO_DEVICE_JOYPAD:
if (binds[port] && binds[port][id].valid)
return input_joypad_pressed(ctr->joypad, joypad_info, port, binds[port], id);
break;
return input_joypad_pressed(ctr->joypad, joypad_info, port, binds[port], id);
case RETRO_DEVICE_ANALOG:
if (binds[port])
return input_joypad_analog(ctr->joypad, joypad_info, port, idx, id, binds[port]);

View File

@ -481,9 +481,7 @@ static int16_t dinput_input_state(void *data,
switch (device)
{
case RETRO_DEVICE_JOYPAD:
if (binds[port])
return dinput_is_pressed(di, binds[port], port, id);
break;
return dinput_is_pressed(di, binds[port], port, id);
case RETRO_DEVICE_KEYBOARD:
return dinput_keyboard_pressed(di, id);

View File

@ -58,9 +58,7 @@ static int16_t gx_input_state(void *data, const struct retro_keybind **binds,
switch (device)
{
case RETRO_DEVICE_JOYPAD:
if (binds[port] && binds[port][id].valid)
return input_joypad_pressed(gx->joypad, joypad_info, port, binds[port], id);
break;
return input_joypad_pressed(gx->joypad, joypad_info, port, binds[port], id);
case RETRO_DEVICE_ANALOG:
if (binds[port])
return input_joypad_analog(gx->joypad, joypad_info, port, idx, id, binds[port]);

View File

@ -128,10 +128,8 @@ static int16_t linuxraw_input_state(void *data,
switch (device)
{
case RETRO_DEVICE_JOYPAD:
if (binds[port] && binds[port][id].valid)
return linuxraw_is_pressed(linuxraw, binds[port], id) ||
input_joypad_pressed(linuxraw->joypad, joypad_info, port, binds[port], id);
break;
return linuxraw_is_pressed(linuxraw, binds[port], id) ||
input_joypad_pressed(linuxraw->joypad, joypad_info, port, binds[port], id);
case RETRO_DEVICE_ANALOG:
if (binds[port])
ret = linuxraw_analog_pressed(linuxraw, binds[port], idx, id);

View File

@ -118,9 +118,7 @@ static int16_t ps3_input_state(void *data,
switch (device)
{
case RETRO_DEVICE_JOYPAD:
if (binds[port] && binds[port][id].valid)
return input_joypad_pressed(ps3->joypad, joypad_info, port, binds[port], id);
break;
return input_joypad_pressed(ps3->joypad, joypad_info, port, binds[port], id);
case RETRO_DEVICE_ANALOG:
if (binds[port])
return input_joypad_analog(ps3->joypad, joypad_info, port, idx, id, binds[port]);

View File

@ -80,9 +80,7 @@ static int16_t psp_input_state(void *data, const struct retro_keybind **binds,
switch (device)
{
case RETRO_DEVICE_JOYPAD:
if (binds[port] && binds[port][id].valid)
return input_joypad_pressed(psp->joypad, joypad_info, port, binds[port], id);
break;
return input_joypad_pressed(psp->joypad, joypad_info, port, binds[port], id);
case RETRO_DEVICE_ANALOG:
if (binds[port])
return input_joypad_analog(psp->joypad, joypad_info, port, idx, id, binds[port]);

View File

@ -783,16 +783,12 @@ static int16_t qnx_input_state(void *data,
switch (device)
{
case RETRO_DEVICE_JOYPAD:
if (binds[port] && binds[port][id].valid)
return qnx_is_pressed(qnx, binds[port], port, id);
break;
return qnx_is_pressed(qnx, binds[port], port, id);
case RETRO_DEVICE_KEYBOARD:
return qnx_keyboard_pressed(qnx, id);
break;
return qnx_keyboard_pressed(qnx, id);
case RETRO_DEVICE_POINTER:
case RARCH_DEVICE_POINTER_SCREEN:
return qnx_pointer_input_state(qnx, idx, id, device == RARCH_DEVICE_POINTER_SCREEN);
break;
default:
break;
}

View File

@ -150,15 +150,11 @@ static int16_t rwebinput_input_state(void *data, const struct retro_keybind **bi
switch (device)
{
case RETRO_DEVICE_JOYPAD:
if (binds[port] && binds[port][id].valid)
return rwebinput_is_pressed(rwebinput, binds[port], id);
break;
return rwebinput_is_pressed(rwebinput, binds[port], id);
case RETRO_DEVICE_ANALOG:
return rwebinput_analog_pressed(rwebinput, binds[port], idx, id);
case RETRO_DEVICE_KEYBOARD:
return rwebinput_key_pressed(rwebinput, id);
case RETRO_DEVICE_MOUSE:
return rwebinput_mouse_state(rwebinput, id);
}

View File

@ -119,7 +119,7 @@ static int16_t sdl_joypad_device_state(sdl_input_t *sdl, const struct retro_keyb
settings_t *settings = config_get_ptr();
const struct retro_keybind *binds = binds_[port];
if (binds && binds[id].valid && sdl_is_pressed(sdl, port, binds, id))
if (sdl_is_pressed(sdl, port, binds, id))
{
*device = INPUT_DEVICE_TYPE_KEYBOARD;
return 1;
@ -129,7 +129,7 @@ static int16_t sdl_joypad_device_state(sdl_input_t *sdl, const struct retro_keyb
joypad_info.auto_binds = settings->input.autoconf_binds[port];
joypad_info.axis_threshold = settings->input.axis_threshold;
if (binds && binds[id].valid && input_joypad_pressed(sdl->joypad, joypad_info, 0, binds, id))
if (input_joypad_pressed(sdl->joypad, joypad_info, 0, binds, id))
{
*device = INPUT_DEVICE_TYPE_JOYPAD;
return 1;

View File

@ -510,10 +510,8 @@ static int16_t udev_input_state(void *data, const struct retro_keybind **binds,
switch (device)
{
case RETRO_DEVICE_JOYPAD:
if (binds[port] && binds[port][id].valid)
return udev_input_is_pressed(binds[port], id) ||
input_joypad_pressed(udev->joypad, joypad_info, port, binds[port], id);
break;
return udev_input_is_pressed(binds[port], id) ||
input_joypad_pressed(udev->joypad, joypad_info, port, binds[port], id);
case RETRO_DEVICE_ANALOG:
ret = udev_analog_pressed(binds[port], idx, id);
if (!ret && binds[port])

View File

@ -65,9 +65,7 @@ static int16_t wiiu_input_state(void *data, const struct retro_keybind **binds,
switch (device)
{
case RETRO_DEVICE_JOYPAD:
if (binds[port][id].valid)
return input_joypad_pressed(wiiu->joypad, joypad_info, port, binds[port], id);
break;
return input_joypad_pressed(wiiu->joypad, joypad_info, port, binds[port], id);
case RETRO_DEVICE_ANALOG:
if (binds[port])
return input_joypad_analog(wiiu->joypad, joypad_info, port, idx, id, binds[port]);

View File

@ -235,10 +235,8 @@ static int16_t x_input_state(void *data,
switch (device)
{
case RETRO_DEVICE_JOYPAD:
if (binds[port] && binds[port][id].valid)
return x_is_pressed(x11, binds[port], id) ||
input_joypad_pressed(x11->joypad, joypad_info, port, binds[port], id);
break;
return x_is_pressed(x11, binds[port], id) ||
input_joypad_pressed(x11->joypad, joypad_info, port, binds[port], id);
case RETRO_DEVICE_KEYBOARD:
return x_key_pressed(x11, id);
case RETRO_DEVICE_ANALOG:

View File

@ -65,9 +65,7 @@ static int16_t xdk_input_state(void *data, const struct retro_keybind **binds,
switch (device)
{
case RETRO_DEVICE_JOYPAD:
if (binds[port] && binds[port][id].valid)
return input_joypad_pressed(xdk->joypad, joypad_info, port, binds[port], id);
break;
return input_joypad_pressed(xdk->joypad, joypad_info, port, binds[port], id);
case RETRO_DEVICE_ANALOG:
if (binds[port])
return input_joypad_analog(xdk->joypad, joypad_info, port, index, id, binds[port]);