From af98ee1c8a2bc01b77082319b454b7ac5f2e002b Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Sun, 25 Sep 2016 00:13:33 -0400 Subject: [PATCH] Add CRC calculation function that works with archives with or without a path inside (first file is used if no path) Add all archive's contents to database scan list when scanning files and directories Allow scanning a single file that is an archive Remove unnecessary prototypes from archive_file.h Simplify retrieving of CRCs from archives when scanning --- database_info.c | 87 ++++++- libretro-common/file/archive_file.c | 212 +++++++++++------ libretro-common/file/archive_file_7z.c | 3 +- libretro-common/file/archive_file_zlib.c | 5 +- libretro-common/file/file_path.c | 4 +- libretro-common/include/file/archive_file.h | 26 +- menu/cbs/menu_cbs_ok.c | 55 +++-- menu/menu_displaylist.c | 248 ++++++++++---------- tasks/task_database.c | 56 +---- tasks/task_decompress.c | 13 +- 10 files changed, 405 insertions(+), 304 deletions(-) diff --git a/database_info.c b/database_info.c index 654932e981..1aae10e5c1 100644 --- a/database_info.c +++ b/database_info.c @@ -2,7 +2,7 @@ * Copyright (C) 2010-2014 - Hans-Kristian Arntzen * Copyright (C) 2011-2016 - Daniel De Matteis * Copyright (C) 2013-2015 - Jason Fetters - * + * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -20,6 +20,8 @@ #include #include +#include +#include #include "list_special.h" #include "database_info.h" @@ -212,7 +214,7 @@ char *bin_to_hex_alloc(const uint8_t *data, size_t len) if (len && !ret) return NULL; - + for (i = 0; i < len; i++) snprintf(ret+i * 2, 3, "%02X", data[i]); return ret; @@ -363,10 +365,10 @@ static int database_cursor_open(libretrodb_t *db, if ((libretrodb_open(path, db)) != 0) return -1; - if (query) + if (query) q = (libretrodb_query_t*)libretrodb_query_compile(db, query, strlen(query), &error); - + if (error) goto error; if ((libretrodb_cursor_open(db, cur, q)) != 0) @@ -398,6 +400,7 @@ database_info_handle_t *database_info_dir_init(const char *dir, { database_info_handle_t *db = (database_info_handle_t*) calloc(1, sizeof(*db)); + int i = 0; if (!db) return NULL; @@ -411,6 +414,47 @@ database_info_handle_t *database_info_dir_init(const char *dir, db->status = DATABASE_STATUS_ITERATE; db->type = type; + if (db->list->size > 0) + { + for (i = 0; i < db->list->size; i++) + { + const char *path = db->list->elems[i].data; + + if (path_is_compressed_file(path)) + { + struct string_list *archive_list = + file_archive_get_file_list(path, NULL); + + if (archive_list && archive_list->size > 0) + { + int i = 0; + + for (i = 0; i < archive_list->size; i++) + { + char new_path[PATH_MAX_LENGTH] = {0}; + size_t path_len = strlen(path); + + strlcpy(new_path, path, sizeof(new_path)); + + if (path_len + strlen(archive_list->elems[i].data) + + 1 < PATH_MAX_LENGTH) + { + new_path[path_len] = '#'; + strlcpy(new_path + path_len + 1, + archive_list->elems[i].data, + sizeof(new_path) - path_len); + } + + string_list_append(db->list, new_path, + archive_list->elems[i].attr); + } + + string_list_free(archive_list); + } + } + } + } + return db; error: @@ -436,6 +480,39 @@ database_info_handle_t *database_info_file_init(const char *path, string_list_append(db->list, path, attr); + if (path_is_compressed_file(path)) + { + struct string_list *archive_list = + file_archive_get_file_list(path, NULL); + + if (archive_list && archive_list->size > 0) + { + int i = 0; + + for (i = 0; i < archive_list->size; i++) + { + char new_path[PATH_MAX_LENGTH] = {0}; + size_t path_len = strlen(path); + + strlcpy(new_path, path, sizeof(new_path)); + + if (path_len + strlen(archive_list->elems[i].data) + + 1 < PATH_MAX_LENGTH) + { + new_path[path_len] = '#'; + strlcpy(new_path + path_len + 1, + archive_list->elems[i].data, + sizeof(new_path) - path_len); + } + + string_list_append(db->list, new_path, + archive_list->elems[i].attr); + } + + string_list_free(archive_list); + } + } + db->list_ptr = 0; db->status = DATABASE_STATUS_ITERATE; db->type = type; @@ -505,7 +582,7 @@ database_info_list_t *database_info_list_new( k++; } - } + } database_info_list->list = database_info; database_info_list->count = k; diff --git a/libretro-common/file/archive_file.c b/libretro-common/file/archive_file.c index 6559e209e5..cfb68db5ae 100644 --- a/libretro-common/file/archive_file.c +++ b/libretro-common/file/archive_file.c @@ -58,7 +58,7 @@ struct file_archive_file_data #ifdef HAVE_MMAP /* Closes, unmaps and frees. */ -void file_archive_free(file_archive_file_data_t *data) +static void file_archive_free(file_archive_file_data_t *data) { if (!data) return; @@ -70,7 +70,7 @@ void file_archive_free(file_archive_file_data_t *data) free(data); } -const uint8_t *file_archive_data(file_archive_file_data_t *data) +static const uint8_t *file_archive_data(file_archive_file_data_t *data) { if (!data) return NULL; @@ -119,7 +119,7 @@ error: #else /* Closes, unmaps and frees. */ -void file_archive_free(file_archive_file_data_t *data) +static void file_archive_free(file_archive_file_data_t *data) { if (!data) return; @@ -128,7 +128,7 @@ void file_archive_free(file_archive_file_data_t *data) free(data); } -const uint8_t *file_archive_data(file_archive_file_data_t *data) +static const uint8_t *file_archive_data(file_archive_file_data_t *data) { if (!data) return NULL; @@ -269,7 +269,7 @@ static int file_archive_extract_cb(const char *name, const char *valid_exts, return 1; } -int file_archive_parse_file_init(file_archive_transfer_t *state, +static int file_archive_parse_file_init(file_archive_transfer_t *state, const char *file) { char *last = NULL; @@ -387,7 +387,10 @@ int file_archive_parse_file_iterate( if (file_archive_parse_file_init(state, file) == 0) { if (userdata) + { userdata->context = state->stream; + strlcpy(userdata->archive_path, file, sizeof(userdata->archive_path)); + } state->type = ARCHIVE_TRANSFER_ITERATE; } else @@ -440,7 +443,7 @@ int file_archive_parse_file_iterate( } /** - * file_archive_parse_file: + * file_archive_walk: * @file : filename path of archive * @valid_exts : Valid extensions of archive to be parsed. * If NULL, allow all. @@ -452,7 +455,7 @@ int file_archive_parse_file_iterate( * * Returns: true (1) on success, otherwise false (0). **/ -static bool file_archive_parse_file(const char *file, const char *valid_exts, +static bool file_archive_walk(const char *file, const char *valid_exts, file_archive_file_cb file_cb, struct archive_extract_userdata *userdata) { file_archive_transfer_t state = {0}; @@ -505,7 +508,7 @@ bool file_archive_extract_file( { struct string_list *list = NULL; bool ret = true; - struct archive_extract_userdata userdata = {0}; + struct archive_extract_userdata userdata = {{0}}; /* We cannot extract if the libretro * implementation does not have any valid extensions. */ @@ -519,7 +522,6 @@ bool file_archive_extract_file( goto end; } - userdata.archive_path = archive_path; userdata.archive_path_size = archive_path_size; userdata.extraction_directory = extraction_directory; userdata.ext = list; @@ -527,7 +529,7 @@ bool file_archive_extract_file( userdata.context = NULL; userdata.list_only = false; - if (!file_archive_parse_file(archive_path, valid_exts, + if (!file_archive_walk(archive_path, valid_exts, file_archive_extract_cb, &userdata)) { /* Parsing file archive failed. */ @@ -563,27 +565,30 @@ end: struct string_list *file_archive_get_file_list(const char *path, const char *valid_exts) { - struct archive_extract_userdata userdata = {0}; + struct archive_extract_userdata userdata = {{0}}; + +#ifdef HAVE_COMPRESSION + if (!path_is_compressed_file(path)) + return NULL; +#else + return NULL; +#endif + userdata.list_only = true; - userdata.archive_path = strdup(path); + strlcpy(userdata.archive_path, path, sizeof(userdata.archive_path)); userdata.list = string_list_new(); if (!userdata.list) goto error; - if (!file_archive_parse_file(path, valid_exts, + if (!file_archive_walk(path, valid_exts, file_archive_get_file_list_cb, &userdata)) goto error; - if (userdata.archive_path) - free(userdata.archive_path); - return userdata.list; error: - if (userdata.archive_path) - free(userdata.archive_path); if (userdata.list) string_list_free(userdata.list); return NULL; @@ -608,7 +613,7 @@ bool file_archive_perform_mode(const char *path, const char *valid_exts, handle.backend = file_archive_get_file_backend(userdata->archive_path); handle.stream = userdata->context; - if (!handle.backend->stream_decompress_data_to_file_init(&handle, + if (!handle.backend || !handle.backend->stream_decompress_data_to_file_init(&handle, cdata, csize, size)) goto error; @@ -633,6 +638,50 @@ error: return false; } +/** + * file_archive_filename_split: + * @str : filename to turn into a string list + * + * Creates a new string list based on filename @path, delimited by a hash (#). + * + * Returns: new string list if successful, otherwise NULL. + */ +static struct string_list *file_archive_filename_split(const char *path) +{ + union string_list_elem_attr attr; + struct string_list *list = string_list_new(); + const char *delim = NULL; + + memset(&attr, 0, sizeof(attr)); + + delim = path_get_archive_delim(path); + + if (delim) + { + /* add archive path to list first */ + if (!string_list_append_n(list, path, delim - path, attr)) + goto error; + + /* now add the path within the archive */ + delim++; + + if (*delim) + { + if (!string_list_append(list, delim, attr)) + goto error; + } + } + else + if (!string_list_append(list, path, attr)) + goto error; + + return list; + +error: + string_list_free(list); + return NULL; +} + /* Generic compressed file loader. * Extracts to buf, unless optional_filename != 0 * Then extracts to optional_filename and leaves buf alone. @@ -685,60 +734,6 @@ error: return 0; } -struct string_list *file_archive_file_list_new(const char *path, - const char* ext) -{ -#ifdef HAVE_COMPRESSION - if (path_is_compressed_file(path)) - return file_archive_get_file_list(path, ext); -#endif - return NULL; -} - -/** - * file_archive_filename_split: - * @str : filename to turn into a string list - * - * Creates a new string list based on filename @path, delimited by a hash (#). - * - * Returns: new string list if successful, otherwise NULL. - */ -struct string_list *file_archive_filename_split(const char *path) -{ - union string_list_elem_attr attr; - struct string_list *list = string_list_new(); - const char *delim = NULL; - - memset(&attr, 0, sizeof(attr)); - - delim = path_get_archive_delim(path); - - if (delim) - { - /* add archive path to list first */ - if (!string_list_append_n(list, path, delim - path, attr)) - goto error; - - /* now add the path within the archive */ - delim++; - - if (*delim) - { - if (!string_list_append(list, delim, attr)) - goto error; - } - } - else - if (!string_list_append(list, path, attr)) - goto error; - - return list; - -error: - string_list_free(list); - return NULL; -} - const struct file_archive_file_backend *file_archive_get_zlib_file_backend(void) { #ifdef HAVE_ZLIB @@ -785,3 +780,74 @@ const struct file_archive_file_backend* file_archive_get_file_backend(const char return NULL; } + +/** + * file_archive_get_file_crc32: + * @path : filename path of archive + * + * Returns: CRC32 of the specified file in the archive, otherwise 0. + * If no path within the archive is specified, the first + * file found inside is used. + **/ +uint32_t file_archive_get_file_crc32(const char *path) +{ + const struct file_archive_file_backend *backend = file_archive_get_file_backend(path); + file_archive_transfer_t state = {0}; + struct archive_extract_userdata userdata = {{0}}; + bool returnerr = false; + bool contains_compressed = false; + const char *archive_path = NULL; + + if (!backend) + return 0; + + contains_compressed = path_contains_compressed_file(path); + + if (contains_compressed) + { + archive_path = path_get_archive_delim(path); + + /* move pointer right after the delimiter to give us the path */ + if (archive_path) + archive_path += 1; + } + + state.type = ARCHIVE_TRANSFER_INIT; + + /* Initialize and open archive first. + Sets next state type to ITERATE. */ + file_archive_parse_file_iterate(&state, + &returnerr, path, NULL, NULL, + &userdata); + + for (;;) + { + /* Now find the first file in the archive. */ + if (state.type == ARCHIVE_TRANSFER_ITERATE) + file_archive_parse_file_iterate(&state, + &returnerr, path, NULL, NULL, + &userdata); + + /* If no path specified within archive, stop after + * finding the first file. + */ + if (!contains_compressed) + break; + + /* Stop when the right file in the archive is found. */ + if (archive_path) + { + if (string_is_equal(userdata.extracted_file_path, archive_path)) + break; + } + else + break; + } + + file_archive_parse_file_iterate_stop(&state); + + if (userdata.crc) + return userdata.crc; + + return 0; +} diff --git a/libretro-common/file/archive_file_7z.c b/libretro-common/file/archive_file_7z.c index 33ae16c4f5..18bfb17ee9 100644 --- a/libretro-common/file/archive_file_7z.c +++ b/libretro-common/file/archive_file_7z.c @@ -393,8 +393,9 @@ static int sevenzip_parse_file_iterate_step(file_archive_transfer_t *state, return ret; userdata->extracted_file_path = filename; + userdata->crc = checksum; - if (!file_cb(filename, valid_exts, cdata, cmode, + if (file_cb && !file_cb(filename, valid_exts, cdata, cmode, csize, size, checksum, userdata)) return 0; diff --git a/libretro-common/file/archive_file_zlib.c b/libretro-common/file/archive_file_zlib.c index 2aa998bd6e..1809c9f40f 100644 --- a/libretro-common/file/archive_file_zlib.c +++ b/libretro-common/file/archive_file_zlib.c @@ -331,7 +331,7 @@ static int zip_file_read( file_archive_transfer_t zlib; bool returnerr = true; int ret = 0; - struct archive_extract_userdata userdata = {0}; + struct archive_extract_userdata userdata = {{0}}; zlib.type = ARCHIVE_TRANSFER_INIT; @@ -448,8 +448,9 @@ static int zip_parse_file_iterate_step(file_archive_transfer_t *state, return ret; userdata->extracted_file_path = filename; + userdata->crc = checksum; - if (!file_cb(filename, valid_exts, cdata, cmode, + if (file_cb && !file_cb(filename, valid_exts, cdata, cmode, csize, size, checksum, userdata)) return 0; diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index 92f715635c..e854deac2e 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -94,7 +94,7 @@ end: * after a compression extension is considered. * * Returns: pointer to the delimiter in the path if it contains - * a compressed file, otherwise NULL. + * a path inside a compressed file, otherwise NULL. */ const char *path_get_archive_delim(const char *path) { @@ -663,7 +663,7 @@ void fill_pathname_join_special_ext(char *out_path, } void fill_pathname_join_concat(char *out_path, - const char *dir, const char *path, + const char *dir, const char *path, const char *concat, size_t size) { diff --git a/libretro-common/include/file/archive_file.h b/libretro-common/include/file/archive_file.h index 617024b7a3..048387c857 100644 --- a/libretro-common/include/file/archive_file.h +++ b/libretro-common/include/file/archive_file.h @@ -96,7 +96,7 @@ typedef struct struct archive_extract_userdata { - char *archive_path; + char archive_path[PATH_MAX_LENGTH]; char *first_extracted_file_path; char *extracted_file_path; const char *extraction_directory; @@ -191,29 +191,25 @@ bool file_archive_perform_mode(const char *name, const char *valid_exts, const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size, uint32_t crc32, struct archive_extract_userdata *userdata); -void file_archive_deflate_init(void *data, int level); - int file_archive_compressed_read( const char* path, void **buf, const char* optional_filename, ssize_t *length); -struct string_list* file_archive_file_list_new(const char *path, - const char *ext); - -struct string_list* file_archive_filename_split(const char *path); - -const uint8_t* file_archive_data(file_archive_file_data_t *data); - -int file_archive_parse_file_init(file_archive_transfer_t *state, - const char *file); - -void file_archive_free(file_archive_file_data_t *data); - const struct file_archive_file_backend* file_archive_get_zlib_file_backend(void); const struct file_archive_file_backend* file_archive_get_7z_file_backend(void); const struct file_archive_file_backend* file_archive_get_file_backend(const char *path); +/** + * file_archive_get_file_crc32: + * @path : filename path of archive + * + * Returns: CRC32 of the specified file in the archive, otherwise 0. + * If no path within the archive is specified, the first + * file found inside is used. + **/ +uint32_t file_archive_get_file_crc32(const char *path); + extern const struct file_archive_file_backend zlib_backend; extern const struct file_archive_file_backend sevenzip_backend; diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index fca8ff197b..3f486b3a59 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -204,7 +204,7 @@ int generic_action_ok_displaylist_push(const char *path, { case ACTION_OK_DL_USER_BINDS_LIST: info.type = type; - info.directory_ptr = idx; + info.directory_ptr = idx; info_path = label; info_label = msg_hash_to_str( MENU_ENUM_LABEL_DEFERRED_USER_BINDS_LIST); @@ -306,7 +306,7 @@ int generic_action_ok_displaylist_push(const char *path, case ACTION_OK_DL_PUSH_DEFAULT: info.type = type; info.directory_ptr = idx; - info_path = label; + info_path = label; info_label = label; dl_type = DISPLAYLIST_GENERIC; break; @@ -314,7 +314,7 @@ int generic_action_ok_displaylist_push(const char *path, menu_displaylist_reset_filebrowser(); info.type = type; info.directory_ptr = idx; - info_path = settings->directory.video_shader; + info_path = settings->directory.video_shader; info_label = label; dl_type = DISPLAYLIST_FILE_BROWSER_SELECT_FILE; break; @@ -864,7 +864,7 @@ static int file_load_with_detect_core_wrapper( sizeof(new_core_path))) ret = -1; - if ( !is_carchive && !string_is_empty(path) + if ( !is_carchive && !string_is_empty(path) && !string_is_empty(menu_path_new)) fill_pathname_join(detect_content_path, menu_path_new, path, sizeof(detect_content_path)); @@ -967,9 +967,9 @@ static int action_ok_playlist_entry_collection(const char *path, selection_ptr = entry_idx; playlist_get_index(playlist, selection_ptr, - &entry_path, &entry_label, &core_path, &core_name, NULL, NULL); - - if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT)) + &entry_path, &entry_label, &core_path, &core_name, NULL, NULL); + + if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT)) && string_is_equal(core_name, file_path_str(FILE_PATH_DETECT))) { core_info_ctx_find_t core_info; @@ -977,9 +977,9 @@ static int action_ok_playlist_entry_collection(const char *path, const char *entry_path = NULL; const char *entry_crc32 = NULL; const char *db_name = NULL; - const char *path_base = + const char *path_base = path_basename(menu->db_playlist_file); - bool found_associated_core = + bool found_associated_core = menu_content_playlist_find_associated_core( path_base, new_core_path, sizeof(new_core_path)); @@ -1055,9 +1055,9 @@ static int action_ok_playlist_entry(const char *path, selection_ptr = entry_idx; playlist_get_index(playlist, selection_ptr, - &entry_path, &entry_label, &core_path, &core_name, NULL, NULL); + &entry_path, &entry_label, &core_path, &core_name, NULL, NULL); - if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT)) + if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT)) && string_is_equal(core_name, file_path_str(FILE_PATH_DETECT))) { core_info_ctx_find_t core_info; @@ -1066,9 +1066,9 @@ static int action_ok_playlist_entry(const char *path, const char *entry_path = NULL; const char *entry_crc32 = NULL; const char *db_name = NULL; - const char *path_base = + const char *path_base = path_basename(menu->db_playlist_file); - bool found_associated_core = + bool found_associated_core = menu_content_playlist_find_associated_core( path_base, new_core_path, sizeof(new_core_path)); @@ -1149,9 +1149,9 @@ static int action_ok_playlist_entry_start_content(const char *path, selection_ptr = rdb_entry_start_game_selection_ptr; playlist_get_index(playlist, selection_ptr, - &entry_path, &entry_label, &core_path, &core_name, NULL, NULL); + &entry_path, &entry_label, &core_path, &core_name, NULL, NULL); - if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT)) + if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT)) && string_is_equal(core_name, file_path_str(FILE_PATH_DETECT))) { core_info_ctx_find_t core_info; @@ -1160,9 +1160,9 @@ static int action_ok_playlist_entry_start_content(const char *path, const char *entry_path = NULL; const char *entry_crc32 = NULL; const char *db_name = NULL; - const char *path_base = + const char *path_base = path_basename(menu->db_playlist_file); - bool found_associated_core = + bool found_associated_core = menu_content_playlist_find_associated_core( path_base, new_core_path, sizeof(new_core_path)); @@ -1270,14 +1270,14 @@ static int generic_action_ok(const char *path, strlcpy(settings->path.menu_wallpaper, action_path, sizeof(settings->path.menu_wallpaper)); - task_push_image_load(action_path, + task_push_image_load(action_path, MENU_ENUM_LABEL_CB_MENU_WALLPAPER, menu_display_handle_wallpaper_upload, NULL); } break; case ACTION_OK_LOAD_CORE: flush_type = MENU_SETTINGS; - + if (generic_action_ok_file_load(action_path, NULL, CORE_TYPE_PLAIN, CONTENT_MODE_LOAD_NOTHING_WITH_NEW_CORE_FROM_MENU) == 0) @@ -2063,7 +2063,7 @@ static int generic_action_ok_network(const char *path, #ifdef HAVE_LAKKA case MENU_ENUM_LABEL_CB_LAKKA_LIST: /* TODO unhardcode this path */ - fill_pathname_join(url_path, + fill_pathname_join(url_path, file_path_str(FILE_PATH_LAKKA_URL), LAKKA_PROJECT, sizeof(url_path)); fill_pathname_join(url_path, url_path, @@ -2092,14 +2092,14 @@ static int action_ok_core_content_list(const char *path, { return generic_action_ok_network(path, label, type, idx, entry_idx, MENU_ENUM_LABEL_CB_CORE_CONTENT_LIST); -} +} static int action_ok_core_content_dirs_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { return generic_action_ok_network(path, label, type, idx, entry_idx, MENU_ENUM_LABEL_CB_CORE_CONTENT_DIRS_LIST); -} +} static int action_ok_core_updater_list(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) @@ -2182,7 +2182,7 @@ static void cb_generic_download(void *task_data, case MENU_ENUM_LABEL_CB_UPDATE_SHADERS_GLSL: { static char shaderdir[PATH_MAX_LENGTH] = {0}; - const char *dirname = + const char *dirname = transf->enum_idx == MENU_ENUM_LABEL_CB_UPDATE_SHADERS_CG ? "shaders_cg" : "shaders_glsl"; @@ -2644,7 +2644,7 @@ static int action_ok_rdb_entry_submenu(const char *path, string_list_join_concat(rdb, len, str_list2, "|"); strlcpy(new_path, rdb, sizeof(new_path)); - fill_pathname_join_delim(new_label, + fill_pathname_join_delim(new_label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_CURSOR_MANAGER_LIST), str_list->elems[0].data, '_', sizeof(new_label)); @@ -2952,7 +2952,7 @@ static int action_ok_push_downloads_dir(const char *path, { settings_t *settings = config_get_ptr(); menu_displaylist_reset_filebrowser(); - return generic_action_ok_displaylist_push(path, settings->directory.core_assets, + return generic_action_ok_displaylist_push(path, settings->directory.core_assets, msg_hash_to_str(MENU_ENUM_LABEL_DETECT_CORE_LIST), type, idx, entry_idx, ACTION_OK_DL_CONTENT_LIST); @@ -3258,7 +3258,7 @@ static int action_ok_video_resolution(const char *path, else #endif snprintf(msg, sizeof(msg), - "Applying: %dx%d\n START to reset", + "Applying: %dx%d\n START to reset", width, height); runloop_msg_queue_push(msg, 1, 100, true); } @@ -3843,6 +3843,9 @@ static int menu_cbs_init_bind_ok_compare_type(menu_file_list_cbs_t *cbs, BIND_ACTION_OK(cbs, action_ok_compressed_archive_push_detect_core); break; case MENU_LABEL_SCAN_FILE: +#ifdef HAVE_LIBRETRODB + BIND_ACTION_OK(cbs, action_ok_scan_file); +#endif break; default: BIND_ACTION_OK(cbs, action_ok_compressed_archive_push); diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 30665238df..511228ebc5 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -421,7 +421,7 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info) static int menu_displaylist_parse_network_info(menu_displaylist_info_t *info) { unsigned k = 0; - net_ifinfo_t *list = + net_ifinfo_t *list = (net_ifinfo_t*)calloc(1, sizeof(*list)); if (!list) @@ -772,7 +772,7 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) break; case FRONTEND_POWERSTATE_CHARGED: strlcat(tmp2, " (", sizeof(tmp)); - strlcat(tmp2, + strlcat(tmp2, msg_hash_to_str( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_CHARGED), sizeof(tmp)); @@ -780,7 +780,7 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) break; case FRONTEND_POWERSTATE_ON_POWER_SOURCE: strlcat(tmp2, " (", sizeof(tmp)); - strlcat(tmp2, + strlcat(tmp2, msg_hash_to_str( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_POWER_SOURCE_DISCHARGING), sizeof(tmp)); @@ -809,7 +809,7 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_VIDEO_CONTEXT_DRIVER), ": ", sizeof(tmp)); - strlcat(tmp, tmp_string ? tmp_string + strlcat(tmp, tmp_string ? tmp_string : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), sizeof(tmp)); menu_entries_append_enum(info->list, tmp, "", @@ -821,7 +821,7 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) float val = 0.0f; metrics.type = DISPLAY_METRIC_MM_WIDTH; - metrics.value = &val; + metrics.value = &val; if (video_context_driver_get_metrics(&metrics)) { @@ -868,8 +868,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) ": ", sizeof(feat_str)); strlcat(feat_str, - _libretrodb_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _libretrodb_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO), sizeof(feat_str)); menu_entries_append_enum(info->list, feat_str, "", @@ -881,8 +881,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OVERLAY_SUPPORT), ": ", sizeof(feat_str)); - strlcat(feat_str, _overlay_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + strlcat(feat_str, _overlay_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO), sizeof(feat_str)); menu_entries_append_enum(info->list, feat_str, "", @@ -894,8 +894,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_COMMAND_IFACE_SUPPORT), ": ", sizeof(feat_str)); - strlcat(feat_str, _command_supp - ? msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) + strlcat(feat_str, _command_supp + ? msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO), sizeof(feat_str)); menu_entries_append_enum(info->list, feat_str, "", @@ -906,8 +906,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) "%s : %s", msg_hash_to_str( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_NETWORK_COMMAND_IFACE_SUPPORT), - _network_command_supp - ? msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) + _network_command_supp + ? msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, @@ -917,8 +917,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) "%s : %s", msg_hash_to_str( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_NETWORK_REMOTE_SUPPORT), - _network_gamepad_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) + _network_gamepad_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, @@ -927,8 +927,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_COCOA_SUPPORT), - _cocoa_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _cocoa_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, @@ -938,8 +938,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) "%s: %s", msg_hash_to_str( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RPNG_SUPPORT), - _rpng_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _rpng_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, @@ -949,8 +949,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) "%s: %s", msg_hash_to_str( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RJPEG_SUPPORT), - _rjpeg_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _rjpeg_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -959,8 +959,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) "%s: %s", msg_hash_to_str( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RBMP_SUPPORT), - _rbmp_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _rbmp_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -969,8 +969,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) "%s: %s", msg_hash_to_str( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RTGA_SUPPORT), - _rtga_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _rtga_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -979,8 +979,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) "%s: %s", msg_hash_to_str( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_SDL_SUPPORT), - _sdl_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _sdl_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -989,8 +989,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) "%s: %s", msg_hash_to_str( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_SDL2_SUPPORT), - _sdl2_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _sdl2_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -998,8 +998,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_VULKAN_SUPPORT), - _vulkan_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _vulkan_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1007,8 +1007,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENGL_SUPPORT), - _opengl_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _opengl_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1016,8 +1016,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENGLES_SUPPORT), - _opengles_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _opengles_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1025,8 +1025,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_THREADING_SUPPORT), - _thread_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _thread_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1034,8 +1034,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_KMS_SUPPORT), - _kms_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _kms_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1043,8 +1043,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_UDEV_SUPPORT), - _udev_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _udev_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1052,8 +1052,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENVG_SUPPORT), - _vg_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _vg_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1061,8 +1061,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_EGL_SUPPORT), - _egl_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _egl_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1070,8 +1070,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_X11_SUPPORT), - _x11_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _x11_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1079,8 +1079,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_WAYLAND_SUPPORT), - _wayland_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _wayland_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1088,8 +1088,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_XVIDEO_SUPPORT), - _xvideo_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _xvideo_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1097,8 +1097,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_ALSA_SUPPORT), - _alsa_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _alsa_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1106,8 +1106,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OSS_SUPPORT), - _oss_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _oss_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1115,8 +1115,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENAL_SUPPORT), - _al_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _al_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1124,8 +1124,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_OPENSL_SUPPORT), - _sl_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _sl_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1133,8 +1133,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_RSOUND_SUPPORT), - _rsound_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _rsound_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1142,8 +1142,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_ROARAUDIO_SUPPORT), - _roar_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _roar_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1151,8 +1151,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_JACK_SUPPORT), - _jack_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _jack_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1160,8 +1160,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_PULSEAUDIO_SUPPORT), - _pulse_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _pulse_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1169,8 +1169,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DSOUND_SUPPORT), - _dsound_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _dsound_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1178,8 +1178,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_XAUDIO2_SUPPORT), - _xaudio_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _xaudio_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1187,8 +1187,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_ZLIB_SUPPORT), - _zlib_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _zlib_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1196,8 +1196,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_7ZIP_SUPPORT), - _7zip_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _7zip_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1205,8 +1205,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DYLIB_SUPPORT), - _dylib_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _dylib_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1214,8 +1214,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_DYNAMIC_SUPPORT), - _dynamic_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _dynamic_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1223,8 +1223,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CG_SUPPORT), - _cg_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _cg_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1232,8 +1232,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_GLSL_SUPPORT), - _glsl_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _glsl_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1241,8 +1241,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_HLSL_SUPPORT), - _hlsl_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _hlsl_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1250,8 +1250,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LIBXML2_SUPPORT), - _libxml2_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _libxml2_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1259,8 +1259,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_SDL_IMAGE_SUPPORT), - _sdl_image_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _sdl_image_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1268,8 +1268,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FBO_SUPPORT), - _fbo_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _fbo_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1277,8 +1277,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FFMPEG_SUPPORT), - _ffmpeg_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _ffmpeg_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1286,8 +1286,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_CORETEXT_SUPPORT), - _coretext_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _coretext_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1295,8 +1295,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_FREETYPE_SUPPORT), - _freetype_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : + _freetype_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, @@ -1305,8 +1305,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_NETPLAY_SUPPORT), - _netplay_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) + _netplay_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1314,8 +1314,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_PYTHON_SUPPORT), - _python_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) + _python_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1323,8 +1323,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) snprintf(feat_str, sizeof(feat_str), "%s: %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_V4L2_SUPPORT), - _v4l2_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) + _v4l2_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1333,8 +1333,8 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info) "%s: %s", msg_hash_to_str( MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_LIBUSB_SUPPORT), - _libusb_supp ? - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) + _libusb_supp ? + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_YES) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO)); menu_entries_append_enum(info->list, feat_str, "", MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0); @@ -1642,7 +1642,7 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info) database_info_t *db_info_entry = &db_info->list[i]; settings_t *settings = config_get_ptr(); bool show_advanced_settings = false; - + if (settings) show_advanced_settings = settings->menu.show_advanced_settings; @@ -2134,7 +2134,7 @@ static int menu_displaylist_parse_settings_internal(void *data, for (;;) { bool time_to_exit = false; - const char *short_description = + const char *short_description = menu_setting_get_short_description(setting); const char *name = menu_setting_get_name(setting); enum setting_type type = setting_get_type(setting); @@ -2319,7 +2319,7 @@ static int menu_displaylist_parse_settings_internal_enum(void *data, for (;;) { bool time_to_exit = false; - const char *short_description = + const char *short_description = menu_setting_get_short_description(setting); const char *name = menu_setting_get_name(setting); enum setting_type type = setting_get_type(setting); @@ -2495,7 +2495,7 @@ static int menu_displaylist_parse_horizontal_list( list_horiz_info.idx = list_info.selection - (list_info.size +1); menu_driver_ctl(RARCH_MENU_CTL_LIST_GET_ENTRY, &list_horiz_info); - + item = (struct item_file*)list_horiz_info.entry; if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) @@ -3018,9 +3018,9 @@ static int menu_displaylist_parse_options_remappings( const char *description = NULL; if (desc_offset >= RARCH_FIRST_CUSTOM_BIND) - desc_offset = RARCH_FIRST_CUSTOM_BIND + desc_offset = RARCH_FIRST_CUSTOM_BIND + (desc_offset - RARCH_FIRST_CUSTOM_BIND) * 2; - + description = system->input_desc_btn[p][desc_offset]; if (!description) @@ -3368,7 +3368,7 @@ static int menu_displaylist_parse_generic( } path_is_compressed = path_is_compressed_file(info->path); - filter_ext = + filter_ext = settings->menu.navigation.browser.filter.supported_extensions_enable; if (string_is_equal(info->label, msg_hash_to_str(MENU_ENUM_LABEL_SCAN_FILE))) @@ -3378,9 +3378,7 @@ static int menu_displaylist_parse_generic( filter_ext = true; if (path_is_compressed) - { - str_list = file_archive_file_list_new(info->path, info->exts); - } + str_list = file_archive_get_file_list(info->path, info->exts); else str_list = dir_list_new(info->path, filter_ext ? info->exts : NULL, @@ -3611,7 +3609,7 @@ static void menu_displaylist_parse_playlist_associations( union string_list_elem_attr attr = {0}; char path_base[PATH_MAX_LENGTH] = {0}; char core_path[PATH_MAX_LENGTH] = {0}; - const char *path = + const char *path = path_basename(str_list->elems[i].data); if (!menu_content_playlist_find_associated_core( @@ -4201,7 +4199,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) break; case DISPLAYLIST_SETTING_ENUM: { - menu_displaylist_ctx_parse_entry_t *entry = + menu_displaylist_ctx_parse_entry_t *entry = (menu_displaylist_ctx_parse_entry_t*)data; if (menu_displaylist_parse_settings_enum(entry->data, @@ -4314,7 +4312,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) for (i = 0; i < RARCH_BIND_LIST_END; i++) { ret = menu_displaylist_parse_settings_enum(menu, info, - (enum msg_hash_enums)(MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN + i), + (enum msg_hash_enums)(MENU_ENUM_LABEL_INPUT_HOTKEY_BIND_BEGIN + i), PARSE_ONLY_BIND, false); (void)ret; } @@ -5288,7 +5286,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) ret = deferred_push_video_shader_parameters_common( info, shader_info.data, (type == DISPLAYLIST_SHADER_PARAMETERS) - ? MENU_SETTINGS_SHADER_PARAMETER_0 + ? MENU_SETTINGS_SHADER_PARAMETER_0 : MENU_SETTINGS_SHADER_PRESET_PARAMETER_0 ); else @@ -5308,10 +5306,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) case DISPLAYLIST_PERFCOUNTERS_FRONTEND: menu_displaylist_push_perfcounter(info, (type == DISPLAYLIST_PERFCOUNTERS_CORE) ? - retro_get_perf_counter_libretro() + retro_get_perf_counter_libretro() : retro_get_perf_counter_rarch(), (type == DISPLAYLIST_PERFCOUNTERS_CORE) ? - retro_get_perf_count_libretro() + retro_get_perf_count_libretro() : retro_get_perf_count_rarch(), (type == DISPLAYLIST_PERFCOUNTERS_CORE) ? MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN : @@ -5341,7 +5339,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) break; case DISPLAYLIST_DATABASE_QUERY: ret = menu_database_parse_query(info->list, - info->path, string_is_empty(info->path_c) + info->path, string_is_empty(info->path_c) ? NULL : info->path_c); strlcpy(info->path, info->path_b, sizeof(info->path)); @@ -5578,7 +5576,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) size_t cores_names_size; unsigned cores_paths_len; size_t cores_paths_size; - struct string_list *cores_names = + struct string_list *cores_names = string_list_new_special(STRING_LIST_SUPPORTED_CORES_NAMES, (void*)menu->deferred_path, &cores_names_len, &cores_names_size); @@ -5600,7 +5598,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) } else { - struct string_list *cores_paths = + struct string_list *cores_paths = string_list_new_special(STRING_LIST_SUPPORTED_CORES_PATHS, (void*)menu->deferred_path, &cores_paths_len, &cores_paths_size); @@ -5679,7 +5677,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) for (i = 0; i < opts; i++) menu_entries_append_enum(info->list, core_option_manager_get_desc(coreopts, i), "", - MENU_ENUM_LABEL_CORE_OPTION_ENTRY, + MENU_ENUM_LABEL_CORE_OPTION_ENTRY, MENU_SETTINGS_CORE_OPTION_START + i, 0, 0); } } diff --git a/tasks/task_database.c b/tasks/task_database.c index 2f7c851918..77c6003ed2 100644 --- a/tasks/task_database.c +++ b/tasks/task_database.c @@ -60,24 +60,6 @@ typedef struct db_handle unsigned status; } db_handle_t; - -#ifdef HAVE_COMPRESSION -static int archive_compare_crc32(const char *name, const char *valid_exts, - const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size, - uint32_t crc32, struct archive_extract_userdata *userdata) -{ - userdata->crc = crc32; - - strlcpy(userdata->archive_name, userdata->extracted_file_path, sizeof(userdata->archive_name)); - -#if 0 - RARCH_LOG("Going to compare CRC 0x%x for %s\n", crc32, name); -#endif - - return 1; -} -#endif - static int task_database_iterate_start(database_info_handle_t *db, const char *name) { @@ -182,10 +164,8 @@ static int task_database_iterate_playlist( { case FILE_TYPE_COMPRESSED: #ifdef HAVE_COMPRESSION - db->type = DATABASE_TYPE_ITERATE_ARCHIVE; - memset(&db->state, 0, sizeof(file_archive_transfer_t)); - db_state->archive_name[0] = '\0'; - db->state.type = ARCHIVE_TRANSFER_INIT; + db->type = DATABASE_TYPE_CRC_LOOKUP; + /* first check crc of archive itself */ return file_get_crc(db_state, name, &db_state->archive_crc); #else break; @@ -404,37 +384,11 @@ static int task_database_iterate_playlist_archive( { bool returnerr = true; #ifdef HAVE_COMPRESSION - struct archive_extract_userdata userdata = {0}; - if (db_state->crc != 0) return task_database_iterate_crc_lookup( db_state, db, db_state->archive_name); - userdata.crc = db_state->crc; - userdata.archive_path = strdup(name); - - if (db->state.type == ARCHIVE_TRANSFER_INIT) - file_archive_parse_file_iterate(&db->state, - &returnerr, name, NULL, NULL, - &userdata); - - if (file_archive_parse_file_iterate(&db->state, - &returnerr, name, NULL, archive_compare_crc32, - &userdata)) - { - if (userdata.archive_path) - free(userdata.archive_path); - return 0; - } - - if (userdata.crc) - { - db_state->crc = userdata.crc; - file_archive_parse_file_iterate_stop(&db->state); - } - - if (userdata.archive_path) - free(userdata.archive_path); + db_state->crc = file_archive_get_file_crc32(name); #endif return 1; @@ -547,6 +501,10 @@ static int task_database_iterate(database_state_handle_t *db_state, if (!name) return 0; + if (db->type == DATABASE_TYPE_ITERATE) + if (path_contains_compressed_file(name)) + db->type = DATABASE_TYPE_ITERATE_ARCHIVE; + switch (db->type) { case DATABASE_TYPE_ITERATE: diff --git a/tasks/task_decompress.c b/tasks/task_decompress.c index 56736db664..6b021d5c41 100644 --- a/tasks/task_decompress.c +++ b/tasks/task_decompress.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "tasks_internal.h" #include "../verbosity.h" @@ -146,10 +147,10 @@ static void task_decompress_handler(retro_task_t *task) int ret; bool retdec = false; decompress_state_t *dec = (decompress_state_t*)task->state; - struct archive_extract_userdata userdata = {0}; + struct archive_extract_userdata userdata = {{0}}; userdata.dec = dec; - userdata.archive_path = dec->source_file; + strlcpy(userdata.archive_path, dec->source_file, sizeof(userdata.archive_path)); ret = file_archive_parse_file_iterate(&dec->archive, &retdec, dec->source_file, @@ -171,9 +172,9 @@ static void task_decompress_handler_target_file(retro_task_t *task) bool retdec; int ret; decompress_state_t *dec = (decompress_state_t*)task->state; - struct archive_extract_userdata userdata = {0}; + struct archive_extract_userdata userdata = {{0}}; - userdata.archive_path = dec->source_file; + strlcpy(userdata.archive_path, dec->source_file, sizeof(userdata.archive_path)); ret = file_archive_parse_file_iterate(&dec->archive, &retdec, dec->source_file, @@ -195,10 +196,10 @@ static void task_decompress_handler_subdir(retro_task_t *task) int ret; bool retdec; decompress_state_t *dec = (decompress_state_t*)task->state; - struct archive_extract_userdata userdata = {0}; + struct archive_extract_userdata userdata = {{0}}; userdata.dec = dec; - userdata.archive_path = dec->source_file; + strlcpy(userdata.archive_path, dec->source_file, sizeof(userdata.archive_path)); ret = file_archive_parse_file_iterate(&dec->archive, &retdec, dec->source_file,