Only attempt Cue sheet parsing on files that end in .cue (in any letter case), fixes errors with some .ISO images.

This commit is contained in:
OBattler 2025-01-03 01:19:52 +01:00
parent 92e5ed6aae
commit 370c560c34
2 changed files with 13 additions and 7 deletions

View file

@ -2174,7 +2174,7 @@ cdrom_exit(uint8_t id)
memset(dev->image_path, 0, sizeof(dev->image_path));
pclog("cdrom_exit(%i): cdrom_insert(%i)\n", id, id);
cdrom_log("cdrom_exit(%i): cdrom_insert(%i)\n", id, id);
cdrom_insert(id);
}
@ -2252,7 +2252,7 @@ cdrom_reload(uint8_t id)
#endif
/* Signal media change to the emulated machine. */
pclog("cdrom_reload(%i): cdrom_insert(%i)\n", id, id);
cdrom_log("cdrom_reload(%i): cdrom_insert(%i)\n", id, id);
cdrom_insert(id);
/* The drive was previously empty, transition directly to UNIT ATTENTION. */

View file

@ -436,7 +436,7 @@ cdi_read_sector(cd_img_t *cdi, uint8_t *buffer, int raw, uint32_t sector)
const uint64_t seek = (sect + 150 - idx->start + idx->file_start) * trk->sector_size;
cdrom_image_backend_log("cdrom_read_sector(%08X): track %02X, index %02X, %016" PRIX64 ", %016" PRIX64 ", %i\n",
sector, track, index, trk->start, trk->sector_size);
sector, track, index, idx->start, trk->sector_size);
if (track_is_raw)
raw_size = trk->sector_size;
@ -1477,12 +1477,18 @@ cdi_close(cd_img_t *cdi)
int
cdi_set_device(cd_img_t *cdi, const char *path)
{
int ret;
uintptr_t ext = path + strlen(path) - strrchr(path, '.');
int ret;
if ((ret = cdi_load_cue(cdi, path)))
return ret;
cdrom_image_backend_log("cdi_set_device(): %" PRIu64 ", %lli, %s\n",
ext, strlen(path), path + strlen(path) - ext + 1);
cdi_clear_tracks(cdi);
if ((ext == 4) && !stricmp(path + strlen(path) - ext + 1, "CUE")) {
if ((ret = cdi_load_cue(cdi, path)))
return ret;
cdi_clear_tracks(cdi);
}
if ((ret = cdi_load_iso(cdi, path)))
return ret;