Make device.c assume CONFIG_BIOS is first in the config struct and make sure any device_t struct containing such follows that, in order to not have to traverse the entirety of every single device_t's config struct in the Settings dialog - should reduce the dialog's loading times further.
This commit is contained in:
37
src/device.c
37
src/device.c
@@ -392,29 +392,24 @@ device_available(const device_t *dev)
|
|||||||
{
|
{
|
||||||
if (dev != NULL) {
|
if (dev != NULL) {
|
||||||
const device_config_t *config = dev->config;
|
const device_config_t *config = dev->config;
|
||||||
if (config != NULL) {
|
if ((config != NULL) && (config->type == CONFIG_BIOS)) {
|
||||||
while (config->type != CONFIG_END) {
|
int roms_present = 0;
|
||||||
if (config->type == CONFIG_BIOS) {
|
const device_config_bios_t *bios = (const device_config_bios_t *) config->bios;
|
||||||
int roms_present = 0;
|
|
||||||
const device_config_bios_t *bios = (const device_config_bios_t *) config->bios;
|
|
||||||
|
|
||||||
/* Go through the ROM's in the device configuration. */
|
/* Go through the ROM's in the device configuration. */
|
||||||
while ((bios != NULL) &&
|
while ((bios != NULL) &&
|
||||||
(bios->name != NULL) &&
|
(bios->name != NULL) &&
|
||||||
(bios->internal_name != NULL) &&
|
(bios->internal_name != NULL) &&
|
||||||
(bios->files_no != 0)) {
|
(bios->files_no != 0)) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (uint8_t bf = 0; bf < bios->files_no; bf++)
|
for (uint8_t bf = 0; bf < bios->files_no; bf++)
|
||||||
i += !!rom_present(bios->files[bf]);
|
i += !!rom_present(bios->files[bf]);
|
||||||
if (i == bios->files_no)
|
if (i == bios->files_no)
|
||||||
roms_present++;
|
roms_present++;
|
||||||
bios++;
|
bios++;
|
||||||
}
|
|
||||||
|
|
||||||
return (roms_present ? -1 : 0);
|
|
||||||
}
|
|
||||||
config++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (roms_present ? -1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No CONFIG_BIOS field present, use the classic available(). */
|
/* No CONFIG_BIOS field present, use the classic available(). */
|
||||||
|
|||||||
@@ -1106,6 +1106,36 @@ xta_close(void *priv)
|
|||||||
|
|
||||||
static const device_config_t wdxt150_config[] = {
|
static const device_config_t wdxt150_config[] = {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
{
|
||||||
|
.name = "bios_rev",
|
||||||
|
.description = "BIOS Revision",
|
||||||
|
.type = CONFIG_BIOS,
|
||||||
|
.default_string = "rev_1",
|
||||||
|
.default_int = 0,
|
||||||
|
.file_filter = NULL,
|
||||||
|
.spinner = { 0 },
|
||||||
|
.bios = {
|
||||||
|
{
|
||||||
|
.name = "Revision 1.0",
|
||||||
|
.internal_name = "rev_1",
|
||||||
|
.bios_type = BIOS_NORMAL,
|
||||||
|
.files_no = 1,
|
||||||
|
.local = 0,
|
||||||
|
.size = 8192,
|
||||||
|
.files = { WD_REV_1_BIOS_FILE, "" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "Revision 2.0",
|
||||||
|
.internal_name = "rev_2",
|
||||||
|
.bios_type = BIOS_NORMAL,
|
||||||
|
.files_no = 1,
|
||||||
|
.local = 0,
|
||||||
|
.size = 8192,
|
||||||
|
.files = { WD_REV_2_BIOS_FILE, "" }
|
||||||
|
},
|
||||||
|
{ .files_no = 0 }
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.name = "base",
|
.name = "base",
|
||||||
.description = "Address",
|
.description = "Address",
|
||||||
@@ -1151,36 +1181,6 @@ static const device_config_t wdxt150_config[] = {
|
|||||||
},
|
},
|
||||||
.bios = { { 0 } }
|
.bios = { { 0 } }
|
||||||
},
|
},
|
||||||
{
|
|
||||||
.name = "bios_rev",
|
|
||||||
.description = "BIOS Revision",
|
|
||||||
.type = CONFIG_BIOS,
|
|
||||||
.default_string = "rev_1",
|
|
||||||
.default_int = 0,
|
|
||||||
.file_filter = NULL,
|
|
||||||
.spinner = { 0 },
|
|
||||||
.bios = {
|
|
||||||
{
|
|
||||||
.name = "Revision 1.0",
|
|
||||||
.internal_name = "rev_1",
|
|
||||||
.bios_type = BIOS_NORMAL,
|
|
||||||
.files_no = 1,
|
|
||||||
.local = 0,
|
|
||||||
.size = 8192,
|
|
||||||
.files = { WD_REV_1_BIOS_FILE, "" }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "Revision 2.0",
|
|
||||||
.internal_name = "rev_2",
|
|
||||||
.bios_type = BIOS_NORMAL,
|
|
||||||
.files_no = 1,
|
|
||||||
.local = 0,
|
|
||||||
.size = 8192,
|
|
||||||
.files = { WD_REV_2_BIOS_FILE, "" }
|
|
||||||
},
|
|
||||||
{ .files_no = 0 }
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ .name = "", .description = "", .type = CONFIG_END }
|
{ .name = "", .description = "", .type = CONFIG_END }
|
||||||
// clang-format off
|
// clang-format off
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -252,6 +252,37 @@ xtide_at_close(void *priv)
|
|||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static const device_config_t xtide_config[] = {
|
static const device_config_t xtide_config[] = {
|
||||||
|
{
|
||||||
|
.name = "bios",
|
||||||
|
.description = "BIOS Revision",
|
||||||
|
.type = CONFIG_BIOS,
|
||||||
|
.default_string = "xt",
|
||||||
|
.default_int = 0,
|
||||||
|
.file_filter = NULL,
|
||||||
|
.spinner = { 0 },
|
||||||
|
.selection = { { 0 } },
|
||||||
|
.bios = {
|
||||||
|
{
|
||||||
|
.name = "Regular XT",
|
||||||
|
.internal_name = "xt",
|
||||||
|
.bios_type = BIOS_NORMAL,
|
||||||
|
.files_no = 1,
|
||||||
|
.local = 0,
|
||||||
|
.size = 8192,
|
||||||
|
.files = { ROM_PATH_XT, "" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "XT+ (V20/V30/8018x)",
|
||||||
|
.internal_name = "xt_plus",
|
||||||
|
.bios_type = BIOS_NORMAL,
|
||||||
|
.files_no = 1,
|
||||||
|
.local = 0,
|
||||||
|
.size = 8192,
|
||||||
|
.files = { ROM_PATH_XTP, "" }
|
||||||
|
},
|
||||||
|
{ .files_no = 0 }
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.name = "base",
|
.name = "base",
|
||||||
.description = "Address",
|
.description = "Address",
|
||||||
@@ -348,37 +379,6 @@ static const device_config_t xtide_config[] = {
|
|||||||
},
|
},
|
||||||
.bios = { { 0 } }
|
.bios = { { 0 } }
|
||||||
},
|
},
|
||||||
{
|
|
||||||
.name = "bios",
|
|
||||||
.description = "BIOS Revision",
|
|
||||||
.type = CONFIG_BIOS,
|
|
||||||
.default_string = "xt",
|
|
||||||
.default_int = 0,
|
|
||||||
.file_filter = NULL,
|
|
||||||
.spinner = { 0 },
|
|
||||||
.selection = { { 0 } },
|
|
||||||
.bios = {
|
|
||||||
{
|
|
||||||
.name = "Regular XT",
|
|
||||||
.internal_name = "xt",
|
|
||||||
.bios_type = BIOS_NORMAL,
|
|
||||||
.files_no = 1,
|
|
||||||
.local = 0,
|
|
||||||
.size = 8192,
|
|
||||||
.files = { ROM_PATH_XT, "" }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "XT+ (V20/V30/8018x)",
|
|
||||||
.internal_name = "xt_plus",
|
|
||||||
.bios_type = BIOS_NORMAL,
|
|
||||||
.files_no = 1,
|
|
||||||
.local = 0,
|
|
||||||
.size = 8192,
|
|
||||||
.files = { ROM_PATH_XTP, "" }
|
|
||||||
},
|
|
||||||
{ .files_no = 0 }
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ .name = "", .description = "", .type = CONFIG_END }
|
{ .name = "", .description = "", .type = CONFIG_END }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -859,6 +859,37 @@ static const device_config_t ncr53c400_mmio_config[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const device_config_t rt1000b_config[] = {
|
static const device_config_t rt1000b_config[] = {
|
||||||
|
{
|
||||||
|
.name = "bios_ver",
|
||||||
|
.description = "BIOS Revision",
|
||||||
|
.type = CONFIG_BIOS,
|
||||||
|
.default_string = "v8_10r",
|
||||||
|
.default_int = 0,
|
||||||
|
.file_filter = NULL,
|
||||||
|
.spinner = { 0 },
|
||||||
|
.selection = { { 0 } },
|
||||||
|
.bios = {
|
||||||
|
{
|
||||||
|
.name = "Version 8.10R",
|
||||||
|
.internal_name = "v8_10r",
|
||||||
|
.bios_type = BIOS_NORMAL,
|
||||||
|
.files_no = 1,
|
||||||
|
.local = 0,
|
||||||
|
.size = 8192,
|
||||||
|
.files = { RT1000B_810R_ROM, "" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "Version 8.20R",
|
||||||
|
.internal_name = "v8_20r",
|
||||||
|
.bios_type = BIOS_NORMAL,
|
||||||
|
.files_no = 1,
|
||||||
|
.local = 0,
|
||||||
|
.size = 8192,
|
||||||
|
.files = { RT1000B_820R_ROM, "" }
|
||||||
|
},
|
||||||
|
{ .files_no = 0 }
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.name = "bios_addr",
|
.name = "bios_addr",
|
||||||
.description = "BIOS Address",
|
.description = "BIOS Address",
|
||||||
@@ -895,37 +926,6 @@ static const device_config_t rt1000b_config[] = {
|
|||||||
},
|
},
|
||||||
.bios = { { 0 } }
|
.bios = { { 0 } }
|
||||||
},
|
},
|
||||||
{
|
|
||||||
.name = "bios_ver",
|
|
||||||
.description = "BIOS Revision",
|
|
||||||
.type = CONFIG_BIOS,
|
|
||||||
.default_string = "v8_10r",
|
|
||||||
.default_int = 0,
|
|
||||||
.file_filter = NULL,
|
|
||||||
.spinner = { 0 },
|
|
||||||
.selection = { { 0 } },
|
|
||||||
.bios = {
|
|
||||||
{
|
|
||||||
.name = "Version 8.10R",
|
|
||||||
.internal_name = "v8_10r",
|
|
||||||
.bios_type = BIOS_NORMAL,
|
|
||||||
.files_no = 1,
|
|
||||||
.local = 0,
|
|
||||||
.size = 8192,
|
|
||||||
.files = { RT1000B_810R_ROM, "" }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.name = "Version 8.20R",
|
|
||||||
.internal_name = "v8_20r",
|
|
||||||
.bios_type = BIOS_NORMAL,
|
|
||||||
.files_no = 1,
|
|
||||||
.local = 0,
|
|
||||||
.size = 8192,
|
|
||||||
.files = { RT1000B_820R_ROM, "" }
|
|
||||||
},
|
|
||||||
{ .files_no = 0 }
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ .name = "", .description = "", .type = CONFIG_END }
|
{ .name = "", .description = "", .type = CONFIG_END }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -942,22 +942,6 @@ et4000_kasan_available(void)
|
|||||||
|
|
||||||
static const device_config_t et4000_tc6058af_config[] = {
|
static const device_config_t et4000_tc6058af_config[] = {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
{
|
|
||||||
.name = "memory",
|
|
||||||
.description = "Memory size",
|
|
||||||
.type = CONFIG_SELECTION,
|
|
||||||
.default_string = NULL,
|
|
||||||
.default_int = 512,
|
|
||||||
.file_filter = NULL,
|
|
||||||
.spinner = { 0 },
|
|
||||||
.selection = {
|
|
||||||
{ .description = "256 KB", .value = 256 },
|
|
||||||
{ .description = "512 KB", .value = 512 },
|
|
||||||
{ .description = "1 MB", .value = 1024 },
|
|
||||||
{ .description = "" }
|
|
||||||
},
|
|
||||||
.bios = { { 0 } }
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
.name = "bios_ver",
|
.name = "bios_ver",
|
||||||
.description = "BIOS Revision",
|
.description = "BIOS Revision",
|
||||||
@@ -989,18 +973,12 @@ static const device_config_t et4000_tc6058af_config[] = {
|
|||||||
{ .files_no = 0 }
|
{ .files_no = 0 }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ .name = "", .description = "", .type = CONFIG_END }
|
|
||||||
// clang-format on
|
|
||||||
};
|
|
||||||
|
|
||||||
static const device_config_t et4000_bios_config[] = {
|
|
||||||
// clang-format off
|
|
||||||
{
|
{
|
||||||
.name = "memory",
|
.name = "memory",
|
||||||
.description = "Memory size",
|
.description = "Memory size",
|
||||||
.type = CONFIG_SELECTION,
|
.type = CONFIG_SELECTION,
|
||||||
.default_string = NULL,
|
.default_string = NULL,
|
||||||
.default_int = 1024,
|
.default_int = 512,
|
||||||
.file_filter = NULL,
|
.file_filter = NULL,
|
||||||
.spinner = { 0 },
|
.spinner = { 0 },
|
||||||
.selection = {
|
.selection = {
|
||||||
@@ -1011,6 +989,12 @@ static const device_config_t et4000_bios_config[] = {
|
|||||||
},
|
},
|
||||||
.bios = { { 0 } }
|
.bios = { { 0 } }
|
||||||
},
|
},
|
||||||
|
{ .name = "", .description = "", .type = CONFIG_END }
|
||||||
|
// clang-format on
|
||||||
|
};
|
||||||
|
|
||||||
|
static const device_config_t et4000_bios_config[] = {
|
||||||
|
// clang-format off
|
||||||
{
|
{
|
||||||
.name = "bios_ver",
|
.name = "bios_ver",
|
||||||
.description = "BIOS Revision",
|
.description = "BIOS Revision",
|
||||||
@@ -1042,6 +1026,22 @@ static const device_config_t et4000_bios_config[] = {
|
|||||||
{ .files_no = 0 }
|
{ .files_no = 0 }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.name = "memory",
|
||||||
|
.description = "Memory size",
|
||||||
|
.type = CONFIG_SELECTION,
|
||||||
|
.default_string = NULL,
|
||||||
|
.default_int = 1024,
|
||||||
|
.file_filter = NULL,
|
||||||
|
.spinner = { 0 },
|
||||||
|
.selection = {
|
||||||
|
{ .description = "256 KB", .value = 256 },
|
||||||
|
{ .description = "512 KB", .value = 512 },
|
||||||
|
{ .description = "1 MB", .value = 1024 },
|
||||||
|
{ .description = "" }
|
||||||
|
},
|
||||||
|
.bios = { { 0 } }
|
||||||
|
},
|
||||||
{ .name = "", .description = "", .type = CONFIG_END }
|
{ .name = "", .description = "", .type = CONFIG_END }
|
||||||
// clang-format on
|
// clang-format on
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user