mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-13 13:28:49 +00:00
(Database) Add MD5 and SHA1 entries
This commit is contained in:
parent
24d36c8d03
commit
298fdbea8a
@ -178,6 +178,44 @@ database_info_list_t *database_info_list_new(const char *rdb_path, const char *q
|
||||
strlcpy(db_info->crc32, crc32, sizeof(db_info->crc32));
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcmp(key->string.buff, "sha1"))
|
||||
{
|
||||
unsigned i;
|
||||
db_info->sha1 = (char*)calloc(val->binary.len, sizeof(unsigned char));
|
||||
|
||||
if (db_info->sha1)
|
||||
{
|
||||
char sha1[PATH_MAX_LENGTH];
|
||||
|
||||
for (i = 0; i < val->binary.len; i++)
|
||||
{
|
||||
char sha1_cat[PATH_MAX_LENGTH];
|
||||
snprintf(sha1_cat, sizeof(sha1_cat), "%02X", (unsigned char)val->binary.buff[i]);
|
||||
strlcat(sha1, sha1_cat, sizeof(sha1));
|
||||
}
|
||||
strlcpy(db_info->sha1, sha1, sizeof(db_info->sha1));
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcmp(key->string.buff, "md5"))
|
||||
{
|
||||
unsigned i;
|
||||
db_info->md5 = (char*)calloc(val->binary.len, sizeof(unsigned char));
|
||||
|
||||
if (db_info->md5)
|
||||
{
|
||||
char md5[PATH_MAX_LENGTH];
|
||||
|
||||
for (i = 0; i < val->binary.len; i++)
|
||||
{
|
||||
char md5_cat[PATH_MAX_LENGTH];
|
||||
snprintf(md5_cat, sizeof(md5_cat), "%02X", (unsigned char)val->binary.buff[i]);
|
||||
strlcat(md5, md5_cat, sizeof(md5));
|
||||
}
|
||||
strlcpy(db_info->md5, md5, sizeof(db_info->md5));
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@ -237,6 +275,10 @@ void database_info_list_free(database_info_list_t *database_info_list)
|
||||
free(info->bbfc_rating);
|
||||
if (info->crc32)
|
||||
free(info->crc32);
|
||||
if (info->sha1)
|
||||
free(info->sha1);
|
||||
if (info->md5)
|
||||
free(info->md5);
|
||||
}
|
||||
|
||||
free(database_info_list->list);
|
||||
|
@ -41,6 +41,8 @@ typedef struct
|
||||
char *cero_rating;
|
||||
char *enhancement_hw;
|
||||
char *crc32;
|
||||
char *sha1;
|
||||
char *md5;
|
||||
unsigned edge_magazine_rating;
|
||||
unsigned edge_magazine_issue;
|
||||
unsigned max_users;
|
||||
|
@ -992,6 +992,20 @@ static int deferred_push_rdb_entry_detail(void *data, void *userdata,
|
||||
path, list) == -1)
|
||||
return -1;
|
||||
}
|
||||
if (db_info_entry->sha1)
|
||||
{
|
||||
if (create_string_list_rdb_entry_string("SHA1 Checksum",
|
||||
"rdb_entry_sha1", db_info_entry->sha1,
|
||||
path, list) == -1)
|
||||
return -1;
|
||||
}
|
||||
if (db_info_entry->md5)
|
||||
{
|
||||
if (create_string_list_rdb_entry_string("MD5 Checksum",
|
||||
"rdb_entry_md5", db_info_entry->md5,
|
||||
path, list) == -1)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (db_info->count < 1)
|
||||
|
Loading…
Reference in New Issue
Block a user