From 3bd36941a6785e524f16eb1672179bd3087370f0 Mon Sep 17 00:00:00 2001 From: LibretroAdmin Date: Sun, 4 Sep 2022 21:01:18 +0200 Subject: [PATCH] (Menu) Allow the user to use volume up/down/mute hotkeys from within the menu --- runloop.c | 85 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/runloop.c b/runloop.c index ab5fea35f2..f1df58faef 100644 --- a/runloop.c +++ b/runloop.c @@ -7031,6 +7031,7 @@ static enum runloop_state_enum runloop_check_state( old_pressed = pressed; } +#endif /* Check if we have pressed the FPS toggle button */ HOTKEY_CHECK(RARCH_FPS_TOGGLE, CMD_EVENT_FPS_TOGGLE, true, NULL); @@ -7040,47 +7041,6 @@ static enum runloop_state_enum runloop_check_state( /* Check if we have pressed the netplay host toggle button */ HOTKEY_CHECK(RARCH_NETPLAY_HOST_TOGGLE, CMD_EVENT_NETPLAY_HOST_TOGGLE, true, NULL); - if (menu_st->alive) - { - float fastforward_ratio = runloop_get_fastforward_ratio(settings, - &runloop_st->fastmotion_override.current); - - if (!settings->bools.menu_throttle_framerate && !fastforward_ratio) - return RUNLOOP_STATE_MENU_ITERATE; - - return RUNLOOP_STATE_END; - } -#endif - -#ifdef HAVE_NETWORKING - if (netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL)) -#endif - if (pause_nonactive) - focused = is_focused; - -#ifdef HAVE_SCREENSHOTS - /* Check if we have pressed the screenshot toggle button */ - HOTKEY_CHECK(RARCH_SCREENSHOT, CMD_EVENT_TAKE_SCREENSHOT, true, NULL); -#endif - - /* Check if we have pressed the audio mute toggle button */ - HOTKEY_CHECK(RARCH_MUTE, CMD_EVENT_AUDIO_MUTE_TOGGLE, true, NULL); - - /* Check if we have pressed the OSK toggle button */ - HOTKEY_CHECK(RARCH_OSK, CMD_EVENT_OSK_TOGGLE, true, NULL); - - /* Check if we have pressed the recording toggle button */ - HOTKEY_CHECK(RARCH_RECORDING_TOGGLE, CMD_EVENT_RECORDING_TOGGLE, true, NULL); - - /* Check if we have pressed the streaming toggle button */ - HOTKEY_CHECK(RARCH_STREAMING_TOGGLE, CMD_EVENT_STREAMING_TOGGLE, true, NULL); - - /* Check if we have pressed the Run-Ahead toggle button */ - HOTKEY_CHECK(RARCH_RUNAHEAD_TOGGLE, CMD_EVENT_RUNAHEAD_TOGGLE, true, NULL); - - /* 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; @@ -7115,6 +7075,49 @@ static enum runloop_state_enum runloop_check_state( } } + /* Check if we have pressed the audio mute toggle button */ + HOTKEY_CHECK(RARCH_MUTE, CMD_EVENT_AUDIO_MUTE_TOGGLE, true, NULL); + +#ifdef HAVE_MENU + if (menu_st->alive) + { + float fastforward_ratio = runloop_get_fastforward_ratio(settings, + &runloop_st->fastmotion_override.current); + + if (!settings->bools.menu_throttle_framerate && !fastforward_ratio) + return RUNLOOP_STATE_MENU_ITERATE; + + return RUNLOOP_STATE_END; + } +#endif + +#ifdef HAVE_NETWORKING + if (netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL)) +#endif + if (pause_nonactive) + focused = is_focused; + +#ifdef HAVE_SCREENSHOTS + /* Check if we have pressed the screenshot toggle button */ + HOTKEY_CHECK(RARCH_SCREENSHOT, CMD_EVENT_TAKE_SCREENSHOT, true, NULL); +#endif + + /* Check if we have pressed the OSK toggle button */ + HOTKEY_CHECK(RARCH_OSK, CMD_EVENT_OSK_TOGGLE, true, NULL); + + /* Check if we have pressed the recording toggle button */ + HOTKEY_CHECK(RARCH_RECORDING_TOGGLE, CMD_EVENT_RECORDING_TOGGLE, true, NULL); + + /* Check if we have pressed the streaming toggle button */ + HOTKEY_CHECK(RARCH_STREAMING_TOGGLE, CMD_EVENT_STREAMING_TOGGLE, true, NULL); + + /* Check if we have pressed the Run-Ahead toggle button */ + HOTKEY_CHECK(RARCH_RUNAHEAD_TOGGLE, CMD_EVENT_RUNAHEAD_TOGGLE, true, NULL); + + /* Check if we have pressed the AI Service toggle button */ + HOTKEY_CHECK(RARCH_AI_SERVICE, CMD_EVENT_AI_SERVICE_TOGGLE, true, NULL); + + #ifdef HAVE_NETWORKING /* Check Netplay */ HOTKEY_CHECK(RARCH_NETPLAY_PING_TOGGLE, CMD_EVENT_NETPLAY_PING_TOGGLE, true, NULL);