Playlist + database changes: (#14531)

- Cleanup 'entry_slot'
- Fallback label + logging
This commit is contained in:
sonninnos 2022-10-18 22:32:54 +03:00 committed by GitHub
parent 07ae7ff7f1
commit 03c901dfb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 46 additions and 24 deletions

View file

@ -1394,12 +1394,12 @@ void manual_content_scan_add_content_to_playlist(
* > The push function reads our entry as const,
* so these casts are safe */
entry.path = (char*)playlist_content_path;
entry.entry_slot = 0;
entry.label = label;
entry.core_path = (char*)FILE_PATH_DETECT;
entry.core_name = (char*)FILE_PATH_DETECT;
entry.crc32 = (char*)"00000000|crc";
entry.db_name = task_config->database_name;
entry.entry_slot = 0;
/* Add entry to playlist */
playlist_push(playlist, &entry);

View file

@ -610,26 +610,27 @@ static void playlist_free_entry(struct playlist_entry *entry)
if (entry->path_id)
playlist_path_id_free(entry->path_id);
entry->path = NULL;
entry->label = NULL;
entry->core_path = NULL;
entry->core_name = NULL;
entry->db_name = NULL;
entry->crc32 = NULL;
entry->subsystem_ident = NULL;
entry->subsystem_name = NULL;
entry->runtime_str = NULL;
entry->last_played_str = NULL;
entry->subsystem_roms = NULL;
entry->path_id = NULL;
entry->runtime_status = PLAYLIST_RUNTIME_UNKNOWN;
entry->runtime_hours = 0;
entry->runtime_minutes = 0;
entry->runtime_seconds = 0;
entry->last_played_year = 0;
entry->last_played_month = 0;
entry->last_played_day = 0;
entry->last_played_hour = 0;
entry->path = NULL;
entry->label = NULL;
entry->core_path = NULL;
entry->core_name = NULL;
entry->db_name = NULL;
entry->crc32 = NULL;
entry->subsystem_ident = NULL;
entry->subsystem_name = NULL;
entry->runtime_str = NULL;
entry->last_played_str = NULL;
entry->subsystem_roms = NULL;
entry->path_id = NULL;
entry->entry_slot = 0;
entry->runtime_status = PLAYLIST_RUNTIME_UNKNOWN;
entry->runtime_hours = 0;
entry->runtime_minutes = 0;
entry->runtime_seconds = 0;
entry->last_played_year = 0;
entry->last_played_month = 0;
entry->last_played_day = 0;
entry->last_played_hour = 0;
entry->last_played_minute = 0;
entry->last_played_second = 0;
}

View file

@ -101,7 +101,6 @@ typedef struct
struct playlist_entry
{
char *path;
unsigned entry_slot;
char *label;
char *core_path;
char *core_name;
@ -113,6 +112,7 @@ struct playlist_entry
char *last_played_str;
struct string_list *subsystem_roms;
playlist_path_id_t *path_id;
unsigned entry_slot;
unsigned runtime_hours;
unsigned runtime_minutes;
unsigned runtime_seconds;

View file

@ -1675,7 +1675,6 @@ static void task_push_to_history_list(
/* The push function reads our entry as const,
* so these casts are safe */
entry.path = (char*)tmp;
entry.entry_slot = runloop_st->entry_state_slot;
entry.label = (char*)label;
entry.core_path = (char*)core_path;
entry.core_name = (char*)core_name;
@ -1684,6 +1683,7 @@ static void task_push_to_history_list(
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();
entry.entry_slot = runloop_st->entry_state_slot;
command_playlist_push_write(playlist_hist, &entry);
}

View file

@ -686,6 +686,7 @@ static int database_info_list_iterate_found_match(
char* db_playlist_base_str = (char*)malloc(str_len);
char* db_playlist_path = (char*)malloc(str_len);
char* entry_path_str = (char*)malloc(str_len);
char* entry_label = (char*)malloc(str_len);
char *hash = NULL;
playlist_t *playlist = NULL;
const char *db_path =
@ -723,6 +724,23 @@ static int database_info_list_iterate_found_match(
if (entry_path)
strlcpy(entry_path_str, entry_path, str_len);
/* Use database name for label if found,
* otherwise use filename without extension */
if (!string_is_empty(db_info_entry->name))
strlcpy(entry_label, db_info_entry->name, str_len);
else if (!string_is_empty(entry_path))
{
char *delim = strchr(entry_path, '#');
if (delim)
*delim = '\0';
fill_pathname(entry_label,
path_basename_nocompression(entry_path), "", str_len);
path_remove_extension(entry_label);
RARCH_LOG("[Database]: No match for: \"%s\", CRC: 0x%08X\n", entry_path_str, db_state->crc);
}
if (!string_is_empty(archive_name))
fill_pathname_join_delim(entry_path_str,
entry_path_str, archive_name, '#', str_len);
@ -763,7 +781,7 @@ static int database_info_list_iterate_found_match(
/* 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.label = entry_label;
entry.core_path = (char*)"DETECT";
entry.core_name = (char*)"DETECT";
entry.db_name = db_playlist_base_str;
@ -771,6 +789,7 @@ static int database_info_list_iterate_found_match(
entry.subsystem_ident = NULL;
entry.subsystem_name = NULL;
entry.subsystem_roms = NULL;
entry.entry_slot = 0;
entry.runtime_hours = 0;
entry.runtime_minutes = 0;
entry.runtime_seconds = 0;
@ -810,6 +829,7 @@ static int database_info_list_iterate_found_match(
free(db_playlist_base_str);
free(db_playlist_path);
free(entry_path_str);
free(entry_label);
return 0;
}
@ -965,6 +985,7 @@ static int task_database_iterate_playlist_lutro(
entry.subsystem_ident = NULL;
entry.subsystem_name = NULL;
entry.subsystem_roms = NULL;
entry.entry_slot = 0;
entry.runtime_hours = 0;
entry.runtime_minutes = 0;
entry.runtime_seconds = 0;