From 85e78292440ab3b2d58fc19fbaf7f93347d03cc6 Mon Sep 17 00:00:00 2001 From: SarahW Date: Wed, 17 May 2017 19:13:23 +0100 Subject: [PATCH] Fixed CD-ROM initialisation broken by config changes. --- src/cdrom-ioctl.c | 6 ++++++ src/pc.c | 1 + 2 files changed, 7 insertions(+) diff --git a/src/cdrom-ioctl.c b/src/cdrom-ioctl.c index 2d4f176..ef10004 100644 --- a/src/cdrom-ioctl.c +++ b/src/cdrom-ioctl.c @@ -737,14 +737,20 @@ void ioctl_reset() void ioctl_set_drive(char d) { + ioctl_close(); + sprintf(ioctl_path, "\\\\.\\%c:", d); pclog("Path is %s\n", ioctl_path); tocvalid = 0; atapi = &ioctl_atapi; + + ioctl_open(d); } int ioctl_open(char d) { + if (hIOCTL) + ioctl_close(); hIOCTL = CreateFile(ioctl_path,GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,NULL); if (!hIOCTL) diff --git a/src/pc.c b/src/pc.c index 2c38c83..972e867 100644 --- a/src/pc.c +++ b/src/pc.c @@ -411,6 +411,7 @@ void resetpchard() } else { + ioctl_set_drive(cdrom_drive); ioctl_reset(); } }