diff --git a/android/phoenix/src/com/retroarch/browser/HistorySelection.java b/android/phoenix/src/com/retroarch/browser/HistorySelection.java index a0e3746311..e7f76ecdfa 100644 --- a/android/phoenix/src/com/retroarch/browser/HistorySelection.java +++ b/android/phoenix/src/com/retroarch/browser/HistorySelection.java @@ -78,7 +78,7 @@ public final class HistorySelection extends DialogFragment adapter = new IconAdapter(ctx, R.layout.line_list_item); // Populate the adapter - File history = new File(ctx.getApplicationInfo().dataDir, "retroarch-content-history.txt"); + File history = new File(ctx.getApplicationInfo().dataDir, "content_history.rpl"); try { BufferedReader br = new BufferedReader(new InputStreamReader( diff --git a/android/phoenix/src/com/retroarch/browser/preferences/util/UserPreferences.java b/android/phoenix/src/com/retroarch/browser/preferences/util/UserPreferences.java index 9c6031bdbf..c15a9bf7dc 100644 --- a/android/phoenix/src/com/retroarch/browser/preferences/util/UserPreferences.java +++ b/android/phoenix/src/com/retroarch/browser/preferences/util/UserPreferences.java @@ -253,7 +253,7 @@ public final class UserPreferences } config.setBoolean("video_font_enable", prefs.getBoolean("video_font_enable", true)); - config.setString("game_history_path", dataDir + "/retroarch-content-history.txt"); + config.setString("content_history_path", dataDir + "/content_history.rpl"); // FIXME: This is incomplete. Need analog axes as well. for (int i = 1; i <= 4; i++) diff --git a/configuration.c b/configuration.c index 0347ae6919..6afc0df4c6 100644 --- a/configuration.c +++ b/configuration.c @@ -1529,8 +1529,8 @@ static bool config_load_file(const char *path, bool set_defaults) CONFIG_GET_BOOL_BASE(conf, settings, history_list_enable, "history_list_enable"); - CONFIG_GET_PATH_BASE(conf, settings, content_history_path, "game_history_path"); - CONFIG_GET_INT_BASE(conf, settings, content_history_size, "game_history_size"); + CONFIG_GET_PATH_BASE(conf, settings, content_history_path, "content_history_path"); + CONFIG_GET_INT_BASE(conf, settings, content_history_size, "content_history_size"); CONFIG_GET_INT_BASE(conf, settings, input.turbo_period, "input_turbo_period"); CONFIG_GET_INT_BASE(conf, settings, input.turbo_duty_cycle, "input_duty_cycle"); @@ -1601,13 +1601,13 @@ static bool config_load_file(const char *path, bool set_defaults) { fill_pathname_join(settings->content_history_path, settings->content_history_directory, - "retroarch-content-history.txt", + "content_history.rpl", sizeof(settings->content_history_path)); } else { fill_pathname_resolve_relative(settings->content_history_path, - global->config_path, "retroarch-content-history.txt", + global->config_path, "content_history.rpl", sizeof(settings->content_history_path)); } } @@ -2438,8 +2438,8 @@ bool config_save_file(const char *path) settings->menu.title_color); #endif - config_set_path(conf, "game_history_path", settings->content_history_path); - config_set_int(conf, "game_history_size", settings->content_history_size); + config_set_path(conf, "content_history_path", settings->content_history_path); + config_set_int(conf, "content_history_size", settings->content_history_size); config_set_path(conf, "joypad_autoconfig_dir", settings->input.autoconfig_dir); config_set_bool(conf, "input_autodetect_enable", diff --git a/frontend/frontend.c b/frontend/frontend.c index 67f47cda31..69fd4dff65 100644 --- a/frontend/frontend.c +++ b/frontend/frontend.c @@ -180,8 +180,10 @@ static void history_playlist_push(content_playlist_t *playlist, if (global->system.no_content || *tmp) content_playlist_push(playlist, *tmp ? tmp : NULL, + NULL, core_path, - info->library_name); + info->library_name, + NULL); } /** diff --git a/menu/menu.c b/menu/menu.c index fc8e3c4acd..50845a45a7 100644 --- a/menu/menu.c +++ b/menu/menu.c @@ -69,8 +69,10 @@ static void push_to_history_playlist(void) content_playlist_push(g_defaults.history, global->fullpath, + NULL, settings->libretro, - global->menu.info.library_name); + global->menu.info.library_name, + NULL); } /** diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index e5d1217a33..644a98d1ae 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -725,13 +725,15 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, char path_copy[PATH_MAX_LENGTH]; const char *core_name = NULL; const char *path = NULL; + const char *label = NULL; + const char *crc32 = NULL; strlcpy(path_copy, info->path, sizeof(path_copy)); path = path_copy; content_playlist_get_index(playlist, i, - &path, NULL, &core_name); + &path, &label, NULL, &core_name, &crc32); strlcpy(fill_buf, core_name, sizeof(fill_buf)); if (path) @@ -741,7 +743,8 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, fill_short_pathname_representation(path_short, path, sizeof(path_short)); snprintf(fill_buf,sizeof(fill_buf),"%s (%s)", - path_short, core_name); + (label && label[0] != '\0') ? label : path_short, + core_name); } if (!strcmp(path_playlist, "collection")) diff --git a/menu/menu_entries_cbs_deferred_push.c b/menu/menu_entries_cbs_deferred_push.c index 9a54f65093..2a1fd70c72 100644 --- a/menu/menu_entries_cbs_deferred_push.c +++ b/menu/menu_entries_cbs_deferred_push.c @@ -301,7 +301,7 @@ static int deferred_push_cursor_manager_list(menu_displaylist_info_t *info) static int deferred_push_content_collection_list(menu_displaylist_info_t *info) { info->type_default = MENU_FILE_PLAIN; - strlcpy(info->exts, "cfg", sizeof(info->exts)); + strlcpy(info->exts, "rpl", sizeof(info->exts)); return menu_displaylist_push_list(info, DISPLAYLIST_DATABASE_PLAYLISTS); } @@ -413,7 +413,7 @@ static int deferred_push_video_font_path(menu_displaylist_info_t *info) static int deferred_push_content_history_path(menu_displaylist_info_t *info) { info->type_default = MENU_FILE_PLAIN; - strlcpy(info->exts, "cfg", sizeof(info->exts)); + strlcpy(info->exts, "rpl", sizeof(info->exts)); return menu_displaylist_push_list(info, DISPLAYLIST_CONTENT_HISTORY); } @@ -578,7 +578,7 @@ void menu_entries_cbs_init_bind_deferred_push(menu_file_list_cbs_t *cbs, cbs->action_deferred_push = deferred_push_input_osk_overlay; else if (!strcmp(label, "video_font_path")) cbs->action_deferred_push = deferred_push_video_font_path; - else if (!strcmp(label, "game_history_path")) + else if (!strcmp(label, "content_history_path")) cbs->action_deferred_push = deferred_push_content_history_path; else if (!strcmp(label, "detect_core_list")) cbs->action_deferred_push = deferred_push_detect_core_list; diff --git a/playlist.c b/playlist.c index 35d53eb3a5..1b40826f76 100644 --- a/playlist.c +++ b/playlist.c @@ -36,24 +36,30 @@ **/ void content_playlist_get_index(content_playlist_t *playlist, size_t idx, - const char **path, const char **core_path, - const char **core_name) + const char **path, const char **label, + const char **core_path, const char **core_name, + const char **crc32) { if (!playlist) return; if (path) *path = playlist->entries[idx].path; + if (label) + *label = playlist->entries[idx].label; if (core_path) *core_path = playlist->entries[idx].core_path; if (core_name) *core_name = playlist->entries[idx].core_name; + if (crc32) + *crc32 = playlist->entries[idx].crc32; } void content_playlist_get_index_by_path(content_playlist_t *playlist, const char *search_path, - char **path, char **core_path, - char **core_name) + char **path, char **label, + char **core_path, char **core_name, + char **crc32) { size_t i; if (!playlist) @@ -66,10 +72,14 @@ void content_playlist_get_index_by_path(content_playlist_t *playlist, if (path) *path = playlist->entries[i].path; + if (label) + *label = playlist->entries[i].label; if (core_path) *core_path = playlist->entries[i].core_path; if (core_name) *core_name = playlist->entries[i].core_name; + if (crc32) + *crc32 = playlist->entries[i].crc32; break; } @@ -89,13 +99,23 @@ static void content_playlist_free_entry(content_playlist_entry_t *entry) if (entry->path) free(entry->path); entry->path = NULL; + + if (entry->label) + free(entry->label); + entry->label = NULL; + if (entry->core_path) free(entry->core_path); entry->core_path = NULL; + if (entry->core_name) free(entry->core_name); entry->core_name = NULL; + if (entry->crc32) + free(entry->crc32); + entry->crc32 = NULL; + memset(entry, 0, sizeof(*entry)); } @@ -109,8 +129,9 @@ static void content_playlist_free_entry(content_playlist_entry_t *entry) * Push entry to top of playlist. **/ void content_playlist_push(content_playlist_t *playlist, - const char *path, const char *core_path, - const char *core_name) + const char *path, const char *label, + const char *core_path, const char *core_name, + const char *crc32) { size_t i; @@ -119,7 +140,7 @@ void content_playlist_push(content_playlist_t *playlist, if (!core_path || !*core_path || !core_name || !*core_name) { - RARCH_ERR("cannot push NULL or empty core info into the playlist"); + RARCH_ERR("cannot push NULL or empty core info into the playlist.\n"); return; } @@ -165,8 +186,10 @@ void content_playlist_push(content_playlist_t *playlist, (playlist->cap - 1) * sizeof(content_playlist_entry_t)); playlist->entries[0].path = path ? strdup(path) : NULL; + playlist->entries[0].label = label ? strdup(label) : NULL; playlist->entries[0].core_path = strdup(core_path); playlist->entries[0].core_name = strdup(core_name); + playlist->entries[0].crc32 = crc32 ? strdup(crc32) : NULL; playlist->size++; } @@ -184,10 +207,12 @@ void content_playlist_write_file(content_playlist_t *playlist) return; for (i = 0; i < playlist->size; i++) - fprintf(file, "%s\n%s\n%s\n", - playlist->entries[i].path ? playlist->entries[i].path : "", + fprintf(file, "%s\n%s\n%s\n%s\n%s\n", + playlist->entries[i].path ? playlist->entries[i].path : "", + playlist->entries[i].label ? playlist->entries[i].label : "", playlist->entries[i].core_path, - playlist->entries[i].core_name); + playlist->entries[i].core_name, + playlist->entries[i].crc32 ? playlist->entries[i].crc32 : ""); fclose(file); } @@ -247,10 +272,14 @@ size_t content_playlist_size(content_playlist_t *playlist) return playlist->size; } +#ifndef PLAYLIST_ENTRIES +#define PLAYLIST_ENTRIES 5 +#endif + static bool content_playlist_read_file( content_playlist_t *playlist, const char *path) { - char buf[3][1024]; + char buf[PLAYLIST_ENTRIES][1024]; unsigned i; content_playlist_entry_t *entry = NULL; char *last = NULL; @@ -264,7 +293,7 @@ static bool content_playlist_read_file( for (playlist->size = 0; playlist->size < playlist->cap; ) { - for (i = 0; i < 3; i++) + for (i = 0; i < PLAYLIST_ENTRIES; i++) { *buf[i] = '\0'; @@ -278,13 +307,17 @@ static bool content_playlist_read_file( entry = &playlist->entries[playlist->size]; - if (!*buf[1] || !*buf[2]) + if (!*buf[2] || !*buf[3]) continue; if (*buf[0]) - entry->path = strdup(buf[0]); - entry->core_path = strdup(buf[1]); - entry->core_name = strdup(buf[2]); + entry->path = strdup(buf[0]); + if (*buf[1]) + entry->label = strdup(buf[1]); + entry->core_path = strdup(buf[2]); + entry->core_name = strdup(buf[3]); + if (*buf[4]) + entry->crc32 = strdup(buf[4]); playlist->size++; } diff --git a/playlist.h b/playlist.h index 085ed50382..8819a50154 100644 --- a/playlist.h +++ b/playlist.h @@ -27,8 +27,10 @@ extern "C" { typedef struct content_playlist_entry { char *path; + char *label; char *core_path; char *core_name; + char *crc32; } content_playlist_entry_t; typedef struct content_playlist @@ -87,9 +89,10 @@ size_t content_playlist_size(content_playlist_t *playlist); * Gets values of playlist index: **/ void content_playlist_get_index(content_playlist_t *playlist, - size_t index, - const char **path, const char **core_path, - const char **core_name); + size_t idx, + const char **path, const char **label, + const char **core_path, const char **core_name, + const char **crc32); /** * content_playlist_push: @@ -101,13 +104,15 @@ void content_playlist_get_index(content_playlist_t *playlist, * Push entry to top of playlist. **/ void content_playlist_push(content_playlist_t *playlist, - const char *path, const char *core_path, - const char *core_name); + const char *path, const char *label, + const char *core_path, const char *core_name, + const char *crc32); void content_playlist_get_index_by_path(content_playlist_t *playlist, const char *search_path, - char **path, char **core_path, - char **core_name); + char **path, char **label, + char **core_path, char **core_name, + char **crc32); void content_playlist_write_file(content_playlist_t *playlist); diff --git a/retroarch.c b/retroarch.c index 903b6edb08..7bc3424884 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1340,7 +1340,7 @@ void rarch_playlist_load_content(content_playlist_t *playlist, settings_t *settings = config_get_ptr(); content_playlist_get_index(playlist, - idx, &path, &core_path, NULL); + idx, &path, NULL, &core_path, NULL, NULL); strlcpy(settings->libretro, core_path, sizeof(settings->libretro)); diff --git a/retroarch.cfg b/retroarch.cfg index 78aaa39543..c80eb6dfb3 100644 --- a/retroarch.cfg +++ b/retroarch.cfg @@ -69,10 +69,10 @@ # Path to content load history file. # RetroArch keeps track of all content loaded in the menu and from CLI directly for convenient quick loading. # A default path will be assigned if not set. -# game_history_path = +# content_history_path = # Number of entries that will be kept in content history file. -# game_history_size = 100 +# content_history_size = 100 # Sets the "system" directory. # Implementations can query for this directory to load BIOSes, system-specific configs, etc. diff --git a/settings.c b/settings.c index 1318d1917c..67a5414f60 100644 --- a/settings.c +++ b/settings.c @@ -5977,7 +5977,7 @@ static bool setting_append_list_playlist_options( CONFIG_UINT( settings->content_history_size, - "game_history_size", + "content_history_size", "History List Size", default_content_history_size, group_info.name, diff --git a/tasks/task_database.c b/tasks/task_database.c index 560d39f4c7..27a851de3b 100644 --- a/tasks/task_database.c +++ b/tasks/task_database.c @@ -168,7 +168,7 @@ static int database_info_list_iterate_found_match( snprintf(db_crc, sizeof(db_crc), "%s|crc", db_info_entry->crc32); - content_playlist_push(playlist, entry_path, "Test", db_crc); + content_playlist_push(playlist, entry_path, db_info_entry->name, "DETECT", "DETECT", db_crc); content_playlist_write_file(playlist); content_playlist_free(playlist);