Moved input_overlay_add_inputs call out of input_driver.c, shortened arguments.

This commit is contained in:
denu8thell 2017-08-08 02:31:26 -05:00
parent 3d4e36455d
commit 4c31d41920
3 changed files with 44 additions and 44 deletions

View File

@ -419,15 +419,10 @@ void input_poll(void)
settings->floats.input_overlay_opacity,
settings->uints.input_analog_dpad_mode[0],
input_driver_axis_threshold);
rarch_joypad_info_t joypad_info;
//TODO: Make this work for an arbitrary joypad, set up in the settings
joypad_info.axis_threshold = input_driver_axis_threshold;
joypad_info.joy_idx = settings->uints.input_joypad_map[0];
joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx];
input_overlay_add_inputs(overlay_ptr, &joypad_info, libretro_input_binds, 0,
RETRO_DEVICE_JOYPAD, settings->uints.input_analog_dpad_mode[0]);
/*input_overlay_add_inputs(overlay_ptr, 0,
settings->uints.input_analog_dpad_mode[0]);
*/
}
#endif

View File

@ -575,6 +575,7 @@ void input_poll_overlay(input_overlay_t *ol, float opacity, unsigned analog_dpad
settings_t *settings = config_get_ptr();
uint16_t key_mod = 0;
bool polled = false;
bool button_pressed = false;
input_overlay_state_t *ol_state = &ol->overlay_state;
if (!ol_state)
@ -703,7 +704,8 @@ void input_poll_overlay(input_overlay_t *ol, float opacity, unsigned analog_dpad
break;
}
if (polled)
button_pressed = input_overlay_add_inputs(ol, 0, analog_dpad_mode);
if (button_pressed || polled)
input_overlay_post_poll(ol, opacity);
else
input_overlay_poll_clear(ol, opacity);
@ -746,43 +748,46 @@ void input_state_overlay(input_overlay_t *ol, int16_t *ret,
}
}
void input_overlay_add_inputs(input_overlay_t *ol, rarch_joypad_info_t *joy_info, const struct retro_keybind **keybinds,
unsigned port, unsigned device, unsigned analog_dpad_mode)
bool input_overlay_add_inputs(input_overlay_t *ol,
unsigned port, unsigned analog_dpad_mode)
{
int i;
uint64_t mask;
int id;
//Only do joypad stuff for now
if(device == RETRO_DEVICE_JOYPAD){
input_overlay_state_t *ol_state = &ol->overlay_state;
for(i = 0; i < ol->active->size; i++)
bool button_pressed = false;
input_overlay_state_t *ol_state = &ol->overlay_state;
if(!ol_state)
return false;
for(i = 0; i < ol->active->size; i++)
{
overlay_desc_t *desc = &(ol->active->descs[i]);
switch(desc->type)
{
overlay_desc_t *desc = &(ol->active->descs[i]);
switch(desc->type)
{
case OVERLAY_TYPE_BUTTONS:
//Get the button ID
mask = desc->key_mask;
id = RETRO_DEVICE_ID_JOYPAD_B-1;
while(mask > 0){
id+=1;
mask = mask >> 1;
}
if(input_state(port, device, 0, id)){
desc->updated = true;
}
break;
case OVERLAY_TYPE_ANALOG_LEFT:
break;
case OVERLAY_TYPE_ANALOG_RIGHT:
break;
case OVERLAY_TYPE_KEYBOARD:
break;
default:
break;
}
case OVERLAY_TYPE_BUTTONS:
//Get the button ID
mask = desc->key_mask;
id = RETRO_DEVICE_ID_JOYPAD_B-1;
while(mask > 0){
id+=1;
mask = mask >> 1;
}
//light up the button if pressed
if(input_state(port, RETRO_DEVICE_JOYPAD, 0, id)){
desc->updated = true;
button_pressed = true;
}
break;
case OVERLAY_TYPE_ANALOG_LEFT:
case OVERLAY_TYPE_ANALOG_RIGHT:
break;
case OVERLAY_TYPE_KEYBOARD:
break;
default:
break;
}
}
settings_t *settings = config_get_ptr();
input_overlay_post_poll(ol, settings->floats.input_overlay_opacity);
return button_pressed;
}

View File

@ -248,10 +248,10 @@ void input_state_overlay(input_overlay_t *ol,
* input_overlay_add_inputs:
* @ol : pointer to overlay
*
* Adds inputs from current_input to the overlay, so it's displayed
* Adds inputs from current_input to the overlay, so it's displayed
* returns true if an input that is pressed will change the overlay
*/
void input_overlay_add_inputs(input_overlay_t *ol, rarch_joypad_info_t *joy_info, const struct retro_keybind **keybinds,
unsigned port, unsigned device, unsigned analog_dpad_mode);
bool input_overlay_add_inputs(input_overlay_t *ol, unsigned port, unsigned analog_dpad_mode);
bool input_overlay_key_pressed(input_overlay_t *ol, int key);