mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
(LibretroDB) Move function to menu_entries.c
This commit is contained in:
parent
47344b8c3e
commit
abe3bf4626
@ -16,6 +16,7 @@
|
|||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "menu_database.h"
|
#include "menu_database.h"
|
||||||
#include "menu_list.h"
|
#include "menu_list.h"
|
||||||
|
#include "menu_entries.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef HAVE_LIBRETRODB
|
#ifdef HAVE_LIBRETRODB
|
||||||
@ -37,33 +38,6 @@ static int menu_database_open_cursor(libretrodb_t *db,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int menu_database_fetch_from_query(libretrodb_t *db,
|
|
||||||
libretrodb_cursor_t *cur, file_list_t *list)
|
|
||||||
{
|
|
||||||
unsigned i;
|
|
||||||
struct rmsgpack_dom_value item;
|
|
||||||
|
|
||||||
while (libretrodb_cursor_read_item(cur, &item) == 0)
|
|
||||||
{
|
|
||||||
if (item.type != RDT_MAP)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (i = 0; i < item.map.len; i++)
|
|
||||||
{
|
|
||||||
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"))
|
|
||||||
{
|
|
||||||
menu_list_push(list, val->string.buff, db->path,
|
|
||||||
MENU_FILE_RDB_ENTRY, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int menu_database_populate_query(file_list_t *list, const char *path,
|
int menu_database_populate_query(file_list_t *list, const char *path,
|
||||||
@ -77,7 +51,7 @@ int menu_database_populate_query(file_list_t *list, const char *path,
|
|||||||
return -1;
|
return -1;
|
||||||
if ((menu_database_open_cursor(&db, &cur, query) != 0))
|
if ((menu_database_open_cursor(&db, &cur, query) != 0))
|
||||||
return -1;
|
return -1;
|
||||||
if ((menu_database_fetch_from_query(&db, &cur, list)) != 0)
|
if ((menu_entries_push_query(&db, &cur, list)) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
libretrodb_cursor_close(&cur);
|
libretrodb_cursor_close(&cur);
|
||||||
|
@ -47,6 +47,36 @@ int menu_entries_setting_set_flags(rarch_setting_t *setting)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBRETRODB
|
||||||
|
int menu_entries_push_query(libretrodb_t *db,
|
||||||
|
libretrodb_cursor_t *cur, file_list_t *list)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
struct rmsgpack_dom_value item;
|
||||||
|
|
||||||
|
while (libretrodb_cursor_read_item(cur, &item) == 0)
|
||||||
|
{
|
||||||
|
if (item.type != RDT_MAP)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (i = 0; i < item.map.len; i++)
|
||||||
|
{
|
||||||
|
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"))
|
||||||
|
{
|
||||||
|
menu_list_push(list, val->string.buff, db->path,
|
||||||
|
MENU_FILE_RDB_ENTRY, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int menu_entries_push_list(menu_handle_t *menu,
|
int menu_entries_push_list(menu_handle_t *menu,
|
||||||
file_list_t *list,
|
file_list_t *list,
|
||||||
const char *path, const char *label,
|
const char *path, const char *label,
|
||||||
@ -276,6 +306,7 @@ static void menu_entries_parse_drive_list(file_list_t *list)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int menu_entries_parse_list(
|
int menu_entries_parse_list(
|
||||||
file_list_t *list, file_list_t *menu_list,
|
file_list_t *list, file_list_t *menu_list,
|
||||||
const char *dir, const char *label, unsigned type,
|
const char *dir, const char *label, unsigned type,
|
||||||
|
@ -21,6 +21,9 @@
|
|||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include <file/file_list.h>
|
#include <file/file_list.h>
|
||||||
#include "../settings_data.h"
|
#include "../settings_data.h"
|
||||||
|
#ifdef HAVE_LIBRETRODB
|
||||||
|
#include "menu_database.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -55,6 +58,11 @@ int menu_entries_push_horizontal_menu_list(menu_handle_t *menu,
|
|||||||
const char *path, const char *label,
|
const char *path, const char *label,
|
||||||
unsigned menu_type);
|
unsigned menu_type);
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBRETRODB
|
||||||
|
int menu_entries_push_query(libretrodb_t *db,
|
||||||
|
libretrodb_cursor_t *cur, file_list_t *list);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user