mirror of
https://github.com/libretro/RetroArch
synced 2025-04-18 14:42:30 +00:00
Simplify input_state_device:
* run it within a loop internally for button_mask enabled * only one function call invocation in codebase
This commit is contained in:
parent
66ad300515
commit
0b9bc85ddd
21
retroarch.c
21
retroarch.c
@ -22293,10 +22293,14 @@ static int16_t input_state_device(
|
|||||||
unsigned idx, unsigned id,
|
unsigned idx, unsigned id,
|
||||||
bool button_mask)
|
bool button_mask)
|
||||||
{
|
{
|
||||||
|
unsigned i;
|
||||||
int16_t res = 0;
|
int16_t res = 0;
|
||||||
settings_t *settings = p_rarch->configuration_settings;
|
settings_t *settings = p_rarch->configuration_settings;
|
||||||
input_mapper_t *handle = &p_rarch->input_driver_mapper;
|
input_mapper_t *handle = &p_rarch->input_driver_mapper;
|
||||||
|
unsigned iterations = button_mask ? RARCH_FIRST_CUSTOM_BIND : 1;
|
||||||
|
|
||||||
|
for (i = 0; i < iterations; i++, id++)
|
||||||
|
{
|
||||||
switch (device)
|
switch (device)
|
||||||
{
|
{
|
||||||
case RETRO_DEVICE_JOYPAD:
|
case RETRO_DEVICE_JOYPAD:
|
||||||
@ -22578,6 +22582,8 @@ static int16_t input_state_device(
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -22691,16 +22697,11 @@ static int16_t input_state(unsigned port, unsigned device,
|
|||||||
if ( (p_rarch->input_driver_flushing_input == 0)
|
if ( (p_rarch->input_driver_flushing_input == 0)
|
||||||
&& !p_rarch->input_driver_block_libretro_input)
|
&& !p_rarch->input_driver_block_libretro_input)
|
||||||
{
|
{
|
||||||
if ( (device == RETRO_DEVICE_JOYPAD) &&
|
bool button_mask = (device == RETRO_DEVICE_JOYPAD) &&
|
||||||
(id == RETRO_DEVICE_ID_JOYPAD_MASK))
|
(id == RETRO_DEVICE_ID_JOYPAD_MASK);
|
||||||
{
|
|
||||||
unsigned i;
|
result = input_state_device(p_rarch, ret, port, device, idx,
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
button_mask ? 0 : id, button_mask);
|
||||||
if (input_state_device(p_rarch, ret, port, device, idx, i, true))
|
|
||||||
result |= (1 << i);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
result = input_state_device(p_rarch, ret, port, device, idx, id, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_BSV_MOVIE
|
#ifdef HAVE_BSV_MOVIE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user