From 54c25229795bf372e1502dbe0bb18fbfe254e94f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 5 Oct 2014 05:18:46 +0200 Subject: [PATCH] Refine check_oneshot function - we no longer need g_extern.is_oneshot anymore --- driver.h | 2 +- general.h | 1 - runloop.c | 12 +++++------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/driver.h b/driver.h index 05252bd8c1..22d5fc40f6 100644 --- a/driver.h +++ b/driver.h @@ -676,7 +676,7 @@ extern rarch_joypad_driver_t *joypad_drivers[]; #define check_netplay_flip_func(trigger_input) check_netplay_flip(BIND_PRESSED(trigger_input, RARCH_NETPLAY_FLIP), BIND_PRESSED(trigger_input, RARCH_FULLSCREEN_TOGGLE_KEY)) #define check_overlay_func(input, old_input) rarch_check_overlay(BIND_PRESSED(input, RARCH_OVERLAY_NEXT), BIND_PRESSED(old_input, RARCH_OVERLAY_NEXT)) -#define check_oneshot_func(trigger_input) check_oneshot(BIND_PRESSED(trigger_input, RARCH_FRAMEADVANCE), BIND_PRESSED(trigger_input, RARCH_REWIND)) +#define check_oneshot_func(trigger_input) (check_is_oneshot(BIND_PRESSED(trigger_input, RARCH_FRAMEADVANCE), BIND_PRESSED(trigger_input, RARCH_REWIND))) #define check_slowmotion_func(input) check_slowmotion(BIND_PRESSED(input, RARCH_SLOWMOTION)) #define check_shader_dir_func(trigger_input) check_shader_dir(BIND_PRESSED(trigger_input, RARCH_SHADER_NEXT), BIND_PRESSED(trigger_input, RARCH_SHADER_PREV)) #define check_enter_menu_func(input) BIND_PRESSED(input, RARCH_MENU_TOGGLE) diff --git a/general.h b/general.h index be24c0e342..cc142332ed 100644 --- a/general.h +++ b/general.h @@ -645,7 +645,6 @@ struct global /* Lifecycle state checks. */ bool is_paused; - bool is_oneshot; bool is_menu; bool is_slowmotion; diff --git a/runloop.c b/runloop.c index 010e6ab059..4023dad8a4 100644 --- a/runloop.c +++ b/runloop.c @@ -137,11 +137,11 @@ static void check_pause(bool pressed, bool frameadvance_pressed) } } -static inline void check_oneshot(bool oneshot_pressed, bool rewind_pressed) +/* Rewind buttons works like FRAMEREWIND when paused. + * We will one-shot in that case. */ +static inline bool check_is_oneshot(bool oneshot_pressed, bool rewind_pressed) { - /* Rewind buttons works like FRAMEREWIND when paused. - * We will one-shot in that case. */ - g_extern.is_oneshot = oneshot_pressed | rewind_pressed; + return (oneshot_pressed | rewind_pressed); } /* To avoid continous switching if we hold the button down, we require @@ -464,12 +464,10 @@ static int do_state_checks( #endif check_pause_func(trigger_input); - check_oneshot_func(trigger_input); - if (check_fullscreen_func(trigger_input) && g_extern.is_paused) rarch_render_cached_frame(); - if (g_extern.is_paused && !g_extern.is_oneshot) + if (g_extern.is_paused && !check_oneshot_func(trigger_input)) return 1; check_fast_forward_button_func(input, old_input, trigger_input);