From ac6c576d29aeeb29c403a4b58956fd167ada3be8 Mon Sep 17 00:00:00 2001 From: Themaister Date: Fri, 26 Apr 2013 23:52:29 +0200 Subject: [PATCH] Drop dependency on delay_timer in RGUI. --- driver.c | 9 --------- frontend/menu/menu_common.c | 9 ++++++--- frontend/menu/menu_common.h | 3 +++ frontend/menu/rgui.c | 28 ++++++++++++++++------------ retroarch.c | 1 - 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/driver.c b/driver.c index d4f3cf808d..8352bebf69 100644 --- a/driver.c +++ b/driver.c @@ -361,15 +361,6 @@ void init_drivers(void) adjust_system_rates(); - // Readjust timers first before resetting frame count. - for (unsigned i = 0; i < ARRAY_SIZE(g_extern.delay_timer); i++) - { - if (g_extern.delay_timer[i] > g_extern.frame_count) - g_extern.delay_timer[i] -= g_extern.frame_count; - else - g_extern.delay_timer[i] = 0; - } - g_extern.frame_count = 0; init_video_input(); diff --git a/frontend/menu/menu_common.c b/frontend/menu/menu_common.c index 23305fb507..bb3e7f9406 100644 --- a/frontend/menu/menu_common.c +++ b/frontend/menu/menu_common.c @@ -444,6 +444,7 @@ bool menu_iterate(void) rgui->need_refresh = true; g_extern.lifecycle_mode_state &= ~(1ULL << MODE_MENU_PREINIT); + rgui->old_input_state |= 1ULL << DEVICE_NAV_MENU; } rarch_input_poll(); @@ -464,13 +465,14 @@ bool menu_iterate(void) if (!first_held) { first_held = true; - g_extern.delay_timer[1] = g_extern.frame_count + (initial_held ? 15 : 7); + rgui->delay_timer = initial_held ? 12 : 6; + rgui->delay_count = 0; } - if (g_extern.frame_count >= g_extern.delay_timer[1]) + if (rgui->delay_count >= rgui->delay_timer) { first_held = false; - rgui->trigger_state = input_state; //second input frame set as current frame + rgui->trigger_state = input_state; } initial_held = false; @@ -481,6 +483,7 @@ bool menu_iterate(void) initial_held = true; } + rgui->delay_count++; rgui->old_input_state = input_state; input_entry_ret = rgui_iterate(rgui); diff --git a/frontend/menu/menu_common.h b/frontend/menu/menu_common.h index 09baeffa5e..1537eb1046 100644 --- a/frontend/menu/menu_common.h +++ b/frontend/menu/menu_common.h @@ -181,6 +181,9 @@ typedef struct uint64_t trigger_state; bool do_held; + unsigned delay_timer; + unsigned delay_count; + uint16_t *frame_buf; size_t frame_buf_pitch; bool frame_buf_show; diff --git a/frontend/menu/rgui.c b/frontend/menu/rgui.c index e3b65f204a..907685d692 100644 --- a/frontend/menu/rgui.c +++ b/frontend/menu/rgui.c @@ -2071,7 +2071,6 @@ static const struct retro_keybind *menu_nav_binds[] = { int rgui_input_postprocess(void *data, uint64_t old_state) { (void)data; - (void)old_state; int ret = 0; @@ -2084,16 +2083,15 @@ int rgui_input_postprocess(void *data, uint64_t old_state) ret = -1; } - if (g_extern.frame_count >= g_extern.delay_timer[0]) + if ((rgui->trigger_state & (1ULL << DEVICE_NAV_MENU)) && + g_extern.main_is_init && + !g_extern.libretro_dummy) { - if ((rgui->trigger_state & (1ULL << DEVICE_NAV_MENU)) && g_extern.main_is_init) - { - if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_INGAME)) - g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU_INGAME_EXIT); - - g_extern.lifecycle_mode_state |= (1ULL << MODE_GAME); - ret = -1; - } + if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_INGAME)) + g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU_INGAME_EXIT); + + g_extern.lifecycle_mode_state |= (1ULL << MODE_GAME); + ret = -1; } if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_INGAME_EXIT) && @@ -2146,8 +2144,14 @@ uint64_t rgui_input(void) input_state |= input_key_pressed_func(RARCH_MENU_TOGGLE) ? (1ULL << DEVICE_NAV_MENU) : 0; #endif - rgui->trigger_state = input_state & ~(rgui->old_input_state); - rgui->do_held = (input_state & ((1ULL << DEVICE_NAV_UP) | (1ULL << DEVICE_NAV_DOWN) | (1ULL << DEVICE_NAV_LEFT) | (1ULL << DEVICE_NAV_RIGHT))) && !(input_state & ((1ULL << DEVICE_NAV_MENU))); + rgui->trigger_state = input_state & ~rgui->old_input_state; + + rgui->do_held = (input_state & ( + (1ULL << DEVICE_NAV_UP) | + (1ULL << DEVICE_NAV_DOWN) | + (1ULL << DEVICE_NAV_LEFT) | + (1ULL << DEVICE_NAV_RIGHT))) && + !(input_state & DEVICE_NAV_MENU); return input_state; } diff --git a/retroarch.c b/retroarch.c index a884573431..fdda8946d2 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2920,7 +2920,6 @@ static inline bool check_enter_rgui(void) g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU_INGAME); g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU); - g_extern.delay_timer[0] = g_extern.frame_count + 30; // FIXME: Purge. Should do something similar in RGUI as well. old_rmenu_toggle = true; return true; }