Improvements to firmware checks when "System Files are in Content Directory" is enabled (#16170)

This commit is contained in:
Bobby Smith 2024-01-28 18:57:34 +01:00 committed by GitHub
parent 00d01c844e
commit 3572461d31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 62 additions and 4 deletions

View File

@ -527,6 +527,14 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_CORE_INFO_FIRMWARE,
"Firmware"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CORE_INFO_FIRMWARE_IN_CONTENT_DIRECTORY,
"- Note: 'System Files are in Content Directory' is currently enabled."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_CORE_INFO_FIRMWARE_PATH,
"- Looking in: '%s'"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_MISSING_REQUIRED,
"Missing, Required:"

View File

@ -709,11 +709,33 @@ static int menu_displaylist_parse_core_info(
if (core_info->firmware_count > 0)
{
core_info_ctx_firmware_t firmware_info;
bool update_missing_firmware = false;
bool set_missing_firmware = false;
uint8_t flags = content_get_flags();
bool update_missing_firmware = false;
bool set_missing_firmware = false;
bool systemfiles_in_content_dir = settings->bools.systemfiles_in_content_dir;
bool content_is_inited = flags & CONTENT_ST_FLAG_IS_INITED;
char tmp_path[PATH_MAX_LENGTH];
firmware_info.path = core_info->path;
firmware_info.directory.system = settings->paths.directory_system;
/* If 'System Files are in Content Directory' is enabled and content is inited,
* adjust the path to check for firmware files */
if (systemfiles_in_content_dir && content_is_inited)
{
size_t len;
strlcpy(tmp_path, path_get(RARCH_PATH_CONTENT), sizeof(tmp_path));
path_basedir(tmp_path);
/* Removes trailing slash, doesn't really matter but it's more consistent with how
* the path is stored and displayed without 'System Files are in Content Directory' */
len = strlen(tmp_path);
if (tmp_path[len - 1] == PATH_DEFAULT_SLASH_C())
tmp_path[len - 1] = '\0';
firmware_info.directory.system = tmp_path;
}
else
firmware_info.directory.system = settings->paths.directory_system;
update_missing_firmware = core_info_list_update_missing_firmware(&firmware_info, &set_missing_firmware);
@ -740,6 +762,25 @@ static int menu_displaylist_parse_core_info(
MENU_ENUM_LABEL_CORE_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0, NULL))
count++;
/* If 'System Files are in Content Directory' is enabled, let's add a note about it. */
if (systemfiles_in_content_dir)
{
len = strlcpy(tmp,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_FIRMWARE_IN_CONTENT_DIRECTORY),
sizeof(tmp));
if (menu_entries_append(list, tmp, "",
MENU_ENUM_LABEL_CORE_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0, NULL))
count++;
}
/* Show the path that was checked */
len = snprintf(tmp, sizeof(tmp),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_FIRMWARE_PATH),
firmware_info.directory.system);
if (menu_entries_append(list, tmp, "",
MENU_ENUM_LABEL_CORE_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE, 0, 0, NULL))
count++;
len = strlcpy(tmp, "(!) ", sizeof(tmp));
/* FIXME: This looks hacky and probably

View File

@ -3366,6 +3366,8 @@ enum msg_hash_enums
MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES,
MENU_ENUM_LABEL_VALUE_CORE_INFO_SUPPORTED_EXTENSIONS,
MENU_ENUM_LABEL_VALUE_CORE_INFO_FIRMWARE,
MENU_ENUM_LABEL_VALUE_CORE_INFO_FIRMWARE_IN_CONTENT_DIRECTORY,
MENU_ENUM_LABEL_VALUE_CORE_INFO_FIRMWARE_PATH,
MENU_ENUM_LABEL_VALUE_CORE_INFO_REQUIRED_HW_API,
MENU_ENUM_LABEL_VALUE_CORE_INFO_SAVESTATE_SUPPORT_LEVEL,

View File

@ -1971,6 +1971,7 @@ bool runloop_environment_cb(unsigned cmd, void *data)
if (!string_is_empty(fullpath))
{
size_t len;
char tmp_path[PATH_MAX_LENGTH];
if (string_is_empty(dir_system))
@ -1979,12 +1980,18 @@ bool runloop_environment_cb(unsigned cmd, void *data)
strlcpy(tmp_path, fullpath, sizeof(tmp_path));
path_basedir(tmp_path);
/* Removes trailing slash */
len = strlen(tmp_path);
if (tmp_path[len - 1] == PATH_DEFAULT_SLASH_C())
tmp_path[len - 1] = '\0';
dir_set(RARCH_DIR_SYSTEM, tmp_path);
}
*(const char**)data = dir_get_ptr(RARCH_DIR_SYSTEM);
RARCH_LOG("[Environ]: SYSTEM_DIRECTORY: \"%s\".\n",
dir_system);
*(const char**)data);
}
else
{