Fix handling of nocdrom

This commit is contained in:
Seth Polsley 2020-05-25 18:55:56 -05:00
parent bebeacc895
commit 23da9e72eb

View File

@ -295,16 +295,18 @@ static bool position2msf(const cdrom_drive_info &info, uint16 postype, uint32 po
void CDROMInit(void)
{
// No drives specified in prefs? Then add defaults
if (PrefsFindString("cdrom", 0) == NULL)
if (PrefsFindString("cdrom", 0) == NULL) {
SysAddCDROMPrefs();
// Add drives specified in preferences
int index = 0;
const char *str;
while ((str = PrefsFindString("cdrom", index++)) != NULL) {
void *fh = Sys_open(str, true);
if (fh)
drives.push_back(cdrom_drive_info(fh));
}
else {
// Add drives specified in preferences
int index = 0;
const char *str;
while ((str = PrefsFindString("cdrom", index++)) != NULL) {
void *fh = Sys_open(str, true);
if (fh)
drives.push_back(cdrom_drive_info(fh));
}
}
if (!drives.empty()) { // set to first drive by default