summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/imagedev/chd_cd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/imagedev/chd_cd.c')
-rw-r--r--src/emu/imagedev/chd_cd.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/emu/imagedev/chd_cd.c b/src/emu/imagedev/chd_cd.c
index 5a2b5496fb3..b67d485ecd6 100644
--- a/src/emu/imagedev/chd_cd.c
+++ b/src/emu/imagedev/chd_cd.c
@@ -84,7 +84,22 @@ const option_guide *cdrom_image_device::create_option_guide() const
void cdrom_image_device::device_start()
{
- m_cdrom_handle = NULL;
+ // try to locate the CHD from a DISK_REGION
+ chd_file *chd = get_disk_handle( machine(), owner()->tag() );
+ if( chd != NULL )
+ {
+ m_cdrom_handle = cdrom_open( chd );
+ }
+ else
+ {
+ m_cdrom_handle = NULL;
+ }
+}
+
+void cdrom_image_device::device_stop()
+{
+ if (m_cdrom_handle)
+ cdrom_close(m_cdrom_handle);
}
bool cdrom_image_device::call_load()
@@ -93,6 +108,9 @@ bool cdrom_image_device::call_load()
chd_file *chd = NULL;
astring tempstring;
+ if (m_cdrom_handle)
+ cdrom_close(m_cdrom_handle);
+
if (software_entry() == NULL)
{
if (strstr(m_image_name,".chd") && is_loaded()) {