mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(playlist.c) Go through wrapper functions
This commit is contained in:
parent
fa48c8d4ce
commit
6c4b6310aa
@ -29,6 +29,12 @@
|
||||
#include "../../input/input_remapping.h"
|
||||
#include "../../system.h"
|
||||
|
||||
enum
|
||||
{
|
||||
ACTION_OK_FFMPEG = 0,
|
||||
ACTION_OK_IMAGEVIEWER
|
||||
};
|
||||
|
||||
#ifndef BIND_ACTION_OK
|
||||
#define BIND_ACTION_OK(cbs, name) \
|
||||
cbs->action_ok = name; \
|
||||
@ -539,13 +545,22 @@ static int action_ok_playlist_entry(const char *path,
|
||||
if (found_associated_core)
|
||||
{
|
||||
char new_display_name[PATH_MAX_LENGTH];
|
||||
const char *entry_path = NULL;
|
||||
const char *entry_crc32 = NULL;
|
||||
const char *db_name = NULL;
|
||||
|
||||
content_playlist_get_index(menu->playlist, selection_ptr,
|
||||
&entry_path, &entry_label, NULL, NULL, &entry_crc32, &db_name);
|
||||
|
||||
strlcpy(new_display_name, core_info->display_name, sizeof(new_display_name));
|
||||
content_playlist_update(menu->playlist, selection_ptr,
|
||||
menu->playlist->entries[selection_ptr].path, menu->playlist->entries[selection_ptr].label,
|
||||
new_core_path , new_display_name,
|
||||
menu->playlist->entries[selection_ptr].crc32,
|
||||
menu->playlist->entries[selection_ptr].db_name);
|
||||
content_playlist_update(menu->playlist,
|
||||
selection_ptr,
|
||||
entry_path,
|
||||
entry_label,
|
||||
new_core_path,
|
||||
new_display_name,
|
||||
entry_crc32,
|
||||
db_name);
|
||||
content_playlist_write_file(menu->playlist);
|
||||
}
|
||||
else
|
||||
@ -937,6 +952,10 @@ static int action_ok_core_deferred_set(const char *path,
|
||||
{
|
||||
size_t selection;
|
||||
char core_display_name[PATH_MAX_LENGTH];
|
||||
const char *entry_path = NULL;
|
||||
const char *entry_label = NULL;
|
||||
const char *entry_crc32 = NULL;
|
||||
const char *db_name = NULL;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
if (!menu)
|
||||
return -1;
|
||||
@ -949,11 +968,14 @@ static int action_ok_core_deferred_set(const char *path,
|
||||
|
||||
idx = rdb_entry_start_game_selection_ptr;
|
||||
|
||||
content_playlist_get_index(menu->playlist, idx,
|
||||
&entry_path, &entry_label, NULL, NULL, &entry_crc32, &db_name);
|
||||
|
||||
content_playlist_update(menu->playlist, idx,
|
||||
menu->playlist->entries[idx].path, menu->playlist->entries[idx].label,
|
||||
entry_path, entry_label,
|
||||
path , core_display_name,
|
||||
menu->playlist->entries[idx].crc32,
|
||||
menu->playlist->entries[idx].db_name);
|
||||
entry_crc32,
|
||||
db_name);
|
||||
|
||||
content_playlist_write_file(menu->playlist);
|
||||
|
||||
@ -985,11 +1007,6 @@ static int action_ok_deferred_list_stub(const char *path,
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
ACTION_OK_FFMPEG = 0,
|
||||
ACTION_OK_IMAGEVIEWER
|
||||
};
|
||||
|
||||
static int generic_action_ok_file_load(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx,
|
||||
|
@ -1158,15 +1158,21 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info)
|
||||
|
||||
if (playlist)
|
||||
{
|
||||
for (j = 0; j < playlist->size; j++)
|
||||
for (j = 0; j < content_playlist_size(playlist); j++)
|
||||
{
|
||||
const char *crc32 = NULL;
|
||||
char elem0[PATH_MAX_LENGTH] = {0};
|
||||
char elem1[PATH_MAX_LENGTH] = {0};
|
||||
bool match_found = false;
|
||||
struct string_list *tmp_str_list = string_split(
|
||||
playlist->entries[j].crc32, "|");
|
||||
struct string_list *tmp_str_list = NULL;
|
||||
uint32_t hash_value = 0;
|
||||
|
||||
content_playlist_get_index(playlist, j,
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL, &crc32);
|
||||
|
||||
tmp_str_list = string_split(crc32, "|");
|
||||
|
||||
if (!tmp_str_list)
|
||||
continue;
|
||||
|
||||
@ -1638,10 +1644,13 @@ loop:
|
||||
static int menu_displaylist_sort_playlist(const content_playlist_entry_t *a,
|
||||
const content_playlist_entry_t *b)
|
||||
{
|
||||
if (!a->label || !b->label)
|
||||
const char *a_label = content_playlist_entry_get_label(a);
|
||||
const char *b_label = content_playlist_entry_get_label(b);
|
||||
|
||||
if (!a_label || !b_label)
|
||||
return 0;
|
||||
|
||||
return strcasecmp(a->label, b->label);
|
||||
return strcasecmp(a_label, b_label);
|
||||
}
|
||||
|
||||
static int menu_displaylist_parse_horizontal_list(menu_displaylist_info_t *info)
|
||||
|
26
playlist.c
26
playlist.c
@ -25,6 +25,25 @@
|
||||
#include "playlist.h"
|
||||
#include "verbosity.h"
|
||||
|
||||
struct content_playlist_entry
|
||||
{
|
||||
char *path;
|
||||
char *label;
|
||||
char *core_path;
|
||||
char *core_name;
|
||||
char *db_name;
|
||||
char *crc32;
|
||||
};
|
||||
|
||||
struct content_playlist
|
||||
{
|
||||
struct content_playlist_entry *entries;
|
||||
size_t size;
|
||||
size_t cap;
|
||||
|
||||
char *conf_path;
|
||||
};
|
||||
|
||||
/**
|
||||
* content_playlist_get_index:
|
||||
* @playlist : Playlist handle.
|
||||
@ -315,6 +334,13 @@ size_t content_playlist_size(content_playlist_t *playlist)
|
||||
return playlist->size;
|
||||
}
|
||||
|
||||
const char *content_playlist_entry_get_label(const content_playlist_entry_t *entry)
|
||||
{
|
||||
if (!entry)
|
||||
return NULL;
|
||||
return entry->label;
|
||||
}
|
||||
|
||||
#ifndef PLAYLIST_ENTRIES
|
||||
#define PLAYLIST_ENTRIES 6
|
||||
#endif
|
||||
|
22
playlist.h
22
playlist.h
@ -24,24 +24,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct content_playlist_entry
|
||||
{
|
||||
char *path;
|
||||
char *label;
|
||||
char *core_path;
|
||||
char *core_name;
|
||||
char *db_name;
|
||||
char *crc32;
|
||||
} content_playlist_entry_t;
|
||||
|
||||
typedef struct content_playlist
|
||||
{
|
||||
struct content_playlist_entry *entries;
|
||||
size_t size;
|
||||
size_t cap;
|
||||
|
||||
char *conf_path;
|
||||
} content_playlist_t;
|
||||
typedef struct content_playlist_entry content_playlist_entry_t;
|
||||
typedef struct content_playlist content_playlist_t;
|
||||
|
||||
typedef int (content_playlist_sort_fun_t)(const content_playlist_entry_t *a,
|
||||
const content_playlist_entry_t *b);
|
||||
@ -82,6 +66,8 @@ void content_playlist_clear(content_playlist_t *playlist);
|
||||
**/
|
||||
size_t content_playlist_size(content_playlist_t *playlist);
|
||||
|
||||
const char *content_playlist_entry_get_label(const content_playlist_entry_t *entry);
|
||||
|
||||
/**
|
||||
* content_playlist_get_index:
|
||||
* @playlist : Playlist handle.
|
||||
|
Loading…
x
Reference in New Issue
Block a user