diff --git a/src/config.c b/src/config.c index af3f39cb8..a4c3be03a 100644 --- a/src/config.c +++ b/src/config.c @@ -278,44 +278,73 @@ static void load_machine(void) { ini_section_t cat = ini_find_section(config, "Machine"); + ini_section_t migration_cat; const char *p; const char *migrate_from = NULL; + const char *migrate_bios = NULL; int c; int i; int j; int speed; double multi; + static const struct { + const char *old; + const char *new; + const char *new_bios; + } machine_migrations[] = { + { .old = "tandy", .new = "tandy1000sx", .new_bios = NULL }, + { .old = "mr1217", .new = "325ax", .new_bios = "mr1217" }, + { .old = "deskpro386_05_1988", .new = "deskpro386", .new_bios = "deskpro386_05_1988" }, + { .old = "mr495", .new = "ami495", .new_bios = "mr495" }, + { .old = "403tg_d", .new = "403tg", .new_bios = "403tg_d" }, + { .old = "403tg_d_mr", .new = "403tg", .new_bios = "403tg_d_mr" }, + { .old = "aptiva510", .new = "pc330_6573", .new_bios = "aptiva510" }, + { .old = "ambradp60", .new = "batman", .new_bios = "ambradp60" }, + { .old = "dellxp60", .new = "batman", .new_bios = "dellxp60" }, + { .old = "586mc1", .new = "586is", .new_bios = NULL }, + { .old = "ambradp90", .new = "plato", .new_bios = "ambradp90" }, + { .old = "dellplato", .new = "plato", .new_bios = "dellplato" }, + { .old = "430nx", .new = "586ip", .new_bios = NULL }, + { .old = "p54tp4xe_mr", .new = "p54tp4xe", .new_bios = "p54tp4xe_mr" }, + { .old = "gw2katx", .new = "thor", .new_bios = "gw2katx" }, + { .old = "mrthor", .new = "thor", .new_bios = "mrthor" }, + { .old = "equium5200", .new = "cu430hx", .new_bios = "equium5200" }, + { .old = "infinia7200", .new = "tc430hx", .new_bios = "infinia7200" }, + { .old = "dellvenus", .new = "vs440fx", .new_bios = "dellvenus" }, + { .old = "gw2kvenus", .new = "vs440fx", .new_bios = "gw2kvenus" }, + { 0 } + }; + p = ini_section_get_string(cat, "machine", NULL); if (p != NULL) { - migrate_from = p; /* Migrate renamed machines. */ - if (!strcmp(p, "tandy")) - machine = machine_get_machine_from_internal_name("tandy1000sx"); - else if (!strcmp(p, "430nx")) - machine = machine_get_machine_from_internal_name("586ip"); - else if (!strcmp(p, "586mc1")) - machine = machine_get_machine_from_internal_name("586is"); - else { - machine = machine_get_machine_from_internal_name(p); - migrate_from = NULL; + for (i = 0; machine_migrations[i].old; i++) { + if (!strcmp(p, machine_migrations[i].old)) { + machine = machine_get_machine_from_internal_name(machine_migrations[i].new); + migrate_from = p; + if ((migrate_bios = machine_migrations[i].new_bios)) { + migration_cat = ini_find_or_create_section(config, machine_get_device(machine)->name); + ini_section_set_string(migration_cat, "bios", migrate_bios); + } + break; + } } - } else + if (!migrate_from) + machine = machine_get_machine_from_internal_name(p); + } else { machine = 0; + } if (machine >= machine_count()) machine = machine_count() - 1; - /* Copy NVR files when migrating a machine to a new internal name. */ - if (migrate_from) { + /* Copy NVR files when migrating a machine to a new NVR name. */ + if (migrate_from && strcmp(migrate_bios ? migrate_bios : migrate_from, machine_get_nvr_name())) { char old_fn[256]; - strcpy(old_fn, migrate_from); - strcat(old_fn, "."); - c = strlen(old_fn); + c = snprintf(old_fn, sizeof(old_fn), "%s.", migrate_from); char new_fn[256]; - strcpy(new_fn, machines[machine].internal_name); - strcat(new_fn, "."); - i = strlen(new_fn); + i = snprintf(new_fn, sizeof(new_fn), "%s.", machine_get_nvr_name()); /* Iterate through NVR files. */ DIR *dirp = opendir(nvr_path(".")); @@ -505,7 +534,7 @@ load_video(void) monitor_edid = ini_section_get_int(cat, "monitor_edid", 0); monitor_edid_path[0] = 0; - strncpy(monitor_edid_path, ini_section_get_string(cat, "monitor_edid_path", (char*)""), sizeof(monitor_edid_path)); + strncpy(monitor_edid_path, ini_section_get_string(cat, "monitor_edid_path", (char*)""), sizeof(monitor_edid_path) - 1); } /* Load "Input Devices" section. */ diff --git a/src/machine/m_at_socket8.c b/src/machine/m_at_socket8.c index df0f89196..e7975f601 100644 --- a/src/machine/m_at_socket8.c +++ b/src/machine/m_at_socket8.c @@ -351,7 +351,7 @@ static const device_config_t vs440fx_config[] = { }; const device_t vs440fx_device = { - .name = "Intel TC430HX (Tucson)", + .name = "Intel VS440FX (Venus)", .internal_name = "vs440fx_device", .flags = 0, .local = 0,