cdrom_set_signature() now does a sanity check on the CD-ROM drive ID, fixes random crashes on hard reset.

This commit is contained in:
OBattler
2017-02-13 20:21:57 +01:00
parent 8747bede97
commit 20a25caba7
2 changed files with 5 additions and 1 deletions

View File

@@ -306,6 +306,10 @@ void cdrom_reset_cdb_len(int id)
void cdrom_set_signature(int id)
{
if (id >= CDROM_NUM)
{
return;
}
cdrom[id].phase = 1;
cdrom[id].request_length = 0xEB14;
}

View File

@@ -559,7 +559,7 @@ static void loadhd(IDE *ide, int d, const char *fn)
void ide_set_signature(IDE *ide)
{
uint8_t cdrom_id = atapi_cdrom_drives[cur_ide[ide->board]];
uint8_t cdrom_id = atapi_cdrom_drives[ide->channel];
ide->sector=1;
ide->head=0;
if (ide_drive_is_cdrom(ide))