Move LBA Enhancer to the ISA ROM system
This commit is contained in:
31
src/config.c
31
src/config.c
@@ -994,11 +994,6 @@ load_storage_controllers(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lba_enhancer_enabled = !!ini_section_get_int(cat, "lba_enhancer_enabled", 0);
|
||||
|
||||
if (!lba_enhancer_enabled)
|
||||
ini_section_delete_var(cat, "lba_enhancer_enabled");
|
||||
}
|
||||
|
||||
/* Load "Hard Disks" section. */
|
||||
@@ -1736,6 +1731,17 @@ load_other_peripherals(void)
|
||||
ini_section_delete_var(cat, temp);
|
||||
}
|
||||
|
||||
/* Backwards compatibility for standalone LBA Enhancer from v4.2 and older. */
|
||||
if (ini_section_get_int(ini_find_section(config, "Storage controllers"), "lba_enhancer_enabled", 0) == 1) {
|
||||
/* Migrate to the first available ISA ROM slot. */
|
||||
for (uint8_t c = 0; c < ISAROM_MAX; c++) {
|
||||
if (!isarom_type[c]) {
|
||||
isarom_type[c] = isarom_get_from_internal_name("lba_enhancer");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p = ini_section_get_string(cat, "isartc_type", "none");
|
||||
isartc_type = isartc_get_from_internal_name(p);
|
||||
|
||||
@@ -2706,10 +2712,19 @@ save_storage_controllers(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (lba_enhancer_enabled == 0)
|
||||
/* Downgrade compatibility for standalone LBA Enhancer from v4.2 and older. */
|
||||
int card_id = isarom_get_from_internal_name("lba_enhancer");
|
||||
for (c = 0; c < ISAROM_MAX; c++) {
|
||||
if (isarom_type[c] == card_id) {
|
||||
/* A special value of 2 still enables the cards on older versions,
|
||||
but lets newer versions know that they've already been migrated. */
|
||||
ini_section_set_int(cat, "lba_enhancer_enabled", 2);
|
||||
card_id = 0; /* mark as found */
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (card_id > 0) /* not found */
|
||||
ini_section_delete_var(cat, "lba_enhancer_enabled");
|
||||
else
|
||||
ini_section_set_int(cat, "lba_enhancer_enabled", 1);
|
||||
|
||||
ini_delete_section_if_empty(config, cat);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user