diff --git a/config.def.h b/config.def.h index 5187c08a67..baa9068185 100644 --- a/config.def.h +++ b/config.def.h @@ -406,6 +406,7 @@ static const struct retro_keybind retro_keybinds_1[] = { { true, RARCH_ENABLE_HOTKEY, RETROK_UNKNOWN, NO_BTN, AXIS_NONE }, { true, RARCH_VOLUME_UP, RETROK_KP_PLUS, NO_BTN, AXIS_NONE }, { true, RARCH_VOLUME_DOWN, RETROK_KP_MINUS, NO_BTN, AXIS_NONE }, + { true, RARCH_OVERLAY_NEXT, RETROK_UNKNOWN, NO_BTN, AXIS_NONE }, }; // Player 2-5 diff --git a/driver.h b/driver.h index 404012c924..60f9762dbe 100644 --- a/driver.h +++ b/driver.h @@ -99,6 +99,7 @@ enum // RetroArch specific bind IDs. RARCH_ENABLE_HOTKEY, RARCH_VOLUME_UP, RARCH_VOLUME_DOWN, + RARCH_OVERLAY_NEXT, #ifdef RARCH_CONSOLE RARCH_CHEAT_INPUT, diff --git a/input/input_common.c b/input/input_common.c index ece76fd3ec..104bf190a0 100644 --- a/input/input_common.c +++ b/input/input_common.c @@ -539,6 +539,7 @@ static const struct str_to_bind_map str_to_bind[] = { { "enable_hotkey", RARCH_ENABLE_HOTKEY }, { "volume_up", RARCH_VOLUME_UP }, { "volume_down", RARCH_VOLUME_DOWN }, + { "overlay_next", RARCH_OVERLAY_NEXT }, }; unsigned input_str_to_bind(const char *str) diff --git a/retroarch.c b/retroarch.c index 2cc0614590..a308b273dd 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2310,8 +2310,8 @@ static void check_turbo(void) #ifdef HAVE_XML static void check_shader_dir(void) { - static bool old_pressed_next = false; - static bool old_pressed_prev = false; + static bool old_pressed_next; + static bool old_pressed_prev; if (!g_extern.shader_dir.list || !driver.video->set_shader) return; @@ -2370,9 +2370,9 @@ static void check_cheats(void) if (!g_extern.cheat) return; - static bool old_pressed_prev = false; - static bool old_pressed_next = false; - static bool old_pressed_toggle = false; + static bool old_pressed_prev; + static bool old_pressed_next; + static bool old_pressed_toggle; bool pressed_next = input_key_pressed_func(RARCH_CHEAT_INDEX_PLUS); bool pressed_prev = input_key_pressed_func(RARCH_CHEAT_INDEX_MINUS); @@ -2394,7 +2394,7 @@ static void check_cheats(void) #if defined(HAVE_SCREENSHOTS) && !defined(_XBOX) static void check_screenshot(void) { - static bool old_pressed = false; + static bool old_pressed; bool pressed = input_key_pressed_func(RARCH_SCREENSHOT); if (pressed && !old_pressed) take_screenshot(); @@ -2409,7 +2409,7 @@ static void check_dsp_config(void) if (!g_extern.audio_data.dsp_plugin || !g_extern.audio_data.dsp_plugin->config) return; - static bool old_pressed = false; + static bool old_pressed; bool pressed = input_key_pressed_func(RARCH_DSP_CONFIG); if (pressed && !old_pressed) g_extern.audio_data.dsp_plugin->config(g_extern.audio_data.dsp_handle); @@ -2424,7 +2424,7 @@ static void check_mute(void) if (!g_extern.audio_active) return; - static bool old_pressed = false; + static bool old_pressed; bool pressed = input_key_pressed_func(RARCH_MUTE); if (pressed && !old_pressed) { @@ -2475,7 +2475,7 @@ static void check_volume(void) #ifdef HAVE_NETPLAY static void check_netplay_flip(void) { - static bool old_pressed = false; + static bool old_pressed; bool pressed = input_key_pressed_func(RARCH_NETPLAY_FLIP); if (pressed && !old_pressed) netplay_flip_players(g_extern.netplay); @@ -2497,6 +2497,19 @@ static void check_block_hotkey(void) driver.block_hotkey = !input_key_pressed_func(RARCH_ENABLE_HOTKEY); } +static void check_overlay(void) +{ + if (!driver.overlay) + return; + + static bool old_pressed; + bool pressed = input_key_pressed_func(RARCH_OVERLAY_NEXT); + if (pressed && !old_pressed) + input_overlay_next(driver.overlay); + + old_pressed = pressed; +} + static void do_state_checks(void) { check_block_hotkey(); @@ -2510,6 +2523,7 @@ static void do_state_checks(void) #endif check_turbo(); + check_overlay(); #ifdef HAVE_NETPLAY if (!g_extern.netplay) diff --git a/retroarch.cfg b/retroarch.cfg index 0af2040e6b..928e2e4d44 100644 --- a/retroarch.cfg +++ b/retroarch.cfg @@ -356,6 +356,9 @@ # Decreases audio volume. # input_volume_down = kp_minus +# Toggles to next overlay. Wraps around. +# input_overlay_next = + #### Misc # Enable rewinding. This will take a performance hit when playing, so it is disabled by default. diff --git a/settings.c b/settings.c index 3be4b24ee7..89716575a2 100644 --- a/settings.c +++ b/settings.c @@ -678,6 +678,7 @@ static const struct bind_map bind_maps[MAX_PLAYERS][RARCH_BIND_LIST_END_NULL] = DECLARE_BIND(enable_hotkey, RARCH_ENABLE_HOTKEY), DECLARE_BIND(volume_up, RARCH_VOLUME_UP), DECLARE_BIND(volume_down, RARCH_VOLUME_DOWN), + DECLARE_BIND(overlay_next, RARCH_OVERLAY_NEXT), }, { DECL_PLAYER(2) }, diff --git a/tools/retroarch-joyconfig.c b/tools/retroarch-joyconfig.c index 0fdca81d3b..fd43fe5da0 100644 --- a/tools/retroarch-joyconfig.c +++ b/tools/retroarch-joyconfig.c @@ -122,6 +122,7 @@ static struct bind binds[] = { MISC_BIND("Hotkey enable", enable_hotkey), MISC_BIND("Volume up", volume_up), MISC_BIND("Volume down", volume_down), + MISC_BIND("Next overlay", overlay_next), }; #define MAX_BUTTONS 32