mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
Refactor/reimplement mapper
This commit is contained in:
parent
05187f1a8c
commit
a643f9e07e
@ -45,6 +45,7 @@
|
||||
void input_mapper_poll(input_mapper_t *handle,
|
||||
void *ol_pointer,
|
||||
void *settings_data,
|
||||
void *input_data,
|
||||
unsigned max_users,
|
||||
bool poll_overlay)
|
||||
{
|
||||
@ -53,26 +54,15 @@ void input_mapper_poll(input_mapper_t *handle,
|
||||
input_overlay_t *overlay_pointer = (input_overlay_t*)ol_pointer;
|
||||
#endif
|
||||
settings_t *settings = (settings_t*)settings_data;
|
||||
input_bits_t *current_inputs = (input_bits_t*)input_data;
|
||||
|
||||
memset(handle->keys, 0, sizeof(handle->keys));
|
||||
|
||||
for (i = 0; i < max_users; i++)
|
||||
{
|
||||
input_bits_t current_input;
|
||||
unsigned device = settings->uints.input_libretro_device[i]
|
||||
& RETRO_DEVICE_MASK;
|
||||
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_KEYBOARD:
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
BIT256_CLEAR_ALL_PTR(¤t_input);
|
||||
input_get_state_for_port(settings, i, ¤t_input);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
input_bits_t current_input = *current_inputs++;
|
||||
|
||||
switch (device)
|
||||
{
|
||||
|
@ -45,6 +45,7 @@ typedef struct input_mapper
|
||||
void input_mapper_poll(input_mapper_t *handle,
|
||||
void *overlay_pointer,
|
||||
void *settings_data,
|
||||
void *data,
|
||||
unsigned max_users,
|
||||
bool poll_overlay);
|
||||
|
||||
|
19
retroarch.c
19
retroarch.c
@ -10649,6 +10649,7 @@ static void input_driver_poll(void)
|
||||
size_t i;
|
||||
settings_t *settings = configuration_settings;
|
||||
uint8_t max_users = (uint8_t)input_driver_max_users;
|
||||
input_bits_t current_inputs[MAX_USERS];
|
||||
|
||||
current_input->poll(current_input_data);
|
||||
|
||||
@ -10690,6 +10691,23 @@ static void input_driver_poll(void)
|
||||
#endif
|
||||
if (settings->bools.input_remap_binds_enable && input_driver_mapper)
|
||||
{
|
||||
for (i = 0; i < max_users; i++)
|
||||
{
|
||||
unsigned device = settings->uints.input_libretro_device[i] & RETRO_DEVICE_MASK;
|
||||
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_KEYBOARD:
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
BIT256_CLEAR_ALL_PTR(¤t_inputs[i]);
|
||||
input_get_state_for_port(settings, i, ¤t_inputs[i]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
input_mapper_poll(input_driver_mapper,
|
||||
#ifdef HAVE_OVERLAY
|
||||
overlay_ptr,
|
||||
@ -10697,6 +10715,7 @@ static void input_driver_poll(void)
|
||||
NULL,
|
||||
#endif
|
||||
settings,
|
||||
¤t_inputs,
|
||||
max_users,
|
||||
#ifdef HAVE_OVERLAY
|
||||
(overlay_ptr && overlay_ptr->alive)
|
||||
|
Loading…
Reference in New Issue
Block a user