mirror of
https://github.com/libretro/RetroArch
synced 2025-03-25 16:44:01 +00:00
(libretro-db) Store CRC32 as uint32_t
This commit is contained in:
parent
47af2e6d1c
commit
4d23fd211c
@ -286,7 +286,7 @@ static int database_cursor_iterate(libretrodb_cursor_t *cur,
|
|||||||
db_info->size = val->uint_;
|
db_info->size = val->uint_;
|
||||||
break;
|
break;
|
||||||
case DB_CURSOR_CHECKSUM_CRC32:
|
case DB_CURSOR_CHECKSUM_CRC32:
|
||||||
db_info->crc32 = bin_to_hex_alloc((uint8_t*)val->binary.buff, val->binary.len);
|
db_info->crc32 = swap_if_little32(*(uint32_t*)val->binary.buff);
|
||||||
break;
|
break;
|
||||||
case DB_CURSOR_CHECKSUM_SHA1:
|
case DB_CURSOR_CHECKSUM_SHA1:
|
||||||
db_info->sha1 = bin_to_hex_alloc((uint8_t*)val->binary.buff, val->binary.len);
|
db_info->sha1 = bin_to_hex_alloc((uint8_t*)val->binary.buff, val->binary.len);
|
||||||
@ -512,8 +512,6 @@ void database_info_list_free(database_info_list_t *database_info_list)
|
|||||||
free(info->esrb_rating);
|
free(info->esrb_rating);
|
||||||
if (info->bbfc_rating)
|
if (info->bbfc_rating)
|
||||||
free(info->bbfc_rating);
|
free(info->bbfc_rating);
|
||||||
if (info->crc32)
|
|
||||||
free(info->crc32);
|
|
||||||
if (info->sha1)
|
if (info->sha1)
|
||||||
free(info->sha1);
|
free(info->sha1);
|
||||||
if (info->md5)
|
if (info->md5)
|
||||||
|
@ -75,7 +75,7 @@ typedef struct
|
|||||||
char *pegi_rating;
|
char *pegi_rating;
|
||||||
char *cero_rating;
|
char *cero_rating;
|
||||||
char *enhancement_hw;
|
char *enhancement_hw;
|
||||||
char *crc32;
|
uint32_t crc32;
|
||||||
char *sha1;
|
char *sha1;
|
||||||
char *md5;
|
char *md5;
|
||||||
unsigned size;
|
unsigned size;
|
||||||
|
@ -945,11 +945,14 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info)
|
|||||||
for (i = 0; i < db_info->count; i++)
|
for (i = 0; i < db_info->count; i++)
|
||||||
{
|
{
|
||||||
char tmp[PATH_MAX_LENGTH];
|
char tmp[PATH_MAX_LENGTH];
|
||||||
|
char crc_str[20] = {0};
|
||||||
database_info_t *db_info_entry = &db_info->list[i];
|
database_info_t *db_info_entry = &db_info->list[i];
|
||||||
|
|
||||||
if (!db_info_entry)
|
if (!db_info_entry)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
snprintf(crc_str, sizeof(crc_str), "%08X", db_info_entry->crc32);
|
||||||
|
|
||||||
if (playlist)
|
if (playlist)
|
||||||
{
|
{
|
||||||
for (j = 0; j < playlist->size; j++)
|
for (j = 0; j < playlist->size; j++)
|
||||||
@ -973,7 +976,7 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info)
|
|||||||
switch (hash_value)
|
switch (hash_value)
|
||||||
{
|
{
|
||||||
case MENU_VALUE_CRC:
|
case MENU_VALUE_CRC:
|
||||||
if (!strcmp(db_info_entry->crc32, elem0))
|
if (!strcmp(crc_str, elem0))
|
||||||
match_found = true;
|
match_found = true;
|
||||||
break;
|
break;
|
||||||
case MENU_VALUE_SHA1:
|
case MENU_VALUE_SHA1:
|
||||||
@ -1147,7 +1150,7 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info)
|
|||||||
if (db_info_entry->crc32)
|
if (db_info_entry->crc32)
|
||||||
{
|
{
|
||||||
if (create_string_list_rdb_entry_string("CRC32 Checksum",
|
if (create_string_list_rdb_entry_string("CRC32 Checksum",
|
||||||
"rdb_entry_crc32", db_info_entry->crc32,
|
"rdb_entry_crc32", crc_str,
|
||||||
info->path, info->list) == -1)
|
info->path, info->list) == -1)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -1165,7 +1168,6 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info)
|
|||||||
info->path, info->list) == -1)
|
info->path, info->list) == -1)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (db_info->count < 1)
|
if (db_info->count < 1)
|
||||||
|
@ -177,7 +177,7 @@ static int database_info_list_iterate_found_match(
|
|||||||
playlist = content_playlist_init(db_playlist_path, 1000);
|
playlist = content_playlist_init(db_playlist_path, 1000);
|
||||||
|
|
||||||
|
|
||||||
snprintf(db_crc, sizeof(db_crc), "%s|crc", db_info_entry->crc32);
|
snprintf(db_crc, sizeof(db_crc), "%08X|crc", db_info_entry->crc32);
|
||||||
|
|
||||||
strlcpy(entry_path_str, entry_path, sizeof(entry_path_str));
|
strlcpy(entry_path_str, entry_path, sizeof(entry_path_str));
|
||||||
if (zip_name && zip_name[0] != '\0')
|
if (zip_name && zip_name[0] != '\0')
|
||||||
@ -236,18 +236,13 @@ static int database_info_iterate_crc_lookup(
|
|||||||
{
|
{
|
||||||
database_info_t *db_info_entry = &db_state->info->list[db_state->entry_index];
|
database_info_t *db_info_entry = &db_state->info->list[db_state->entry_index];
|
||||||
|
|
||||||
if (db_info_entry && db_info_entry->crc32 && db_info_entry->crc32[0] != '\0')
|
if (db_info_entry && db_info_entry->crc32)
|
||||||
{
|
{
|
||||||
char entry_state_crc[PATH_MAX_LENGTH];
|
|
||||||
/* Check if the CRC matches with the current entry. */
|
|
||||||
snprintf(entry_state_crc, sizeof(entry_state_crc), "%x", db_state->crc);
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
RARCH_LOG("CRC32: 0x%s , entry CRC32: 0x%s (%s).\n",
|
RARCH_LOG("CRC32: 0x%08X , entry CRC32: 0x%08X (%s).\n",
|
||||||
entry_state_crc, db_info_entry->crc32, db_info_entry->name);
|
db_state->crc, db_info_entry->crc32, db_info_entry->name);
|
||||||
#endif
|
#endif
|
||||||
|
if (db_state->crc == db_info_entry->crc32)
|
||||||
if (strcasestr(entry_state_crc, db_info_entry->crc32))
|
|
||||||
database_info_list_iterate_found_match(db_state, db, zip_entry);
|
database_info_list_iterate_found_match(db_state, db, zip_entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user