mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Merge pull request #11552 from sonninnos/turbo-single-hold
Add hold mode for turbo fire 'Single Button'
This commit is contained in:
commit
380e878c66
@ -69,6 +69,7 @@ enum input_turbo_mode
|
||||
{
|
||||
INPUT_TURBO_MODE_CLASSIC = 0,
|
||||
INPUT_TURBO_MODE_SINGLEBUTTON,
|
||||
INPUT_TURBO_MODE_SINGLEBUTTON_HOLD,
|
||||
INPUT_TURBO_MODE_LAST
|
||||
};
|
||||
|
||||
|
@ -6155,7 +6155,10 @@ static void setting_get_string_representation_turbo_mode(
|
||||
strlcpy(s, "Classic", len);
|
||||
break;
|
||||
case INPUT_TURBO_MODE_SINGLEBUTTON:
|
||||
strlcpy(s, "Single Button", len);
|
||||
strlcpy(s, "Single Button (Toggle)", len);
|
||||
break;
|
||||
case INPUT_TURBO_MODE_SINGLEBUTTON_HOLD:
|
||||
strlcpy(s, "Single Button (Hold)", len);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
14
retroarch.c
14
retroarch.c
@ -22038,7 +22038,9 @@ static int16_t input_state_device(
|
||||
/*
|
||||
* Apply turbo button if activated.
|
||||
*/
|
||||
if (settings->uints.input_turbo_mode == 1)
|
||||
unsigned turbo_mode = settings->uints.input_turbo_mode;
|
||||
|
||||
if (turbo_mode > INPUT_TURBO_MODE_CLASSIC)
|
||||
{
|
||||
/* Pressing turbo button toggles turbo mode on or off.
|
||||
* Holding the button will
|
||||
@ -22080,7 +22082,8 @@ static int16_t input_state_device(
|
||||
/* Avoid detecting buttons being held as multiple toggles */
|
||||
if (!res)
|
||||
p_rarch->input_driver_turbo_btns.turbo_pressed[port] &= ~(1 << id);
|
||||
else if (!(p_rarch->input_driver_turbo_btns.turbo_pressed[port] & (1 << id)))
|
||||
else if (!(p_rarch->input_driver_turbo_btns.turbo_pressed[port] & (1 << id)) &&
|
||||
turbo_mode == INPUT_TURBO_MODE_SINGLEBUTTON)
|
||||
{
|
||||
uint16_t enable_new;
|
||||
p_rarch->input_driver_turbo_btns.turbo_pressed[port] |= 1 << id;
|
||||
@ -22091,6 +22094,13 @@ static int16_t input_state_device(
|
||||
p_rarch->input_driver_turbo_btns.enable[port] = enable_new;
|
||||
}
|
||||
}
|
||||
else if (turbo_mode == INPUT_TURBO_MODE_SINGLEBUTTON_HOLD &&
|
||||
p_rarch->input_driver_turbo_btns.enable[port] &&
|
||||
p_rarch->input_driver_turbo_btns.mode1_enable[port])
|
||||
{
|
||||
/* Hold mode stops turbo on release */
|
||||
p_rarch->input_driver_turbo_btns.mode1_enable[port] = 0;
|
||||
}
|
||||
|
||||
if (!res && p_rarch->input_driver_turbo_btns.mode1_enable[port] &&
|
||||
p_rarch->input_driver_turbo_btns.enable[port] & (1 << id))
|
||||
|
Loading…
x
Reference in New Issue
Block a user