mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
add subsystem_name (friendly name) to history playlist, make playlist_entry struct public to simplify function parameters
This commit is contained in:
parent
2c71ce437c
commit
f7b0c0947c
29
command.c
29
command.c
@ -2407,16 +2407,19 @@ TODO: Add a setting for these tweaks */
|
||||
{
|
||||
if (str_list->size >= 6)
|
||||
{
|
||||
struct playlist_entry entry = {0};
|
||||
|
||||
entry.path = str_list->elems[0].data; /* content_path */
|
||||
entry.label = str_list->elems[1].data; /* content_label */
|
||||
entry.core_path = str_list->elems[2].data; /* core_path */
|
||||
entry.core_name = str_list->elems[3].data; /* core_name */
|
||||
entry.crc32 = str_list->elems[4].data; /* crc32 */
|
||||
entry.db_name = str_list->elems[5].data; /* db_name */
|
||||
|
||||
/* Write playlist entry */
|
||||
command_playlist_push_write(
|
||||
g_defaults.content_favorites,
|
||||
str_list->elems[0].data, /* content_path */
|
||||
str_list->elems[1].data, /* content_label */
|
||||
str_list->elems[2].data, /* core_path */
|
||||
str_list->elems[3].data, /* core_name */
|
||||
str_list->elems[4].data, /* crc32 */
|
||||
str_list->elems[5].data, /* db_name */
|
||||
NULL, NULL
|
||||
&entry
|
||||
);
|
||||
runloop_msg_queue_push(msg_hash_to_str(MSG_ADDED_TO_FAVORITES), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
}
|
||||
@ -2429,16 +2432,16 @@ TODO: Add a setting for these tweaks */
|
||||
const char *core_name = "DETECT";
|
||||
const char *core_path = "DETECT";
|
||||
size_t *playlist_index = (size_t*)data;
|
||||
struct playlist_entry entry = {0};
|
||||
|
||||
/* the update function reads our entry as const, so these casts are safe */
|
||||
entry.core_path = (char*)core_path;
|
||||
entry.core_name = (char*)core_name;
|
||||
|
||||
command_playlist_update_write(
|
||||
NULL,
|
||||
*playlist_index,
|
||||
NULL,
|
||||
NULL,
|
||||
core_path,
|
||||
core_name,
|
||||
NULL,
|
||||
NULL);
|
||||
&entry);
|
||||
|
||||
runloop_msg_queue_push(msg_hash_to_str(MSG_RESET_CORE_ASSOCIATION), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
break;
|
||||
|
@ -344,15 +344,19 @@ void discord_update(enum discord_presence presence)
|
||||
{
|
||||
const char *system_id = core_info->system_id
|
||||
? core_info->system_id : "core";
|
||||
char *label = NULL;
|
||||
const char *label = NULL;
|
||||
const struct playlist_entry *entry = NULL;
|
||||
playlist_t *current_playlist = playlist_get_cached();
|
||||
|
||||
if (current_playlist)
|
||||
{
|
||||
playlist_get_index_by_path(
|
||||
current_playlist, path_get(RARCH_PATH_CONTENT), NULL, &label, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
current_playlist, path_get(RARCH_PATH_CONTENT), &entry);
|
||||
label = entry->label;
|
||||
}
|
||||
|
||||
if (!label)
|
||||
label = (char *)path_basename(path_get(RARCH_PATH_BASENAME));
|
||||
label = path_basename(path_get(RARCH_PATH_BASENAME));
|
||||
#if 0
|
||||
RARCH_LOG("[discord] current core: %s\n", system_id);
|
||||
RARCH_LOG("[discord] current content: %s\n", label);
|
||||
|
@ -965,9 +965,11 @@ end:
|
||||
static bool menu_content_playlist_load(playlist_t *playlist, size_t idx)
|
||||
{
|
||||
const char *path = NULL;
|
||||
const struct playlist_entry *entry = NULL;
|
||||
|
||||
playlist_get_index(playlist,
|
||||
idx, &path, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
playlist_get_index(playlist, idx, &entry);
|
||||
|
||||
path = entry->path;
|
||||
|
||||
if (!string_is_empty(path))
|
||||
{
|
||||
@ -1708,16 +1710,9 @@ static int action_ok_playlist_entry_collection(const char *path,
|
||||
size_t selection_ptr = 0;
|
||||
bool playlist_initialized = false;
|
||||
playlist_t *playlist = NULL;
|
||||
const char *entry_path = NULL;
|
||||
const char *entry_label = NULL;
|
||||
const char *core_path = NULL;
|
||||
const char *core_name = NULL;
|
||||
playlist_t *tmp_playlist = NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
|
||||
const char *subsystem_ident = NULL;
|
||||
const struct string_list
|
||||
*subsystem_rom_list = NULL;
|
||||
const struct playlist_entry *entry = NULL;
|
||||
unsigned i = 0;
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
@ -1740,28 +1735,27 @@ static int action_ok_playlist_entry_collection(const char *path,
|
||||
playlist = tmp_playlist;
|
||||
selection_ptr = entry_idx;
|
||||
|
||||
playlist_get_index(playlist, selection_ptr,
|
||||
&entry_path, &entry_label, &core_path, &core_name, NULL, NULL, &subsystem_ident, &subsystem_rom_list);
|
||||
playlist_get_index(playlist, selection_ptr, &entry);
|
||||
|
||||
/* Subsystem codepath */
|
||||
if (!string_is_empty(subsystem_ident))
|
||||
if (!string_is_empty(entry->subsystem_ident))
|
||||
{
|
||||
content_ctx_info_t content_info = {0};
|
||||
|
||||
task_push_load_new_core(core_path, NULL,
|
||||
task_push_load_new_core(entry->core_path, NULL,
|
||||
&content_info, CORE_TYPE_PLAIN, NULL, NULL);
|
||||
|
||||
content_clear_subsystem();
|
||||
|
||||
if (!content_set_subsystem_by_name(subsystem_ident))
|
||||
if (!content_set_subsystem_by_name(entry->subsystem_ident))
|
||||
{
|
||||
RARCH_LOG("[playlist] subsystem not found in implementation\n");
|
||||
/* TODO: Add OSD message telling users that content can't be loaded */
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < subsystem_rom_list->size; i++)
|
||||
content_add_subsystem(subsystem_rom_list->elems[i].data);
|
||||
for (i = 0; i < entry->subsystem_roms->size; i++)
|
||||
content_add_subsystem(entry->subsystem_roms->elems[i].data);
|
||||
|
||||
task_push_load_subsystem_with_core_from_menu(
|
||||
NULL, &content_info,
|
||||
@ -1771,8 +1765,8 @@ static int action_ok_playlist_entry_collection(const char *path,
|
||||
}
|
||||
|
||||
/* Is the core path / name of the playlist entry not yet filled in? */
|
||||
if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT))
|
||||
&& string_is_equal(core_name, file_path_str(FILE_PATH_DETECT)))
|
||||
if ( string_is_equal(entry->core_path, file_path_str(FILE_PATH_DETECT))
|
||||
&& string_is_equal(entry->core_name, file_path_str(FILE_PATH_DETECT)))
|
||||
{
|
||||
core_info_ctx_find_t core_info;
|
||||
const char *entry_path = NULL;
|
||||
@ -1802,18 +1796,20 @@ static int action_ok_playlist_entry_collection(const char *path,
|
||||
tmp_playlist = playlist_get_cached();
|
||||
|
||||
if (tmp_playlist)
|
||||
{
|
||||
struct playlist_entry entry = {0};
|
||||
|
||||
entry.core_path = new_core_path;
|
||||
entry.core_name = core_info.inf->display_name;
|
||||
|
||||
command_playlist_update_write(
|
||||
tmp_playlist,
|
||||
selection_ptr,
|
||||
NULL,
|
||||
NULL,
|
||||
new_core_path,
|
||||
core_info.inf->display_name,
|
||||
NULL,
|
||||
NULL);
|
||||
&entry);
|
||||
}
|
||||
}
|
||||
else
|
||||
strlcpy(new_core_path, core_path, sizeof(new_core_path));
|
||||
strlcpy(new_core_path, entry->core_path, sizeof(new_core_path));
|
||||
|
||||
if (!playlist || !menu_content_playlist_load(playlist, selection_ptr))
|
||||
{
|
||||
@ -1826,11 +1822,10 @@ static int action_ok_playlist_entry_collection(const char *path,
|
||||
return menu_cbs_exit();
|
||||
}
|
||||
|
||||
playlist_get_index(playlist,
|
||||
selection_ptr, &path, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
playlist_get_index(playlist, selection_ptr, &entry);
|
||||
|
||||
return default_action_ok_load_content_from_playlist_from_menu(
|
||||
new_core_path, path, entry_label);
|
||||
new_core_path, entry->path, entry->label);
|
||||
}
|
||||
|
||||
static int action_ok_playlist_entry(const char *path,
|
||||
@ -1839,11 +1834,9 @@ static int action_ok_playlist_entry(const char *path,
|
||||
char new_core_path[PATH_MAX_LENGTH];
|
||||
size_t selection_ptr = 0;
|
||||
playlist_t *playlist = g_defaults.content_history;
|
||||
const char *entry_path = NULL;
|
||||
const char *entry_label = NULL;
|
||||
const char *core_path = NULL;
|
||||
const char *core_name = NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
const struct playlist_entry *entry = NULL;
|
||||
const char *entry_label = NULL;
|
||||
|
||||
new_core_path[0] = '\0';
|
||||
|
||||
@ -1852,11 +1845,12 @@ static int action_ok_playlist_entry(const char *path,
|
||||
|
||||
selection_ptr = entry_idx;
|
||||
|
||||
playlist_get_index(playlist, selection_ptr,
|
||||
&entry_path, &entry_label, &core_path, &core_name, NULL, NULL, NULL, NULL);
|
||||
playlist_get_index(playlist, selection_ptr, &entry);
|
||||
|
||||
if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT))
|
||||
&& string_is_equal(core_name, file_path_str(FILE_PATH_DETECT)))
|
||||
entry_label = entry->label;
|
||||
|
||||
if ( string_is_equal(entry->core_path, file_path_str(FILE_PATH_DETECT))
|
||||
&& string_is_equal(entry->core_name, file_path_str(FILE_PATH_DETECT)))
|
||||
{
|
||||
core_info_ctx_find_t core_info;
|
||||
const char *entry_path = NULL;
|
||||
@ -1875,21 +1869,23 @@ static int action_ok_playlist_entry(const char *path,
|
||||
if (!found_associated_core)
|
||||
/* TODO: figure out if this should refer to the inner or outer entry_path */
|
||||
/* TODO: make sure there's only one entry_path in this function */
|
||||
return action_ok_file_load_with_detect_core(entry_path,
|
||||
return action_ok_file_load_with_detect_core(entry->path,
|
||||
label, type, selection_ptr, entry_idx);
|
||||
|
||||
command_playlist_update_write(NULL,
|
||||
selection_ptr,
|
||||
NULL,
|
||||
NULL,
|
||||
new_core_path,
|
||||
core_info.inf->display_name,
|
||||
NULL,
|
||||
NULL);
|
||||
{
|
||||
struct playlist_entry entry = {0};
|
||||
|
||||
entry.core_path = new_core_path;
|
||||
entry.core_name = core_info.inf->display_name;
|
||||
|
||||
command_playlist_update_write(NULL,
|
||||
selection_ptr,
|
||||
&entry);
|
||||
}
|
||||
|
||||
}
|
||||
else if (!string_is_empty(core_path))
|
||||
strlcpy(new_core_path, core_path, sizeof(new_core_path));
|
||||
else if (!string_is_empty(entry->core_path))
|
||||
strlcpy(new_core_path, entry->core_path, sizeof(new_core_path));
|
||||
|
||||
if (!playlist || !menu_content_playlist_load(playlist, selection_ptr))
|
||||
{
|
||||
@ -1901,23 +1897,19 @@ static int action_ok_playlist_entry(const char *path,
|
||||
}
|
||||
|
||||
playlist_get_index(playlist,
|
||||
selection_ptr, &path, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL);
|
||||
selection_ptr, &entry);
|
||||
|
||||
return default_action_ok_load_content_from_playlist_from_menu(
|
||||
new_core_path, path, entry_label);
|
||||
new_core_path, entry->path, entry_label);
|
||||
}
|
||||
|
||||
static int action_ok_playlist_entry_start_content(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
size_t selection_ptr = 0;
|
||||
const char *entry_path = NULL;
|
||||
const char *entry_label = NULL;
|
||||
const char *core_path = NULL;
|
||||
const char *core_name = NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
const struct playlist_entry *entry = NULL;
|
||||
|
||||
if ( !playlist ||
|
||||
!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
@ -1925,11 +1917,10 @@ static int action_ok_playlist_entry_start_content(const char *path,
|
||||
|
||||
selection_ptr = menu->scratchpad.unsigned_var;
|
||||
|
||||
playlist_get_index(playlist, selection_ptr,
|
||||
&entry_path, &entry_label, &core_path, &core_name, NULL, NULL, NULL, NULL);
|
||||
playlist_get_index(playlist, selection_ptr, &entry);
|
||||
|
||||
if ( string_is_equal(core_path, file_path_str(FILE_PATH_DETECT))
|
||||
&& string_is_equal(core_name, file_path_str(FILE_PATH_DETECT)))
|
||||
if ( string_is_equal(entry->core_path, file_path_str(FILE_PATH_DETECT))
|
||||
&& string_is_equal(entry->core_name, file_path_str(FILE_PATH_DETECT)))
|
||||
{
|
||||
core_info_ctx_find_t core_info;
|
||||
char new_core_path[PATH_MAX_LENGTH];
|
||||
@ -1958,15 +1949,17 @@ static int action_ok_playlist_entry_start_content(const char *path,
|
||||
return action_ok_file_load_with_detect_core(entry_path,
|
||||
label, type, selection_ptr, entry_idx);
|
||||
|
||||
command_playlist_update_write(
|
||||
playlist,
|
||||
selection_ptr,
|
||||
NULL,
|
||||
NULL,
|
||||
new_core_path,
|
||||
core_info.inf->display_name,
|
||||
NULL,
|
||||
NULL);
|
||||
{
|
||||
struct playlist_entry entry = {0};
|
||||
|
||||
entry.core_path = new_core_path;
|
||||
entry.core_name = core_info.inf->display_name;
|
||||
|
||||
command_playlist_update_write(
|
||||
playlist,
|
||||
selection_ptr,
|
||||
&entry);
|
||||
}
|
||||
}
|
||||
|
||||
if (!menu_content_playlist_load(playlist, selection_ptr))
|
||||
@ -1975,10 +1968,9 @@ static int action_ok_playlist_entry_start_content(const char *path,
|
||||
goto error;
|
||||
}
|
||||
|
||||
playlist_get_index(playlist,
|
||||
selection_ptr, &path, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
playlist_get_index(playlist, selection_ptr, &entry);
|
||||
|
||||
return default_action_ok_load_content_from_playlist_from_menu(core_path, path, entry_label);
|
||||
return default_action_ok_load_content_from_playlist_from_menu(entry->core_path, entry->path, entry->label);
|
||||
|
||||
error:
|
||||
return menu_cbs_exit();
|
||||
@ -2095,15 +2087,15 @@ static int action_ok_audio_add_to_mixer(const char *path,
|
||||
{
|
||||
const char *entry_path = NULL;
|
||||
playlist_t *tmp_playlist = playlist_get_cached();
|
||||
const struct playlist_entry *entry = NULL;
|
||||
|
||||
if (!tmp_playlist)
|
||||
return -1;
|
||||
|
||||
playlist_get_index(tmp_playlist, entry_idx,
|
||||
&entry_path, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
playlist_get_index(tmp_playlist, entry_idx, &entry);
|
||||
|
||||
if (filestream_exists(entry_path))
|
||||
task_push_audio_mixer_load(entry_path,
|
||||
if (filestream_exists(entry->path))
|
||||
task_push_audio_mixer_load(entry->path,
|
||||
NULL, NULL, false,
|
||||
AUDIO_MIXER_SLOT_SELECTION_AUTOMATIC,
|
||||
0
|
||||
@ -2117,15 +2109,15 @@ static int action_ok_audio_add_to_mixer_and_play(const char *path,
|
||||
{
|
||||
const char *entry_path = NULL;
|
||||
playlist_t *tmp_playlist = playlist_get_cached();
|
||||
const struct playlist_entry *entry = NULL;
|
||||
|
||||
if (!tmp_playlist)
|
||||
return -1;
|
||||
|
||||
playlist_get_index(tmp_playlist, entry_idx,
|
||||
&entry_path, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
playlist_get_index(tmp_playlist, entry_idx, &entry);
|
||||
|
||||
if (filestream_exists(entry_path))
|
||||
task_push_audio_mixer_load_and_play(entry_path,
|
||||
if (filestream_exists(entry->path))
|
||||
task_push_audio_mixer_load_and_play(entry->path,
|
||||
NULL, NULL, false,
|
||||
AUDIO_MIXER_SLOT_SELECTION_AUTOMATIC,
|
||||
0);
|
||||
@ -2138,6 +2130,7 @@ static int action_ok_audio_add_to_mixer_and_collection(const char *path,
|
||||
{
|
||||
char combined_path[PATH_MAX_LENGTH];
|
||||
menu_handle_t *menu = NULL;
|
||||
struct playlist_entry entry = {0};
|
||||
|
||||
combined_path[0] = '\0';
|
||||
|
||||
@ -2147,14 +2140,12 @@ static int action_ok_audio_add_to_mixer_and_collection(const char *path,
|
||||
fill_pathname_join(combined_path, menu->scratch2_buf,
|
||||
menu->scratch_buf, sizeof(combined_path));
|
||||
|
||||
command_playlist_push_write(
|
||||
g_defaults.music_history,
|
||||
combined_path,
|
||||
NULL,
|
||||
"builtin",
|
||||
"musicplayer",
|
||||
NULL, NULL,
|
||||
NULL, NULL);
|
||||
/* the push function reads our entry as const, so these casts are safe */
|
||||
entry.path = combined_path;
|
||||
entry.core_path = (char*)"builtin";
|
||||
entry.core_name = (char*)"musicplayer";
|
||||
|
||||
command_playlist_push_write(g_defaults.music_history, &entry);
|
||||
|
||||
if (filestream_exists(combined_path))
|
||||
task_push_audio_mixer_load(combined_path,
|
||||
@ -2170,6 +2161,7 @@ static int action_ok_audio_add_to_mixer_and_collection_and_play(const char *path
|
||||
{
|
||||
char combined_path[PATH_MAX_LENGTH];
|
||||
menu_handle_t *menu = NULL;
|
||||
struct playlist_entry entry = {0};
|
||||
|
||||
combined_path[0] = '\0';
|
||||
|
||||
@ -2179,14 +2171,12 @@ static int action_ok_audio_add_to_mixer_and_collection_and_play(const char *path
|
||||
fill_pathname_join(combined_path, menu->scratch2_buf,
|
||||
menu->scratch_buf, sizeof(combined_path));
|
||||
|
||||
command_playlist_push_write(
|
||||
g_defaults.music_history,
|
||||
combined_path,
|
||||
NULL,
|
||||
"builtin",
|
||||
"musicplayer",
|
||||
NULL, NULL,
|
||||
NULL, NULL);
|
||||
/* the push function reads our entry as const, so these casts are safe */
|
||||
entry.path = combined_path;
|
||||
entry.core_path = (char*)"builtin";
|
||||
entry.core_name = (char*)"musicplayer";
|
||||
|
||||
command_playlist_push_write(g_defaults.music_history, &entry);
|
||||
|
||||
if (filestream_exists(combined_path))
|
||||
task_push_audio_mixer_load_and_play(combined_path,
|
||||
@ -2250,14 +2240,16 @@ static void menu_input_st_string_cb_rename_entry(void *userdata,
|
||||
const char *label = menu_input_dialog_get_buffer();
|
||||
|
||||
if (!string_is_empty(label))
|
||||
{
|
||||
struct playlist_entry entry = {0};
|
||||
|
||||
/* the update function reads our entry as const, so these casts are safe */
|
||||
entry.label = (char*)label;
|
||||
|
||||
command_playlist_update_write(NULL,
|
||||
menu_input_dialog_get_kb_idx(),
|
||||
NULL,
|
||||
label,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
&entry);
|
||||
}
|
||||
}
|
||||
|
||||
menu_input_dialog_end();
|
||||
@ -2708,15 +2700,20 @@ static int action_ok_core_deferred_set(const char *new_core_path,
|
||||
ext_name,
|
||||
settings->bools.show_hidden_files,
|
||||
true);
|
||||
command_playlist_update_write(
|
||||
NULL,
|
||||
menu->scratchpad.unsigned_var,
|
||||
NULL,
|
||||
content_label,
|
||||
new_core_path,
|
||||
core_display_name,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
{
|
||||
struct playlist_entry entry = {0};
|
||||
|
||||
/* the update function reads our entry as const, so these casts are safe */
|
||||
entry.label = (char*)content_label;
|
||||
entry.core_path = (char*)new_core_path;
|
||||
entry.core_name = core_display_name;
|
||||
|
||||
command_playlist_update_write(
|
||||
NULL,
|
||||
menu->scratchpad.unsigned_var,
|
||||
&entry);
|
||||
}
|
||||
|
||||
menu_entries_pop_stack(&selection, 0, 1);
|
||||
menu_navigation_set_selection(selection);
|
||||
@ -3834,10 +3831,6 @@ static int action_ok_reset_core_association(const char *path,
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
return menu_cbs_exit();
|
||||
|
||||
playlist_get_index(tmp_playlist,
|
||||
menu->rpl_entry_selection_ptr,
|
||||
&tmp_path, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
if (!command_event(CMD_EVENT_RESET_CORE_ASSOCIATION,
|
||||
(void *)&menu->rpl_entry_selection_ptr))
|
||||
return menu_cbs_exit();
|
||||
@ -3962,14 +3955,9 @@ static int action_ok_add_to_favorites(const char *path,
|
||||
static int action_ok_add_to_favorites_playlist(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
const char *content_path = NULL;
|
||||
const char *content_label = NULL;
|
||||
const char *core_path = NULL;
|
||||
const char *core_name = NULL;
|
||||
const char *crc32 = NULL;
|
||||
const char *db_name = NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
playlist_t *playlist_curr = playlist_get_cached();
|
||||
const struct playlist_entry *entry = NULL;
|
||||
int ret = 0;
|
||||
|
||||
if (!playlist_curr)
|
||||
@ -3978,13 +3966,11 @@ static int action_ok_add_to_favorites_playlist(const char *path,
|
||||
return menu_cbs_exit();
|
||||
|
||||
/* Read current playlist parameters */
|
||||
playlist_get_index(playlist_curr, menu->rpl_entry_selection_ptr,
|
||||
&content_path, &content_label, &core_path, &core_name,
|
||||
&crc32, NULL, NULL, NULL);
|
||||
playlist_get_index(playlist_curr, menu->rpl_entry_selection_ptr, &entry);
|
||||
|
||||
/* Error checking
|
||||
* > If content path is empty, cannot do anything... */
|
||||
if (!string_is_empty(content_path))
|
||||
if (!string_is_empty(entry->path))
|
||||
{
|
||||
struct string_list *str_list = NULL;
|
||||
union string_list_elem_attr attr;
|
||||
@ -4007,43 +3993,43 @@ static int action_ok_add_to_favorites_playlist(const char *path,
|
||||
* [5]: db_name */
|
||||
|
||||
/* > content_path */
|
||||
string_list_append(str_list, content_path, attr);
|
||||
string_list_append(str_list, entry->path, attr);
|
||||
|
||||
/* > content_label */
|
||||
if (!string_is_empty(content_label))
|
||||
if (!string_is_empty(entry->label))
|
||||
{
|
||||
string_list_append(str_list, content_label, attr);
|
||||
string_list_append(str_list, entry->label, attr);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Label is empty - use file name instead */
|
||||
char fallback_content_label[PATH_MAX_LENGTH];
|
||||
fallback_content_label[0] = '\0';
|
||||
fill_short_pathname_representation(fallback_content_label, content_path, sizeof(fallback_content_label));
|
||||
fill_short_pathname_representation(fallback_content_label, entry->path, sizeof(fallback_content_label));
|
||||
string_list_append(str_list, fallback_content_label, attr);
|
||||
}
|
||||
|
||||
/* > core_path + core_name */
|
||||
if (!string_is_empty(core_path) && !string_is_empty(core_name))
|
||||
if (!string_is_empty(entry->core_path) && !string_is_empty(entry->core_name))
|
||||
{
|
||||
core_info_ctx_find_t core_info;
|
||||
|
||||
/* >> core_path */
|
||||
string_list_append(str_list, core_path, attr);
|
||||
string_list_append(str_list, entry->core_path, attr);
|
||||
|
||||
/* >> core_name
|
||||
* (always use display name, if available) */
|
||||
core_info.inf = NULL;
|
||||
core_info.path = core_path;
|
||||
core_info.path = entry->core_path;
|
||||
|
||||
if (core_info_find(&core_info, core_path))
|
||||
if (core_info_find(&core_info, entry->core_path))
|
||||
if (!string_is_empty(core_info.inf->display_name))
|
||||
strlcpy(core_display_name, core_info.inf->display_name, sizeof(core_display_name));
|
||||
|
||||
if (!string_is_empty(core_display_name))
|
||||
string_list_append(str_list, core_display_name, attr);
|
||||
else
|
||||
string_list_append(str_list, core_name, attr);
|
||||
string_list_append(str_list, entry->core_name, attr);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4052,11 +4038,10 @@ static int action_ok_add_to_favorites_playlist(const char *path,
|
||||
}
|
||||
|
||||
/* crc32 */
|
||||
string_list_append(str_list, !string_is_empty(crc32) ? crc32 : "", attr);
|
||||
string_list_append(str_list, !string_is_empty(entry->crc32) ? entry->crc32 : "", attr);
|
||||
|
||||
/* db_name */
|
||||
playlist_get_db_name(playlist_curr, menu->rpl_entry_selection_ptr, &db_name);
|
||||
string_list_append(str_list, !string_is_empty(db_name) ? db_name : "", attr);
|
||||
string_list_append(str_list, !string_is_empty(entry->db_name) ? entry->db_name : "", attr);
|
||||
|
||||
/* Trigger 'ADD_TO_FAVORITES' event */
|
||||
if (!command_event(CMD_EVENT_ADD_TO_FAVORITES, (void*)str_list))
|
||||
|
@ -837,6 +837,7 @@ static int action_bind_sublabel_playlist_entry(
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
playlist_t *playlist = NULL;
|
||||
const struct playlist_entry *entry = NULL;
|
||||
const char *core_name = NULL;
|
||||
unsigned runtime_hours = 0;
|
||||
unsigned runtime_minutes = 0;
|
||||
@ -853,13 +854,17 @@ static int action_bind_sublabel_playlist_entry(
|
||||
|
||||
/* Get current playlist */
|
||||
playlist = playlist_get_cached();
|
||||
|
||||
if (!playlist)
|
||||
return 0;
|
||||
|
||||
if (i >= playlist_get_size(playlist))
|
||||
return 0;
|
||||
|
||||
/* Read playlist entry */
|
||||
playlist_get_index(playlist, i, NULL, NULL, NULL, &core_name, NULL, NULL, NULL, NULL);
|
||||
playlist_get_index(playlist, i, &entry);
|
||||
|
||||
core_name = entry->core_name;
|
||||
|
||||
/* Only add sublabel if a core is currently assigned */
|
||||
if (string_is_empty(core_name) || string_is_equal(core_name, file_path_str(FILE_PATH_DETECT)))
|
||||
|
@ -1132,6 +1132,7 @@ void ozone_update_content_metadata(ozone_handle_t *ozone)
|
||||
{
|
||||
size_t selection = menu_navigation_get_selection();
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
const struct playlist_entry *entry = NULL;
|
||||
const char *core_name = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
@ -1140,8 +1141,9 @@ void ozone_update_content_metadata(ozone_handle_t *ozone)
|
||||
if (ozone->is_playlist && playlist)
|
||||
{
|
||||
const char *core_label = NULL;
|
||||
playlist_get_index(playlist, selection,
|
||||
NULL, NULL, NULL, &core_name, NULL, NULL, NULL, NULL);
|
||||
playlist_get_index(playlist, selection, &entry);
|
||||
|
||||
core_name = entry->core_name;
|
||||
|
||||
/* Fill core name */
|
||||
if (!core_name || string_is_equal(core_name, "DETECT"))
|
||||
@ -1207,7 +1209,6 @@ void ozone_update_content_metadata(ozone_handle_t *ozone)
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DISABLED));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void ozone_set_thumbnail_content(void *data, const char *s)
|
||||
|
@ -903,11 +903,10 @@ static void stripes_update_thumbnail_path(void *data, unsigned i, char pos)
|
||||
|
||||
if (playlist)
|
||||
{
|
||||
const char *core_name = NULL;
|
||||
playlist_get_index(playlist, i,
|
||||
NULL, NULL, NULL, &core_name, NULL, NULL, NULL, NULL);
|
||||
const struct playlist_entry *entry = NULL;
|
||||
playlist_get_index(playlist, i, &entry);
|
||||
|
||||
if (string_is_equal(core_name, "imageviewer"))
|
||||
if (string_is_equal(entry->core_name, "imageviewer"))
|
||||
{
|
||||
if (pos == 'R' || (pos == 'L' && string_is_equal(stripes_thumbnails_ident('R'),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF))))
|
||||
|
@ -1345,22 +1345,18 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
|
||||
for (i = 0; i < list_size; i++)
|
||||
{
|
||||
char menu_entry_label[PATH_MAX_LENGTH];
|
||||
const char *path = NULL;
|
||||
const char *label = NULL;
|
||||
const char *core_path = NULL;
|
||||
const char *core_name = NULL;
|
||||
const struct playlist_entry *entry = NULL;
|
||||
|
||||
menu_entry_label[0] = '\0';
|
||||
|
||||
/* Read playlist entry */
|
||||
playlist_get_index(playlist, i,
|
||||
&path, &label, &core_path, &core_name, NULL, NULL, NULL, NULL);
|
||||
playlist_get_index(playlist, i, &entry);
|
||||
|
||||
/* Extract any available runtime values, if required */
|
||||
if (get_runtime)
|
||||
{
|
||||
runtime_log_t *runtime_log = NULL;
|
||||
runtime_log = runtime_log_init(path, core_path,
|
||||
runtime_log = runtime_log_init(entry->path, entry->core_path,
|
||||
settings->uints.playlist_sublabel_runtime_type == PLAYLIST_RUNTIME_PER_CORE);
|
||||
|
||||
if (runtime_log)
|
||||
@ -1400,7 +1396,7 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
|
||||
}
|
||||
}
|
||||
|
||||
if (!string_is_empty(path))
|
||||
if (!string_is_empty(entry->path))
|
||||
{
|
||||
/* Standard playlist entry
|
||||
* > Base menu entry label is always playlist label
|
||||
@ -1408,27 +1404,27 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
|
||||
* > If required, add currently associated core (if any), otherwise
|
||||
* no further action is necessary */
|
||||
|
||||
if (string_is_empty(label))
|
||||
fill_short_pathname_representation(menu_entry_label, path, sizeof(menu_entry_label));
|
||||
if (string_is_empty(entry->label))
|
||||
fill_short_pathname_representation(menu_entry_label, entry->path, sizeof(menu_entry_label));
|
||||
else
|
||||
strlcpy(menu_entry_label, label, sizeof(menu_entry_label));
|
||||
strlcpy(menu_entry_label, entry->label, sizeof(menu_entry_label));
|
||||
|
||||
if (show_inline_core_name)
|
||||
{
|
||||
if (!string_is_empty(core_name) && !string_is_equal(core_name, file_path_str(FILE_PATH_DETECT)))
|
||||
if (!string_is_empty(entry->core_name) && !string_is_equal(entry->core_name, file_path_str(FILE_PATH_DETECT)))
|
||||
{
|
||||
strlcat(menu_entry_label, label_spacer, sizeof(menu_entry_label));
|
||||
strlcat(menu_entry_label, core_name, sizeof(menu_entry_label));
|
||||
strlcat(menu_entry_label, entry->core_name, sizeof(menu_entry_label));
|
||||
}
|
||||
}
|
||||
|
||||
menu_entries_append_enum(info->list, menu_entry_label, path,
|
||||
menu_entries_append_enum(info->list, menu_entry_label, entry->path,
|
||||
MENU_ENUM_LABEL_PLAYLIST_ENTRY, FILE_TYPE_RPL_ENTRY, 0, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (core_name)
|
||||
strlcpy(menu_entry_label, core_name, sizeof(menu_entry_label));
|
||||
if (entry->core_name)
|
||||
strlcpy(menu_entry_label, entry->core_name, sizeof(menu_entry_label));
|
||||
|
||||
menu_entries_append_enum(info->list, menu_entry_label, path_playlist,
|
||||
MENU_ENUM_LABEL_PLAYLIST_ENTRY, FILE_TYPE_PLAYLIST_ENTRY, 0, i);
|
||||
@ -1735,16 +1731,14 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu,
|
||||
{
|
||||
for (j = 0; j < playlist_size(playlist); j++)
|
||||
{
|
||||
const char *crc32 = NULL;
|
||||
const struct playlist_entry *entry = NULL;
|
||||
bool match_found = false;
|
||||
struct string_list *tmp_str_list = NULL;
|
||||
|
||||
playlist_get_index(playlist, j,
|
||||
NULL, NULL, NULL, NULL,
|
||||
&crc32, NULL, NULL, NULL);
|
||||
playlist_get_index(playlist, j, &entry);
|
||||
|
||||
if (crc32)
|
||||
tmp_str_list = string_split(crc32, "|");
|
||||
if (entry->crc32)
|
||||
tmp_str_list = string_split(entry->crc32, "|");
|
||||
|
||||
if (!tmp_str_list)
|
||||
continue;
|
||||
@ -2878,19 +2872,14 @@ static int menu_displaylist_parse_horizontal_content_actions(
|
||||
menu_displaylist_info_t *info)
|
||||
{
|
||||
bool content_loaded = false;
|
||||
const char *label = NULL;
|
||||
const char *entry_path = NULL;
|
||||
const char *core_path = NULL;
|
||||
const char *core_name = NULL;
|
||||
const char *db_name = NULL;
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *fullpath = path_get(RARCH_PATH_CONTENT);
|
||||
unsigned idx = menu->rpl_entry_selection_ptr;
|
||||
const struct playlist_entry *entry = NULL;
|
||||
|
||||
if (playlist)
|
||||
playlist_get_index(playlist, idx,
|
||||
&entry_path, &label, &core_path, &core_name, NULL, &db_name, NULL, NULL);
|
||||
playlist_get_index(playlist, idx, &entry);
|
||||
|
||||
content_loaded = !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL)
|
||||
&& string_is_equal(menu->deferred_path, fullpath);
|
||||
@ -2901,8 +2890,8 @@ static int menu_displaylist_parse_horizontal_content_actions(
|
||||
{
|
||||
const char *ext = NULL;
|
||||
|
||||
if (!string_is_empty(entry_path))
|
||||
ext = path_get_extension(entry_path);
|
||||
if (!string_is_empty(entry->path))
|
||||
ext = path_get_extension(entry->path);
|
||||
|
||||
if (!string_is_empty(ext) &&
|
||||
audio_driver_mixer_extension_supported(ext))
|
||||
@ -2956,10 +2945,9 @@ static int menu_displaylist_parse_horizontal_content_actions(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_RESET_CORE_ASSOCIATION),
|
||||
MENU_ENUM_LABEL_RESET_CORE_ASSOCIATION, FILE_TYPE_PLAYLIST_ENTRY, 0, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!string_is_empty(db_name) && (!content_loaded ||
|
||||
if (!string_is_empty(entry->db_name) && (!content_loaded ||
|
||||
(content_loaded && settings->bools.quick_menu_show_information)))
|
||||
{
|
||||
char *db_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
@ -2968,7 +2956,7 @@ static int menu_displaylist_parse_horizontal_content_actions(
|
||||
|
||||
fill_pathname_join_noext(db_path,
|
||||
settings->paths.path_content_database,
|
||||
db_name,
|
||||
entry->db_name,
|
||||
PATH_MAX_LENGTH * sizeof(char));
|
||||
strlcat(db_path,
|
||||
file_path_str(FILE_PATH_RDB_EXTENSION),
|
||||
@ -2977,7 +2965,7 @@ static int menu_displaylist_parse_horizontal_content_actions(
|
||||
if (filestream_exists(db_path))
|
||||
menu_entries_append_enum(
|
||||
info->list,
|
||||
label,
|
||||
entry->label,
|
||||
db_path,
|
||||
MENU_ENUM_LABEL_INFORMATION,
|
||||
FILE_TYPE_RDB_ENTRY, 0, idx);
|
||||
|
@ -316,7 +316,8 @@ bool menu_thumbnail_set_content_playlist(menu_thumbnail_path_data_t *path_data,
|
||||
const char *content_label = NULL;
|
||||
const char *core_name = NULL;
|
||||
const char *db_name = NULL;
|
||||
|
||||
const struct playlist_entry *entry = NULL;
|
||||
|
||||
if (!path_data)
|
||||
return false;
|
||||
|
||||
@ -339,9 +340,13 @@ bool menu_thumbnail_set_content_playlist(menu_thumbnail_path_data_t *path_data,
|
||||
return false;
|
||||
|
||||
/* Read playlist values */
|
||||
playlist_get_index(playlist, idx,
|
||||
&content_path, &content_label, NULL, &core_name, NULL, &db_name, NULL, NULL);
|
||||
|
||||
playlist_get_index(playlist, idx, &entry);
|
||||
|
||||
content_path = entry->path;
|
||||
content_label = entry->label;
|
||||
core_name = entry->core_name;
|
||||
db_name = entry->db_name;
|
||||
|
||||
/* Content without a path is invalid by definition */
|
||||
if (string_is_empty(content_path))
|
||||
return false;
|
||||
|
237
playlist.c
237
playlist.c
@ -1,7 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
* Copyright (C) 2018-2019 - Brad Parker
|
||||
* Copyright (C) 2016-2019 - Brad Parker
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
@ -39,30 +39,6 @@
|
||||
#define PLAYLIST_ENTRIES 6
|
||||
#endif
|
||||
|
||||
struct playlist_entry
|
||||
{
|
||||
char *path;
|
||||
char *label;
|
||||
char *core_path;
|
||||
char *core_name;
|
||||
char *db_name;
|
||||
char *crc32;
|
||||
char *subsystem_ident;
|
||||
struct string_list *subsystem_roms;
|
||||
unsigned runtime_hours;
|
||||
unsigned runtime_minutes;
|
||||
unsigned runtime_seconds;
|
||||
/* Note: due to platform dependence, have to record
|
||||
* timestamp as either a string or independent integer
|
||||
* values. The latter is more verbose, but more efficient. */
|
||||
unsigned last_played_year;
|
||||
unsigned last_played_month;
|
||||
unsigned last_played_day;
|
||||
unsigned last_played_hour;
|
||||
unsigned last_played_minute;
|
||||
unsigned last_played_second;
|
||||
};
|
||||
|
||||
struct content_playlist
|
||||
{
|
||||
bool modified;
|
||||
@ -124,32 +100,12 @@ char *playlist_get_conf_path(playlist_t *playlist)
|
||||
**/
|
||||
void playlist_get_index(playlist_t *playlist,
|
||||
size_t idx,
|
||||
const char **path, const char **label,
|
||||
const char **core_path, const char **core_name,
|
||||
const char **crc32,
|
||||
const char **db_name,
|
||||
const char **subsystem_ident,
|
||||
const struct string_list **subsystem_roms)
|
||||
const struct playlist_entry **entry)
|
||||
{
|
||||
if (!playlist)
|
||||
if (!playlist || !entry)
|
||||
return;
|
||||
|
||||
if (path)
|
||||
*path = playlist->entries[idx].path;
|
||||
if (label)
|
||||
*label = playlist->entries[idx].label;
|
||||
if (core_path)
|
||||
*core_path = playlist->entries[idx].core_path;
|
||||
if (core_name)
|
||||
*core_name = playlist->entries[idx].core_name;
|
||||
if (db_name)
|
||||
*db_name = playlist->entries[idx].db_name;
|
||||
if (crc32)
|
||||
*crc32 = playlist->entries[idx].crc32;
|
||||
if (subsystem_ident)
|
||||
*subsystem_ident = playlist->entries[idx].subsystem_ident;
|
||||
if (subsystem_roms)
|
||||
*subsystem_roms = playlist->entries[idx].subsystem_roms;
|
||||
*entry = &playlist->entries[idx];
|
||||
}
|
||||
|
||||
void playlist_get_runtime_index(playlist_t *playlist,
|
||||
@ -209,15 +165,11 @@ void playlist_delete_index(playlist_t *playlist,
|
||||
|
||||
void playlist_get_index_by_path(playlist_t *playlist,
|
||||
const char *search_path,
|
||||
char **path, char **label,
|
||||
char **core_path, char **core_name,
|
||||
char **crc32,
|
||||
char **db_name,
|
||||
char **subsystem_ident,
|
||||
struct string_list **subsystem_roms)
|
||||
const struct playlist_entry **entry)
|
||||
{
|
||||
size_t i;
|
||||
if (!playlist)
|
||||
|
||||
if (!playlist || !entry)
|
||||
return;
|
||||
|
||||
for (i = 0; i < playlist->size; i++)
|
||||
@ -225,22 +177,8 @@ void playlist_get_index_by_path(playlist_t *playlist,
|
||||
if (!string_is_equal(playlist->entries[i].path, search_path))
|
||||
continue;
|
||||
|
||||
if (path)
|
||||
*path = playlist->entries[i].path;
|
||||
if (label)
|
||||
*label = playlist->entries[i].label;
|
||||
if (core_path)
|
||||
*core_path = playlist->entries[i].core_path;
|
||||
if (core_name)
|
||||
*core_name = playlist->entries[i].core_name;
|
||||
if (db_name)
|
||||
*db_name = playlist->entries[i].db_name;
|
||||
if (crc32)
|
||||
*crc32 = playlist->entries[i].crc32;
|
||||
if (subsystem_ident)
|
||||
*subsystem_ident = playlist->entries[i].subsystem_ident;
|
||||
if (subsystem_roms)
|
||||
*subsystem_roms = playlist->entries[i].subsystem_roms;
|
||||
*entry = &playlist->entries[i];
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -285,6 +223,8 @@ static void playlist_free_entry(struct playlist_entry *entry)
|
||||
free(entry->crc32);
|
||||
if (entry->subsystem_ident != NULL)
|
||||
free(entry->subsystem_ident);
|
||||
if (entry->subsystem_name != NULL)
|
||||
free(entry->subsystem_name);
|
||||
if (entry->subsystem_roms != NULL)
|
||||
string_list_free(entry->subsystem_roms);
|
||||
|
||||
@ -295,6 +235,7 @@ static void playlist_free_entry(struct playlist_entry *entry)
|
||||
entry->db_name = NULL;
|
||||
entry->crc32 = NULL;
|
||||
entry->subsystem_ident = NULL;
|
||||
entry->subsystem_name = NULL;
|
||||
entry->subsystem_roms = NULL;
|
||||
entry->runtime_hours = 0;
|
||||
entry->runtime_minutes = 0;
|
||||
@ -308,10 +249,7 @@ static void playlist_free_entry(struct playlist_entry *entry)
|
||||
}
|
||||
|
||||
void playlist_update(playlist_t *playlist, size_t idx,
|
||||
const char *path, const char *label,
|
||||
const char *core_path, const char *core_name,
|
||||
const char *crc32,
|
||||
const char *db_name)
|
||||
const struct playlist_entry *update_entry)
|
||||
{
|
||||
struct playlist_entry *entry = NULL;
|
||||
|
||||
@ -320,52 +258,52 @@ void playlist_update(playlist_t *playlist, size_t idx,
|
||||
|
||||
entry = &playlist->entries[idx];
|
||||
|
||||
if (path && (path != entry->path))
|
||||
if (update_entry->path && (update_entry->path != entry->path))
|
||||
{
|
||||
if (entry->path != NULL)
|
||||
free(entry->path);
|
||||
entry->path = strdup(path);
|
||||
entry->path = strdup(update_entry->path);
|
||||
playlist->modified = true;
|
||||
}
|
||||
|
||||
if (label && (label != entry->label))
|
||||
if (update_entry->label && (update_entry->label != entry->label))
|
||||
{
|
||||
if (entry->label != NULL)
|
||||
free(entry->label);
|
||||
entry->label = strdup(label);
|
||||
entry->label = strdup(update_entry->label);
|
||||
playlist->modified = true;
|
||||
}
|
||||
|
||||
if (core_path && (core_path != entry->core_path))
|
||||
if (update_entry->core_path && (update_entry->core_path != entry->core_path))
|
||||
{
|
||||
if (entry->core_path != NULL)
|
||||
free(entry->core_path);
|
||||
entry->core_path = NULL;
|
||||
entry->core_path = strdup(core_path);
|
||||
entry->core_path = strdup(update_entry->core_path);
|
||||
playlist->modified = true;
|
||||
}
|
||||
|
||||
if (core_name && (core_name != entry->core_name))
|
||||
if (update_entry->core_name && (update_entry->core_name != entry->core_name))
|
||||
{
|
||||
if (entry->core_name != NULL)
|
||||
free(entry->core_name);
|
||||
entry->core_name = strdup(core_name);
|
||||
entry->core_name = strdup(update_entry->core_name);
|
||||
playlist->modified = true;
|
||||
}
|
||||
|
||||
if (db_name && (db_name != entry->db_name))
|
||||
if (update_entry->db_name && (update_entry->db_name != entry->db_name))
|
||||
{
|
||||
if (entry->db_name != NULL)
|
||||
free(entry->db_name);
|
||||
entry->db_name = strdup(db_name);
|
||||
entry->db_name = strdup(update_entry->db_name);
|
||||
playlist->modified = true;
|
||||
}
|
||||
|
||||
if (crc32 && (crc32 != entry->crc32))
|
||||
if (update_entry->crc32 && (update_entry->crc32 != entry->crc32))
|
||||
{
|
||||
if (entry->crc32 != NULL)
|
||||
free(entry->crc32);
|
||||
entry->crc32 = strdup(crc32);
|
||||
entry->crc32 = strdup(update_entry->crc32);
|
||||
playlist->modified = true;
|
||||
}
|
||||
}
|
||||
@ -558,30 +496,24 @@ success:
|
||||
/**
|
||||
* playlist_push:
|
||||
* @playlist : Playlist handle.
|
||||
* @path : Path of new playlist entry.
|
||||
* @core_path : Core path of new playlist entry.
|
||||
* @core_name : Core name of new playlist entry.
|
||||
*
|
||||
* Push entry to top of playlist.
|
||||
**/
|
||||
bool playlist_push(playlist_t *playlist,
|
||||
const char *path, const char *label,
|
||||
const char *core_path, const char *core_name,
|
||||
const char *crc32,
|
||||
const char *db_name,
|
||||
const char *subsystem_ident,
|
||||
const struct string_list *subsystem_roms)
|
||||
const struct playlist_entry *entry)
|
||||
{
|
||||
size_t i;
|
||||
bool core_path_empty = string_is_empty(core_path);
|
||||
bool core_name_empty = string_is_empty(core_name);
|
||||
bool core_path_empty = string_is_empty(entry->core_path);
|
||||
bool core_name_empty = string_is_empty(entry->core_name);
|
||||
const char *core_name = entry->core_name;
|
||||
const char *path = entry->path;
|
||||
|
||||
if (core_path_empty || core_name_empty)
|
||||
{
|
||||
if (core_name_empty && !core_path_empty)
|
||||
{
|
||||
static char base_path[255] = {0};
|
||||
fill_pathname_base_noext(base_path, core_path, sizeof(base_path));
|
||||
fill_pathname_base_noext(base_path, entry->core_path, sizeof(base_path));
|
||||
core_name = base_path;
|
||||
}
|
||||
|
||||
@ -607,9 +539,9 @@ bool playlist_push(playlist_t *playlist,
|
||||
(path && playlist->entries[i].path &&
|
||||
#ifdef _WIN32
|
||||
/*prevent duplicates on case-insensitive operating systems*/
|
||||
string_is_equal_noncase(path,playlist->entries[i].path)
|
||||
string_is_equal_noncase(path, playlist->entries[i].path)
|
||||
#else
|
||||
string_is_equal(path,playlist->entries[i].path)
|
||||
string_is_equal(path, playlist->entries[i].path)
|
||||
#endif
|
||||
);
|
||||
|
||||
@ -618,30 +550,39 @@ bool playlist_push(playlist_t *playlist,
|
||||
if (!equal_path)
|
||||
continue;
|
||||
|
||||
if (!string_is_equal(playlist->entries[i].core_path, core_path))
|
||||
if (!string_is_equal(playlist->entries[i].core_path, entry->core_path))
|
||||
continue;
|
||||
|
||||
if (!string_is_empty(subsystem_ident) && !string_is_empty(playlist->entries[i].subsystem_ident) && !string_is_equal(playlist->entries[i].subsystem_ident, subsystem_ident))
|
||||
if (!string_is_empty(entry->subsystem_ident) && !string_is_empty(playlist->entries[i].subsystem_ident) && !string_is_equal(playlist->entries[i].subsystem_ident, entry->subsystem_ident))
|
||||
continue;
|
||||
|
||||
if (string_is_empty(subsystem_ident) && !string_is_empty(playlist->entries[i].subsystem_ident))
|
||||
if (string_is_empty(entry->subsystem_ident) && !string_is_empty(playlist->entries[i].subsystem_ident))
|
||||
continue;
|
||||
|
||||
if (!string_is_empty(subsystem_ident) && string_is_empty(playlist->entries[i].subsystem_ident))
|
||||
if (!string_is_empty(entry->subsystem_ident) && string_is_empty(playlist->entries[i].subsystem_ident))
|
||||
continue;
|
||||
|
||||
if (subsystem_roms)
|
||||
if (!string_is_empty(entry->subsystem_name) && !string_is_empty(playlist->entries[i].subsystem_name) && !string_is_equal(playlist->entries[i].subsystem_name, entry->subsystem_name))
|
||||
continue;
|
||||
|
||||
if (string_is_empty(entry->subsystem_name) && !string_is_empty(playlist->entries[i].subsystem_name))
|
||||
continue;
|
||||
|
||||
if (!string_is_empty(entry->subsystem_name) && string_is_empty(playlist->entries[i].subsystem_name))
|
||||
continue;
|
||||
|
||||
if (entry->subsystem_roms)
|
||||
{
|
||||
int j;
|
||||
const struct string_list *roms = playlist->entries[i].subsystem_roms;
|
||||
bool unequal = false;
|
||||
|
||||
if (subsystem_roms->size != roms->size)
|
||||
if (entry->subsystem_roms->size != roms->size)
|
||||
continue;
|
||||
|
||||
for (j = 0; j < subsystem_roms->size; j++)
|
||||
for (j = 0; j < entry->subsystem_roms->size; j++)
|
||||
{
|
||||
if (!string_is_equal(subsystem_roms->elems[j].data, roms->elems[j].data))
|
||||
if (!string_is_equal(entry->subsystem_roms->elems[j].data, roms->elems[j].data))
|
||||
{
|
||||
unequal = true;
|
||||
break;
|
||||
@ -687,6 +628,7 @@ bool playlist_push(playlist_t *playlist,
|
||||
playlist->entries[0].db_name = NULL;
|
||||
playlist->entries[0].crc32 = NULL;
|
||||
playlist->entries[0].subsystem_ident = NULL;
|
||||
playlist->entries[0].subsystem_name = NULL;
|
||||
playlist->entries[0].subsystem_roms = NULL;
|
||||
playlist->entries[0].runtime_hours = 0;
|
||||
playlist->entries[0].runtime_minutes = 0;
|
||||
@ -697,29 +639,31 @@ bool playlist_push(playlist_t *playlist,
|
||||
playlist->entries[0].last_played_hour = 0;
|
||||
playlist->entries[0].last_played_minute = 0;
|
||||
playlist->entries[0].last_played_second = 0;
|
||||
if (!string_is_empty(path))
|
||||
playlist->entries[0].path = strdup(path);
|
||||
if (!string_is_empty(label))
|
||||
playlist->entries[0].label = strdup(label);
|
||||
if (!string_is_empty(core_path))
|
||||
playlist->entries[0].core_path = strdup(core_path);
|
||||
if (!string_is_empty(entry->path))
|
||||
playlist->entries[0].path = strdup(entry->path);
|
||||
if (!string_is_empty(entry->label))
|
||||
playlist->entries[0].label = strdup(entry->label);
|
||||
if (!string_is_empty(entry->core_path))
|
||||
playlist->entries[0].core_path = strdup(entry->core_path);
|
||||
if (!string_is_empty(core_name))
|
||||
playlist->entries[0].core_name = strdup(core_name);
|
||||
if (!string_is_empty(db_name))
|
||||
playlist->entries[0].db_name = strdup(db_name);
|
||||
if (!string_is_empty(crc32))
|
||||
playlist->entries[0].crc32 = strdup(crc32);
|
||||
if (!string_is_empty(subsystem_ident))
|
||||
playlist->entries[0].subsystem_ident = strdup(subsystem_ident);
|
||||
if (subsystem_roms)
|
||||
if (!string_is_empty(entry->db_name))
|
||||
playlist->entries[0].db_name = strdup(entry->db_name);
|
||||
if (!string_is_empty(entry->crc32))
|
||||
playlist->entries[0].crc32 = strdup(entry->crc32);
|
||||
if (!string_is_empty(entry->subsystem_ident))
|
||||
playlist->entries[0].subsystem_ident = strdup(entry->subsystem_ident);
|
||||
if (!string_is_empty(entry->subsystem_name))
|
||||
playlist->entries[0].subsystem_name = strdup(entry->subsystem_name);
|
||||
if (entry->subsystem_roms)
|
||||
{
|
||||
union string_list_elem_attr attributes = {0};
|
||||
|
||||
playlist->entries[0].subsystem_roms = string_list_new();
|
||||
|
||||
for (i = 0; i < subsystem_roms->size; i++)
|
||||
for (i = 0; i < entry->subsystem_roms->size; i++)
|
||||
{
|
||||
string_list_append(playlist->entries[0].subsystem_roms, subsystem_roms->elems[i].data, attributes);
|
||||
string_list_append(playlist->entries[0].subsystem_roms, entry->subsystem_roms->elems[i].data, attributes);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1085,6 +1029,17 @@ void playlist_write_file(playlist_t *playlist)
|
||||
JSON_Writer_WriteString(context.writer, playlist->entries[i].subsystem_ident ? playlist->entries[i].subsystem_ident : "", playlist->entries[i].subsystem_ident ? strlen(playlist->entries[i].subsystem_ident) : 0, JSON_UTF8);
|
||||
}
|
||||
|
||||
if (!string_is_empty(playlist->entries[i].subsystem_name))
|
||||
{
|
||||
JSON_Writer_WriteComma(context.writer);
|
||||
JSON_Writer_WriteNewLine(context.writer);
|
||||
JSON_Writer_WriteSpace(context.writer, 6);
|
||||
JSON_Writer_WriteString(context.writer, "subsystem_name", strlen("subsystem_name"), JSON_UTF8);
|
||||
JSON_Writer_WriteColon(context.writer);
|
||||
JSON_Writer_WriteSpace(context.writer, 1);
|
||||
JSON_Writer_WriteString(context.writer, playlist->entries[i].subsystem_name ? playlist->entries[i].subsystem_name : "", playlist->entries[i].subsystem_name ? strlen(playlist->entries[i].subsystem_name) : 0, JSON_UTF8);
|
||||
}
|
||||
|
||||
if (playlist->entries[i].subsystem_roms && playlist->entries[i].subsystem_roms->size > 0)
|
||||
{
|
||||
int j;
|
||||
@ -1436,6 +1391,8 @@ static JSON_Parser_HandlerResult JSONObjectMemberHandler(JSON_Parser parser, cha
|
||||
pCtx->current_entry_val = &pCtx->current_entry->db_name;
|
||||
else if (string_is_equal(pValue, "subsystem_ident"))
|
||||
pCtx->current_entry_val = &pCtx->current_entry->subsystem_ident;
|
||||
else if (string_is_equal(pValue, "subsystem_name"))
|
||||
pCtx->current_entry_val = &pCtx->current_entry->subsystem_name;
|
||||
else if (string_is_equal(pValue, "subsystem_roms"))
|
||||
pCtx->current_entry_string_list_val = &pCtx->current_entry->subsystem_roms;
|
||||
else if (string_is_equal(pValue, "runtime_hours"))
|
||||
@ -1798,28 +1755,14 @@ void playlist_qsort(playlist_t *playlist)
|
||||
|
||||
void command_playlist_push_write(
|
||||
playlist_t *playlist,
|
||||
const char *path,
|
||||
const char *label,
|
||||
const char *core_path,
|
||||
const char *core_name,
|
||||
const char *crc32,
|
||||
const char *db_name,
|
||||
const char *subsystem_ident,
|
||||
const struct string_list *subsystem_roms)
|
||||
const struct playlist_entry *entry)
|
||||
{
|
||||
if (!playlist)
|
||||
return;
|
||||
|
||||
if (playlist_push(
|
||||
playlist,
|
||||
path,
|
||||
label,
|
||||
core_path,
|
||||
core_name,
|
||||
crc32,
|
||||
db_name,
|
||||
subsystem_ident,
|
||||
subsystem_roms
|
||||
entry
|
||||
))
|
||||
playlist_write_file(playlist);
|
||||
}
|
||||
@ -1827,12 +1770,7 @@ void command_playlist_push_write(
|
||||
void command_playlist_update_write(
|
||||
playlist_t *plist,
|
||||
size_t idx,
|
||||
const char *path,
|
||||
const char *label,
|
||||
const char *core_path,
|
||||
const char *core_display_name,
|
||||
const char *crc32,
|
||||
const char *db_name)
|
||||
const struct playlist_entry *entry)
|
||||
{
|
||||
playlist_t *playlist = plist ? plist : playlist_get_cached();
|
||||
|
||||
@ -1842,12 +1780,7 @@ void command_playlist_update_write(
|
||||
playlist_update(
|
||||
playlist,
|
||||
idx,
|
||||
path,
|
||||
label,
|
||||
core_path,
|
||||
core_display_name,
|
||||
crc32,
|
||||
db_name);
|
||||
entry);
|
||||
|
||||
playlist_write_file(playlist);
|
||||
}
|
||||
|
73
playlist.h
73
playlist.h
@ -1,6 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||
* Copyright (C) 2016-2019 - Brad Parker
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
@ -25,7 +26,32 @@
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
typedef struct content_playlist playlist_t;
|
||||
typedef struct content_playlist playlist_t;
|
||||
|
||||
struct playlist_entry
|
||||
{
|
||||
char *path;
|
||||
char *label;
|
||||
char *core_path;
|
||||
char *core_name;
|
||||
char *db_name;
|
||||
char *crc32;
|
||||
char *subsystem_ident;
|
||||
char *subsystem_name;
|
||||
struct string_list *subsystem_roms;
|
||||
unsigned runtime_hours;
|
||||
unsigned runtime_minutes;
|
||||
unsigned runtime_seconds;
|
||||
/* Note: due to platform dependence, have to record
|
||||
* timestamp as either a string or independent integer
|
||||
* values. The latter is more verbose, but more efficient. */
|
||||
unsigned last_played_year;
|
||||
unsigned last_played_month;
|
||||
unsigned last_played_day;
|
||||
unsigned last_played_hour;
|
||||
unsigned last_played_minute;
|
||||
unsigned last_played_second;
|
||||
};
|
||||
|
||||
/**
|
||||
* playlist_init:
|
||||
@ -67,20 +93,12 @@ size_t playlist_size(playlist_t *playlist);
|
||||
* playlist_get_index:
|
||||
* @playlist : Playlist handle.
|
||||
* @idx : Index of playlist entry.
|
||||
* @path : Path of playlist entry.
|
||||
* @core_path : Core path of playlist entry.
|
||||
* @core_name : Core name of playlist entry.
|
||||
*
|
||||
* Gets values of playlist index:
|
||||
**/
|
||||
void playlist_get_index(playlist_t *playlist,
|
||||
size_t idx,
|
||||
const char **path, const char **label,
|
||||
const char **core_path, const char **core_name,
|
||||
const char **crc32,
|
||||
const char **db_name,
|
||||
const char **subsystem_ident,
|
||||
const struct string_list **subsystem_roms);
|
||||
const struct playlist_entry **entry);
|
||||
|
||||
void playlist_get_runtime_index(playlist_t *playlist,
|
||||
size_t idx,
|
||||
@ -109,12 +127,7 @@ void playlist_delete_index(playlist_t *playlist,
|
||||
* Push entry to top of playlist.
|
||||
**/
|
||||
bool playlist_push(playlist_t *playlist,
|
||||
const char *path, const char *label,
|
||||
const char *core_path, const char *core_name,
|
||||
const char *crc32,
|
||||
const char *db_name,
|
||||
const char *subsystem_ident,
|
||||
const struct string_list *subsystem_roms);
|
||||
const struct playlist_entry *entry);
|
||||
|
||||
bool playlist_push_runtime(playlist_t *playlist,
|
||||
const char *path, const char *core_path,
|
||||
@ -123,10 +136,7 @@ bool playlist_push_runtime(playlist_t *playlist,
|
||||
unsigned last_played_hour, unsigned last_played_minute, unsigned last_played_second);
|
||||
|
||||
void playlist_update(playlist_t *playlist, size_t idx,
|
||||
const char *path, const char *label,
|
||||
const char *core_path, const char *core_name,
|
||||
const char *crc32,
|
||||
const char *db_name);
|
||||
const struct playlist_entry *update_entry);
|
||||
|
||||
/* Note: register_update determines whether the internal
|
||||
* 'playlist->modified' flag is set when updating runtime
|
||||
@ -142,12 +152,7 @@ void playlist_update_runtime(playlist_t *playlist, size_t idx,
|
||||
|
||||
void playlist_get_index_by_path(playlist_t *playlist,
|
||||
const char *search_path,
|
||||
char **path, char **label,
|
||||
char **core_path, char **core_name,
|
||||
char **crc32,
|
||||
char **db_name,
|
||||
char **subsystem_ident,
|
||||
struct string_list **subsystem_roms);
|
||||
const struct playlist_entry **entry);
|
||||
|
||||
bool playlist_entry_exists(playlist_t *playlist,
|
||||
const char *path,
|
||||
@ -171,24 +176,12 @@ bool playlist_init_cached(const char *path, size_t size);
|
||||
|
||||
void command_playlist_push_write(
|
||||
playlist_t *playlist,
|
||||
const char *path,
|
||||
const char *label,
|
||||
const char *core_path,
|
||||
const char *core_name,
|
||||
const char *crc32,
|
||||
const char *db_name,
|
||||
const char *subsystem_ident,
|
||||
const struct string_list *subsystem_roms);
|
||||
const struct playlist_entry *entry);
|
||||
|
||||
void command_playlist_update_write(
|
||||
playlist_t *playlist,
|
||||
size_t idx,
|
||||
const char *path,
|
||||
const char *label,
|
||||
const char *core_path,
|
||||
const char *core_display_name,
|
||||
const char *crc32,
|
||||
const char *db_name);
|
||||
const struct playlist_entry *entry);
|
||||
|
||||
/* Returns true if specified playlist index matches
|
||||
* specified content/core paths */
|
||||
|
@ -439,7 +439,7 @@ static bool load_content_from_compressed_archive(
|
||||
|
||||
string_list_append(additional_path_allocs, new_path, attributes);
|
||||
info[i].path =
|
||||
additional_path_allocs->elems[additional_path_allocs->size -1 ].data;
|
||||
additional_path_allocs->elems[additional_path_allocs->size - 1].data;
|
||||
|
||||
if (!string_list_append(content_ctx->temporary_content,
|
||||
new_path, attributes))
|
||||
@ -1052,6 +1052,7 @@ static bool task_load_content(content_ctx_info_t *content_info,
|
||||
* (As far as I can tell, core_info_get_current_core()
|
||||
* should always provide a valid pointer here...) */
|
||||
core_info_get_current_core(&core_info);
|
||||
|
||||
if (core_info)
|
||||
core_name = core_info->display_name;
|
||||
|
||||
@ -1087,16 +1088,28 @@ static bool task_load_content(content_ctx_info_t *content_info,
|
||||
if (
|
||||
content_ctx->history_list_enable
|
||||
&& playlist_hist)
|
||||
{
|
||||
char subsystem_name[PATH_MAX_LENGTH];
|
||||
struct playlist_entry entry = {0};
|
||||
|
||||
subsystem_name[0] = '\0';
|
||||
|
||||
content_get_subsystem_friendly_name(path_get(RARCH_PATH_SUBSYSTEM), subsystem_name, sizeof(subsystem_name));
|
||||
|
||||
/* the push function reads our entry as const, so these casts are safe */
|
||||
entry.path = (char*)tmp;
|
||||
entry.label = (char*)label;
|
||||
entry.core_path = (char*)core_path;
|
||||
entry.core_name = (char*)core_name;
|
||||
entry.crc32 = (char*)crc32;
|
||||
entry.db_name = (char*)db_name;
|
||||
entry.subsystem_ident = (char*)path_get(RARCH_PATH_SUBSYSTEM),
|
||||
entry.subsystem_name = (char*)subsystem_name;
|
||||
entry.subsystem_roms = (struct string_list*)path_get_subsystem_list();
|
||||
|
||||
command_playlist_push_write(
|
||||
playlist_hist,
|
||||
tmp,
|
||||
label,
|
||||
core_path,
|
||||
core_name,
|
||||
crc32,
|
||||
db_name,
|
||||
path_get(RARCH_PATH_SUBSYSTEM),
|
||||
path_get_subsystem_list());
|
||||
playlist_hist, &entry);
|
||||
}
|
||||
}
|
||||
|
||||
free(tmp);
|
||||
|
@ -845,12 +845,17 @@ static int database_info_list_iterate_found_match(
|
||||
|
||||
if (!playlist_entry_exists(playlist, entry_path_str, db_crc))
|
||||
{
|
||||
playlist_push(playlist, entry_path_str,
|
||||
db_info_entry->name,
|
||||
file_path_str(FILE_PATH_DETECT),
|
||||
file_path_str(FILE_PATH_DETECT),
|
||||
db_crc, db_playlist_base_str,
|
||||
NULL, NULL);
|
||||
struct playlist_entry entry = {0};
|
||||
|
||||
/* the push function reads our entry as const, so these casts are safe */
|
||||
entry.path = entry_path_str;
|
||||
entry.label = db_info_entry->name;
|
||||
entry.core_path = (char*)file_path_str(FILE_PATH_DETECT);
|
||||
entry.core_name = (char*)file_path_str(FILE_PATH_DETECT);
|
||||
entry.crc32 = db_crc;
|
||||
entry.db_name = db_playlist_base_str;
|
||||
|
||||
playlist_push(playlist, &entry);
|
||||
}
|
||||
|
||||
playlist_write_file(playlist);
|
||||
@ -1015,19 +1020,22 @@ static int task_database_iterate_playlist_lutro(
|
||||
path, file_path_str(FILE_PATH_DETECT)))
|
||||
{
|
||||
char *game_title = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
struct playlist_entry entry = {0};
|
||||
|
||||
game_title[0] = '\0';
|
||||
|
||||
fill_short_pathname_representation_noext(game_title,
|
||||
path, PATH_MAX_LENGTH * sizeof(char));
|
||||
|
||||
playlist_push(playlist, path,
|
||||
game_title,
|
||||
file_path_str(FILE_PATH_DETECT),
|
||||
file_path_str(FILE_PATH_DETECT),
|
||||
file_path_str(FILE_PATH_DETECT),
|
||||
file_path_str(FILE_PATH_LUTRO_PLAYLIST),
|
||||
NULL, NULL);
|
||||
/* the push function reads our entry as const, so these casts are safe */
|
||||
entry.path = (char*)path;
|
||||
entry.label = game_title;
|
||||
entry.core_path = (char*)file_path_str(FILE_PATH_DETECT);
|
||||
entry.core_name = (char*)file_path_str(FILE_PATH_DETECT);
|
||||
entry.crc32 = (char*)file_path_str(FILE_PATH_DETECT);
|
||||
entry.db_name = (char*)file_path_str(FILE_PATH_LUTRO_PLAYLIST);
|
||||
|
||||
playlist_push(playlist, &entry);
|
||||
|
||||
free(game_title);
|
||||
}
|
||||
|
@ -205,7 +205,8 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
|
||||
/* start by checking cases that don't require a search */
|
||||
|
||||
/* the core doesn't have any content to match, so fast-succeed */
|
||||
if(!core_requires_content(state)) {
|
||||
if (!core_requires_content(state))
|
||||
{
|
||||
state->found = true;
|
||||
state->contentless = true;
|
||||
task_set_data(task, state);
|
||||
@ -222,7 +223,8 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
|
||||
}
|
||||
|
||||
/* We opened the playlist directory, but there's nothing there. Nothing to do. */
|
||||
if(state->lpl_list->size == 0 && core_requires_content(state)) {
|
||||
if (state->lpl_list->size == 0 && core_requires_content(state))
|
||||
{
|
||||
string_list_free(state->lpl_list);
|
||||
finish_task(task, "There are no playlists available; cannot execute search");
|
||||
command_event(CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED, state->hostname);
|
||||
@ -233,7 +235,7 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
|
||||
have_crc = !string_is_equal(state->content_crc, "00000000|crc");
|
||||
|
||||
/* if content is already loaded and the lobby gave us a CRC, check the loaded content first */
|
||||
if(have_crc && content_get_crc() > 0)
|
||||
if (have_crc && content_get_crc() > 0)
|
||||
{
|
||||
char current[PATH_MAX_LENGTH];
|
||||
|
||||
@ -258,7 +260,7 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
|
||||
/* now let's do the search */
|
||||
if (string_is_empty(state->subsystem_name) || string_is_equal(state->subsystem_name, "N/A"))
|
||||
{
|
||||
for(i = 0; i < state->lpl_list->size; i++)
|
||||
for (i = 0; i < state->lpl_list->size; i++)
|
||||
{
|
||||
playlist_t *playlist = NULL;
|
||||
unsigned playlist_size = 0;
|
||||
@ -272,14 +274,18 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
|
||||
playlist = playlist_init(lpl_path, 99999);
|
||||
playlist_size = playlist_get_size(playlist);
|
||||
|
||||
for(j = 0; j < playlist_size; j++)
|
||||
for (j = 0; j < playlist_size; j++)
|
||||
{
|
||||
const char *playlist_crc32 = NULL;
|
||||
const char *playlist_path = NULL;
|
||||
const char *playlist_crc32 = NULL;
|
||||
const struct playlist_entry *playlist_entry = NULL;
|
||||
|
||||
playlist_get_index(playlist, j, &playlist_path, NULL, NULL, NULL, &playlist_crc32, NULL, NULL, NULL);
|
||||
playlist_get_index(playlist, j, &playlist_entry);
|
||||
|
||||
if(have_crc && string_is_equal(playlist_crc32, state->content_crc))
|
||||
playlist_path = playlist_entry->path;
|
||||
playlist_crc32 = playlist_entry->crc32;
|
||||
|
||||
if (have_crc && string_is_equal(playlist_crc32, state->content_crc))
|
||||
{
|
||||
RARCH_LOG("[lobby] CRC match %s\n", playlist_crc32);
|
||||
strlcpy(state->content_path, playlist_path, sizeof(state->content_path));
|
||||
@ -298,7 +304,7 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
|
||||
* Otherwise, on match we complete the task and mark it as successful immediately.
|
||||
*/
|
||||
|
||||
if(!string_is_empty(entry) &&
|
||||
if (!string_is_empty(entry) &&
|
||||
string_is_equal(entry, state->content_path) &&
|
||||
strstr(state->core_extensions, path_get_extension(playlist_path)))
|
||||
{
|
||||
@ -312,8 +318,10 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
|
||||
playlist_free(playlist);
|
||||
return;
|
||||
}
|
||||
|
||||
task_set_progress(task, (int)(j / playlist_size * 100.0));
|
||||
}
|
||||
|
||||
playlist_free(playlist);
|
||||
}
|
||||
}
|
||||
@ -326,7 +334,7 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
|
||||
{
|
||||
found[i] = false;
|
||||
|
||||
for(j = 0; j < state->lpl_list->size && !found[i]; j++)
|
||||
for (j = 0; j < state->lpl_list->size && !found[i]; j++)
|
||||
{
|
||||
playlist_t *playlist = NULL;
|
||||
unsigned playlist_size = 0;
|
||||
@ -340,34 +348,37 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
|
||||
playlist = playlist_init(lpl_path, 99999);
|
||||
playlist_size = playlist_get_size(playlist);
|
||||
|
||||
for(k = 0; k < playlist_size && !found[i]; k++)
|
||||
for (k = 0; k < playlist_size && !found[i]; k++)
|
||||
{
|
||||
const char *playlist_crc32 = NULL;
|
||||
const char *playlist_path = NULL;
|
||||
const struct playlist_entry *playlist_entry = NULL;
|
||||
|
||||
playlist_get_index(playlist, k, &playlist_path, NULL, NULL, NULL, &playlist_crc32, NULL, NULL, NULL);
|
||||
get_entry(entry, sizeof(entry), playlist_path);
|
||||
playlist_get_index(playlist, k, &playlist_entry);
|
||||
|
||||
if(!string_is_empty(entry) &&
|
||||
get_entry(entry, sizeof(entry), playlist_entry->path);
|
||||
|
||||
if (!string_is_empty(entry) &&
|
||||
strstr(game_list->elems[i].data, entry) &&
|
||||
strstr(state->core_extensions, path_get_extension(playlist_path)))
|
||||
strstr(state->core_extensions, path_get_extension(playlist_entry->path)))
|
||||
{
|
||||
RARCH_LOG("[lobby] filename match %s\n", playlist_path);
|
||||
RARCH_LOG("[lobby] filename match %s\n", playlist_entry->path);
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
state->content_path[0] = '\0';
|
||||
strlcpy(state->content_path, playlist_path, sizeof(state->content_path));
|
||||
strlcpy(state->content_path, playlist_entry->path, sizeof(state->content_path));
|
||||
}
|
||||
else
|
||||
{
|
||||
strlcat(state->content_path, "|", sizeof(state->content_path));
|
||||
strlcat(state->content_path, playlist_path, sizeof(state->content_path));
|
||||
strlcat(state->content_path, playlist_entry->path, sizeof(state->content_path));
|
||||
}
|
||||
|
||||
found[i] = true;
|
||||
}
|
||||
|
||||
task_set_progress(task, (int)(j / playlist_size * 100.0));
|
||||
}
|
||||
|
||||
playlist_free(playlist);
|
||||
}
|
||||
}
|
||||
@ -388,6 +399,7 @@ static void task_netplay_crc_scan_handler(retro_task_t *task)
|
||||
task_set_data(task, state);
|
||||
finish_task(task, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND));
|
||||
}
|
||||
|
||||
string_list_free(state->lpl_list);
|
||||
string_list_free(game_list);
|
||||
return;
|
||||
@ -457,7 +469,7 @@ bool task_push_netplay_crc_scan(uint32_t crc, char* name,
|
||||
#if 0
|
||||
printf("Info: %s State: %s", info->list[i].core_name, state->core_name);
|
||||
#endif
|
||||
if(string_is_equal(info->list[i].core_name, state->core_name))
|
||||
if (string_is_equal(info->list[i].core_name, state->core_name))
|
||||
{
|
||||
strlcpy(state->core_path,
|
||||
info->list[i].path, sizeof(state->core_path));
|
||||
|
@ -170,14 +170,16 @@ static void task_screenshot_handler(retro_task_t *task)
|
||||
!state->silence &&
|
||||
state->history_list_enable
|
||||
)
|
||||
command_playlist_push_write(
|
||||
g_defaults.image_history,
|
||||
state->filename,
|
||||
NULL,
|
||||
"builtin",
|
||||
"imageviewer",
|
||||
NULL, NULL,
|
||||
NULL, NULL);
|
||||
{
|
||||
struct playlist_entry entry = {0};
|
||||
|
||||
/* the push function reads our entry as const, so these casts are safe */
|
||||
entry.path = state->filename;
|
||||
entry.core_path = (char*)"builtin";
|
||||
entry.core_name = (char*)"imageviewer";
|
||||
|
||||
command_playlist_push_write(g_defaults.image_history, &entry);
|
||||
}
|
||||
#endif
|
||||
|
||||
task_set_progress(task, 100);
|
||||
|
@ -601,8 +601,19 @@ void MainWindow::addFilesToPlaylist(QStringList files)
|
||||
}
|
||||
}
|
||||
|
||||
playlist_push(playlist, pathData, fileNameNoExten,
|
||||
corePathData, coreNameData, "00000000|crc", databaseData, NULL, NULL);
|
||||
{
|
||||
struct playlist_entry entry = {0};
|
||||
|
||||
/* the push function reads our entry as const, so these casts are safe */
|
||||
entry.path = const_cast<char*>(pathData);
|
||||
entry.label = const_cast<char*>(fileNameNoExten);
|
||||
entry.core_path = const_cast<char*>(corePathData);
|
||||
entry.core_name = const_cast<char*>(coreNameData);
|
||||
entry.crc32 = const_cast<char*>("00000000|crc");
|
||||
entry.db_name = const_cast<char*>(databaseData);
|
||||
|
||||
playlist_push(playlist, &entry);
|
||||
}
|
||||
}
|
||||
|
||||
playlist_write_file(playlist);
|
||||
@ -703,8 +714,20 @@ bool MainWindow::updateCurrentPlaylistEntry(const QHash<QString, QString> &conte
|
||||
|
||||
playlist = playlist_init(playlistPathData, COLLECTION_SIZE);
|
||||
|
||||
playlist_update(playlist, index, pathData, labelData,
|
||||
corePathData, coreNameData, crc32Data, dbNameData);
|
||||
{
|
||||
struct playlist_entry entry = {0};
|
||||
|
||||
/* the update function reads our entry as const, so these casts are safe */
|
||||
entry.path = const_cast<char*>(pathData);
|
||||
entry.label = const_cast<char*>(labelData);
|
||||
entry.core_path = const_cast<char*>(corePathData);
|
||||
entry.core_name = const_cast<char*>(coreNameData);
|
||||
entry.crc32 = const_cast<char*>(crc32Data);
|
||||
entry.db_name = const_cast<char*>(dbNameData);
|
||||
|
||||
playlist_update(playlist, index, &entry);
|
||||
}
|
||||
|
||||
playlist_write_file(playlist);
|
||||
playlist_free(playlist);
|
||||
|
||||
@ -1358,48 +1381,41 @@ void PlaylistModel::getPlaylistItems(QString path)
|
||||
|
||||
for (i = 0; i < playlistSize; i++)
|
||||
{
|
||||
const char *path = NULL;
|
||||
const char *label = NULL;
|
||||
const char *core_path = NULL;
|
||||
const char *core_name = NULL;
|
||||
const char *crc32 = NULL;
|
||||
const char *db_name = NULL;
|
||||
const struct playlist_entry *entry = NULL;
|
||||
QHash<QString, QString> hash;
|
||||
|
||||
playlist_get_index(playlist, i,
|
||||
&path, &label, &core_path,
|
||||
&core_name, &crc32, &db_name, NULL, NULL);
|
||||
playlist_get_index(playlist, i, &entry);
|
||||
|
||||
if (string_is_empty(path))
|
||||
if (string_is_empty(entry->path))
|
||||
continue;
|
||||
else
|
||||
hash["path"] = path;
|
||||
hash["path"] = entry->path;
|
||||
|
||||
hash["index"] = QString::number(i);
|
||||
|
||||
if (string_is_empty(label))
|
||||
if (string_is_empty(entry->label))
|
||||
{
|
||||
hash["label"] = path;
|
||||
hash["label_noext"] = path;
|
||||
hash["label"] = entry->path;
|
||||
hash["label_noext"] = entry->path;
|
||||
}
|
||||
else
|
||||
{
|
||||
hash["label"] = label;
|
||||
hash["label_noext"] = label;
|
||||
hash["label"] = entry->label;
|
||||
hash["label_noext"] = entry->label;
|
||||
}
|
||||
|
||||
if (!string_is_empty(core_path))
|
||||
hash["core_path"] = core_path;
|
||||
if (!string_is_empty(entry->core_path))
|
||||
hash["core_path"] = entry->core_path;
|
||||
|
||||
if (!string_is_empty(core_name))
|
||||
hash["core_name"] = core_name;
|
||||
if (!string_is_empty(entry->core_name))
|
||||
hash["core_name"] = entry->core_name;
|
||||
|
||||
if (!string_is_empty(crc32))
|
||||
hash["crc32"] = crc32;
|
||||
if (!string_is_empty(entry->crc32))
|
||||
hash["crc32"] = entry->crc32;
|
||||
|
||||
if (!string_is_empty(db_name))
|
||||
if (!string_is_empty(entry->db_name))
|
||||
{
|
||||
hash["db_name"] = db_name;
|
||||
hash["db_name"] = entry->db_name;
|
||||
hash["db_name"].remove(file_path_str(FILE_PATH_LPL_EXTENSION));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user