Drop dependency on delay_timer in RGUI.

This commit is contained in:
Themaister 2013-04-26 23:52:29 +02:00
parent a92ff2a23a
commit ac6c576d29
5 changed files with 25 additions and 25 deletions

View File

@ -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();

View File

@ -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);

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}