mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(Playlist) Get rid of settings_t dependency
This commit is contained in:
parent
1d6f547e7f
commit
9c6c10da22
@ -17,6 +17,11 @@
|
||||
#include <string/stdstring.h>
|
||||
#include <retro_timers.h>
|
||||
|
||||
#include <net/net_http.h>
|
||||
#include <streams/file_stream.h>
|
||||
#include <file/file_path.h>
|
||||
#include <features/features_cpu.h>
|
||||
|
||||
#include "discord.h"
|
||||
#include "discord_register.h"
|
||||
|
||||
@ -46,14 +51,10 @@
|
||||
#include "../../menu/menu_cbs.h"
|
||||
#endif
|
||||
|
||||
#include <net/net_http.h>
|
||||
#include "../network/net_http_special.h"
|
||||
#include "../tasks/tasks_internal.h"
|
||||
#include <streams/file_stream.h>
|
||||
#include <file/file_path.h>
|
||||
#include "../file_path_special.h"
|
||||
|
||||
#include <features/features_cpu.h>
|
||||
|
||||
static int64_t start_time = 0;
|
||||
static int64_t pause_time = 0;
|
||||
@ -210,7 +211,7 @@ static void handle_discord_join_cb(retro_task_t *task,
|
||||
task_push_netplay_crc_scan(room->gamecrc,
|
||||
room->gamename, join_hostname, room->corename, room->subsystem_name);
|
||||
connecting = true;
|
||||
discord_update(DISCORD_PRESENCE_NETPLAY_CLIENT);
|
||||
discord_update(DISCORD_PRESENCE_NETPLAY_CLIENT, false);
|
||||
}
|
||||
|
||||
finish:
|
||||
@ -302,7 +303,9 @@ static void handle_discord_join_request(const DiscordUser* request)
|
||||
#endif
|
||||
}
|
||||
|
||||
void discord_update(enum discord_presence presence)
|
||||
/* TODO/FIXME - replace last parameter with struct type to allow for more
|
||||
* arguments to be passed later */
|
||||
void discord_update(enum discord_presence presence, bool fuzzy_archive_match)
|
||||
{
|
||||
core_info_t *core_info = NULL;
|
||||
|
||||
@ -350,7 +353,8 @@ void discord_update(enum discord_presence presence)
|
||||
if (current_playlist)
|
||||
{
|
||||
playlist_get_index_by_path(
|
||||
current_playlist, path_get(RARCH_PATH_CONTENT), &entry);
|
||||
current_playlist, path_get(RARCH_PATH_CONTENT), &entry,
|
||||
fuzzy_archive_match);
|
||||
|
||||
if (entry && !string_is_empty(entry->label))
|
||||
label = entry->label;
|
||||
|
@ -45,7 +45,7 @@ void discord_init(const char *discord_app_id);
|
||||
|
||||
void discord_shutdown(void);
|
||||
|
||||
void discord_update(enum discord_presence presence);
|
||||
void discord_update(enum discord_presence presence, bool fuzzy_archive_match);
|
||||
|
||||
bool discord_is_ready(void);
|
||||
|
||||
|
@ -1077,7 +1077,8 @@ static bool manual_content_scan_get_playlist_content_label(
|
||||
void manual_content_scan_add_content_to_playlist(
|
||||
manual_content_scan_task_config_t *task_config,
|
||||
playlist_t *playlist, const char *content_path,
|
||||
int content_type, logiqx_dat_t *dat_file)
|
||||
int content_type, logiqx_dat_t *dat_file,
|
||||
bool fuzzy_archive_match)
|
||||
{
|
||||
char playlist_content_path[PATH_MAX_LENGTH];
|
||||
|
||||
@ -1095,7 +1096,7 @@ void manual_content_scan_add_content_to_playlist(
|
||||
|
||||
/* Check whether content is already included
|
||||
* in playlist */
|
||||
if (!playlist_entry_exists(playlist, playlist_content_path))
|
||||
if (!playlist_entry_exists(playlist, playlist_content_path, fuzzy_archive_match))
|
||||
{
|
||||
struct playlist_entry entry = {0};
|
||||
char label[PATH_MAX_LENGTH];
|
||||
@ -1119,6 +1120,6 @@ void manual_content_scan_add_content_to_playlist(
|
||||
entry.db_name = task_config->database_name;
|
||||
|
||||
/* Add entry to playlist */
|
||||
playlist_push(playlist, &entry);
|
||||
playlist_push(playlist, &entry, fuzzy_archive_match);
|
||||
}
|
||||
}
|
||||
|
@ -228,7 +228,8 @@ struct string_list *manual_content_scan_get_content_list(manual_content_scan_tas
|
||||
void manual_content_scan_add_content_to_playlist(
|
||||
manual_content_scan_task_config_t *task_config,
|
||||
playlist_t *playlist, const char *content_path,
|
||||
int content_type, logiqx_dat_t *dat_file);
|
||||
int content_type, logiqx_dat_t *dat_file,
|
||||
bool fuzzy_archive_match);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
|
@ -392,6 +392,7 @@ static int playlist_association_left(unsigned type, const char *label,
|
||||
{
|
||||
char core_path[PATH_MAX_LENGTH];
|
||||
size_t i, next, current = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
core_info_list_t *core_info_list = NULL;
|
||||
core_info_t *core_info = NULL;
|
||||
@ -450,7 +451,7 @@ static int playlist_association_left(unsigned type, const char *label,
|
||||
/* Update playlist */
|
||||
playlist_set_default_core_path(playlist, core_info->path);
|
||||
playlist_set_default_core_name(playlist, core_info->display_name);
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -459,6 +460,7 @@ static int playlist_label_display_mode_left(unsigned type, const char *label,
|
||||
bool wraparound)
|
||||
{
|
||||
enum playlist_label_display_mode label_display_mode;
|
||||
settings_t *settings = config_get_ptr();
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
|
||||
if (!playlist)
|
||||
@ -472,7 +474,7 @@ static int playlist_label_display_mode_left(unsigned type, const char *label,
|
||||
label_display_mode = LABEL_DISPLAY_MODE_KEEP_REGION_AND_DISC_INDEX;
|
||||
|
||||
playlist_set_label_display_mode(playlist, label_display_mode);
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -480,6 +482,7 @@ static int playlist_label_display_mode_left(unsigned type, const char *label,
|
||||
static void playlist_thumbnail_mode_left(playlist_t *playlist, enum playlist_thumbnail_id thumbnail_id,
|
||||
bool wraparound)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
enum playlist_thumbnail_mode thumbnail_mode =
|
||||
playlist_get_thumbnail_mode(playlist, thumbnail_id);
|
||||
|
||||
@ -489,7 +492,7 @@ static void playlist_thumbnail_mode_left(playlist_t *playlist, enum playlist_thu
|
||||
thumbnail_mode = PLAYLIST_THUMBNAIL_MODE_BOXARTS;
|
||||
|
||||
playlist_set_thumbnail_mode(playlist, thumbnail_id, thumbnail_mode);
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
|
||||
}
|
||||
|
||||
static int playlist_right_thumbnail_mode_left(unsigned type, const char *label,
|
||||
|
@ -1981,6 +1981,7 @@ static int action_ok_playlist_entry_collection(const char *path,
|
||||
const struct playlist_entry *entry = NULL;
|
||||
unsigned i = 0;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!menu)
|
||||
return menu_cbs_exit();
|
||||
@ -2077,7 +2078,8 @@ static int action_ok_playlist_entry_collection(const char *path,
|
||||
command_playlist_update_write(
|
||||
tmp_playlist,
|
||||
selection_ptr,
|
||||
&entry);
|
||||
&entry,
|
||||
settings->bools.playlist_use_old_format);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -2110,9 +2112,10 @@ static int action_ok_playlist_entry(const char *path,
|
||||
{
|
||||
char new_core_path[PATH_MAX_LENGTH];
|
||||
size_t selection_ptr = 0;
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
const struct playlist_entry *entry = NULL;
|
||||
const char *entry_label = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
|
||||
new_core_path[0] = '\0';
|
||||
@ -2161,7 +2164,8 @@ static int action_ok_playlist_entry(const char *path,
|
||||
|
||||
command_playlist_update_write(NULL,
|
||||
selection_ptr,
|
||||
&entry);
|
||||
&entry,
|
||||
settings->bools.playlist_use_old_format);
|
||||
}
|
||||
|
||||
}
|
||||
@ -2190,8 +2194,9 @@ 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;
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
const struct playlist_entry *entry = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
|
||||
if (!playlist || !menu)
|
||||
@ -2242,7 +2247,8 @@ static int action_ok_playlist_entry_start_content(const char *path,
|
||||
command_playlist_update_write(
|
||||
playlist,
|
||||
selection_ptr,
|
||||
&entry);
|
||||
&entry,
|
||||
settings->bools.playlist_use_old_format);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2499,6 +2505,7 @@ static int action_ok_audio_add_to_mixer_and_collection(const char *path,
|
||||
{
|
||||
char combined_path[PATH_MAX_LENGTH];
|
||||
struct playlist_entry entry = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
|
||||
combined_path[0] = '\0';
|
||||
@ -2514,7 +2521,9 @@ static int action_ok_audio_add_to_mixer_and_collection(const char *path,
|
||||
entry.core_path = (char*)"builtin";
|
||||
entry.core_name = (char*)"musicplayer";
|
||||
|
||||
command_playlist_push_write(g_defaults.music_history, &entry);
|
||||
command_playlist_push_write(g_defaults.music_history, &entry,
|
||||
settings->bools.playlist_fuzzy_archive_match,
|
||||
settings->bools.playlist_use_old_format);
|
||||
|
||||
if (filestream_exists(combined_path))
|
||||
task_push_audio_mixer_load(combined_path,
|
||||
@ -2530,6 +2539,7 @@ static int action_ok_audio_add_to_mixer_and_collection_and_play(const char *path
|
||||
{
|
||||
char combined_path[PATH_MAX_LENGTH];
|
||||
struct playlist_entry entry = {0};
|
||||
settings_t *settings = config_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
|
||||
combined_path[0] = '\0';
|
||||
@ -2545,7 +2555,10 @@ static int action_ok_audio_add_to_mixer_and_collection_and_play(const char *path
|
||||
entry.core_path = (char*)"builtin";
|
||||
entry.core_name = (char*)"musicplayer";
|
||||
|
||||
command_playlist_push_write(g_defaults.music_history, &entry);
|
||||
command_playlist_push_write(g_defaults.music_history, &entry,
|
||||
settings->bools.playlist_fuzzy_archive_match,
|
||||
settings->bools.playlist_use_old_format
|
||||
);
|
||||
|
||||
if (filestream_exists(combined_path))
|
||||
task_push_audio_mixer_load_and_play(combined_path,
|
||||
@ -2605,6 +2618,7 @@ static void menu_input_wifi_cb(void *userdata, const char *passphrase)
|
||||
static void menu_input_st_string_cb_rename_entry(void *userdata,
|
||||
const char *str)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (str && *str)
|
||||
{
|
||||
const char *label = menu_input_dialog_get_buffer();
|
||||
@ -2618,7 +2632,8 @@ static void menu_input_st_string_cb_rename_entry(void *userdata,
|
||||
|
||||
command_playlist_update_write(NULL,
|
||||
menu_input_dialog_get_kb_idx(),
|
||||
&entry);
|
||||
&entry,
|
||||
settings->bools.playlist_use_old_format);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3195,7 +3210,8 @@ static int action_ok_core_deferred_set(const char *new_core_path,
|
||||
command_playlist_update_write(
|
||||
NULL,
|
||||
menu->scratchpad.unsigned_var,
|
||||
&entry);
|
||||
&entry,
|
||||
settings->bools.playlist_use_old_format);
|
||||
|
||||
/* Provide visual feedback */
|
||||
strlcpy(msg, msg_hash_to_str(MSG_SET_CORE_ASSOCIATION), sizeof(msg));
|
||||
@ -4666,6 +4682,7 @@ static int action_ok_delete_entry(const char *path,
|
||||
char *def_conf_img_path = NULL;
|
||||
#endif
|
||||
char *def_conf_fav_path = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
|
||||
@ -4701,7 +4718,7 @@ static int action_ok_delete_entry(const char *path,
|
||||
if (playlist)
|
||||
{
|
||||
playlist_delete_index(playlist, menu->rpl_entry_selection_ptr);
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
|
||||
}
|
||||
|
||||
new_selection_ptr = menu_navigation_get_selection();
|
||||
@ -5552,6 +5569,7 @@ static int action_ok_push_dropdown_item_playlist_default_core(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
core_info_list_t *core_info_list = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
const char* core_name = path;
|
||||
|
||||
@ -5608,7 +5626,8 @@ static int action_ok_push_dropdown_item_playlist_default_core(const char *path,
|
||||
}
|
||||
|
||||
/* In all cases, update file on disk */
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist,
|
||||
settings->bools.playlist_use_old_format);
|
||||
|
||||
return action_cancel_pop_default(NULL, NULL, 0, 0);
|
||||
}
|
||||
@ -5617,25 +5636,29 @@ static int action_ok_push_dropdown_item_playlist_default_core(const char *path,
|
||||
static int action_ok_push_dropdown_item_playlist_label_display_mode(const char *path,
|
||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
settings_t *settings = config_get_ptr();
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
|
||||
playlist_set_label_display_mode(playlist, (enum playlist_label_display_mode)idx);
|
||||
|
||||
/* In all cases, update file on disk */
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist,
|
||||
settings->bools.playlist_use_old_format);
|
||||
|
||||
return action_cancel_pop_default(NULL, NULL, 0, 0);
|
||||
}
|
||||
|
||||
static int generic_set_thumbnail_mode(enum playlist_thumbnail_id thumbnail_id, size_t idx)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
|
||||
if (!playlist)
|
||||
return -1;
|
||||
|
||||
playlist_set_thumbnail_mode(playlist, thumbnail_id, (enum playlist_thumbnail_mode)idx);
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist,
|
||||
settings->bools.playlist_use_old_format);
|
||||
|
||||
return action_cancel_pop_default(NULL, NULL, 0, 0);
|
||||
}
|
||||
|
@ -472,9 +472,10 @@ static int playlist_association_right(unsigned type, const char *label,
|
||||
{
|
||||
char core_path[PATH_MAX_LENGTH];
|
||||
size_t i, next, current = 0;
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
core_info_list_t *core_info_list = NULL;
|
||||
core_info_t *core_info = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
|
||||
core_path[0] = '\0';
|
||||
|
||||
@ -537,7 +538,7 @@ static int playlist_association_right(unsigned type, const char *label,
|
||||
/* Update playlist */
|
||||
playlist_set_default_core_path(playlist, core_info->path);
|
||||
playlist_set_default_core_name(playlist, core_info->display_name);
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -546,6 +547,7 @@ static int playlist_label_display_mode_right(unsigned type, const char *label,
|
||||
bool wraparound)
|
||||
{
|
||||
enum playlist_label_display_mode label_display_mode;
|
||||
settings_t *settings = config_get_ptr();
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
|
||||
if (!playlist)
|
||||
@ -559,7 +561,7 @@ static int playlist_label_display_mode_right(unsigned type, const char *label,
|
||||
label_display_mode = LABEL_DISPLAY_MODE_DEFAULT;
|
||||
|
||||
playlist_set_label_display_mode(playlist, label_display_mode);
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -567,6 +569,7 @@ static int playlist_label_display_mode_right(unsigned type, const char *label,
|
||||
static void playlist_thumbnail_mode_right(playlist_t *playlist, enum playlist_thumbnail_id thumbnail_id,
|
||||
bool wraparound)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
enum playlist_thumbnail_mode thumbnail_mode =
|
||||
playlist_get_thumbnail_mode(playlist, thumbnail_id);
|
||||
|
||||
@ -576,7 +579,7 @@ static void playlist_thumbnail_mode_right(playlist_t *playlist, enum playlist_th
|
||||
thumbnail_mode = PLAYLIST_THUMBNAIL_MODE_DEFAULT;
|
||||
|
||||
playlist_set_thumbnail_mode(playlist, thumbnail_id, thumbnail_mode);
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
|
||||
}
|
||||
|
||||
static int playlist_right_thumbnail_mode_right(unsigned type, const char *label,
|
||||
|
@ -295,6 +295,7 @@ static int action_start_playlist_association(
|
||||
const char *path, const char *label,
|
||||
unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
|
||||
if (!playlist)
|
||||
@ -303,7 +304,7 @@ static int action_start_playlist_association(
|
||||
/* Set default core path + name to DETECT */
|
||||
playlist_set_default_core_path(playlist, file_path_str(FILE_PATH_DETECT));
|
||||
playlist_set_default_core_name(playlist, file_path_str(FILE_PATH_DETECT));
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -312,6 +313,7 @@ static int action_start_playlist_label_display_mode(
|
||||
const char *path, const char *label,
|
||||
unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
|
||||
if (!playlist)
|
||||
@ -319,7 +321,7 @@ static int action_start_playlist_label_display_mode(
|
||||
|
||||
/* Set label display mode to the default */
|
||||
playlist_set_label_display_mode(playlist, LABEL_DISPLAY_MODE_DEFAULT);
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -328,14 +330,15 @@ static int action_start_playlist_right_thumbnail_mode(
|
||||
const char *path, const char *label,
|
||||
unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
settings_t *settings = config_get_ptr();
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
|
||||
if (!playlist)
|
||||
return -1;
|
||||
|
||||
/* Set thumbnail_mode to default value */
|
||||
playlist_set_thumbnail_mode(playlist, PLAYLIST_THUMBNAIL_RIGHT, PLAYLIST_THUMBNAIL_MODE_DEFAULT);
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -344,6 +347,7 @@ static int action_start_playlist_left_thumbnail_mode(
|
||||
const char *path, const char *label,
|
||||
unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
playlist_t *playlist = playlist_get_cached();
|
||||
|
||||
if (!playlist)
|
||||
@ -351,7 +355,7 @@ static int action_start_playlist_left_thumbnail_mode(
|
||||
|
||||
/* Set thumbnail_mode to default value */
|
||||
playlist_set_thumbnail_mode(playlist, PLAYLIST_THUMBNAIL_LEFT, PLAYLIST_THUMBNAIL_MODE_DEFAULT);
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
57
playlist.c
57
playlist.c
@ -23,6 +23,7 @@
|
||||
#include <libretro.h>
|
||||
#include <boolean.h>
|
||||
#include <retro_assert.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <compat/posix_string.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <streams/interface_stream.h>
|
||||
@ -33,7 +34,6 @@
|
||||
|
||||
#include "playlist.h"
|
||||
#include "verbosity.h"
|
||||
#include "configuration.h"
|
||||
#include "file_path_special.h"
|
||||
|
||||
#ifndef PLAYLIST_ENTRIES
|
||||
@ -94,14 +94,12 @@ typedef int (playlist_sort_fun_t)(
|
||||
* (Taking into account relative paths, case insensitive
|
||||
* filesystems, 'incomplete' archive paths)
|
||||
**/
|
||||
static bool playlist_path_equal(const char *real_path, const char *entry_path)
|
||||
static bool playlist_path_equal(const char *real_path,
|
||||
const char *entry_path, bool fuzzy_archive_match)
|
||||
{
|
||||
bool real_path_is_compressed;
|
||||
bool entry_real_path_is_compressed;
|
||||
char entry_real_path[PATH_MAX_LENGTH];
|
||||
#ifdef RARCH_INTERNAL
|
||||
settings_t *settings = config_get_ptr();
|
||||
#endif
|
||||
|
||||
entry_real_path[0] = '\0';
|
||||
|
||||
@ -128,7 +126,7 @@ static bool playlist_path_equal(const char *real_path, const char *entry_path)
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
/* If fuzzy matching is disabled, we can give up now */
|
||||
if (!settings || !settings->bools.playlist_fuzzy_archive_match)
|
||||
if (!fuzzy_archive_match)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
@ -342,7 +340,8 @@ void playlist_delete_index(playlist_t *playlist,
|
||||
|
||||
void playlist_get_index_by_path(playlist_t *playlist,
|
||||
const char *search_path,
|
||||
const struct playlist_entry **entry)
|
||||
const struct playlist_entry **entry,
|
||||
bool fuzzy_archive_match)
|
||||
{
|
||||
size_t i;
|
||||
char real_search_path[PATH_MAX_LENGTH];
|
||||
@ -358,7 +357,8 @@ void playlist_get_index_by_path(playlist_t *playlist,
|
||||
|
||||
for (i = 0; i < playlist->size; i++)
|
||||
{
|
||||
if (!playlist_path_equal(real_search_path, playlist->entries[i].path))
|
||||
if (!playlist_path_equal(real_search_path, playlist->entries[i].path,
|
||||
fuzzy_archive_match))
|
||||
continue;
|
||||
|
||||
*entry = &playlist->entries[i];
|
||||
@ -368,7 +368,7 @@ void playlist_get_index_by_path(playlist_t *playlist,
|
||||
}
|
||||
|
||||
bool playlist_entry_exists(playlist_t *playlist,
|
||||
const char *path)
|
||||
const char *path, bool fuzzy_archive_match)
|
||||
{
|
||||
size_t i;
|
||||
char real_search_path[PATH_MAX_LENGTH];
|
||||
@ -383,7 +383,8 @@ bool playlist_entry_exists(playlist_t *playlist,
|
||||
path_resolve_realpath(real_search_path, sizeof(real_search_path), true);
|
||||
|
||||
for (i = 0; i < playlist->size; i++)
|
||||
if (playlist_path_equal(real_search_path, playlist->entries[i].path))
|
||||
if (playlist_path_equal(real_search_path, playlist->entries[i].path,
|
||||
fuzzy_archive_match))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -558,7 +559,8 @@ void playlist_update_runtime(playlist_t *playlist, size_t idx,
|
||||
}
|
||||
|
||||
bool playlist_push_runtime(playlist_t *playlist,
|
||||
const struct playlist_entry *entry)
|
||||
const struct playlist_entry *entry,
|
||||
bool fuzzy_archive_match)
|
||||
{
|
||||
size_t i;
|
||||
char real_path[PATH_MAX_LENGTH];
|
||||
@ -600,7 +602,7 @@ bool playlist_push_runtime(playlist_t *playlist,
|
||||
const char *entry_path = playlist->entries[i].path;
|
||||
bool equal_path =
|
||||
(string_is_empty(real_path) && string_is_empty(entry_path)) ||
|
||||
playlist_path_equal(real_path, entry_path);
|
||||
playlist_path_equal(real_path, entry_path, fuzzy_archive_match);
|
||||
|
||||
/* Core name can have changed while still being the same core.
|
||||
* Differentiate based on the core path only. */
|
||||
@ -725,7 +727,8 @@ void playlist_resolve_path(enum playlist_file_mode mode,
|
||||
* Push entry to top of playlist.
|
||||
**/
|
||||
bool playlist_push(playlist_t *playlist,
|
||||
const struct playlist_entry *entry)
|
||||
const struct playlist_entry *entry,
|
||||
bool fuzzy_archive_match)
|
||||
{
|
||||
size_t i;
|
||||
char real_path[PATH_MAX_LENGTH];
|
||||
@ -782,7 +785,7 @@ bool playlist_push(playlist_t *playlist,
|
||||
const char *entry_path = playlist->entries[i].path;
|
||||
bool equal_path =
|
||||
(string_is_empty(real_path) && string_is_empty(entry_path)) ||
|
||||
playlist_path_equal(real_path, entry_path);
|
||||
playlist_path_equal(real_path, entry_path, fuzzy_archive_match);
|
||||
|
||||
/* Core name can have changed while still being the same core.
|
||||
* Differentiate based on the core path only. */
|
||||
@ -839,7 +842,8 @@ bool playlist_push(playlist_t *playlist,
|
||||
path_resolve_realpath(real_rom_path, sizeof(real_rom_path), true);
|
||||
}
|
||||
|
||||
if (!playlist_path_equal(real_rom_path, roms->elems[j].data))
|
||||
if (!playlist_path_equal(real_rom_path, roms->elems[j].data,
|
||||
fuzzy_archive_match))
|
||||
{
|
||||
unequal = true;
|
||||
break;
|
||||
@ -1214,13 +1218,10 @@ end:
|
||||
filestream_close(file);
|
||||
}
|
||||
|
||||
void playlist_write_file(playlist_t *playlist)
|
||||
void playlist_write_file(playlist_t *playlist, bool use_old_format)
|
||||
{
|
||||
size_t i;
|
||||
RFILE *file = NULL;
|
||||
#ifdef RARCH_INTERNAL
|
||||
settings_t *settings = config_get_ptr();
|
||||
#endif
|
||||
|
||||
if (!playlist || !playlist->modified)
|
||||
return;
|
||||
@ -1235,7 +1236,7 @@ void playlist_write_file(playlist_t *playlist)
|
||||
}
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
if (settings->bools.playlist_use_old_format)
|
||||
if (use_old_format)
|
||||
{
|
||||
for (i = 0; i < playlist->size; i++)
|
||||
filestream_printf(file, "%s\n%s\n%s\n%s\n%s\n%s\n",
|
||||
@ -2454,22 +2455,22 @@ void playlist_qsort(playlist_t *playlist)
|
||||
|
||||
void command_playlist_push_write(
|
||||
playlist_t *playlist,
|
||||
const struct playlist_entry *entry)
|
||||
const struct playlist_entry *entry,
|
||||
bool fuzzy_archive_match,
|
||||
bool use_old_format)
|
||||
{
|
||||
if (!playlist)
|
||||
return;
|
||||
|
||||
if (playlist_push(
|
||||
playlist,
|
||||
entry
|
||||
))
|
||||
playlist_write_file(playlist);
|
||||
if (playlist_push(playlist, entry, fuzzy_archive_match))
|
||||
playlist_write_file(playlist, use_old_format);
|
||||
}
|
||||
|
||||
void command_playlist_update_write(
|
||||
playlist_t *plist,
|
||||
size_t idx,
|
||||
const struct playlist_entry *entry)
|
||||
const struct playlist_entry *entry,
|
||||
bool use_old_format)
|
||||
{
|
||||
playlist_t *playlist = plist ? plist : playlist_get_cached();
|
||||
|
||||
@ -2481,7 +2482,7 @@ void command_playlist_update_write(
|
||||
idx,
|
||||
entry);
|
||||
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist, use_old_format);
|
||||
}
|
||||
|
||||
bool playlist_index_is_valid(playlist_t *playlist, size_t idx,
|
||||
|
20
playlist.h
20
playlist.h
@ -192,10 +192,12 @@ void playlist_resolve_path(enum playlist_file_mode mode,
|
||||
* Push entry to top of playlist.
|
||||
**/
|
||||
bool playlist_push(playlist_t *playlist,
|
||||
const struct playlist_entry *entry);
|
||||
const struct playlist_entry *entry,
|
||||
bool fuzzy_archive_match);
|
||||
|
||||
bool playlist_push_runtime(playlist_t *playlist,
|
||||
const struct playlist_entry *entry);
|
||||
const struct playlist_entry *entry,
|
||||
bool fuzzy_archive_match);
|
||||
|
||||
void playlist_update(playlist_t *playlist, size_t idx,
|
||||
const struct playlist_entry *update_entry);
|
||||
@ -211,16 +213,17 @@ void playlist_update_runtime(playlist_t *playlist, size_t idx,
|
||||
|
||||
void playlist_get_index_by_path(playlist_t *playlist,
|
||||
const char *search_path,
|
||||
const struct playlist_entry **entry);
|
||||
const struct playlist_entry **entry,
|
||||
bool fuzzy_archive_match);
|
||||
|
||||
bool playlist_entry_exists(playlist_t *playlist,
|
||||
const char *path);
|
||||
const char *path, bool fuzzy_archive_match);
|
||||
|
||||
char *playlist_get_conf_path(playlist_t *playlist);
|
||||
|
||||
uint32_t playlist_get_size(playlist_t *playlist);
|
||||
|
||||
void playlist_write_file(playlist_t *playlist);
|
||||
void playlist_write_file(playlist_t *playlist, bool use_old_format);
|
||||
|
||||
void playlist_write_runtime_file(playlist_t *playlist);
|
||||
|
||||
@ -234,12 +237,15 @@ bool playlist_init_cached(const char *path, size_t size);
|
||||
|
||||
void command_playlist_push_write(
|
||||
playlist_t *playlist,
|
||||
const struct playlist_entry *entry);
|
||||
const struct playlist_entry *entry,
|
||||
bool fuzzy_archive_match,
|
||||
bool use_old_format);
|
||||
|
||||
void command_playlist_update_write(
|
||||
playlist_t *playlist,
|
||||
size_t idx,
|
||||
const struct playlist_entry *entry);
|
||||
const struct playlist_entry *entry,
|
||||
bool use_old_format);
|
||||
|
||||
/* Returns true if specified playlist index matches
|
||||
* specified content/core paths */
|
||||
|
37
retroarch.c
37
retroarch.c
@ -4709,7 +4709,8 @@ static bool run_translation_service(void)
|
||||
if (current_playlist)
|
||||
{
|
||||
playlist_get_index_by_path(
|
||||
current_playlist, path_get(RARCH_PATH_CONTENT), &entry);
|
||||
current_playlist, path_get(RARCH_PATH_CONTENT), &entry,
|
||||
settings->bools.playlist_fuzzy_archive_match);
|
||||
|
||||
if (entry && !string_is_empty(entry->label))
|
||||
label = entry->label;
|
||||
@ -6765,14 +6766,18 @@ TODO: Add a setting for these tweaks */
|
||||
case CMD_EVENT_HISTORY_DEINIT:
|
||||
if (g_defaults.content_history)
|
||||
{
|
||||
playlist_write_file(g_defaults.content_history);
|
||||
settings_t *settings = configuration_settings;
|
||||
playlist_write_file(g_defaults.content_history,
|
||||
settings->bools.playlist_use_old_format);
|
||||
playlist_free(g_defaults.content_history);
|
||||
}
|
||||
g_defaults.content_history = NULL;
|
||||
|
||||
if (g_defaults.music_history)
|
||||
{
|
||||
playlist_write_file(g_defaults.music_history);
|
||||
settings_t *settings = configuration_settings;
|
||||
playlist_write_file(g_defaults.music_history,
|
||||
settings->bools.playlist_use_old_format);
|
||||
playlist_free(g_defaults.music_history);
|
||||
}
|
||||
g_defaults.music_history = NULL;
|
||||
@ -6780,7 +6785,9 @@ TODO: Add a setting for these tweaks */
|
||||
#if defined(HAVE_FFMPEG) || defined(HAVE_MPV)
|
||||
if (g_defaults.video_history)
|
||||
{
|
||||
playlist_write_file(g_defaults.video_history);
|
||||
settings_t *settings = configuration_settings;
|
||||
playlist_write_file(g_defaults.video_history,
|
||||
settings->bools.playlist_use_old_format);
|
||||
playlist_free(g_defaults.video_history);
|
||||
}
|
||||
g_defaults.video_history = NULL;
|
||||
@ -6790,7 +6797,9 @@ TODO: Add a setting for these tweaks */
|
||||
#ifdef HAVE_IMAGEVIEWER
|
||||
if (g_defaults.image_history)
|
||||
{
|
||||
playlist_write_file(g_defaults.image_history);
|
||||
settings_t *settings = configuration_settings;
|
||||
playlist_write_file(g_defaults.image_history,
|
||||
settings->bools.playlist_use_old_format);
|
||||
playlist_free(g_defaults.image_history);
|
||||
}
|
||||
g_defaults.image_history = NULL;
|
||||
@ -6966,13 +6975,14 @@ TODO: Add a setting for these tweaks */
|
||||
entry.db_name = str_list->elems[5].data; /* db_name */
|
||||
|
||||
/* Write playlist entry */
|
||||
if (playlist_push(g_defaults.content_favorites, &entry))
|
||||
if (playlist_push(g_defaults.content_favorites, &entry, settings->bools.playlist_fuzzy_archive_match))
|
||||
{
|
||||
/* New addition - need to resort if option is enabled */
|
||||
if (settings->bools.playlist_sort_alphabetical)
|
||||
playlist_qsort(g_defaults.content_favorites);
|
||||
|
||||
playlist_write_file(g_defaults.content_favorites);
|
||||
playlist_write_file(g_defaults.content_favorites,
|
||||
settings->bools.playlist_use_old_format);
|
||||
runloop_msg_queue_push(msg_hash_to_str(MSG_ADDED_TO_FAVORITES), 1, 180, true, NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
}
|
||||
}
|
||||
@ -6982,6 +6992,7 @@ TODO: Add a setting for these tweaks */
|
||||
}
|
||||
case CMD_EVENT_RESET_CORE_ASSOCIATION:
|
||||
{
|
||||
settings_t *settings = configuration_settings;
|
||||
const char *core_name = "DETECT";
|
||||
const char *core_path = "DETECT";
|
||||
size_t *playlist_index = (size_t*)data;
|
||||
@ -6994,7 +7005,9 @@ TODO: Add a setting for these tweaks */
|
||||
command_playlist_update_write(
|
||||
NULL,
|
||||
*playlist_index,
|
||||
&entry);
|
||||
&entry,
|
||||
settings->bools.playlist_use_old_format
|
||||
);
|
||||
|
||||
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;
|
||||
@ -7497,8 +7510,9 @@ TODO: Add a setting for these tweaks */
|
||||
return false;
|
||||
|
||||
{
|
||||
settings_t *settings = configuration_settings;
|
||||
discord_userdata_t *userdata = (discord_userdata_t*)data;
|
||||
discord_update(userdata->status);
|
||||
discord_update(userdata->status, settings->bools.playlist_fuzzy_archive_match);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
@ -27628,7 +27642,7 @@ int runloop_iterate(void)
|
||||
|
||||
#ifdef HAVE_DISCORD
|
||||
if (discord_is_inited && discord_is_ready())
|
||||
discord_update(DISCORD_PRESENCE_GAME);
|
||||
discord_update(DISCORD_PRESENCE_GAME, settings->bools.playlist_fuzzy_archive_match);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < max_users; i++)
|
||||
@ -28658,7 +28672,8 @@ void rarch_favorites_deinit(void)
|
||||
{
|
||||
if (g_defaults.content_favorites)
|
||||
{
|
||||
playlist_write_file(g_defaults.content_favorites);
|
||||
settings_t *settings = configuration_settings;
|
||||
playlist_write_file(g_defaults.content_favorites, settings->bools.playlist_use_old_format);
|
||||
playlist_free(g_defaults.content_favorites);
|
||||
g_defaults.content_favorites = NULL;
|
||||
}
|
||||
|
@ -1435,7 +1435,9 @@ static void task_push_to_history_list(
|
||||
entry.subsystem_roms = (struct string_list*)path_get_subsystem_list();
|
||||
|
||||
command_playlist_push_write(
|
||||
playlist_hist, &entry);
|
||||
playlist_hist, &entry,
|
||||
settings->bools.playlist_fuzzy_archive_match,
|
||||
settings->bools.playlist_use_old_format);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,8 @@ typedef struct database_state_handle
|
||||
|
||||
typedef struct db_handle
|
||||
{
|
||||
bool pl_fuzzy_archive_match;
|
||||
bool pl_use_old_format;
|
||||
bool is_directory;
|
||||
bool scan_started;
|
||||
bool scan_without_core_match;
|
||||
@ -850,7 +852,8 @@ static int database_info_list_iterate_found_match(
|
||||
fprintf(stderr, "entry path str: %s\n", entry_path_str);
|
||||
#endif
|
||||
|
||||
if (!playlist_entry_exists(playlist, entry_path_str))
|
||||
if (!playlist_entry_exists(playlist, entry_path_str,
|
||||
_db->pl_fuzzy_archive_match))
|
||||
{
|
||||
struct playlist_entry entry;
|
||||
|
||||
@ -874,10 +877,10 @@ static int database_info_list_iterate_found_match(
|
||||
entry.last_played_minute= 0;
|
||||
entry.last_played_second= 0;
|
||||
|
||||
playlist_push(playlist, &entry);
|
||||
playlist_push(playlist, &entry, _db->pl_fuzzy_archive_match);
|
||||
}
|
||||
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist, _db->pl_use_old_format);
|
||||
playlist_free(playlist);
|
||||
|
||||
database_info_list_free(db_state->info);
|
||||
@ -1052,7 +1055,8 @@ static int task_database_iterate_playlist_lutro(
|
||||
|
||||
free(db_playlist_path);
|
||||
|
||||
if (!playlist_entry_exists(playlist, path))
|
||||
if (!playlist_entry_exists(playlist, path,
|
||||
_db->pl_fuzzy_archive_match))
|
||||
{
|
||||
struct playlist_entry entry;
|
||||
char *game_title = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
@ -1082,12 +1086,12 @@ static int task_database_iterate_playlist_lutro(
|
||||
entry.last_played_minute= 0;
|
||||
entry.last_played_second= 0;
|
||||
|
||||
playlist_push(playlist, &entry);
|
||||
playlist_push(playlist, &entry, _db->pl_fuzzy_archive_match);
|
||||
|
||||
free(game_title);
|
||||
}
|
||||
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist, _db->pl_use_old_format);
|
||||
playlist_free(playlist);
|
||||
|
||||
return 0;
|
||||
@ -1387,27 +1391,29 @@ bool task_push_dbscan(
|
||||
#ifdef RARCH_INTERNAL
|
||||
settings_t *settings = config_get_ptr();
|
||||
#endif
|
||||
db_handle_t *db = (db_handle_t*)calloc(1, sizeof(db_handle_t));
|
||||
db_handle_t *db = (db_handle_t*)calloc(1, sizeof(db_handle_t));
|
||||
|
||||
if (!t || !db)
|
||||
goto error;
|
||||
|
||||
t->handler = task_database_handler;
|
||||
t->state = db;
|
||||
t->callback = cb;
|
||||
t->title = strdup(msg_hash_to_str(MSG_PREPARING_FOR_CONTENT_SCAN));
|
||||
t->alternative_look = true;
|
||||
t->handler = task_database_handler;
|
||||
t->state = db;
|
||||
t->callback = cb;
|
||||
t->title = strdup(msg_hash_to_str(MSG_PREPARING_FOR_CONTENT_SCAN));
|
||||
t->alternative_look = true;
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
t->progress_cb = task_database_progress_cb;
|
||||
t->progress_cb = task_database_progress_cb;
|
||||
db->scan_without_core_match = settings->bools.scan_without_core_match;
|
||||
#endif
|
||||
db->show_hidden_files = db_dir_show_hidden_files;
|
||||
db->is_directory = directory;
|
||||
db->playlist_directory = NULL;
|
||||
db->fullpath = strdup(fullpath);
|
||||
db->playlist_directory = strdup(playlist_directory);
|
||||
db->content_database_path = strdup(content_database);
|
||||
db->show_hidden_files = db_dir_show_hidden_files;
|
||||
db->is_directory = directory;
|
||||
db->playlist_directory = NULL;
|
||||
db->fullpath = strdup(fullpath);
|
||||
db->playlist_directory = strdup(playlist_directory);
|
||||
db->content_database_path = strdup(content_database);
|
||||
db->pl_fuzzy_archive_match = settings->bools.playlist_fuzzy_archive_match;
|
||||
db->pl_use_old_format = settings->bools.playlist_use_old_format;
|
||||
|
||||
task_queue_push(t);
|
||||
|
||||
|
@ -57,6 +57,8 @@ typedef struct manual_scan_handle
|
||||
size_t list_size;
|
||||
size_t list_index;
|
||||
enum manual_scan_status status;
|
||||
bool fuzzy_archive_match;
|
||||
bool use_old_format;
|
||||
} manual_scan_handle_t;
|
||||
|
||||
/* Frees task handle + all constituent objects */
|
||||
@ -197,7 +199,8 @@ static void task_manual_content_scan_handler(retro_task_t *task)
|
||||
/* Add content to playlist */
|
||||
manual_content_scan_add_content_to_playlist(
|
||||
manual_scan->task_config, manual_scan->playlist,
|
||||
content_path, content_type, manual_scan->dat_file);
|
||||
content_path, content_type, manual_scan->dat_file,
|
||||
manual_scan->fuzzy_archive_match);
|
||||
}
|
||||
|
||||
/* Increment content index */
|
||||
@ -217,7 +220,7 @@ static void task_manual_content_scan_handler(retro_task_t *task)
|
||||
playlist_qsort(manual_scan->playlist);
|
||||
|
||||
/* Save playlist changes to disk */
|
||||
playlist_write_file(manual_scan->playlist);
|
||||
playlist_write_file(manual_scan->playlist, manual_scan->use_old_format);
|
||||
|
||||
/* If this is the currently cached playlist, then
|
||||
* it must be re-cached (otherwise changes will be
|
||||
@ -309,13 +312,15 @@ bool task_push_manual_content_scan(void)
|
||||
goto error;
|
||||
|
||||
/* Configure handle */
|
||||
manual_scan->task_config = NULL;
|
||||
manual_scan->playlist = NULL;
|
||||
manual_scan->content_list = NULL;
|
||||
manual_scan->dat_file = NULL;
|
||||
manual_scan->list_size = 0;
|
||||
manual_scan->list_index = 0;
|
||||
manual_scan->status = MANUAL_SCAN_BEGIN;
|
||||
manual_scan->task_config = NULL;
|
||||
manual_scan->playlist = NULL;
|
||||
manual_scan->content_list = NULL;
|
||||
manual_scan->dat_file = NULL;
|
||||
manual_scan->list_size = 0;
|
||||
manual_scan->list_index = 0;
|
||||
manual_scan->status = MANUAL_SCAN_BEGIN;
|
||||
manual_scan->fuzzy_archive_match = settings->bools.playlist_fuzzy_archive_match;
|
||||
manual_scan->use_old_format = settings->bools.playlist_use_old_format;
|
||||
|
||||
/* > Get current manual content scan configuration */
|
||||
manual_scan->task_config = (manual_content_scan_task_config_t*)
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "tasks_internal.h"
|
||||
|
||||
#include "../configuration.h"
|
||||
#include "../msg_hash.h"
|
||||
#include "../file_path_special.h"
|
||||
#include "../playlist.h"
|
||||
@ -44,6 +45,7 @@ typedef struct pl_manager_handle
|
||||
size_t list_size;
|
||||
size_t list_index;
|
||||
enum pl_manager_status status;
|
||||
bool use_old_format;
|
||||
} pl_manager_handle_t;
|
||||
|
||||
/**************************/
|
||||
@ -182,7 +184,7 @@ static void task_pl_manager_reset_cores_handler(retro_task_t *task)
|
||||
task_title[0] = '\0';
|
||||
|
||||
/* Save playlist changes to disk */
|
||||
playlist_write_file(pl_manager->playlist);
|
||||
playlist_write_file(pl_manager->playlist, pl_manager->use_old_format);
|
||||
|
||||
/* If this is the currently cached playlist, then
|
||||
* it must be re-cached (otherwise changes will be
|
||||
@ -245,6 +247,7 @@ bool task_push_pl_manager_reset_cores(const char *playlist_path)
|
||||
task_finder_data_t find_data;
|
||||
char playlist_name[PATH_MAX_LENGTH];
|
||||
char task_title[PATH_MAX_LENGTH];
|
||||
settings_t *settings = config_get_ptr();
|
||||
retro_task_t *task = task_init();
|
||||
pl_manager_handle_t *pl_manager = (pl_manager_handle_t*)calloc(1, sizeof(pl_manager_handle_t));
|
||||
|
||||
@ -290,6 +293,7 @@ bool task_push_pl_manager_reset_cores(const char *playlist_path)
|
||||
pl_manager->list_size = 0;
|
||||
pl_manager->list_index = 0;
|
||||
pl_manager->status = PL_MANAGER_BEGIN;
|
||||
pl_manager->use_old_format = settings->bools.playlist_use_old_format;
|
||||
|
||||
task_queue_push(task);
|
||||
|
||||
|
@ -66,6 +66,8 @@ struct screenshot_task_state
|
||||
bool is_idle;
|
||||
bool is_paused;
|
||||
bool history_list_enable;
|
||||
bool pl_fuzzy_archive_match;
|
||||
bool pl_use_old_format;
|
||||
int pitch;
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
@ -177,7 +179,9 @@ static void task_screenshot_handler(retro_task_t *task)
|
||||
entry.core_path = (char*)"builtin";
|
||||
entry.core_name = (char*)"imageviewer";
|
||||
|
||||
command_playlist_push_write(g_defaults.image_history, &entry);
|
||||
command_playlist_push_write(g_defaults.image_history, &entry,
|
||||
state->pl_fuzzy_archive_match,
|
||||
state->pl_use_old_format);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -240,22 +244,24 @@ static bool screenshot_dump(
|
||||
if (fullpath)
|
||||
strlcpy(state->filename, name_base, sizeof(state->filename));
|
||||
|
||||
state->is_idle = is_idle;
|
||||
state->is_paused = is_paused;
|
||||
state->bgr24 = bgr24;
|
||||
state->height = height;
|
||||
state->width = width;
|
||||
state->pitch = pitch;
|
||||
state->frame = frame;
|
||||
state->userbuf = userbuf;
|
||||
state->pl_fuzzy_archive_match = settings->bools.playlist_fuzzy_archive_match;
|
||||
state->pl_use_old_format = settings->bools.playlist_use_old_format;
|
||||
state->is_idle = is_idle;
|
||||
state->is_paused = is_paused;
|
||||
state->bgr24 = bgr24;
|
||||
state->height = height;
|
||||
state->width = width;
|
||||
state->pitch = pitch;
|
||||
state->frame = frame;
|
||||
state->userbuf = userbuf;
|
||||
#ifdef HAVE_MENU_WIDGETS
|
||||
state->widgets_ready = menu_widgets_ready();
|
||||
state->widgets_ready = menu_widgets_ready();
|
||||
#else
|
||||
state->widgets_ready = false;
|
||||
state->widgets_ready = false;
|
||||
#endif
|
||||
state->silence = savestate;
|
||||
state->history_list_enable = settings->bools.history_list_enable;
|
||||
state->pixel_format_type = pixel_format_type;
|
||||
state->silence = savestate;
|
||||
state->history_list_enable = settings->bools.history_list_enable;
|
||||
state->pixel_format_type = pixel_format_type;
|
||||
|
||||
if (!fullpath)
|
||||
{
|
||||
|
@ -358,21 +358,22 @@ void MainWindow::onPlaylistFilesDropped(QStringList files)
|
||||
/* Takes a list of files and folders and adds them to the currently selected playlist. Folders will have their contents added recursively. */
|
||||
void MainWindow::addFilesToPlaylist(QStringList files)
|
||||
{
|
||||
int i;
|
||||
QStringList list;
|
||||
QString currentPlaylistPath;
|
||||
QListWidgetItem *currentItem = m_listWidget->currentItem();
|
||||
QByteArray currentPlaylistArray;
|
||||
QScopedPointer<QProgressDialog> dialog(NULL);
|
||||
PlaylistEntryDialog *playlistDialog = playlistEntryDialog();
|
||||
QHash<QString, QString> selectedCore;
|
||||
QHash<QString, QString> itemToAdd;
|
||||
QString selectedDatabase;
|
||||
QString selectedName;
|
||||
QString selectedPath;
|
||||
QStringList selectedExtensions;
|
||||
const char *currentPlaylistData = NULL;
|
||||
playlist_t *playlist = NULL;
|
||||
int i;
|
||||
PlaylistEntryDialog *playlistDialog = playlistEntryDialog();
|
||||
const char *currentPlaylistData = NULL;
|
||||
playlist_t *playlist = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
/* Assume a blank list means we will manually enter in all fields. */
|
||||
if (files.isEmpty())
|
||||
@ -604,18 +605,18 @@ void MainWindow::addFilesToPlaylist(QStringList files)
|
||||
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.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);
|
||||
entry.crc32 = const_cast<char*>("00000000|crc");
|
||||
entry.db_name = const_cast<char*>(databaseData);
|
||||
|
||||
playlist_push(playlist, &entry);
|
||||
playlist_push(playlist, &entry, settings->bools.playlist_fuzzy_archive_match);
|
||||
}
|
||||
}
|
||||
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
|
||||
playlist_free(playlist);
|
||||
|
||||
reloadPlaylists();
|
||||
@ -623,7 +624,6 @@ void MainWindow::addFilesToPlaylist(QStringList files)
|
||||
|
||||
bool MainWindow::updateCurrentPlaylistEntry(const QHash<QString, QString> &contentHash)
|
||||
{
|
||||
QString playlistPath = getCurrentPlaylistPath();
|
||||
QString path;
|
||||
QString label;
|
||||
QString corePath;
|
||||
@ -637,18 +637,22 @@ bool MainWindow::updateCurrentPlaylistEntry(const QHash<QString, QString> &conte
|
||||
QByteArray coreNameArray;
|
||||
QByteArray dbNameArray;
|
||||
QByteArray crc32Array;
|
||||
settings_t *settings = config_get_ptr();
|
||||
QString playlistPath = getCurrentPlaylistPath();
|
||||
const char *playlistPathData = NULL;
|
||||
const char *pathData = NULL;
|
||||
const char *labelData = NULL;
|
||||
const char *corePathData = NULL;
|
||||
const char *coreNameData = NULL;
|
||||
const char *dbNameData = NULL;
|
||||
const char *crc32Data = NULL;
|
||||
playlist_t *playlist = NULL;
|
||||
unsigned index = 0;
|
||||
bool ok = false;
|
||||
const char *pathData = NULL;
|
||||
const char *labelData = NULL;
|
||||
const char *corePathData = NULL;
|
||||
const char *coreNameData = NULL;
|
||||
const char *dbNameData = NULL;
|
||||
const char *crc32Data = NULL;
|
||||
playlist_t *playlist = NULL;
|
||||
unsigned index = 0;
|
||||
bool ok = false;
|
||||
|
||||
if (playlistPath.isEmpty() || contentHash.isEmpty() || !contentHash.contains("index"))
|
||||
if ( playlistPath.isEmpty() ||
|
||||
contentHash.isEmpty() ||
|
||||
!contentHash.contains("index"))
|
||||
return false;
|
||||
|
||||
index = contentHash.value("index").toUInt(&ok);
|
||||
@ -656,42 +660,42 @@ bool MainWindow::updateCurrentPlaylistEntry(const QHash<QString, QString> &conte
|
||||
if (!ok)
|
||||
return false;
|
||||
|
||||
path = contentHash.value("path");
|
||||
label = contentHash.value("label");
|
||||
path = contentHash.value("path");
|
||||
label = contentHash.value("label");
|
||||
coreName = contentHash.value("core_name");
|
||||
corePath = contentHash.value("core_path");
|
||||
dbName = contentHash.value("db_name");
|
||||
crc32 = contentHash.value("crc32");
|
||||
dbName = contentHash.value("db_name");
|
||||
crc32 = contentHash.value("crc32");
|
||||
|
||||
if (path.isEmpty() ||
|
||||
label.isEmpty() ||
|
||||
if (path.isEmpty() ||
|
||||
label.isEmpty() ||
|
||||
coreName.isEmpty() ||
|
||||
corePath.isEmpty()
|
||||
)
|
||||
return false;
|
||||
|
||||
playlistPathArray = playlistPath.toUtf8();
|
||||
pathArray = QDir::toNativeSeparators(path).toUtf8();
|
||||
labelArray = label.toUtf8();
|
||||
coreNameArray = coreName.toUtf8();
|
||||
corePathArray = QDir::toNativeSeparators(corePath).toUtf8();
|
||||
pathArray = QDir::toNativeSeparators(path).toUtf8();
|
||||
labelArray = label.toUtf8();
|
||||
coreNameArray = coreName.toUtf8();
|
||||
corePathArray = QDir::toNativeSeparators(corePath).toUtf8();
|
||||
|
||||
if (!dbName.isEmpty())
|
||||
{
|
||||
dbNameArray = (dbName + ".lpl").toUtf8();
|
||||
dbNameData = dbNameArray.constData();
|
||||
dbNameData = dbNameArray.constData();
|
||||
}
|
||||
|
||||
playlistPathData = playlistPathArray.constData();
|
||||
pathData = pathArray.constData();
|
||||
labelData = labelArray.constData();
|
||||
coreNameData = coreNameArray.constData();
|
||||
corePathData = corePathArray.constData();
|
||||
pathData = pathArray.constData();
|
||||
labelData = labelArray.constData();
|
||||
coreNameData = coreNameArray.constData();
|
||||
corePathData = corePathArray.constData();
|
||||
|
||||
if (!crc32.isEmpty())
|
||||
{
|
||||
crc32Array = crc32.toUtf8();
|
||||
crc32Data = crc32Array.constData();
|
||||
crc32Array = crc32.toUtf8();
|
||||
crc32Data = crc32Array.constData();
|
||||
}
|
||||
|
||||
if (path_is_compressed_file(pathData))
|
||||
@ -717,17 +721,17 @@ bool MainWindow::updateCurrentPlaylistEntry(const QHash<QString, QString> &conte
|
||||
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.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);
|
||||
entry.crc32 = const_cast<char*>(crc32Data);
|
||||
entry.db_name = const_cast<char*>(dbNameData);
|
||||
|
||||
playlist_update(playlist, index, &entry);
|
||||
}
|
||||
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
|
||||
playlist_free(playlist);
|
||||
|
||||
reloadPlaylists();
|
||||
@ -737,7 +741,7 @@ bool MainWindow::updateCurrentPlaylistEntry(const QHash<QString, QString> &conte
|
||||
|
||||
void MainWindow::onPlaylistWidgetContextMenuRequested(const QPoint&)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
QScopedPointer<QMenu> menu;
|
||||
QScopedPointer<QMenu> associateMenu;
|
||||
QScopedPointer<QMenu> hiddenPlaylistsMenu;
|
||||
@ -750,20 +754,21 @@ void MainWindow::onPlaylistWidgetContextMenuRequested(const QPoint&)
|
||||
QScopedPointer<QAction> downloadAllThumbnailsThisPlaylistAction;
|
||||
QPointer<QAction> selectedAction;
|
||||
QPoint cursorPos = QCursor::pos();
|
||||
QListWidgetItem *selectedItem = m_listWidget->itemAt(m_listWidget->viewport()->mapFromGlobal(cursorPos));
|
||||
QDir playlistDir(settings->paths.directory_playlist);
|
||||
QString playlistDirAbsPath = playlistDir.absolutePath();
|
||||
QString currentPlaylistDirPath;
|
||||
QString currentPlaylistPath;
|
||||
QString currentPlaylistFileName;
|
||||
QFile currentPlaylistFile;
|
||||
QFileInfo currentPlaylistFileInfo;
|
||||
QMap<QString, const core_info_t*> coreList;
|
||||
QListWidgetItem *selectedItem = m_listWidget->itemAt(
|
||||
m_listWidget->viewport()->mapFromGlobal(cursorPos));
|
||||
QString playlistDirAbsPath = playlistDir.absolutePath();
|
||||
core_info_list_t *core_info_list = NULL;
|
||||
unsigned i = 0;
|
||||
int j = 0;
|
||||
bool specialPlaylist = false;
|
||||
bool foundHiddenPlaylist = false;
|
||||
unsigned i = 0;
|
||||
int j = 0;
|
||||
bool specialPlaylist = false;
|
||||
bool foundHiddenPlaylist = false;
|
||||
|
||||
if (selectedItem)
|
||||
{
|
||||
@ -948,7 +953,8 @@ void MainWindow::onPlaylistWidgetContextMenuRequested(const QPoint&)
|
||||
}
|
||||
|
||||
/* Write changes to disk */
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist,
|
||||
settings->bools.playlist_use_old_format);
|
||||
|
||||
/* Free playlist, if required */
|
||||
if (loadPlaylist)
|
||||
@ -1275,14 +1281,15 @@ bool MainWindow::currentPlaylistIsAll()
|
||||
|
||||
void MainWindow::deleteCurrentPlaylistItem()
|
||||
{
|
||||
QString playlistPath = getCurrentPlaylistPath();
|
||||
QByteArray playlistArray;
|
||||
QString playlistPath = getCurrentPlaylistPath();
|
||||
QHash<QString, QString> contentHash = getCurrentContentHash();
|
||||
playlist_t *playlist = NULL;
|
||||
const char *playlistData = NULL;
|
||||
unsigned index = 0;
|
||||
bool ok = false;
|
||||
bool isAllPlaylist = currentPlaylistIsAll();
|
||||
playlist_t *playlist = NULL;
|
||||
const char *playlistData = NULL;
|
||||
unsigned index = 0;
|
||||
bool ok = false;
|
||||
bool isAllPlaylist = currentPlaylistIsAll();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (isAllPlaylist)
|
||||
return;
|
||||
@ -1307,7 +1314,7 @@ void MainWindow::deleteCurrentPlaylistItem()
|
||||
playlist = playlist_init(playlistData, COLLECTION_SIZE);
|
||||
|
||||
playlist_delete_index(playlist, index);
|
||||
playlist_write_file(playlist);
|
||||
playlist_write_file(playlist, settings->bools.playlist_use_old_format);
|
||||
playlist_free(playlist);
|
||||
|
||||
reloadPlaylists();
|
||||
|
Loading…
x
Reference in New Issue
Block a user