This commit is contained in:
OBattler
2025-08-26 21:02:16 +02:00
2 changed files with 50 additions and 21 deletions

View File

@@ -278,44 +278,73 @@ static void
load_machine(void) load_machine(void)
{ {
ini_section_t cat = ini_find_section(config, "Machine"); ini_section_t cat = ini_find_section(config, "Machine");
ini_section_t migration_cat;
const char *p; const char *p;
const char *migrate_from = NULL; const char *migrate_from = NULL;
const char *migrate_bios = NULL;
int c; int c;
int i; int i;
int j; int j;
int speed; int speed;
double multi; 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); p = ini_section_get_string(cat, "machine", NULL);
if (p != NULL) { if (p != NULL) {
migrate_from = p;
/* Migrate renamed machines. */ /* Migrate renamed machines. */
if (!strcmp(p, "tandy")) for (i = 0; machine_migrations[i].old; i++) {
machine = machine_get_machine_from_internal_name("tandy1000sx"); if (!strcmp(p, machine_migrations[i].old)) {
else if (!strcmp(p, "430nx")) machine = machine_get_machine_from_internal_name(machine_migrations[i].new);
machine = machine_get_machine_from_internal_name("586ip"); migrate_from = p;
else if (!strcmp(p, "586mc1")) if ((migrate_bios = machine_migrations[i].new_bios)) {
machine = machine_get_machine_from_internal_name("586is"); migration_cat = ini_find_or_create_section(config, machine_get_device(machine)->name);
else { ini_section_set_string(migration_cat, "bios", migrate_bios);
machine = machine_get_machine_from_internal_name(p); }
migrate_from = NULL; break;
}
} }
} else if (!migrate_from)
machine = machine_get_machine_from_internal_name(p);
} else {
machine = 0; machine = 0;
}
if (machine >= machine_count()) if (machine >= machine_count())
machine = machine_count() - 1; machine = machine_count() - 1;
/* Copy NVR files when migrating a machine to a new internal name. */ /* Copy NVR files when migrating a machine to a new NVR name. */
if (migrate_from) { if (migrate_from && strcmp(migrate_bios ? migrate_bios : migrate_from, machine_get_nvr_name())) {
char old_fn[256]; char old_fn[256];
strcpy(old_fn, migrate_from); c = snprintf(old_fn, sizeof(old_fn), "%s.", migrate_from);
strcat(old_fn, ".");
c = strlen(old_fn);
char new_fn[256]; char new_fn[256];
strcpy(new_fn, machines[machine].internal_name); i = snprintf(new_fn, sizeof(new_fn), "%s.", machine_get_nvr_name());
strcat(new_fn, ".");
i = strlen(new_fn);
/* Iterate through NVR files. */ /* Iterate through NVR files. */
DIR *dirp = opendir(nvr_path(".")); DIR *dirp = opendir(nvr_path("."));
@@ -505,7 +534,7 @@ load_video(void)
monitor_edid = ini_section_get_int(cat, "monitor_edid", 0); monitor_edid = ini_section_get_int(cat, "monitor_edid", 0);
monitor_edid_path[0] = 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. */ /* Load "Input Devices" section. */

View File

@@ -351,7 +351,7 @@ static const device_config_t vs440fx_config[] = {
}; };
const device_t vs440fx_device = { const device_t vs440fx_device = {
.name = "Intel TC430HX (Tucson)", .name = "Intel VS440FX (Venus)",
.internal_name = "vs440fx_device", .internal_name = "vs440fx_device",
.flags = 0, .flags = 0,
.local = 0, .local = 0,