mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 04:20:28 +00:00
Create CORE_INFO_CTL_LIST_UPDATE_MISSING_FIRMWARE
This commit is contained in:
parent
452df47c14
commit
b647e8186d
18
core_info.c
18
core_info.c
@ -577,7 +577,7 @@ core_info_t *core_info_get(core_info_list_t *list, size_t i)
|
||||
}
|
||||
|
||||
|
||||
void core_info_list_update_missing_firmware(
|
||||
static bool core_info_list_update_missing_firmware(
|
||||
core_info_list_t *core_info_list,
|
||||
const char *core, const char *systemdir)
|
||||
{
|
||||
@ -586,10 +586,10 @@ void core_info_list_update_missing_firmware(
|
||||
core_info_t *info = NULL;
|
||||
|
||||
if (!core_info_list || !core)
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (!(info = core_info_find(core_info_list, core)))
|
||||
return;
|
||||
return false;
|
||||
|
||||
for (i = 0; i < info->firmware_count; i++)
|
||||
{
|
||||
@ -600,6 +600,8 @@ void core_info_list_update_missing_firmware(
|
||||
info->firmware[i].path, sizeof(path));
|
||||
info->firmware[i].missing = !path_file_exists(path);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -690,6 +692,16 @@ bool core_info_ctl(enum core_info_state state, void *data)
|
||||
*core = core_info_curr_list;
|
||||
}
|
||||
break;
|
||||
case CORE_INFO_CTL_LIST_UPDATE_MISSING_FIRMWARE:
|
||||
{
|
||||
core_info_ctx_firmware_t *info = (core_info_ctx_firmware_t*)data;
|
||||
if (!info)
|
||||
return false;
|
||||
|
||||
return core_info_list_update_missing_firmware(core_info_curr_list,
|
||||
info->path, info->system_directory);
|
||||
}
|
||||
break;
|
||||
case CORE_INFO_CTL_FIND:
|
||||
{
|
||||
core_info_ctx_find_t *info = (core_info_ctx_find_t*)data;
|
||||
|
10
core_info.h
10
core_info.h
@ -30,6 +30,7 @@ enum core_info_state
|
||||
CORE_INFO_CTL_LIST_DEINIT,
|
||||
CORE_INFO_CTL_LIST_INIT,
|
||||
CORE_INFO_CTL_LIST_GET,
|
||||
CORE_INFO_CTL_LIST_UPDATE_MISSING_FIRMWARE,
|
||||
CORE_INFO_CTL_CURRENT_CORE_FREE,
|
||||
CORE_INFO_CTL_CURRENT_CORE_INIT,
|
||||
CORE_INFO_CTL_CURRENT_CORE_GET,
|
||||
@ -82,6 +83,12 @@ typedef struct
|
||||
char *all_ext;
|
||||
} core_info_list_t;
|
||||
|
||||
typedef struct core_info_ctx_firmware
|
||||
{
|
||||
const char *path;
|
||||
const char *system_directory;
|
||||
} core_info_ctx_firmware_t;
|
||||
|
||||
typedef struct core_info_ctx_find
|
||||
{
|
||||
core_info_t *inf;
|
||||
@ -92,9 +99,6 @@ typedef struct core_info_ctx_find
|
||||
void core_info_list_get_supported_cores(core_info_list_t *list,
|
||||
const char *path, const core_info_t **infos, size_t *num_infos);
|
||||
|
||||
void core_info_list_update_missing_firmware(core_info_list_t *list,
|
||||
const char *core, const char *systemdir);
|
||||
|
||||
/* Shallow-copies internal state. Data in *info is invalidated when the
|
||||
* core_info_list is freed. */
|
||||
bool core_info_list_get_info(core_info_list_t *list,
|
||||
|
@ -269,44 +269,45 @@ static int menu_displaylist_parse_core_info(menu_displaylist_info_t *info)
|
||||
|
||||
if (core_info->firmware_count > 0)
|
||||
{
|
||||
core_info_list_t *list = NULL;
|
||||
core_info_ctx_firmware_t firmware_info;
|
||||
|
||||
core_info_ctl(CORE_INFO_CTL_LIST_GET, &list);
|
||||
firmware_info.path = core_info->path;
|
||||
firmware_info.system_directory = settings->system_directory;
|
||||
|
||||
core_info_list_update_missing_firmware(list, core_info->path,
|
||||
settings->system_directory);
|
||||
|
||||
strlcpy(tmp, menu_hash_to_str(MENU_LABEL_VALUE_CORE_INFO_FIRMWARE),
|
||||
sizeof(tmp));
|
||||
strlcat(tmp, ": ", sizeof(tmp));
|
||||
menu_entries_push(info->list, tmp, "",
|
||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
|
||||
/* FIXME: This looks hacky and probably
|
||||
* needs to be improved for good translation support. */
|
||||
|
||||
for (i = 0; i < core_info->firmware_count; i++)
|
||||
if (core_info_ctl(CORE_INFO_CTL_LIST_UPDATE_MISSING_FIRMWARE, &firmware_info))
|
||||
{
|
||||
if (core_info->firmware[i].desc)
|
||||
{
|
||||
snprintf(tmp, sizeof(tmp), " %s: %s",
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_RDB_ENTRY_NAME),
|
||||
core_info->firmware[i].desc ?
|
||||
core_info->firmware[i].desc : "");
|
||||
menu_entries_push(info->list, tmp, "",
|
||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
strlcpy(tmp, menu_hash_to_str(MENU_LABEL_VALUE_CORE_INFO_FIRMWARE),
|
||||
sizeof(tmp));
|
||||
strlcat(tmp, ": ", sizeof(tmp));
|
||||
menu_entries_push(info->list, tmp, "",
|
||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
|
||||
snprintf(tmp, sizeof(tmp), " %s: %s, %s",
|
||||
menu_hash_to_str(MENU_VALUE_STATUS),
|
||||
core_info->firmware[i].missing ?
|
||||
menu_hash_to_str(MENU_VALUE_MISSING) :
|
||||
menu_hash_to_str(MENU_VALUE_PRESENT),
|
||||
core_info->firmware[i].optional ?
|
||||
menu_hash_to_str(MENU_VALUE_OPTIONAL) :
|
||||
menu_hash_to_str(MENU_VALUE_REQUIRED)
|
||||
);
|
||||
menu_entries_push(info->list, tmp, "",
|
||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
/* FIXME: This looks hacky and probably
|
||||
* needs to be improved for good translation support. */
|
||||
|
||||
for (i = 0; i < core_info->firmware_count; i++)
|
||||
{
|
||||
if (core_info->firmware[i].desc)
|
||||
{
|
||||
snprintf(tmp, sizeof(tmp), " %s: %s",
|
||||
menu_hash_to_str(MENU_LABEL_VALUE_RDB_ENTRY_NAME),
|
||||
core_info->firmware[i].desc ?
|
||||
core_info->firmware[i].desc : "");
|
||||
menu_entries_push(info->list, tmp, "",
|
||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
|
||||
snprintf(tmp, sizeof(tmp), " %s: %s, %s",
|
||||
menu_hash_to_str(MENU_VALUE_STATUS),
|
||||
core_info->firmware[i].missing ?
|
||||
menu_hash_to_str(MENU_VALUE_MISSING) :
|
||||
menu_hash_to_str(MENU_VALUE_PRESENT),
|
||||
core_info->firmware[i].optional ?
|
||||
menu_hash_to_str(MENU_VALUE_OPTIONAL) :
|
||||
menu_hash_to_str(MENU_VALUE_REQUIRED)
|
||||
);
|
||||
menu_entries_push(info->list, tmp, "",
|
||||
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user