mirror of
https://github.com/libretro/RetroArch
synced 2025-04-07 13:23:32 +00:00
Small style nits and plain sense cleanups
This commit is contained in:
parent
797c7ff381
commit
c699e47534
@ -129,16 +129,13 @@ void disk_control_set_ext_callback(
|
|||||||
bool disk_control_enabled(
|
bool disk_control_enabled(
|
||||||
disk_control_interface_t *disk_control)
|
disk_control_interface_t *disk_control)
|
||||||
{
|
{
|
||||||
if (!disk_control)
|
if ( disk_control
|
||||||
return false;
|
&& disk_control->cb.set_eject_state
|
||||||
|
&& disk_control->cb.get_eject_state
|
||||||
if (disk_control->cb.set_eject_state &&
|
&& disk_control->cb.get_image_index
|
||||||
disk_control->cb.get_eject_state &&
|
&& disk_control->cb.set_image_index
|
||||||
disk_control->cb.get_image_index &&
|
&& disk_control->cb.get_num_images)
|
||||||
disk_control->cb.set_image_index &&
|
|
||||||
disk_control->cb.get_num_images)
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +152,7 @@ bool disk_control_append_enabled(
|
|||||||
disk_control_interface_t *disk_control)
|
disk_control_interface_t *disk_control)
|
||||||
{
|
{
|
||||||
if ( disk_control
|
if ( disk_control
|
||||||
&& disk_control->cb.replace_image_index
|
&& disk_control->cb.replace_image_index
|
||||||
&& disk_control->cb.add_image_index)
|
&& disk_control->cb.add_image_index)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
@ -166,7 +163,7 @@ bool disk_control_append_enabled(
|
|||||||
*
|
*
|
||||||
* Leaf function.
|
* Leaf function.
|
||||||
*
|
*
|
||||||
* @return true if core supports image labels
|
* @return true if core supports image labels
|
||||||
* - get_image_label
|
* - get_image_label
|
||||||
**/
|
**/
|
||||||
bool disk_control_image_label_enabled(
|
bool disk_control_image_label_enabled(
|
||||||
@ -187,7 +184,7 @@ bool disk_control_image_label_enabled(
|
|||||||
bool disk_control_initial_image_enabled(
|
bool disk_control_initial_image_enabled(
|
||||||
disk_control_interface_t *disk_control)
|
disk_control_interface_t *disk_control)
|
||||||
{
|
{
|
||||||
if ( disk_control
|
if ( disk_control
|
||||||
&& disk_control->cb.set_initial_image
|
&& disk_control->cb.set_initial_image
|
||||||
&& disk_control->cb.get_image_path)
|
&& disk_control->cb.get_image_path)
|
||||||
return true;
|
return true;
|
||||||
@ -309,7 +306,7 @@ static void disk_control_get_index_set_msg(
|
|||||||
if (index < num_images)
|
if (index < num_images)
|
||||||
{
|
{
|
||||||
size_t _len = strlcpy(msg,
|
size_t _len = strlcpy(msg,
|
||||||
success
|
success
|
||||||
? msg_hash_to_str(MSG_SETTING_DISK_IN_TRAY)
|
? msg_hash_to_str(MSG_SETTING_DISK_IN_TRAY)
|
||||||
: msg_hash_to_str(MSG_FAILED_TO_SET_DISK), len);
|
: msg_hash_to_str(MSG_FAILED_TO_SET_DISK), len);
|
||||||
if (has_label)
|
if (has_label)
|
||||||
@ -324,7 +321,7 @@ static void disk_control_get_index_set_msg(
|
|||||||
else
|
else
|
||||||
strlcpy(
|
strlcpy(
|
||||||
msg,
|
msg,
|
||||||
success
|
success
|
||||||
? msg_hash_to_str(MSG_REMOVED_DISK_FROM_TRAY)
|
? msg_hash_to_str(MSG_REMOVED_DISK_FROM_TRAY)
|
||||||
: msg_hash_to_str(MSG_FAILED_TO_REMOVE_DISK_FROM_TRAY),
|
: msg_hash_to_str(MSG_FAILED_TO_REMOVE_DISK_FROM_TRAY),
|
||||||
len);
|
len);
|
||||||
@ -351,7 +348,7 @@ bool disk_control_set_eject_state(
|
|||||||
if (disk_control->cb.set_eject_state(eject))
|
if (disk_control->cb.set_eject_state(eject))
|
||||||
strlcpy(
|
strlcpy(
|
||||||
msg,
|
msg,
|
||||||
eject
|
eject
|
||||||
? msg_hash_to_str(MSG_DISK_EJECTED)
|
? msg_hash_to_str(MSG_DISK_EJECTED)
|
||||||
: msg_hash_to_str(MSG_DISK_CLOSED),
|
: msg_hash_to_str(MSG_DISK_CLOSED),
|
||||||
sizeof(msg));
|
sizeof(msg));
|
||||||
@ -360,7 +357,7 @@ bool disk_control_set_eject_state(
|
|||||||
error = true;
|
error = true;
|
||||||
strlcpy(
|
strlcpy(
|
||||||
msg,
|
msg,
|
||||||
eject
|
eject
|
||||||
? msg_hash_to_str(MSG_VIRTUAL_DISK_TRAY_EJECT)
|
? msg_hash_to_str(MSG_VIRTUAL_DISK_TRAY_EJECT)
|
||||||
: msg_hash_to_str(MSG_VIRTUAL_DISK_TRAY_CLOSE),
|
: msg_hash_to_str(MSG_VIRTUAL_DISK_TRAY_CLOSE),
|
||||||
sizeof(msg));
|
sizeof(msg));
|
||||||
@ -419,9 +416,9 @@ bool disk_control_set_index(
|
|||||||
if (!disk_control)
|
if (!disk_control)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!disk_control->cb.get_eject_state ||
|
if ( !disk_control->cb.get_eject_state
|
||||||
!disk_control->cb.get_num_images ||
|
|| !disk_control->cb.get_num_images
|
||||||
!disk_control->cb.set_image_index)
|
|| !disk_control->cb.set_image_index)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Ensure that disk is currently ejected */
|
/* Ensure that disk is currently ejected */
|
||||||
@ -460,8 +457,8 @@ bool disk_control_set_index(
|
|||||||
* index record (if enabled) */
|
* index record (if enabled) */
|
||||||
if (!error && disk_control->record_enabled)
|
if (!error && disk_control->record_enabled)
|
||||||
{
|
{
|
||||||
if (disk_control->cb.get_image_index &&
|
if ( disk_control->cb.get_image_index
|
||||||
disk_control->cb.get_image_path)
|
&& disk_control->cb.get_image_path)
|
||||||
{
|
{
|
||||||
char new_image_path[PATH_MAX_LENGTH] = {0};
|
char new_image_path[PATH_MAX_LENGTH] = {0};
|
||||||
/* Get current image index + path */
|
/* Get current image index + path */
|
||||||
@ -498,8 +495,8 @@ bool disk_control_set_index_next(
|
|||||||
if (!disk_control)
|
if (!disk_control)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!disk_control->cb.get_num_images ||
|
if ( !disk_control->cb.get_num_images
|
||||||
!disk_control->cb.get_image_index)
|
|| !disk_control->cb.get_image_index)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
num_images = disk_control->cb.get_num_images();
|
num_images = disk_control->cb.get_num_images();
|
||||||
@ -538,8 +535,8 @@ bool disk_control_set_index_prev(
|
|||||||
if (!disk_control)
|
if (!disk_control)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!disk_control->cb.get_num_images ||
|
if ( !disk_control->cb.get_num_images
|
||||||
!disk_control->cb.get_image_index)
|
|| !disk_control->cb.get_image_index)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
num_images = disk_control->cb.get_num_images();
|
num_images = disk_control->cb.get_num_images();
|
||||||
@ -584,11 +581,11 @@ bool disk_control_append_image(
|
|||||||
if (!disk_control)
|
if (!disk_control)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!disk_control->cb.get_image_index ||
|
if ( !disk_control->cb.get_image_index
|
||||||
!disk_control->cb.get_num_images ||
|
|| !disk_control->cb.get_num_images
|
||||||
!disk_control->cb.add_image_index ||
|
|| !disk_control->cb.add_image_index
|
||||||
!disk_control->cb.replace_image_index ||
|
|| !disk_control->cb.replace_image_index
|
||||||
!disk_control->cb.get_eject_state)
|
|| !disk_control->cb.get_eject_state)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (string_is_empty(image_path))
|
if (string_is_empty(image_path))
|
||||||
@ -705,10 +702,10 @@ bool disk_control_set_initial_index(
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* Check that 'initial index' functionality is enabled */
|
/* Check that 'initial index' functionality is enabled */
|
||||||
if (!disk_control->cb.set_initial_image ||
|
if ( !disk_control->cb.set_initial_image
|
||||||
!disk_control->cb.get_num_images ||
|
|| !disk_control->cb.get_num_images
|
||||||
!disk_control->cb.get_image_index ||
|
|| !disk_control->cb.get_image_index
|
||||||
!disk_control->cb.get_image_path)
|
|| !disk_control->cb.get_image_path)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* Attempt to initialise disk index record (reading
|
/* Attempt to initialise disk index record (reading
|
||||||
@ -719,10 +716,10 @@ bool disk_control_set_initial_index(
|
|||||||
|
|
||||||
/* If record is enabled and initial index is *not*
|
/* If record is enabled and initial index is *not*
|
||||||
* zero, notify current core */
|
* zero, notify current core */
|
||||||
if (disk_control->record_enabled &&
|
if ( disk_control->record_enabled
|
||||||
(disk_control->index_record.image_index != 0))
|
&& (disk_control->index_record.image_index != 0))
|
||||||
{
|
{
|
||||||
if (!disk_control->cb.set_initial_image(
|
if ( !disk_control->cb.set_initial_image(
|
||||||
disk_control->index_record.image_index,
|
disk_control->index_record.image_index,
|
||||||
disk_control->index_record.image_path))
|
disk_control->index_record.image_path))
|
||||||
{
|
{
|
||||||
@ -773,10 +770,10 @@ bool disk_control_verify_initial_index(
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Check that 'initial index' functionality is enabled */
|
/* Check that 'initial index' functionality is enabled */
|
||||||
if (!disk_control->cb.set_initial_image ||
|
if ( !disk_control->cb.set_initial_image
|
||||||
!disk_control->cb.get_num_images ||
|
|| !disk_control->cb.get_num_images
|
||||||
!disk_control->cb.get_image_index ||
|
|| !disk_control->cb.get_image_index
|
||||||
!disk_control->cb.get_image_path)
|
|| !disk_control->cb.get_image_path)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Cache initial number of images
|
/* Cache initial number of images
|
||||||
@ -798,10 +795,10 @@ bool disk_control_verify_initial_index(
|
|||||||
* read here (since this corresponds to a
|
* read here (since this corresponds to a
|
||||||
* 'first run', where no existing disk index
|
* 'first run', where no existing disk index
|
||||||
* file was present) */
|
* file was present) */
|
||||||
if ((image_index == disk_control->index_record.image_index) &&
|
if ( (image_index == disk_control->index_record.image_index)
|
||||||
(string_is_equal(image_path, disk_control->index_record.image_path) ||
|
&& (string_is_equal(image_path, disk_control->index_record.image_path)
|
||||||
((disk_control->index_record.image_index == 0) &&
|
|| ((disk_control->index_record.image_index == 0)
|
||||||
string_is_empty(disk_control->index_record.image_path))))
|
&& string_is_empty(disk_control->index_record.image_path))))
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,18 +98,6 @@ static bool DCifJSONStringHandler(void* context, const char *pValue, size_t leng
|
|||||||
/* Initialisation */
|
/* Initialisation */
|
||||||
/******************/
|
/******************/
|
||||||
|
|
||||||
/* Resets existing disk index record */
|
|
||||||
static void disk_index_file_reset(disk_index_file_t *disk_index_file)
|
|
||||||
{
|
|
||||||
if (!disk_index_file)
|
|
||||||
return;
|
|
||||||
|
|
||||||
disk_index_file->modified = false;
|
|
||||||
disk_index_file->image_index = 0;
|
|
||||||
disk_index_file->image_path[0] = '\0';
|
|
||||||
disk_index_file->file_path[0] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Parses disk index file referenced by
|
/* Parses disk index file referenced by
|
||||||
* disk_index_file->file_path.
|
* disk_index_file->file_path.
|
||||||
* Does nothing if disk index file does not exist. */
|
* Does nothing if disk index file does not exist. */
|
||||||
@ -127,8 +115,8 @@ static bool disk_index_file_read(disk_index_file_t *disk_index_file)
|
|||||||
|
|
||||||
file_path = disk_index_file->file_path;
|
file_path = disk_index_file->file_path;
|
||||||
|
|
||||||
if ( string_is_empty(file_path) ||
|
if ( string_is_empty(file_path)
|
||||||
!path_is_valid(file_path)
|
|| !path_is_valid(file_path)
|
||||||
)
|
)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -147,8 +135,7 @@ static bool disk_index_file_read(disk_index_file_t *disk_index_file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialise JSON parser */
|
/* Initialise JSON parser */
|
||||||
parser = rjson_open_rfile(file);
|
if (!(parser = rjson_open_rfile(file)))
|
||||||
if (!parser)
|
|
||||||
{
|
{
|
||||||
RARCH_ERR("[disk index file] Failed to create JSON parser.\n");
|
RARCH_ERR("[disk index file] Failed to create JSON parser.\n");
|
||||||
goto end;
|
goto end;
|
||||||
@ -221,7 +208,6 @@ bool disk_index_file_init(
|
|||||||
const char *content_file = NULL;
|
const char *content_file = NULL;
|
||||||
char content_name[256];
|
char content_name[256];
|
||||||
char disk_index_file_dir[PATH_MAX_LENGTH];
|
char disk_index_file_dir[PATH_MAX_LENGTH];
|
||||||
char disk_index_file_path[PATH_MAX_LENGTH];
|
|
||||||
|
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
if (!disk_index_file)
|
if (!disk_index_file)
|
||||||
@ -269,33 +255,32 @@ bool disk_index_file_init(
|
|||||||
|
|
||||||
/* > Generate final path */
|
/* > Generate final path */
|
||||||
len = fill_pathname_join_special(
|
len = fill_pathname_join_special(
|
||||||
disk_index_file_path, disk_index_file_dir,
|
disk_index_file->file_path, disk_index_file_dir,
|
||||||
content_name, sizeof(disk_index_file_path));
|
content_name, sizeof(disk_index_file->file_path));
|
||||||
strlcpy(disk_index_file_path + len,
|
strlcpy(disk_index_file->file_path + len,
|
||||||
".ldci",
|
".ldci",
|
||||||
sizeof(disk_index_file_path) - len);
|
sizeof(disk_index_file->file_path) - len);
|
||||||
if (string_is_empty(disk_index_file_path))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
/* All is well - reset disk_index_file_t and
|
/* All is well - reset disk_index_file_t and
|
||||||
* attempt to load values from file */
|
* attempt to load values from file */
|
||||||
disk_index_file_reset(disk_index_file);
|
disk_index_file->modified = false;
|
||||||
strlcpy(
|
disk_index_file->image_index = 0;
|
||||||
disk_index_file->file_path,
|
disk_index_file->image_path[0] = '\0';
|
||||||
disk_index_file_path,
|
|
||||||
sizeof(disk_index_file->file_path));
|
|
||||||
|
|
||||||
/* > If file does not exist (or some other
|
/* > If file does not exist (or some other
|
||||||
* error occurs) then this is a new record
|
* error occurs) then this is a new record
|
||||||
* - in this case, 'modified' flag should
|
* - in this case, 'modified' flag should
|
||||||
* be set to 'true' */
|
* be set to 'true' */
|
||||||
if (!disk_index_file_read(disk_index_file))
|
if (!disk_index_file_read(disk_index_file))
|
||||||
disk_index_file->modified = true;
|
disk_index_file->modified = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
disk_index_file_reset(disk_index_file);
|
disk_index_file->modified = false;
|
||||||
|
disk_index_file->image_index = 0;
|
||||||
|
disk_index_file->image_path[0] = '\0';
|
||||||
|
disk_index_file->file_path[0] = '\0';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,8 +300,8 @@ void disk_index_file_set(
|
|||||||
/* Check whether image index should be updated */
|
/* Check whether image index should be updated */
|
||||||
if (disk_index_file->image_index != image_index)
|
if (disk_index_file->image_index != image_index)
|
||||||
{
|
{
|
||||||
disk_index_file->image_index = image_index;
|
disk_index_file->image_index = image_index;
|
||||||
disk_index_file->modified = true;
|
disk_index_file->modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check whether image path should be updated */
|
/* Check whether image path should be updated */
|
||||||
@ -327,7 +312,7 @@ void disk_index_file_set(
|
|||||||
strlcpy(
|
strlcpy(
|
||||||
disk_index_file->image_path, image_path,
|
disk_index_file->image_path, image_path,
|
||||||
sizeof(disk_index_file->image_path));
|
sizeof(disk_index_file->image_path));
|
||||||
disk_index_file->modified = true;
|
disk_index_file->modified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!string_is_empty(disk_index_file->image_path))
|
else if (!string_is_empty(disk_index_file->image_path))
|
||||||
@ -361,14 +346,14 @@ bool disk_index_file_save(disk_index_file_t *disk_index_file)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
file_path = disk_index_file->file_path;
|
file_path = disk_index_file->file_path;
|
||||||
|
|
||||||
if (string_is_empty(file_path))
|
if (string_is_empty(file_path))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
RARCH_LOG(
|
RARCH_LOG(
|
||||||
"[disk index file] Saving disk index file: %s\n",
|
"[disk index file] Saving disk index file: %s\n",
|
||||||
file_path);
|
file_path);
|
||||||
|
|
||||||
/* Attempt to open disk index file */
|
/* Attempt to open disk index file */
|
||||||
if (!(file = filestream_open(
|
if (!(file = filestream_open(
|
||||||
file_path,
|
file_path,
|
||||||
|
@ -207,7 +207,7 @@ void manual_content_scan_scrub_system_name_custom(void)
|
|||||||
* and/or violate the No-Intro filename standard:
|
* and/or violate the No-Intro filename standard:
|
||||||
* http://datomatic.no-intro.org/stuff/The%20Official%20No-Intro%20Convention%20(20071030).zip
|
* http://datomatic.no-intro.org/stuff/The%20Official%20No-Intro%20Convention%20(20071030).zip
|
||||||
* Replace these characters with underscores */
|
* Replace these characters with underscores */
|
||||||
while ((scrub_char_pointer =
|
while ((scrub_char_pointer =
|
||||||
strpbrk(scan_settings.system_name_custom, "&*/:`\"<>?\\|")))
|
strpbrk(scan_settings.system_name_custom, "&*/:`\"<>?\\|")))
|
||||||
*scrub_char_pointer = '_';
|
*scrub_char_pointer = '_';
|
||||||
}
|
}
|
||||||
@ -656,8 +656,8 @@ enum manual_content_scan_playlist_refresh_status
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Set core path/name */
|
/* Set core path/name */
|
||||||
if (!string_is_empty(core_name) &&
|
if ( !string_is_empty(core_name)
|
||||||
!string_is_equal(core_name, FILE_PATH_DETECT))
|
&& !string_is_equal(core_name, FILE_PATH_DETECT))
|
||||||
core_type = MANUAL_CONTENT_SCAN_CORE_SET;
|
core_type = MANUAL_CONTENT_SCAN_CORE_SET;
|
||||||
|
|
||||||
if (!manual_content_scan_set_menu_core_name(
|
if (!manual_content_scan_set_menu_core_name(
|
||||||
@ -749,29 +749,28 @@ bool manual_content_scan_get_menu_content_dir(const char **content_dir)
|
|||||||
* actual system name used when generating the playlist */
|
* actual system name used when generating the playlist */
|
||||||
bool manual_content_scan_get_menu_system_name(const char **system_name)
|
bool manual_content_scan_get_menu_system_name(const char **system_name)
|
||||||
{
|
{
|
||||||
if (!system_name)
|
if (system_name)
|
||||||
return false;
|
|
||||||
|
|
||||||
switch (scan_settings.system_name_type)
|
|
||||||
{
|
{
|
||||||
case MANUAL_CONTENT_SCAN_SYSTEM_NAME_CONTENT_DIR:
|
switch (scan_settings.system_name_type)
|
||||||
*system_name = msg_hash_to_str(
|
{
|
||||||
MENU_ENUM_LABEL_VALUE_MANUAL_CONTENT_SCAN_SYSTEM_NAME_USE_CONTENT_DIR);
|
case MANUAL_CONTENT_SCAN_SYSTEM_NAME_CONTENT_DIR:
|
||||||
return true;
|
*system_name = msg_hash_to_str(
|
||||||
case MANUAL_CONTENT_SCAN_SYSTEM_NAME_CUSTOM:
|
MENU_ENUM_LABEL_VALUE_MANUAL_CONTENT_SCAN_SYSTEM_NAME_USE_CONTENT_DIR);
|
||||||
*system_name = msg_hash_to_str(
|
|
||||||
MENU_ENUM_LABEL_VALUE_MANUAL_CONTENT_SCAN_SYSTEM_NAME_USE_CUSTOM);
|
|
||||||
return true;
|
|
||||||
case MANUAL_CONTENT_SCAN_SYSTEM_NAME_DATABASE:
|
|
||||||
if (string_is_empty(scan_settings.system_name_database))
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*system_name = scan_settings.system_name_database;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
case MANUAL_CONTENT_SCAN_SYSTEM_NAME_CUSTOM:
|
||||||
default:
|
*system_name = msg_hash_to_str(
|
||||||
break;
|
MENU_ENUM_LABEL_VALUE_MANUAL_CONTENT_SCAN_SYSTEM_NAME_USE_CUSTOM);
|
||||||
|
return true;
|
||||||
|
case MANUAL_CONTENT_SCAN_SYSTEM_NAME_DATABASE:
|
||||||
|
if (!string_is_empty(scan_settings.system_name_database))
|
||||||
|
{
|
||||||
|
*system_name = scan_settings.system_name_database;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -781,25 +780,24 @@ bool manual_content_scan_get_menu_system_name(const char **system_name)
|
|||||||
* Returns true if core name is valid. */
|
* Returns true if core name is valid. */
|
||||||
bool manual_content_scan_get_menu_core_name(const char **core_name)
|
bool manual_content_scan_get_menu_core_name(const char **core_name)
|
||||||
{
|
{
|
||||||
if (!core_name)
|
if (core_name)
|
||||||
return false;
|
|
||||||
|
|
||||||
switch (scan_settings.core_type)
|
|
||||||
{
|
{
|
||||||
case MANUAL_CONTENT_SCAN_CORE_DETECT:
|
switch (scan_settings.core_type)
|
||||||
*core_name = msg_hash_to_str(
|
{
|
||||||
MENU_ENUM_LABEL_VALUE_MANUAL_CONTENT_SCAN_CORE_NAME_DETECT);
|
case MANUAL_CONTENT_SCAN_CORE_DETECT:
|
||||||
return true;
|
*core_name = msg_hash_to_str(
|
||||||
case MANUAL_CONTENT_SCAN_CORE_SET:
|
MENU_ENUM_LABEL_VALUE_MANUAL_CONTENT_SCAN_CORE_NAME_DETECT);
|
||||||
if (string_is_empty(scan_settings.core_name))
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*core_name = scan_settings.core_name;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
case MANUAL_CONTENT_SCAN_CORE_SET:
|
||||||
default:
|
if (!string_is_empty(scan_settings.core_name))
|
||||||
break;
|
{
|
||||||
|
*core_name = scan_settings.core_name;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -925,8 +923,8 @@ struct string_list *manual_content_scan_get_menu_core_name_list(void)
|
|||||||
|
|
||||||
if (core_info_list)
|
if (core_info_list)
|
||||||
{
|
{
|
||||||
core_info_t *core_info = NULL;
|
|
||||||
size_t i;
|
size_t i;
|
||||||
|
core_info_t *core_info = NULL;
|
||||||
|
|
||||||
/* Sort cores alphabetically */
|
/* Sort cores alphabetically */
|
||||||
core_info_qsort(core_info_list, CORE_INFO_LIST_SORT_DISPLAY_NAME);
|
core_info_qsort(core_info_list, CORE_INFO_LIST_SORT_DISPLAY_NAME);
|
||||||
@ -934,10 +932,7 @@ struct string_list *manual_content_scan_get_menu_core_name_list(void)
|
|||||||
/* Loop through cores */
|
/* Loop through cores */
|
||||||
for (i = 0; i < core_info_list->count; i++)
|
for (i = 0; i < core_info_list->count; i++)
|
||||||
{
|
{
|
||||||
core_info = NULL;
|
if ((core_info = core_info_get(core_info_list, i)))
|
||||||
core_info = core_info_get(core_info_list, i);
|
|
||||||
|
|
||||||
if (core_info)
|
|
||||||
{
|
{
|
||||||
if (string_is_empty(core_info->display_name))
|
if (string_is_empty(core_info->display_name))
|
||||||
continue;
|
continue;
|
||||||
@ -1003,32 +998,26 @@ bool manual_content_scan_get_task_config(
|
|||||||
case MANUAL_CONTENT_SCAN_SYSTEM_NAME_CONTENT_DIR:
|
case MANUAL_CONTENT_SCAN_SYSTEM_NAME_CONTENT_DIR:
|
||||||
if (string_is_empty(scan_settings.system_name_content_dir))
|
if (string_is_empty(scan_settings.system_name_content_dir))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
strlcpy(
|
strlcpy(
|
||||||
task_config->system_name,
|
task_config->system_name,
|
||||||
scan_settings.system_name_content_dir,
|
scan_settings.system_name_content_dir,
|
||||||
sizeof(task_config->system_name));
|
sizeof(task_config->system_name));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case MANUAL_CONTENT_SCAN_SYSTEM_NAME_CUSTOM:
|
case MANUAL_CONTENT_SCAN_SYSTEM_NAME_CUSTOM:
|
||||||
if (string_is_empty(scan_settings.system_name_custom))
|
if (string_is_empty(scan_settings.system_name_custom))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
strlcpy(
|
strlcpy(
|
||||||
task_config->system_name,
|
task_config->system_name,
|
||||||
scan_settings.system_name_custom,
|
scan_settings.system_name_custom,
|
||||||
sizeof(task_config->system_name));
|
sizeof(task_config->system_name));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case MANUAL_CONTENT_SCAN_SYSTEM_NAME_DATABASE:
|
case MANUAL_CONTENT_SCAN_SYSTEM_NAME_DATABASE:
|
||||||
if (string_is_empty(scan_settings.system_name_database))
|
if (string_is_empty(scan_settings.system_name_database))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
strlcpy(
|
strlcpy(
|
||||||
task_config->system_name,
|
task_config->system_name,
|
||||||
scan_settings.system_name_database,
|
scan_settings.system_name_database,
|
||||||
sizeof(task_config->system_name));
|
sizeof(task_config->system_name));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -1143,9 +1132,9 @@ bool manual_content_scan_get_task_config(
|
|||||||
struct string_list *manual_content_scan_get_content_list(
|
struct string_list *manual_content_scan_get_content_list(
|
||||||
manual_content_scan_task_config_t *task_config)
|
manual_content_scan_task_config_t *task_config)
|
||||||
{
|
{
|
||||||
struct string_list *dir_list = NULL;
|
|
||||||
bool filter_exts;
|
bool filter_exts;
|
||||||
bool include_compressed;
|
bool include_compressed;
|
||||||
|
struct string_list *dir_list = NULL;
|
||||||
|
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
if (!task_config)
|
if (!task_config)
|
||||||
@ -1226,8 +1215,8 @@ static bool manual_content_scan_get_playlist_content_path(
|
|||||||
|
|
||||||
/* Check whether this is an archive file
|
/* Check whether this is an archive file
|
||||||
* requiring special attention... */
|
* requiring special attention... */
|
||||||
if ((content_type == RARCH_COMPRESSED_ARCHIVE) &&
|
if ( (content_type == RARCH_COMPRESSED_ARCHIVE)
|
||||||
task_config->search_archives)
|
&& task_config->search_archives)
|
||||||
{
|
{
|
||||||
bool filter_exts = !string_is_empty(task_config->file_exts);
|
bool filter_exts = !string_is_empty(task_config->file_exts);
|
||||||
const char *archive_file = NULL;
|
const char *archive_file = NULL;
|
||||||
@ -1305,7 +1294,7 @@ static bool manual_content_scan_get_playlist_content_label(
|
|||||||
|
|
||||||
/* In most cases, content label is just the
|
/* In most cases, content label is just the
|
||||||
* filename without extension */
|
* filename without extension */
|
||||||
fill_pathname(content_label, path_basename(content_path),
|
fill_pathname(content_label, path_basename(content_path),
|
||||||
"", len);
|
"", len);
|
||||||
|
|
||||||
if (string_is_empty(content_label))
|
if (string_is_empty(content_label))
|
||||||
|
@ -1984,7 +1984,7 @@ static void ram_state_to_file(void)
|
|||||||
|
|
||||||
enum rarch_content_type path_is_media_type(const char *path)
|
enum rarch_content_type path_is_media_type(const char *path)
|
||||||
{
|
{
|
||||||
char ext_lower[128];
|
char ext_lower[16];
|
||||||
strlcpy(ext_lower, path_get_extension(path), sizeof(ext_lower));
|
strlcpy(ext_lower, path_get_extension(path), sizeof(ext_lower));
|
||||||
|
|
||||||
string_to_lower(ext_lower);
|
string_to_lower(ext_lower);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user