config: Migrate standalone SSI-2001, CMS and GUS from v3.11 and older
This commit is contained in:
33
src/config.c
33
src/config.c
@@ -718,6 +718,20 @@ load_sound(void)
|
||||
|
||||
mpu401_standalone_enable = !!ini_section_get_int(cat, "mpu401_standalone", 0);
|
||||
|
||||
/* Backwards compatibility for standalone SSI-2001, CMS and GUS from v3.11 and older. */
|
||||
char *legacy_cards[][2] = {{"ssi2001", "ssi2001"}, {"gameblaster", "cms"}, {"gus", "gus"}};
|
||||
for (int i = 0, j = 0; i < (sizeof(legacy_cards) / sizeof(legacy_cards[0])); i++) {
|
||||
if (ini_section_get_int(cat, legacy_cards[i][0], 0) == 1) {
|
||||
/* Migrate to the first available sound card slot. */
|
||||
for (; j < (sizeof(sound_card_current) / sizeof(sound_card_current[0])); j++) {
|
||||
if (!sound_card_current[j]) {
|
||||
sound_card_current[j] = sound_card_get_from_internal_name(legacy_cards[i][1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
memset(temp, '\0', sizeof(temp));
|
||||
p = ini_section_get_string(cat, "sound_type", "float");
|
||||
if (strlen(p) > 511)
|
||||
@@ -2159,7 +2173,7 @@ save_machine(void)
|
||||
else
|
||||
ini_section_delete_var(cat, "cpu_override");
|
||||
|
||||
/* Forwards compatibility with the previous CPU model system. */
|
||||
/* Downgrade compatibility with the previous CPU model system. */
|
||||
ini_section_delete_var(cat, "cpu_manufacturer");
|
||||
ini_section_delete_var(cat, "cpu");
|
||||
|
||||
@@ -2390,6 +2404,23 @@ save_sound(void)
|
||||
else
|
||||
ini_section_set_int(cat, "mpu401_standalone", mpu401_standalone_enable);
|
||||
|
||||
/* Downgrade compatibility for standalone SSI-2001, CMS and GUS from v3.11 and older. */
|
||||
char *legacy_cards[][2] = {{"ssi2001", "ssi2001"}, {"gameblaster", "cms"}, {"gus", "gus"}};
|
||||
for (int i = 0; i < (sizeof(legacy_cards) / sizeof(legacy_cards[0])); i++) {
|
||||
int card_id = sound_card_get_from_internal_name(legacy_cards[i][1]);
|
||||
for (int j = 0; j < (sizeof(sound_card_current) / sizeof(sound_card_current[0])); j++) {
|
||||
if (sound_card_current[j] == 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, legacy_cards[i][0], 2);
|
||||
card_id = 0; /* mark as found */
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (card_id > 0) /* not found */
|
||||
ini_section_delete_var(cat, legacy_cards[i][0]);
|
||||
}
|
||||
|
||||
if (sound_is_float == 1)
|
||||
ini_section_delete_var(cat, "sound_type");
|
||||
else
|
||||
|
Reference in New Issue
Block a user