mirror of
https://github.com/libretro/RetroArch
synced 2025-03-17 10:21:26 +00:00
Split up input_state into input_state_internal - no longer
rely on recursion of function
This commit is contained in:
parent
6de62dc4b0
commit
a23928fb89
55
retroarch.c
55
retroarch.c
@ -2517,19 +2517,7 @@ static void input_poll(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* input_state:
|
||||
* @port : user number.
|
||||
* @device : device identifier of user.
|
||||
* @idx : index value of user.
|
||||
* @id : identifier of key pressed by user.
|
||||
*
|
||||
* Input state callback function.
|
||||
*
|
||||
* Returns: Non-zero if the given key (identified by @id)
|
||||
* was pressed by the user (assigned to @port).
|
||||
**/
|
||||
int16_t input_state(unsigned port, unsigned device,
|
||||
static int16_t input_state_internal(unsigned port, unsigned device,
|
||||
unsigned idx, unsigned id)
|
||||
{
|
||||
int16_t bsv_result;
|
||||
@ -2541,17 +2529,6 @@ int16_t input_state(unsigned port, unsigned device,
|
||||
is in action for that button*/
|
||||
bool reset_state = false;
|
||||
|
||||
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(port, device, idx, i))
|
||||
res |= (1 << i);
|
||||
return res;
|
||||
}
|
||||
|
||||
device &= RETRO_DEVICE_MASK;
|
||||
|
||||
if (bsv_movie_get_input(&bsv_result))
|
||||
@ -2680,6 +2657,36 @@ int16_t input_state(unsigned port, unsigned device,
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* input_state:
|
||||
* @port : user number.
|
||||
* @device : device identifier of user.
|
||||
* @idx : index value of user.
|
||||
* @id : identifier of key pressed by user.
|
||||
*
|
||||
* Input state callback function.
|
||||
*
|
||||
* Returns: Non-zero if the given key (identified by @id)
|
||||
* was pressed by the user (assigned to @port).
|
||||
**/
|
||||
int16_t input_state(unsigned port, unsigned device,
|
||||
unsigned idx, unsigned id)
|
||||
{
|
||||
if ( (device == RETRO_DEVICE_JOYPAD) &&
|
||||
(id == RETRO_DEVICE_ID_JOYPAD_MASK))
|
||||
{
|
||||
unsigned i;
|
||||
int16_t res = 0;
|
||||
|
||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||
if (input_state_internal(port, device, idx, i))
|
||||
res |= (1 << i);
|
||||
return res;
|
||||
}
|
||||
|
||||
return input_state_internal(port, device, idx, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* state_tracker_update_input:
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user