mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 13:23:32 +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,
|
||||
bool button_mask)
|
||||
{
|
||||
unsigned i;
|
||||
int16_t res = 0;
|
||||
settings_t *settings = p_rarch->configuration_settings;
|
||||
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)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
@ -22578,6 +22582,8 @@ static int16_t input_state_device(
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -22691,16 +22697,11 @@ static int16_t input_state(unsigned port, unsigned device,
|
||||
if ( (p_rarch->input_driver_flushing_input == 0)
|
||||
&& !p_rarch->input_driver_block_libretro_input)
|
||||
{
|
||||
if ( (device == RETRO_DEVICE_JOYPAD) &&
|
||||
(id == RETRO_DEVICE_ID_JOYPAD_MASK))
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||
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);
|
||||
bool button_mask = (device == RETRO_DEVICE_JOYPAD) &&
|
||||
(id == RETRO_DEVICE_ID_JOYPAD_MASK);
|
||||
|
||||
result = input_state_device(p_rarch, ret, port, device, idx,
|
||||
button_mask ? 0 : id, button_mask);
|
||||
}
|
||||
|
||||
#ifdef HAVE_BSV_MOVIE
|
||||
|
Loading…
x
Reference in New Issue
Block a user