mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 12:40:23 +00:00
Volume hotkey logic+response improvement (#13667)
This commit is contained in:
parent
b697f556e5
commit
977a7d3eb6
28
runloop.c
28
runloop.c
@ -6902,26 +6902,24 @@ static enum runloop_state_enum runloop_check_state(
|
||||
{
|
||||
static unsigned volume_hotkey_delay = 0;
|
||||
static unsigned volume_hotkey_delay_active = 0;
|
||||
unsigned volume_hotkey_delay_default = 15;
|
||||
if (BIT256_GET(current_bits, RARCH_VOLUME_UP))
|
||||
unsigned volume_hotkey_delay_default = 6;
|
||||
bool volume_hotkey_up = BIT256_GET(
|
||||
current_bits, RARCH_VOLUME_UP);
|
||||
bool volume_hotkey_down = BIT256_GET(
|
||||
current_bits, RARCH_VOLUME_DOWN);
|
||||
|
||||
if ( (volume_hotkey_up && !volume_hotkey_down) ||
|
||||
(volume_hotkey_down && !volume_hotkey_up))
|
||||
{
|
||||
if (volume_hotkey_delay > 0)
|
||||
volume_hotkey_delay--;
|
||||
else
|
||||
{
|
||||
command_event(CMD_EVENT_VOLUME_UP, NULL);
|
||||
if (volume_hotkey_delay_active > 0)
|
||||
volume_hotkey_delay_active--;
|
||||
volume_hotkey_delay = volume_hotkey_delay_active;
|
||||
}
|
||||
}
|
||||
else if (BIT256_GET(current_bits, RARCH_VOLUME_DOWN))
|
||||
{
|
||||
if (volume_hotkey_delay > 0)
|
||||
volume_hotkey_delay--;
|
||||
else
|
||||
{
|
||||
command_event(CMD_EVENT_VOLUME_DOWN, NULL);
|
||||
if (volume_hotkey_up)
|
||||
command_event(CMD_EVENT_VOLUME_UP, NULL);
|
||||
else if (volume_hotkey_down)
|
||||
command_event(CMD_EVENT_VOLUME_DOWN, NULL);
|
||||
|
||||
if (volume_hotkey_delay_active > 0)
|
||||
volume_hotkey_delay_active--;
|
||||
volume_hotkey_delay = volume_hotkey_delay_active;
|
||||
|
Loading…
x
Reference in New Issue
Block a user