Reduce dependence on settings_t struct
This commit is contained in:
parent
05d71ebb67
commit
758a6c76ae
|
@ -26,7 +26,6 @@
|
||||||
#include <lists/dir_list.h>
|
#include <lists/dir_list.h>
|
||||||
#include <retro_miscellaneous.h>
|
#include <retro_miscellaneous.h>
|
||||||
|
|
||||||
#include "configuration.h"
|
|
||||||
#include "msg_hash.h"
|
#include "msg_hash.h"
|
||||||
#include "list_special.h"
|
#include "list_special.h"
|
||||||
#include "core_info.h"
|
#include "core_info.h"
|
||||||
|
@ -548,12 +547,10 @@ bool manual_content_scan_get_menu_core_name(const char **core_name)
|
||||||
* lists and 'menu_cbs_left/right'
|
* lists and 'menu_cbs_left/right'
|
||||||
* > Returns NULL in the event of failure
|
* > Returns NULL in the event of failure
|
||||||
* > Returned string list must be free()'d */
|
* > Returned string list must be free()'d */
|
||||||
struct string_list *manual_content_scan_get_menu_system_name_list(void)
|
struct string_list *manual_content_scan_get_menu_system_name_list(
|
||||||
|
const char *path_content_database)
|
||||||
{
|
{
|
||||||
union string_list_elem_attr attr;
|
union string_list_elem_attr attr;
|
||||||
#ifdef HAVE_LIBRETRODB
|
|
||||||
settings_t *settings = config_get_ptr();
|
|
||||||
#endif
|
|
||||||
struct string_list *name_list = string_list_new();
|
struct string_list *name_list = string_list_new();
|
||||||
|
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
|
@ -575,14 +572,13 @@ struct string_list *manual_content_scan_get_menu_system_name_list(void)
|
||||||
#ifdef HAVE_LIBRETRODB
|
#ifdef HAVE_LIBRETRODB
|
||||||
/* If platform has database support, get names
|
/* If platform has database support, get names
|
||||||
* of all installed database files */
|
* of all installed database files */
|
||||||
if (settings)
|
|
||||||
{
|
{
|
||||||
/* Note: dir_list_new_special() is well behaved - the
|
/* Note: dir_list_new_special() is well behaved - the
|
||||||
* returned string list will only include database
|
* returned string list will only include database
|
||||||
* files (i.e. don't have to check for directories,
|
* files (i.e. don't have to check for directories,
|
||||||
* or verify file extensions) */
|
* or verify file extensions) */
|
||||||
struct string_list *rdb_list = dir_list_new_special(
|
struct string_list *rdb_list = dir_list_new_special(
|
||||||
settings->paths.path_content_database,
|
path_content_database,
|
||||||
DIR_LIST_DATABASES, NULL);
|
DIR_LIST_DATABASES, NULL);
|
||||||
|
|
||||||
if (rdb_list && rdb_list->size)
|
if (rdb_list && rdb_list->size)
|
||||||
|
@ -704,11 +700,12 @@ error:
|
||||||
* and extracts all information required to configure
|
* and extracts all information required to configure
|
||||||
* a manual content scan task.
|
* a manual content scan task.
|
||||||
* Returns false if current settings are invalid. */
|
* Returns false if current settings are invalid. */
|
||||||
bool manual_content_scan_get_task_config(manual_content_scan_task_config_t *task_config)
|
bool manual_content_scan_get_task_config(
|
||||||
|
manual_content_scan_task_config_t *task_config,
|
||||||
|
const char *path_dir_playlist
|
||||||
|
)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
if (!task_config)
|
||||||
|
|
||||||
if (!task_config || !settings)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Ensure all 'task_config' strings are
|
/* Ensure all 'task_config' strings are
|
||||||
|
@ -785,12 +782,12 @@ bool manual_content_scan_get_task_config(manual_content_scan_task_config_t *task
|
||||||
|
|
||||||
/* ...which can in turn be used to generate the
|
/* ...which can in turn be used to generate the
|
||||||
* playlist path */
|
* playlist path */
|
||||||
if (string_is_empty(settings->paths.directory_playlist))
|
if (string_is_empty(path_dir_playlist))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
fill_pathname_join(
|
fill_pathname_join(
|
||||||
task_config->playlist_file,
|
task_config->playlist_file,
|
||||||
settings->paths.directory_playlist,
|
path_dir_playlist,
|
||||||
task_config->database_name,
|
task_config->database_name,
|
||||||
sizeof(task_config->playlist_file));
|
sizeof(task_config->playlist_file));
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,8 @@ bool manual_content_scan_get_menu_core_name(const char **core_name);
|
||||||
* lists and 'menu_cbs_left/right'
|
* lists and 'menu_cbs_left/right'
|
||||||
* > Returns NULL in the event of failure
|
* > Returns NULL in the event of failure
|
||||||
* > Returned string list must be free()'d */
|
* > Returned string list must be free()'d */
|
||||||
struct string_list *manual_content_scan_get_menu_system_name_list(void);
|
struct string_list *manual_content_scan_get_menu_system_name_list(
|
||||||
|
const char *path_content_database);
|
||||||
|
|
||||||
/* Creates a list of all possible 'core name' menu
|
/* Creates a list of all possible 'core name' menu
|
||||||
* strings, for use in 'menu_displaylist' drop-down
|
* strings, for use in 'menu_displaylist' drop-down
|
||||||
|
@ -211,7 +212,10 @@ struct string_list *manual_content_scan_get_menu_core_name_list(void);
|
||||||
* and extracts all information required to configure
|
* and extracts all information required to configure
|
||||||
* a manual content scan task.
|
* a manual content scan task.
|
||||||
* Returns false if current settings are invalid. */
|
* Returns false if current settings are invalid. */
|
||||||
bool manual_content_scan_get_task_config(manual_content_scan_task_config_t *task_config);
|
bool manual_content_scan_get_task_config(
|
||||||
|
manual_content_scan_task_config_t *task_config,
|
||||||
|
const char *path_dir_playlist
|
||||||
|
);
|
||||||
|
|
||||||
/* Creates a list of all valid content in the specified
|
/* Creates a list of all valid content in the specified
|
||||||
* content directory
|
* content directory
|
||||||
|
|
|
@ -521,8 +521,14 @@ static int playlist_left_thumbnail_mode_left(unsigned type, const char *label,
|
||||||
static int manual_content_scan_system_name_left(unsigned type, const char *label,
|
static int manual_content_scan_system_name_left(unsigned type, const char *label,
|
||||||
bool wraparound)
|
bool wraparound)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_LIBRETRODB
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
struct string_list *system_name_list =
|
struct string_list *system_name_list =
|
||||||
manual_content_scan_get_menu_system_name_list();
|
manual_content_scan_get_menu_system_name_list(settings->paths.path_content_database);
|
||||||
|
#else
|
||||||
|
struct string_list *system_name_list =
|
||||||
|
manual_content_scan_get_menu_system_name_list(NULL);
|
||||||
|
#endif
|
||||||
const char *current_system_name = NULL;
|
const char *current_system_name = NULL;
|
||||||
enum manual_content_scan_system_name_type next_system_name_type =
|
enum manual_content_scan_system_name_type next_system_name_type =
|
||||||
MANUAL_CONTENT_SCAN_SYSTEM_NAME_DATABASE;
|
MANUAL_CONTENT_SCAN_SYSTEM_NAME_DATABASE;
|
||||||
|
|
|
@ -608,8 +608,14 @@ static int playlist_left_thumbnail_mode_right(unsigned type, const char *label,
|
||||||
static int manual_content_scan_system_name_right(unsigned type, const char *label,
|
static int manual_content_scan_system_name_right(unsigned type, const char *label,
|
||||||
bool wraparound)
|
bool wraparound)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_LIBRETRODB
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
struct string_list *system_name_list =
|
struct string_list *system_name_list =
|
||||||
manual_content_scan_get_menu_system_name_list();
|
manual_content_scan_get_menu_system_name_list(settings->paths.path_content_database);
|
||||||
|
#else
|
||||||
|
struct string_list *system_name_list =
|
||||||
|
manual_content_scan_get_menu_system_name_list(NULL);
|
||||||
|
#endif
|
||||||
const char *current_system_name = NULL;
|
const char *current_system_name = NULL;
|
||||||
enum manual_content_scan_system_name_type next_system_name_type =
|
enum manual_content_scan_system_name_type next_system_name_type =
|
||||||
MANUAL_CONTENT_SCAN_SYSTEM_NAME_DATABASE;
|
MANUAL_CONTENT_SCAN_SYSTEM_NAME_DATABASE;
|
||||||
|
|
|
@ -5189,7 +5189,14 @@ unsigned menu_displaylist_build_list(file_list_t *list, enum menu_displaylist_ct
|
||||||
case DISPLAYLIST_DROPDOWN_LIST_MANUAL_CONTENT_SCAN_SYSTEM_NAME:
|
case DISPLAYLIST_DROPDOWN_LIST_MANUAL_CONTENT_SCAN_SYSTEM_NAME:
|
||||||
{
|
{
|
||||||
/* Get system name list */
|
/* Get system name list */
|
||||||
struct string_list *system_name_list = manual_content_scan_get_menu_system_name_list();
|
#ifdef HAVE_LIBRETRODB
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
struct string_list *system_name_list =
|
||||||
|
manual_content_scan_get_menu_system_name_list(settings->paths.path_content_database);
|
||||||
|
#else
|
||||||
|
struct string_list *system_name_list =
|
||||||
|
manual_content_scan_get_menu_system_name_list(NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (system_name_list)
|
if (system_name_list)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "tasks_internal.h"
|
#include "tasks_internal.h"
|
||||||
|
|
||||||
|
#include "../configuration.h"
|
||||||
#include "../retroarch.h"
|
#include "../retroarch.h"
|
||||||
#include "../msg_hash.h"
|
#include "../msg_hash.h"
|
||||||
#include "../playlist.h"
|
#include "../playlist.h"
|
||||||
|
@ -297,6 +298,7 @@ bool task_push_manual_content_scan(void)
|
||||||
task_finder_data_t find_data;
|
task_finder_data_t find_data;
|
||||||
char task_title[PATH_MAX_LENGTH];
|
char task_title[PATH_MAX_LENGTH];
|
||||||
retro_task_t *task = NULL;
|
retro_task_t *task = NULL;
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
manual_scan_handle_t *manual_scan = (manual_scan_handle_t*)
|
manual_scan_handle_t *manual_scan = (manual_scan_handle_t*)
|
||||||
calloc(1, sizeof(manual_scan_handle_t));
|
calloc(1, sizeof(manual_scan_handle_t));
|
||||||
|
|
||||||
|
@ -322,7 +324,10 @@ bool task_push_manual_content_scan(void)
|
||||||
if (!manual_scan->task_config)
|
if (!manual_scan->task_config)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (!manual_content_scan_get_task_config(manual_scan->task_config))
|
if (!manual_content_scan_get_task_config(
|
||||||
|
manual_scan->task_config,
|
||||||
|
settings->paths.directory_playlist
|
||||||
|
))
|
||||||
{
|
{
|
||||||
runloop_msg_queue_push(
|
runloop_msg_queue_push(
|
||||||
msg_hash_to_str(MSG_MANUAL_CONTENT_SCAN_INVALID_CONFIG),
|
msg_hash_to_str(MSG_MANUAL_CONTENT_SCAN_INVALID_CONFIG),
|
||||||
|
|
Loading…
Reference in New Issue