Refactor load_menu_content_history

This commit is contained in:
twinaphex 2014-09-03 00:14:02 +02:00
parent bc611b8cc1
commit bc1358a021
5 changed files with 29 additions and 29 deletions

View File

@ -1795,8 +1795,9 @@ static int menu_action_ok(const char *dir, unsigned menu_type)
}
else if (type == MENU_FILE_PLAYLIST_ENTRY)
{
load_menu_content_history(driver.menu->selection_ptr);
menu_flush_stack_type(driver.menu->menu_stack,MENU_SETTINGS);
rarch_playlist_load_content(g_extern.history,
driver.menu->selection_ptr);
menu_flush_stack_type(driver.menu->menu_stack, MENU_SETTINGS);
return -1;
}
else

View File

@ -159,29 +159,6 @@ static void load_menu_content_prepare(void)
MENU_TEXTURE_FULLSCREEN);
}
void load_menu_content_history(unsigned game_index)
{
const char *path = NULL;
const char *core_path = NULL;
const char *core_name = NULL;
if (!driver.menu)
return;
content_playlist_get_index(g_extern.history,
game_index, &path, &core_path, &core_name);
strlcpy(g_settings.libretro, core_path, sizeof(g_settings.libretro));
driver.menu->load_no_content = (path) ? false : true;
rarch_environment_cb(RETRO_ENVIRONMENT_EXEC, (void*)path);
#if defined(HAVE_DYNAMIC)
menu_update_system_info(driver.menu, NULL);
#endif
}
/* Update menu state which depends on config. */
static void menu_update_libretro_info(menu_handle_t *menu)

View File

@ -789,7 +789,11 @@ bool rarch_check_fullscreen(void);
void rarch_disk_control_set_eject(bool state, bool log);
void rarch_disk_control_set_index(unsigned index);
void rarch_disk_control_append_image(const char *path);
bool rarch_set_rumble_state(unsigned port, enum retro_rumble_effect effect, bool enable);
bool rarch_set_rumble_state(unsigned port,
enum retro_rumble_effect effect, bool enable);
void rarch_playlist_load_content(content_playlist_t *playlist,
unsigned index);
/////////

View File

@ -50,10 +50,12 @@ void content_playlist_get_index(content_playlist_t *playlist,
if (!playlist)
return;
*path = playlist->entries[index].path;
if (path)
*path = playlist->entries[index].path;
if (core_path)
*core_path = playlist->entries[index].core_path;
*core_name = playlist->entries[index].core_name;
if (core_name)
*core_name = playlist->entries[index].core_name;
}
static void content_playlist_free_entry(

View File

@ -3304,7 +3304,8 @@ void rarch_main_command(unsigned cmd)
break;
case RARCH_CMD_LOAD_CORE:
#ifdef HAVE_MENU
menu_update_system_info(driver.menu, &driver.menu->load_no_content);
if (driver.menu)
menu_update_system_info(driver.menu, &driver.menu->load_no_content);
#endif
break;
case RARCH_CMD_LOAD_STATE:
@ -3654,6 +3655,21 @@ void rarch_main_deinit(void)
g_extern.main_is_init = false;
}
void rarch_playlist_load_content(content_playlist_t *playlist,
unsigned index)
{
const char *path = NULL;
const char *core_path = NULL;
content_playlist_get_index(playlist,
index, &path, &core_path, NULL);
strlcpy(g_settings.libretro, core_path, sizeof(g_settings.libretro));
rarch_environment_cb(RETRO_ENVIRONMENT_EXEC, (void*)path);
rarch_main_command(RARCH_CMD_LOAD_CORE);
}
void rarch_main_init_wrap(const struct rarch_main_wrap *args,
int *argc, char **argv)
{