Init history file right before we attempt to push something to it

in rarch_main
This commit is contained in:
twinaphex 2014-10-03 13:07:33 +02:00
parent 4f30e1a3d7
commit 4a623684c2
7 changed files with 14 additions and 12 deletions

View File

@ -233,11 +233,13 @@ returntype main_entry(signature())
}
}
rarch_main_command(RARCH_CMD_HISTORY_INIT);
#if defined(HAVE_MENU)
#if defined(RARCH_CONSOLE) || defined(RARCH_MOBILE)
if (ret)
#endif
rarch_playlist_push(g_extern.history, g_extern.fullpath);
rarch_playlist_push(g_defaults.history, g_extern.fullpath);
#endif
#if defined(HAVE_MAIN_LOOP)

View File

@ -791,7 +791,7 @@ static int menu_action_ok(const char *menu_path,
{
case MENU_FILE_PLAYLIST_ENTRY:
rarch_playlist_load_content(g_extern.history,
rarch_playlist_load_content(g_defaults.history,
driver.menu->selection_ptr);
menu_flush_stack_type(driver.menu->menu_stack, MENU_SETTINGS);
return -1;

View File

@ -95,7 +95,7 @@ bool load_menu_content(void)
msg_queue_push(g_extern.msg_queue, str, 1, 1);
}
content_playlist_push(g_extern.history,
content_playlist_push(g_defaults.history,
g_extern.fullpath,
g_settings.libretro,
g_extern.menu.info.library_name);
@ -177,7 +177,6 @@ void *menu_init(const void *data)
menu_shader_manager_init(menu);
rarch_main_command(RARCH_CMD_HISTORY_INIT);
menu->last_time = rarch_get_time_usec();
return menu;

View File

@ -258,7 +258,7 @@ int menu_entries_push_list(menu_handle_t *menu,
else if (!strcmp(label, "history_list"))
{
file_list_clear(list);
list_size = content_playlist_size(g_extern.history);
list_size = content_playlist_size(g_defaults.history);
for (i = 0; i < list_size; i++)
{
@ -266,7 +266,7 @@ int menu_entries_push_list(menu_handle_t *menu,
const char *path = NULL;
const char *core_name = NULL;
content_playlist_get_index(g_extern.history, i,
content_playlist_get_index(g_defaults.history, i,
&path, NULL, &core_name);
strlcpy(fill_buf, core_name, sizeof(fill_buf));

View File

@ -203,6 +203,8 @@ struct defaults
float video_refresh_rate;
bool video_threaded_enable;
} settings;
content_playlist_t *history;
};
/* All config related settings go here. */
@ -436,7 +438,6 @@ struct global
struct string_list *temporary_content;
content_playlist_t *history;
core_info_list_t *core_info;
core_info_t *core_info_current;

View File

@ -2762,7 +2762,7 @@ static void history_playlist_new(void)
g_settings.content_history_path);
if (init_history)
g_extern.history = content_playlist_init(
g_defaults.history = content_playlist_init(
g_settings.content_history_path,
g_settings.content_history_size);
}
@ -2972,9 +2972,9 @@ void rarch_main_command(unsigned cmd)
rarch_main_command(RARCH_CMD_GPU_RECORD_DEINIT);
break;
case RARCH_CMD_HISTORY_DEINIT:
if (g_extern.history)
content_playlist_free(g_extern.history);
g_extern.history = NULL;
if (g_defaults.history)
content_playlist_free(g_defaults.history);
g_defaults.history = NULL;
break;
case RARCH_CMD_RECORD_INIT:
rarch_main_command(RARCH_CMD_HISTORY_DEINIT);

View File

@ -2211,7 +2211,7 @@ rarch_setting_t *setting_data_get_mainmenu(bool regenerate)
#if defined(HAVE_DYNAMIC) || defined(HAVE_LIBRETRO_MANAGEMENT)
CONFIG_BOOL(lists[0], "core_list", "Core", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
#endif
if (g_extern.history)
if (g_defaults.history)
{
CONFIG_BOOL(lists[1], "history_list", "Load Content (History)", false, "", "", GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_FLAGS(SD_FLAG_PUSH_ACTION)
}