mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 12:40:23 +00:00
Add delay + acceleration to volume hotkeys (#13434)
This commit is contained in:
parent
be05a7e194
commit
940f7553fd
31
runloop.c
31
runloop.c
@ -6873,10 +6873,41 @@ static enum runloop_state_enum runloop_check_state(
|
||||
/* Check if we have pressed the AI Service toggle button */
|
||||
HOTKEY_CHECK(RARCH_AI_SERVICE, CMD_EVENT_AI_SERVICE_TOGGLE, true, NULL);
|
||||
|
||||
/* Volume stepping + acceleration */
|
||||
{
|
||||
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))
|
||||
{
|
||||
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_delay_active > 0)
|
||||
volume_hotkey_delay_active--;
|
||||
volume_hotkey_delay = volume_hotkey_delay_active;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
volume_hotkey_delay = 0;
|
||||
volume_hotkey_delay_active = volume_hotkey_delay_default;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
/* Check Netplay */
|
||||
|
Loading…
x
Reference in New Issue
Block a user