Don't access driver.menu directly

This commit is contained in:
twinaphex 2015-02-13 23:30:10 +01:00
parent fbff296638
commit 6815604d70

View File

@ -1955,7 +1955,9 @@ void rarch_main_set_state(unsigned cmd)
{ {
case RARCH_ACTION_STATE_MENU_RUNNING: case RARCH_ACTION_STATE_MENU_RUNNING:
#ifdef HAVE_MENU #ifdef HAVE_MENU
if (!driver.menu) {
menu_handle_t *menu = menu_driver_resolve();
if (!menu)
return; return;
if (driver.menu_ctx && driver.menu_ctx->toggle) if (driver.menu_ctx && driver.menu_ctx->toggle)
@ -1975,9 +1977,10 @@ void rarch_main_set_state(unsigned cmd)
g_extern.frontend_key_event = g_extern.system.key_event; g_extern.frontend_key_event = g_extern.system.key_event;
g_extern.system.key_event = menu_input_key_event; g_extern.system.key_event = menu_input_key_event;
driver.menu->need_refresh = true; menu->need_refresh = true;
g_extern.system.frame_time_last = 0; g_extern.system.frame_time_last = 0;
g_extern.is_menu = true; g_extern.is_menu = true;
}
#endif #endif
break; break;
case RARCH_ACTION_STATE_LOAD_CONTENT: case RARCH_ACTION_STATE_LOAD_CONTENT:
@ -2158,14 +2161,17 @@ bool rarch_main_command(unsigned cmd)
#endif #endif
break; break;
case RARCH_CMD_LOAD_CORE: case RARCH_CMD_LOAD_CORE:
{
#ifdef HAVE_MENU #ifdef HAVE_MENU
if (driver.menu) menu_handle_t *menu = menu_driver_resolve();
if (menu)
rarch_update_system_info(&g_extern.menu.info, rarch_update_system_info(&g_extern.menu.info,
&driver.menu->load_no_content); &menu->load_no_content);
#endif #endif
#ifndef HAVE_DYNAMIC #ifndef HAVE_DYNAMIC
rarch_main_command(RARCH_CMD_QUIT); rarch_main_command(RARCH_CMD_QUIT);
#endif #endif
}
break; break;
case RARCH_CMD_LOAD_STATE: case RARCH_CMD_LOAD_STATE:
/* Immutable - disallow savestate load when /* Immutable - disallow savestate load when
@ -2220,15 +2226,20 @@ bool rarch_main_command(unsigned cmd)
return false; return false;
break; break;
case RARCH_CMD_PREPARE_DUMMY: case RARCH_CMD_PREPARE_DUMMY:
{
menu_handle_t *menu = menu_driver_resolve();
*g_extern.fullpath = '\0'; *g_extern.fullpath = '\0';
(void)menu;
#ifdef HAVE_MENU #ifdef HAVE_MENU
if (driver.menu) if (menu)
driver.menu->load_no_content = false; menu->load_no_content = false;
#endif #endif
rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT); rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT);
g_extern.system.shutdown = false; g_extern.system.shutdown = false;
}
break; break;
case RARCH_CMD_QUIT: case RARCH_CMD_QUIT:
rarch_main_set_state(RARCH_ACTION_STATE_QUIT); rarch_main_set_state(RARCH_ACTION_STATE_QUIT);
@ -2825,13 +2836,15 @@ void rarch_playlist_load_content(content_playlist_t *playlist,
{ {
const char *path = NULL; const char *path = NULL;
const char *core_path = NULL; const char *core_path = NULL;
menu_handle_t *menu = menu_driver_resolve();
content_playlist_get_index(playlist, content_playlist_get_index(playlist,
idx, &path, &core_path, NULL); idx, &path, &core_path, NULL);
strlcpy(g_settings.libretro, core_path, sizeof(g_settings.libretro)); strlcpy(g_settings.libretro, core_path, sizeof(g_settings.libretro));
driver.menu->load_no_content = (path) ? false : true; if (menu)
menu->load_no_content = (path) ? false : true;
rarch_environment_cb(RETRO_ENVIRONMENT_EXEC, (void*)path); rarch_environment_cb(RETRO_ENVIRONMENT_EXEC, (void*)path);