Create RARCH_MENU_CTL_FRAME

This commit is contained in:
twinaphex 2015-12-06 18:28:37 +01:00
parent bea3f938d9
commit 99ea0095a3
5 changed files with 11 additions and 16 deletions

View File

@ -1527,8 +1527,7 @@ static bool d3d_frame(void *data, const void *frame,
#endif
#ifdef HAVE_MENU
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
menu_driver_frame();
menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL);
#endif
retro_perf_stop(&d3d_frame);

View File

@ -1791,8 +1791,7 @@ static bool gl_frame(void *data, const void *frame,
#if defined(HAVE_MENU)
if (gl->menu_texture_enable)
{
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
menu_driver_frame();
menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL);
if (gl->menu_texture_enable)
gl_draw_texture(gl);

View File

@ -522,8 +522,7 @@ static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width,
SDL_RenderCopyEx(vid->renderer, vid->frame.tex, NULL, NULL, vid->rotation, NULL, SDL_FLIP_NONE);
#ifdef HAVE_MENU
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
menu_driver_frame();
menu_driver_ctl(RARCH_MENU_CTL_FRAME, NULL);
#endif
if (vid->menu.active)

View File

@ -244,13 +244,6 @@ void menu_driver_context_reset(void)
driver->context_reset();
}
void menu_driver_frame(void)
{
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
if (driver->frame)
driver->frame();
}
int menu_driver_bind_init(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx,
@ -642,11 +635,11 @@ error:
return NULL;
}
bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
{
static bool menu_driver_alive = false;
static bool menu_driver_data_own = false;
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
switch (state)
{
@ -655,6 +648,12 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
menu_driver_data_own = false;
menu_driver_ctx = NULL;
break;
case RARCH_MENU_CTL_FRAME:
if (!menu_driver_alive)
return false;
if (driver->frame)
driver->frame();
break;
case RARCH_MENU_CTL_SET_TOGGLE:
menu_driver_toggle(true);
break;

View File

@ -95,6 +95,7 @@ enum rarch_menu_ctl_state
{
RARCH_MENU_CTL_NONE = 0,
RARCH_MENU_CTL_DEINIT,
RARCH_MENU_CTL_FRAME,
RARCH_MENU_CTL_SET_TOGGLE,
RARCH_MENU_CTL_UNSET_TOGGLE,
RARCH_MENU_CTL_SET_ALIVE,
@ -336,8 +337,6 @@ menu_handle_t *menu_driver_get_ptr(void);
void menu_driver_set_texture(void);
void menu_driver_frame(void);
void menu_driver_context_reset(void);
void menu_driver_free(menu_handle_t *menu);