mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 22:13:51 +00:00
(Manual content scanner) Add 'Arcade DAT Filter' Option
This commit is contained in:
parent
e2378680ef
commit
9d59fcaded
@ -2200,6 +2200,8 @@ MSG_HASH(MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_SEARCH_ARCHIVES,
|
|||||||
"manual_content_scan_search_archives")
|
"manual_content_scan_search_archives")
|
||||||
MSG_HASH(MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_DAT_FILE,
|
MSG_HASH(MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_DAT_FILE,
|
||||||
"manual_content_scan_dat_file")
|
"manual_content_scan_dat_file")
|
||||||
|
MSG_HASH(MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_DAT_FILE_FILTER,
|
||||||
|
"manual_content_scan_dat_file_filter")
|
||||||
MSG_HASH(MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_OVERWRITE,
|
MSG_HASH(MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_OVERWRITE,
|
||||||
"manual_content_scan_overwrite")
|
"manual_content_scan_overwrite")
|
||||||
MSG_HASH(MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_START,
|
MSG_HASH(MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_START,
|
||||||
|
@ -10299,6 +10299,14 @@ MSG_HASH(
|
|||||||
MENU_ENUM_SUBLABEL_MANUAL_CONTENT_SCAN_DAT_FILE,
|
MENU_ENUM_SUBLABEL_MANUAL_CONTENT_SCAN_DAT_FILE,
|
||||||
"Select a Logiqx or MAME List XML DAT file to enable automatic naming of scanned arcade content (MAME, FinalBurn Neo, etc.)."
|
"Select a Logiqx or MAME List XML DAT file to enable automatic naming of scanned arcade content (MAME, FinalBurn Neo, etc.)."
|
||||||
)
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_VALUE_MANUAL_CONTENT_SCAN_DAT_FILE_FILTER,
|
||||||
|
"Arcade DAT Filter"
|
||||||
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_SUBLABEL_MANUAL_CONTENT_SCAN_DAT_FILE_FILTER,
|
||||||
|
"When using an arcade DAT file, only add content to playlist if a matching DAT file entry is found."
|
||||||
|
)
|
||||||
MSG_HASH(
|
MSG_HASH(
|
||||||
MENU_ENUM_LABEL_VALUE_MANUAL_CONTENT_SCAN_OVERWRITE,
|
MENU_ENUM_LABEL_VALUE_MANUAL_CONTENT_SCAN_OVERWRITE,
|
||||||
"Overwrite Existing Playlist"
|
"Overwrite Existing Playlist"
|
||||||
|
@ -51,6 +51,7 @@ typedef struct
|
|||||||
enum manual_content_scan_system_name_type system_name_type;
|
enum manual_content_scan_system_name_type system_name_type;
|
||||||
enum manual_content_scan_core_type core_type;
|
enum manual_content_scan_core_type core_type;
|
||||||
bool search_archives;
|
bool search_archives;
|
||||||
|
bool filter_dat_content;
|
||||||
bool overwrite_playlist;
|
bool overwrite_playlist;
|
||||||
} scan_settings_t;
|
} scan_settings_t;
|
||||||
|
|
||||||
@ -76,6 +77,7 @@ static scan_settings_t scan_settings = {
|
|||||||
MANUAL_CONTENT_SCAN_SYSTEM_NAME_CONTENT_DIR, /* system_name_type */
|
MANUAL_CONTENT_SCAN_SYSTEM_NAME_CONTENT_DIR, /* system_name_type */
|
||||||
MANUAL_CONTENT_SCAN_CORE_DETECT, /* core_type */
|
MANUAL_CONTENT_SCAN_CORE_DETECT, /* core_type */
|
||||||
false, /* search_archives */
|
false, /* search_archives */
|
||||||
|
false, /* filter_dat_content */
|
||||||
false /* overwrite_playlist */
|
false /* overwrite_playlist */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -134,6 +136,13 @@ bool *manual_content_scan_get_search_archives_ptr(void)
|
|||||||
return &scan_settings.search_archives;
|
return &scan_settings.search_archives;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Returns a pointer to the internal
|
||||||
|
* 'filter_dat_content' bool */
|
||||||
|
bool *manual_content_scan_get_filter_dat_content_ptr(void)
|
||||||
|
{
|
||||||
|
return &scan_settings.filter_dat_content;
|
||||||
|
}
|
||||||
|
|
||||||
/* Returns a pointer to the internal
|
/* Returns a pointer to the internal
|
||||||
* 'overwrite_playlist' bool */
|
* 'overwrite_playlist' bool */
|
||||||
bool *manual_content_scan_get_overwrite_playlist_ptr(void)
|
bool *manual_content_scan_get_overwrite_playlist_ptr(void)
|
||||||
@ -857,6 +866,9 @@ bool manual_content_scan_get_task_config(
|
|||||||
/* Copy 'search inside archives' setting */
|
/* Copy 'search inside archives' setting */
|
||||||
task_config->search_archives = scan_settings.search_archives;
|
task_config->search_archives = scan_settings.search_archives;
|
||||||
|
|
||||||
|
/* Copy 'DAT file filter' setting */
|
||||||
|
task_config->filter_dat_content = scan_settings.filter_dat_content;
|
||||||
|
|
||||||
/* Copy 'overwrite playlist' setting */
|
/* Copy 'overwrite playlist' setting */
|
||||||
task_config->overwrite_playlist = scan_settings.overwrite_playlist;
|
task_config->overwrite_playlist = scan_settings.overwrite_playlist;
|
||||||
|
|
||||||
@ -1017,12 +1029,13 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Extracts content 'label' (name) from content path
|
/* Extracts content 'label' (name) from content path
|
||||||
* > If a DAT file is specified and content is an
|
* > If a DAT file is specified, performs a lookup
|
||||||
* archive, performs a lookup of content file name
|
* of content file name in an attempt to find a
|
||||||
* in an attempt to find a valid 'description' string.
|
* valid 'description' string.
|
||||||
* Returns false if specified content is invalid. */
|
* Returns false if specified content is invalid. */
|
||||||
static bool manual_content_scan_get_playlist_content_label(
|
static bool manual_content_scan_get_playlist_content_label(
|
||||||
const char *content_path, logiqx_dat_t *dat_file,
|
const char *content_path, logiqx_dat_t *dat_file,
|
||||||
|
bool filter_dat_content,
|
||||||
char *content_label, size_t len)
|
char *content_label, size_t len)
|
||||||
{
|
{
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
@ -1040,33 +1053,34 @@ static bool manual_content_scan_get_playlist_content_label(
|
|||||||
/* Check if a DAT file has been specified */
|
/* Check if a DAT file has been specified */
|
||||||
if (dat_file)
|
if (dat_file)
|
||||||
{
|
{
|
||||||
/* DAT files are only relevant for arcade
|
bool content_found = false;
|
||||||
* content. We have no idea what kind of
|
logiqx_dat_game_info_t game_info;
|
||||||
* content we are dealing with here, but
|
|
||||||
* since arcade ROMs are always archives
|
/* Search for current content
|
||||||
* we can at least filter by file type... */
|
* > If content is not listed in DAT file,
|
||||||
if (path_is_compressed_file(content_path))
|
* use existing filename without extension */
|
||||||
|
if (logiqx_dat_search(dat_file, content_label, &game_info))
|
||||||
{
|
{
|
||||||
logiqx_dat_game_info_t game_info;
|
/* BIOS files should always be skipped */
|
||||||
|
if (game_info.is_bios)
|
||||||
|
return false;
|
||||||
|
|
||||||
/* Search for current content
|
/* Only include 'runnable' content */
|
||||||
* > If content is not listed in DAT file,
|
if (!game_info.is_runnable)
|
||||||
* use existing filename without extension */
|
return false;
|
||||||
if (logiqx_dat_search(dat_file, content_label, &game_info))
|
|
||||||
|
/* Copy game description */
|
||||||
|
if (!string_is_empty(game_info.description))
|
||||||
{
|
{
|
||||||
/* BIOS files should always be skipped */
|
strlcpy(content_label, game_info.description, len);
|
||||||
if (game_info.is_bios)
|
content_found = true;
|
||||||
return false;
|
|
||||||
|
|
||||||
/* Only include 'runnable' content */
|
|
||||||
if (!game_info.is_runnable)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* Copy game description */
|
|
||||||
if (!string_is_empty(game_info.description))
|
|
||||||
strlcpy(content_label, game_info.description, len);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If we are applying a DAT file filter,
|
||||||
|
* unlisted content should be skipped */
|
||||||
|
if (!content_found && filter_dat_content)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1106,6 +1120,7 @@ void manual_content_scan_add_content_to_playlist(
|
|||||||
/* Get entry label */
|
/* Get entry label */
|
||||||
if (!manual_content_scan_get_playlist_content_label(
|
if (!manual_content_scan_get_playlist_content_label(
|
||||||
playlist_content_path, dat_file,
|
playlist_content_path, dat_file,
|
||||||
|
task_config->filter_dat_content,
|
||||||
label, sizeof(label)))
|
label, sizeof(label)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -79,6 +79,7 @@ typedef struct
|
|||||||
char dat_file_path[PATH_MAX_LENGTH];
|
char dat_file_path[PATH_MAX_LENGTH];
|
||||||
bool core_set;
|
bool core_set;
|
||||||
bool search_archives;
|
bool search_archives;
|
||||||
|
bool filter_dat_content;
|
||||||
bool overwrite_playlist;
|
bool overwrite_playlist;
|
||||||
} manual_content_scan_task_config_t;
|
} manual_content_scan_task_config_t;
|
||||||
|
|
||||||
@ -120,6 +121,10 @@ size_t manual_content_scan_get_dat_file_path_size(void);
|
|||||||
* 'search_archives' bool */
|
* 'search_archives' bool */
|
||||||
bool *manual_content_scan_get_search_archives_ptr(void);
|
bool *manual_content_scan_get_search_archives_ptr(void);
|
||||||
|
|
||||||
|
/* Returns a pointer to the internal
|
||||||
|
* 'filter_dat_content' bool */
|
||||||
|
bool *manual_content_scan_get_filter_dat_content_ptr(void);
|
||||||
|
|
||||||
/* Returns a pointer to the internal
|
/* Returns a pointer to the internal
|
||||||
* 'overwrite_playlist' bool */
|
* 'overwrite_playlist' bool */
|
||||||
bool *manual_content_scan_get_overwrite_playlist_ptr(void);
|
bool *manual_content_scan_get_overwrite_playlist_ptr(void);
|
||||||
|
@ -764,6 +764,7 @@ default_sublabel_macro(action_bind_sublabel_manual_content_scan_core_name,
|
|||||||
default_sublabel_macro(action_bind_sublabel_manual_content_scan_file_exts, MENU_ENUM_SUBLABEL_MANUAL_CONTENT_SCAN_FILE_EXTS)
|
default_sublabel_macro(action_bind_sublabel_manual_content_scan_file_exts, MENU_ENUM_SUBLABEL_MANUAL_CONTENT_SCAN_FILE_EXTS)
|
||||||
default_sublabel_macro(action_bind_sublabel_manual_content_scan_search_archives, MENU_ENUM_SUBLABEL_MANUAL_CONTENT_SCAN_SEARCH_ARCHIVES)
|
default_sublabel_macro(action_bind_sublabel_manual_content_scan_search_archives, MENU_ENUM_SUBLABEL_MANUAL_CONTENT_SCAN_SEARCH_ARCHIVES)
|
||||||
default_sublabel_macro(action_bind_sublabel_manual_content_scan_dat_file, MENU_ENUM_SUBLABEL_MANUAL_CONTENT_SCAN_DAT_FILE)
|
default_sublabel_macro(action_bind_sublabel_manual_content_scan_dat_file, MENU_ENUM_SUBLABEL_MANUAL_CONTENT_SCAN_DAT_FILE)
|
||||||
|
default_sublabel_macro(action_bind_sublabel_manual_content_scan_dat_file_filter, MENU_ENUM_SUBLABEL_MANUAL_CONTENT_SCAN_DAT_FILE_FILTER)
|
||||||
default_sublabel_macro(action_bind_sublabel_manual_content_scan_overwrite, MENU_ENUM_SUBLABEL_MANUAL_CONTENT_SCAN_OVERWRITE)
|
default_sublabel_macro(action_bind_sublabel_manual_content_scan_overwrite, MENU_ENUM_SUBLABEL_MANUAL_CONTENT_SCAN_OVERWRITE)
|
||||||
default_sublabel_macro(action_bind_sublabel_manual_content_scan_start, MENU_ENUM_SUBLABEL_MANUAL_CONTENT_SCAN_START)
|
default_sublabel_macro(action_bind_sublabel_manual_content_scan_start, MENU_ENUM_SUBLABEL_MANUAL_CONTENT_SCAN_START)
|
||||||
|
|
||||||
@ -3273,6 +3274,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
|||||||
case MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_DAT_FILE:
|
case MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_DAT_FILE:
|
||||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_manual_content_scan_dat_file);
|
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_manual_content_scan_dat_file);
|
||||||
break;
|
break;
|
||||||
|
case MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_DAT_FILE_FILTER:
|
||||||
|
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_manual_content_scan_dat_file_filter);
|
||||||
|
break;
|
||||||
case MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_OVERWRITE:
|
case MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_OVERWRITE:
|
||||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_manual_content_scan_overwrite);
|
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_manual_content_scan_overwrite);
|
||||||
break;
|
break;
|
||||||
|
@ -3939,6 +3939,12 @@ static bool menu_displaylist_parse_manual_content_scan_list(
|
|||||||
false) == 0)
|
false) == 0)
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
|
/* Arcade DAT filter */
|
||||||
|
if (menu_displaylist_parse_settings_enum(info->list,
|
||||||
|
MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_DAT_FILE_FILTER, PARSE_ONLY_BOOL,
|
||||||
|
false) == 0)
|
||||||
|
count++;
|
||||||
|
|
||||||
/* Overwrite playlist */
|
/* Overwrite playlist */
|
||||||
if (menu_displaylist_parse_settings_enum(info->list,
|
if (menu_displaylist_parse_settings_enum(info->list,
|
||||||
MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_OVERWRITE, PARSE_ONLY_BOOL,
|
MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_OVERWRITE, PARSE_ONLY_BOOL,
|
||||||
|
@ -17080,6 +17080,21 @@ static bool setting_append_list(
|
|||||||
general_read_handler);
|
general_read_handler);
|
||||||
menu_settings_list_current_add_values(list, list_info, "dat|xml");
|
menu_settings_list_current_add_values(list, list_info, "dat|xml");
|
||||||
|
|
||||||
|
CONFIG_BOOL(
|
||||||
|
list, list_info,
|
||||||
|
manual_content_scan_get_filter_dat_content_ptr(),
|
||||||
|
MENU_ENUM_LABEL_MANUAL_CONTENT_SCAN_DAT_FILE_FILTER,
|
||||||
|
MENU_ENUM_LABEL_VALUE_MANUAL_CONTENT_SCAN_DAT_FILE_FILTER,
|
||||||
|
false,
|
||||||
|
MENU_ENUM_LABEL_VALUE_OFF,
|
||||||
|
MENU_ENUM_LABEL_VALUE_ON,
|
||||||
|
&group_info,
|
||||||
|
&subgroup_info,
|
||||||
|
parent_group,
|
||||||
|
general_write_handler,
|
||||||
|
general_read_handler,
|
||||||
|
SD_FLAG_NONE);
|
||||||
|
|
||||||
CONFIG_BOOL(
|
CONFIG_BOOL(
|
||||||
list, list_info,
|
list, list_info,
|
||||||
manual_content_scan_get_overwrite_playlist_ptr(),
|
manual_content_scan_get_overwrite_playlist_ptr(),
|
||||||
|
@ -2754,6 +2754,7 @@ enum msg_hash_enums
|
|||||||
MENU_LABEL(MANUAL_CONTENT_SCAN_FILE_EXTS),
|
MENU_LABEL(MANUAL_CONTENT_SCAN_FILE_EXTS),
|
||||||
MENU_LABEL(MANUAL_CONTENT_SCAN_SEARCH_ARCHIVES),
|
MENU_LABEL(MANUAL_CONTENT_SCAN_SEARCH_ARCHIVES),
|
||||||
MENU_LABEL(MANUAL_CONTENT_SCAN_DAT_FILE),
|
MENU_LABEL(MANUAL_CONTENT_SCAN_DAT_FILE),
|
||||||
|
MENU_LABEL(MANUAL_CONTENT_SCAN_DAT_FILE_FILTER),
|
||||||
MENU_LABEL(MANUAL_CONTENT_SCAN_OVERWRITE),
|
MENU_LABEL(MANUAL_CONTENT_SCAN_OVERWRITE),
|
||||||
MENU_LABEL(MANUAL_CONTENT_SCAN_START),
|
MENU_LABEL(MANUAL_CONTENT_SCAN_START),
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user