mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 08:30:16 +00:00
fixed game details not available while browsing dabases; fixed false positives in database_cursor_iterate
This commit is contained in:
parent
e7a3dc0e73
commit
a2b2cb0f34
110
database_info.c
110
database_info.c
@ -62,86 +62,86 @@ int database_info_build_query(char *s, size_t len,
|
||||
switch (value)
|
||||
{
|
||||
case DB_QUERY_ENTRY:
|
||||
if (!strcmp(label, "name"))
|
||||
if (!strcmp(label, "displaylist_parse_database_entry"))
|
||||
strlcat(s, "name", len);
|
||||
break;
|
||||
case DB_QUERY_ENTRY_PUBLISHER:
|
||||
if (!strcmp(label, "publisher"))
|
||||
if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_publisher"))
|
||||
strlcat(s, "publisher", len);
|
||||
break;
|
||||
case DB_QUERY_ENTRY_DEVELOPER:
|
||||
if (!strcmp(label, "developer"))
|
||||
if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_developer"))
|
||||
strlcat(s, "developer", len);
|
||||
break;
|
||||
case DB_QUERY_ENTRY_ORIGIN:
|
||||
if (!strcmp(label, "origin"))
|
||||
if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_origin"))
|
||||
strlcat(s, "origin", len);
|
||||
break;
|
||||
case DB_QUERY_ENTRY_FRANCHISE:
|
||||
if (!strcmp(label, "franchise"))
|
||||
if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_franchise"))
|
||||
strlcat(s, "franchise", len);
|
||||
break;
|
||||
case DB_QUERY_ENTRY_RATING:
|
||||
if (!strcmp(label, "esrb_rating"))
|
||||
if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_esrb_rating"))
|
||||
strlcat(s, "esrb_rating", len);
|
||||
break;
|
||||
case DB_QUERY_ENTRY_BBFC_RATING:
|
||||
if (!strcmp(label, "bbfc_rating"))
|
||||
if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_bbfc_rating"))
|
||||
strlcat(s, "bbfc_rating", len);
|
||||
break;
|
||||
case DB_QUERY_ENTRY_ELSPA_RATING:
|
||||
if (!strcmp(label, "elspa_rating"))
|
||||
if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_elspa_rating"))
|
||||
strlcat(s, "elspa_rating", len);
|
||||
break;
|
||||
case DB_QUERY_ENTRY_PEGI_RATING:
|
||||
if (!strcmp(label, "pegi_rating"))
|
||||
if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_pegi_rating"))
|
||||
strlcat(s, "pegi_rating", len);
|
||||
break;
|
||||
case DB_QUERY_ENTRY_CERO_RATING:
|
||||
if (!strcmp(label, "cero_rating"))
|
||||
if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_cero_rating"))
|
||||
strlcat(s, "cero_rating", len);
|
||||
break;
|
||||
case DB_QUERY_ENTRY_ENHANCEMENT_HW:
|
||||
if (!strcmp(label, "enhancement_hw"))
|
||||
if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_enhancement_hw"))
|
||||
strlcat(s, "enhancement_hw", len);
|
||||
break;
|
||||
case DB_QUERY_ENTRY_EDGE_MAGAZINE_RATING:
|
||||
if (!strcmp(label, "edge_rating"))
|
||||
if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_edge_magazine_rating"))
|
||||
{
|
||||
strlcat(s, "edge_rating", len);
|
||||
add_quotes = false;
|
||||
}
|
||||
break;
|
||||
case DB_QUERY_ENTRY_EDGE_MAGAZINE_ISSUE:
|
||||
if (!strcmp(label, "edge_issue"))
|
||||
if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_edge_magazine_issue"))
|
||||
{
|
||||
strlcat(s, "edge_issue", len);
|
||||
add_quotes = false;
|
||||
}
|
||||
break;
|
||||
case DB_QUERY_ENTRY_FAMITSU_MAGAZINE_RATING:
|
||||
if (!strcmp(label, "famitsu_rating"))
|
||||
if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_famitsu_magazine_rating"))
|
||||
{
|
||||
strlcat(s, "famitsu_rating", len);
|
||||
add_quotes = false;
|
||||
}
|
||||
break;
|
||||
case DB_QUERY_ENTRY_RELEASEDATE_MONTH:
|
||||
if (!strcmp(label, "releasemonth"))
|
||||
if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_releasemonth"))
|
||||
{
|
||||
strlcat(s, "releasemonth", len);
|
||||
add_quotes = false;
|
||||
}
|
||||
break;
|
||||
case DB_QUERY_ENTRY_RELEASEDATE_YEAR:
|
||||
if (!strcmp(label, "releaseyear"))
|
||||
if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_releaseyear"))
|
||||
{
|
||||
strlcat(s, "releaseyear", len);
|
||||
add_quotes = false;
|
||||
}
|
||||
break;
|
||||
case DB_QUERY_ENTRY_MAX_USERS:
|
||||
if (!strcmp(label, "users"))
|
||||
if (!strcmp(label, "deferred_cursor_manager_list_rdb_entry_max_users"))
|
||||
{
|
||||
strlcat(s, "users", len);
|
||||
add_quotes = false;
|
||||
@ -209,6 +209,7 @@ static int database_cursor_iterate(libretrodb_cursor_t *cur,
|
||||
{
|
||||
unsigned i;
|
||||
struct rmsgpack_dom_value item;
|
||||
const char* str;
|
||||
|
||||
if (libretrodb_cursor_read_item(cur, &item) != 0)
|
||||
return -1;
|
||||
@ -228,81 +229,106 @@ static int database_cursor_iterate(libretrodb_cursor_t *cur,
|
||||
if (!key || !val)
|
||||
continue;
|
||||
|
||||
value = djb2_calculate(key->string.buff);
|
||||
str = key->string.buff;
|
||||
value = djb2_calculate(str);
|
||||
|
||||
switch (value)
|
||||
{
|
||||
case DB_CURSOR_NAME:
|
||||
db_info->name = strdup(val->string.buff);
|
||||
if (!strcmp(str, "name"))
|
||||
db_info->name = strdup(val->string.buff);
|
||||
break;
|
||||
case DB_CURSOR_DESCRIPTION:
|
||||
db_info->description = strdup(val->string.buff);
|
||||
if (!strcmp(str, "description"))
|
||||
db_info->description = strdup(val->string.buff);
|
||||
break;
|
||||
case DB_CURSOR_PUBLISHER:
|
||||
db_info->publisher = strdup(val->string.buff);
|
||||
if (!strcmp(str, "publisher"))
|
||||
db_info->publisher = strdup(val->string.buff);
|
||||
break;
|
||||
case DB_CURSOR_DEVELOPER:
|
||||
db_info->developer = strdup(val->string.buff);
|
||||
if (!strcmp(str, "developer"))
|
||||
db_info->developer = strdup(val->string.buff);
|
||||
break;
|
||||
case DB_CURSOR_ORIGIN:
|
||||
db_info->origin = strdup(val->string.buff);
|
||||
if (!strcmp(str, "origin"))
|
||||
db_info->origin = strdup(val->string.buff);
|
||||
break;
|
||||
case DB_CURSOR_FRANCHISE:
|
||||
db_info->franchise = strdup(val->string.buff);
|
||||
if (!strcmp(str, "franchise"))
|
||||
db_info->franchise = strdup(val->string.buff);
|
||||
break;
|
||||
case DB_CURSOR_BBFC_RATING:
|
||||
db_info->bbfc_rating = strdup(val->string.buff);
|
||||
if (!strcmp(str, "bbfc_rating"))
|
||||
db_info->bbfc_rating = strdup(val->string.buff);
|
||||
break;
|
||||
case DB_CURSOR_ESRB_RATING:
|
||||
db_info->esrb_rating = strdup(val->string.buff);
|
||||
if (!strcmp(str, "esrb_rating"))
|
||||
db_info->esrb_rating = strdup(val->string.buff);
|
||||
break;
|
||||
case DB_CURSOR_ELSPA_RATING:
|
||||
db_info->elspa_rating = strdup(val->string.buff);
|
||||
if (!strcmp(str, "elspa_rating"))
|
||||
db_info->elspa_rating = strdup(val->string.buff);
|
||||
break;
|
||||
case DB_CURSOR_CERO_RATING:
|
||||
db_info->cero_rating = strdup(val->string.buff);
|
||||
if (!strcmp(str, "cero_rating"))
|
||||
db_info->cero_rating = strdup(val->string.buff);
|
||||
break;
|
||||
case DB_CURSOR_PEGI_RATING:
|
||||
db_info->pegi_rating = strdup(val->string.buff);
|
||||
if (!strcmp(str, "pegi_rating"))
|
||||
db_info->pegi_rating = strdup(val->string.buff);
|
||||
break;
|
||||
case DB_CURSOR_ENHANCEMENT_HW:
|
||||
db_info->enhancement_hw = strdup(val->string.buff);
|
||||
if (!strcmp(str, "enhancement_hw"))
|
||||
db_info->enhancement_hw = strdup(val->string.buff);
|
||||
break;
|
||||
case DB_CURSOR_EDGE_MAGAZINE_REVIEW:
|
||||
db_info->edge_magazine_review = strdup(val->string.buff);
|
||||
if (!strcmp(str, "edge_review"))
|
||||
db_info->edge_magazine_review = strdup(val->string.buff);
|
||||
break;
|
||||
case DB_CURSOR_EDGE_MAGAZINE_RATING:
|
||||
db_info->edge_magazine_rating = val->uint_;
|
||||
if (!strcmp(str, "edge_rating"))
|
||||
db_info->edge_magazine_rating = val->uint_;
|
||||
break;
|
||||
case DB_CURSOR_EDGE_MAGAZINE_ISSUE:
|
||||
db_info->edge_magazine_issue = val->uint_;
|
||||
if (!strcmp(str, "edge_issue"))
|
||||
db_info->edge_magazine_issue = val->uint_;
|
||||
break;
|
||||
case DB_CURSOR_FAMITSU_MAGAZINE_RATING:
|
||||
db_info->famitsu_magazine_rating = val->uint_;
|
||||
if (!strcmp(str, "famitsu_rating"))
|
||||
db_info->famitsu_magazine_rating = val->uint_;
|
||||
break;
|
||||
case DB_CURSOR_MAX_USERS:
|
||||
db_info->max_users = val->uint_;
|
||||
if (!strcmp(str, "users"))
|
||||
db_info->max_users = val->uint_;
|
||||
break;
|
||||
case DB_CURSOR_RELEASEDATE_MONTH:
|
||||
db_info->releasemonth = val->uint_;
|
||||
if (!strcmp(str, "releasemonth"))
|
||||
db_info->releasemonth = val->uint_;
|
||||
break;
|
||||
case DB_CURSOR_RELEASEDATE_YEAR:
|
||||
db_info->releaseyear = val->uint_;
|
||||
if (!strcmp(str, "releaseyear"))
|
||||
db_info->releaseyear = val->uint_;
|
||||
break;
|
||||
case DB_CURSOR_RUMBLE_SUPPORTED:
|
||||
db_info->rumble_supported = val->uint_;
|
||||
if (!strcmp(str, "rumble"))
|
||||
db_info->rumble_supported = val->uint_;
|
||||
break;
|
||||
case DB_CURSOR_ANALOG_SUPPORTED:
|
||||
db_info->analog_supported = val->uint_;
|
||||
if (!strcmp(str, "analog"))
|
||||
db_info->analog_supported = val->uint_;
|
||||
break;
|
||||
case DB_CURSOR_CHECKSUM_CRC32:
|
||||
db_info->crc32 = bin_to_hex_alloc((uint8_t*)val->binary.buff, val->binary.len);
|
||||
if (!strcmp(str, "crc"))
|
||||
db_info->crc32 = bin_to_hex_alloc((uint8_t*)val->binary.buff, val->binary.len);
|
||||
break;
|
||||
case DB_CURSOR_CHECKSUM_SHA1:
|
||||
db_info->sha1 = bin_to_hex_alloc((uint8_t*)val->binary.buff, val->binary.len);
|
||||
if (!strcmp(str, "sha1"))
|
||||
db_info->sha1 = bin_to_hex_alloc((uint8_t*)val->binary.buff, val->binary.len);
|
||||
break;
|
||||
case DB_CURSOR_CHECKSUM_MD5:
|
||||
db_info->md5 = bin_to_hex_alloc((uint8_t*)val->binary.buff, val->binary.len);
|
||||
if (!strcmp(str, "md5"))
|
||||
db_info->md5 = bin_to_hex_alloc((uint8_t*)val->binary.buff, val->binary.len);
|
||||
break;
|
||||
default:
|
||||
RARCH_LOG("Unknown value: %d\n", value);
|
||||
|
Loading…
Reference in New Issue
Block a user