Fixed IOCTL failing to read raw TOC after hard reset.

This commit is contained in:
OBattler
2025-02-13 08:36:36 +01:00
parent 3c2f70f6c7
commit 44c6daad1c
2 changed files with 9 additions and 15 deletions

View File

@@ -2873,7 +2873,7 @@ cdrom_load(cdrom_t *dev, const char *fn, const int skip_insert)
if ((dev->ops->is_empty != NULL) && dev->ops->is_empty(dev->local))
dev->cd_status = CD_STATUS_EMPTY;
if (dev->ops->is_dvd(dev->local))
else if (dev->ops->is_dvd(dev->local))
dev->cd_status = CD_STATUS_DVD;
else
dev->cd_status = dev->ops->has_audio(dev->local) ? CD_STATUS_STOPPED :

View File

@@ -124,7 +124,7 @@ ioctl_read_normal_toc(ioctl_t *ioctl, uint8_t *toc_buf)
cur_read_toc_ex.SessionTrack = 1;
const int temp = DeviceIoControl(ioctl->handle, IOCTL_CDROM_READ_TOC_EX,
&cur_read_toc_ex, 65535,
&cur_read_toc_ex, sizeof(CDROM_READ_TOC_EX),
cur_full_toc, 65535,
(LPDWORD) &size, NULL);
ioctl_log(ioctl->log, "temp = %i\n", temp);
@@ -179,7 +179,7 @@ ioctl_read_raw_toc(ioctl_t *ioctl)
if (!ioctl->is_dvd) {
status = DeviceIoControl(ioctl->handle, IOCTL_CDROM_READ_TOC_EX,
&cur_read_toc_ex, 65535,
&cur_read_toc_ex, sizeof(CDROM_READ_TOC_EX),
cur_full_toc, 65535,
(LPDWORD) &size, NULL);
ioctl_log(ioctl->log, "status = %i\n", status);
@@ -261,12 +261,6 @@ ioctl_read_raw_toc(ioctl_t *ioctl)
free(cur_full_toc);
}
static void
ioctl_read_toc(ioctl_t *ioctl)
{
ioctl_read_raw_toc(ioctl);
}
static int
ioctl_get_track(const ioctl_t *ioctl, const uint32_t sector) {
raw_track_info_t *rti = (raw_track_info_t *) ioctl->cur_rti;
@@ -761,13 +755,13 @@ ioctl_load(const void *local)
{
const ioctl_t *ioctl = (const ioctl_t *) local;
if (ioctl_open_handle((ioctl_t *) ioctl)) {
long size;
DeviceIoControl(ioctl->handle, IOCTL_STORAGE_LOAD_MEDIA,
if ((ioctl->handle != NULL) || ioctl_open_handle((ioctl_t *) ioctl)) {
long size = 0;
(void) DeviceIoControl(ioctl->handle, IOCTL_STORAGE_LOAD_MEDIA,
NULL, 0, NULL, 0,
(LPDWORD) &size, NULL);
ioctl_read_toc((ioctl_t *) ioctl);
ioctl_read_raw_toc((ioctl_t *) ioctl);
}
}