diff --git a/driver.c b/driver.c index 2879541aa2..3e47573f3f 100644 --- a/driver.c +++ b/driver.c @@ -392,12 +392,7 @@ void init_drivers(int flags) #ifdef HAVE_MENU if (flags & DRIVER_MENU) - { init_menu(); - - if (driver->menu_ctx && driver->menu_ctx->context_reset) - driver->menu_ctx->context_reset(); - } #endif if (flags & (DRIVER_VIDEO | DRIVER_AUDIO)) diff --git a/menu/menu.c b/menu/menu.c index f98db5bb4b..e564611236 100644 --- a/menu/menu.c +++ b/menu/menu.c @@ -66,6 +66,16 @@ static void draw_frame(void) rarch_render_cached_frame(); } +void menu_context_reset(void) +{ + driver_t *driver = driver_get_ptr(); + if (!driver) + return; + + if (driver->menu_ctx && driver->menu_ctx->context_reset) + driver->menu_ctx->context_reset(); +} + /** * menu_update_libretro_info: * @info : Pointer to system info @@ -74,17 +84,14 @@ static void draw_frame(void) **/ static void menu_update_libretro_info(struct retro_system_info *info) { - driver_t *driver = driver_get_ptr(); - #ifndef HAVE_DYNAMIC retro_get_system_info(info); #endif rarch_main_command(RARCH_CMD_CORE_INFO_INIT); - if (driver->menu_ctx && driver->menu_ctx->context_reset) - driver->menu_ctx->context_reset(); - rarch_main_command(RARCH_CMD_LOAD_CORE_PERSIST); + + menu_context_reset(); } static void menu_environment_get(int *argc, char *argv[], @@ -256,6 +263,7 @@ error: return NULL; } + /** * menu_free_list: * @data : Menu handle. diff --git a/menu/menu.h b/menu/menu.h index 9f87cd6da4..5357a63e13 100644 --- a/menu/menu.h +++ b/menu/menu.h @@ -193,6 +193,8 @@ void menu_free(void *data); **/ bool menu_load_content(void); +void menu_context_reset(void); + void menu_update_system_info(menu_handle_t *menu, bool *load_no_content); void menu_apply_deferred_settings(void); diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 12027523a9..2ecec99ab5 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -164,6 +164,8 @@ void init_menu(void) RARCH_ERR("Cannot initialize menu lists.\n"); rarch_fail(1, "init_menu()"); } + + menu_context_reset(); } menu_handle_t *menu_driver_get_ptr(void)