(Database) List entries by name instead of description

This commit is contained in:
twinaphex 2015-01-29 01:32:35 +01:00
parent 011900be17
commit 5a5ae4f9a5
6 changed files with 15 additions and 66 deletions

View File

@ -74,6 +74,7 @@ database_info_list_t *database_info_list_new(const char *rdb_path, const char *q
db_info = (database_info_t*)&database_info[i];
db_info->name = NULL;
db_info->description = NULL;
db_info->publisher = NULL;
db_info->developer = NULL;
@ -99,6 +100,9 @@ database_info_list_t *database_info_list_new(const char *rdb_path, const char *q
struct rmsgpack_dom_value *key = &item.map.items[j].key;
struct rmsgpack_dom_value *val = &item.map.items[j].value;
if (!strcmp(key->string.buff, "name"))
db_info->name = strdup(val->string.buff);
if (!strcmp(key->string.buff, "description"))
db_info->description = strdup(val->string.buff);
@ -185,6 +189,8 @@ void database_info_list_free(database_info_list_t *database_info_list)
if (!info)
continue;
if (info->name)
free(info->name);
if (info->description)
free(info->description);
if (info->publisher)

View File

@ -27,6 +27,7 @@ extern "C" {
typedef struct
{
char *name;
char *description;
char *publisher;
char *developer;

View File

@ -40,64 +40,3 @@ int menu_database_populate_query(file_list_t *list, const char *path,
return 0;
}
int menu_database_print_info(const char *path,
const char *query)
{
#ifdef HAVE_LIBRETRODB
size_t i;
database_info_list_t *db_info = NULL;
if (!(db_info = database_info_list_new(path, query)))
return -1;
for (i = 0; i < db_info->count; i++)
{
database_info_t *db_info_entry = (database_info_t*)&db_info->list[i];
if (!db_info_entry)
continue;
if (db_info_entry->description)
RARCH_LOG("Description: %s\n", db_info_entry->description);
if (db_info_entry->publisher)
RARCH_LOG("Publisher: %s\n", db_info_entry->publisher);
if (db_info_entry->developer)
RARCH_LOG("Developer: %s\n", db_info_entry->developer);
if (db_info_entry->origin)
RARCH_LOG("Origin: %s\n", db_info_entry->origin);
if (db_info_entry->franchise)
RARCH_LOG("Franchise: %s\n", db_info_entry->franchise);
if (db_info_entry->max_users)
RARCH_LOG("Max Users: %d\n", db_info_entry->max_users);
if (db_info_entry->edge_magazine_rating)
RARCH_LOG("Edge Magazine Rating: %d/10\n", db_info_entry->edge_magazine_rating);
if (db_info_entry->edge_magazine_issue)
RARCH_LOG("Edge Magazine Issue: %d\n", db_info_entry->edge_magazine_issue);
if (db_info_entry->edge_magazine_review)
RARCH_LOG("Edge Magazine Review: %s\n", db_info_entry->edge_magazine_review);
if (db_info_entry->releasemonth)
RARCH_LOG("Releasedate Month: %d\n", db_info_entry->releasemonth);
if (db_info_entry->releaseyear)
RARCH_LOG("Releasedate Year: %d\n", db_info_entry->releaseyear);
if (db_info_entry->bbfc_rating)
RARCH_LOG("BBFC Rating: %s\n", db_info_entry->bbfc_rating);
if (db_info_entry->esrb_rating)
RARCH_LOG("ESRB Rating: %s\n", db_info_entry->esrb_rating);
if (db_info_entry->elspa_rating)
RARCH_LOG("ELSPA Rating: %s\n", db_info_entry->elspa_rating);
if (db_info_entry->pegi_rating)
RARCH_LOG("PEGI Rating: %s\n", db_info_entry->pegi_rating);
if (db_info_entry->cero_rating)
RARCH_LOG("CERO Rating: %s\n", db_info_entry->cero_rating);
RARCH_LOG("Analog supported: %s\n", db_info_entry->analog_supported ? "true" : "false");
RARCH_LOG("Rumble supported: %s\n", db_info_entry->rumble_supported ? "true" : "false");
RARCH_LOG("\n\n");
}
if (db_info)
database_info_list_free(db_info);
db_info = NULL;
#endif
return 0;
}

View File

@ -29,9 +29,6 @@ extern "C" {
int menu_database_populate_query(file_list_t *list, const char *path,
const char *query);
int menu_database_print_info(const char *path,
const char *query);
#ifdef __cplusplus
}
#endif

View File

@ -64,7 +64,7 @@ int menu_entries_push_query(libretrodb_t *db,
struct rmsgpack_dom_value *key = &item.map.items[i].key;
struct rmsgpack_dom_value *val = &item.map.items[i].value;
if (!strcmp(key->string.buff, "description"))
if (!strcmp(key->string.buff, "name"))
{
menu_list_push(list, val->string.buff, db->path,
MENU_FILE_RDB_ENTRY, 0);

View File

@ -841,7 +841,7 @@ static int deferred_push_rdb_entry_detail(void *data, void *userdata,
goto done;
}
strlcpy(query, "{'description':\"", sizeof(query));
strlcpy(query, "{'name':\"", sizeof(query));
strlcat(query, str_list->elems[1].data, sizeof(query));
strlcat(query, "\"}", sizeof(query));
@ -861,6 +861,12 @@ static int deferred_push_rdb_entry_detail(void *data, void *userdata,
if (!db_info_entry)
continue;
if (db_info_entry->name)
{
snprintf(tmp, sizeof(tmp), "Description: %s", db_info_entry->name);
menu_list_push(list, tmp, "rdb_entry_name",
0, 0);
}
if (db_info_entry->description)
{
snprintf(tmp, sizeof(tmp), "Description: %s", db_info_entry->description);