Previous 199869 Revisions Next

r18465 Thursday 11th October, 2012 at 21:50:16 UTC by smf
made cdrom_image_device & harddisk_image_device responsible for accessing driver based chd's (nw)
[src/emu/imagedev]chd_cd.c chd_cd.h harddriv.c harddriv.h
[src/emu/machine]scsicd.c scsicd.h scsihd.c scsihd.h

trunk/src/emu/imagedev/harddriv.c
r18464r18465
101101void harddisk_image_device::device_start()
102102{
103103   m_chd = NULL;
104   m_hard_disk_handle = NULL;
104
105   // try to locate the CHD from a DISK_REGION
106   chd_file *handle = get_disk_handle(machine(), owner()->tag());
107   if (handle != NULL)
108   {
109      m_hard_disk_handle = hard_disk_open(handle);
110   }
111   else
112   {
113      m_hard_disk_handle = NULL;
114   }
105115}
106116
117void harddisk_image_device::device_stop()
118{
119   if (m_hard_disk_handle)
120      hard_disk_close(m_hard_disk_handle);
121}
122
107123bool harddisk_image_device::call_load()
108124{
109125   int our_result;
r18464r18465
224240
225241   m_chd = NULL;
226242
243   if (m_hard_disk_handle)
244      hard_disk_close(m_hard_disk_handle);
245
227246   /* open the CHD file */
228247   if (software_entry() != NULL)
229248   {
trunk/src/emu/imagedev/chd_cd.c
r18464r18465
8484
8585void cdrom_image_device::device_start()
8686{
87   m_cdrom_handle = NULL;
87   // try to locate the CHD from a DISK_REGION
88   chd_file *chd = get_disk_handle( machine(), owner()->tag() );
89   if( chd != NULL )
90   {
91      m_cdrom_handle = cdrom_open( chd );
92   }
93   else
94   {
95      m_cdrom_handle = NULL;
96   }
8897}
8998
99void cdrom_image_device::device_stop()
100{
101   if (m_cdrom_handle)
102      cdrom_close(m_cdrom_handle);
103}
104
90105bool cdrom_image_device::call_load()
91106{
92107   chd_error   err = (chd_error)0;
93108   chd_file   *chd = NULL;
94109   astring tempstring;
95110
111   if (m_cdrom_handle)
112      cdrom_close(m_cdrom_handle);
113
96114   if (software_entry() == NULL)
97115   {
98116      if (strstr(m_image_name,".chd") && is_loaded()) {
trunk/src/emu/imagedev/harddriv.h
r18464r18465
6363   // device-level overrides
6464    virtual void device_config_complete();
6565   virtual void device_start();
66   virtual void device_stop();
6667
6768   int internal_load_hd();
6869
trunk/src/emu/imagedev/chd_cd.h
r18464r18465
5656   // device-level overrides
5757    virtual void device_config_complete();
5858   virtual void device_start();
59   virtual void device_stop();
5960
6061   chd_file   m_self_chd;
6162   cdrom_file   *m_cdrom_handle;
trunk/src/emu/machine/scsihd.c
r18464r18465
3535{
3636   scsihle_device::device_reset();
3737
38   is_image_device = true;
39   disk = subdevice<harddisk_image_device>("image")->get_hard_disk_file();
40   if( !disk )
41   {
42      // try to locate the CHD from a DISK_REGION
43      chd_file *handle = get_disk_handle(machine(), tag());
44      if (handle != NULL)
45      {
46         is_image_device = false;
47         disk = hard_disk_open(handle);
48      }
49   }
50
5138   lba = 0;
5239   blocks = 0;
5340   sectorbytes = 512;
5441
42   disk = subdevice<harddisk_image_device>("image")->get_hard_disk_file();
5543   if (!disk)
5644   {
5745      logerror("%s SCSIHD: no HD found!\n", tag());
r18464r18465
6452   }
6553}
6654
67void scsihd_device::device_stop()
68{
69   if (!is_image_device)
70   {
71      if( disk )
72      {
73         hard_disk_close( disk );
74      }
75   }
76}
77
7855static MACHINE_CONFIG_FRAGMENT(scsi_harddisk)
7956   MCFG_HARDDISK_ADD("image")
8057MACHINE_CONFIG_END
trunk/src/emu/machine/scsihd.h
r18464r18465
2929   // device-level overrides
3030   virtual void device_start();
3131   virtual void device_reset();
32   virtual void device_stop();
3332
3433private:
3534   UINT32 lba;
3635   UINT32 blocks;
3736   int sectorbytes;
3837   hard_disk_file *disk;
39   bool is_image_device;
4038};
4139
4240// device type definition
trunk/src/emu/machine/scsicd.c
r18464r18465
4949{
5050   scsihle_device::device_reset();
5151
52   is_file = TRUE;
5352   cdrom = subdevice<cdrom_image_device>("image")->get_cdrom_file();
5453   if( !cdrom )
5554   {
56      // try to locate the CHD from a DISK_REGION
57      chd_file *chd = get_disk_handle( machine(), tag() );
58      if( chd != NULL )
59      {
60         is_file = FALSE;
61         cdrom = cdrom_open( chd );
62      }
63   }
64
65   if( !cdrom )
66   {
6755      logerror( "SCSICD %s: no CD found!\n", tag() );
6856   }
6957
r18464r18465
7664   play_err_flag = 0;
7765}
7866
79void scsicd_device::device_stop()
80{
81   if (!is_file)
82   {
83      if( cdrom )
84      {
85         cdrom_close( cdrom );
86      }
87   }
88}
89
9067cdrom_interface scsicd_device::cd_intf = { 0, 0 };
9168
9269static MACHINE_CONFIG_FRAGMENT(scsi_cdrom)
trunk/src/emu/machine/scsicd.h
r18464r18465
3131   // device-level overrides
3232   virtual void device_start();
3333   virtual void device_reset();
34   virtual void device_stop();
3534
3635private:
3736   UINT32 lba;
r18464r18465
4241   UINT32 cur_subblock;
4342   UINT32 play_err_flag;
4443   cdrom_file *cdrom;
45   bool is_file;
4644};
4745
4846// device type definition

Previous 199869 Revisions Next


© 1997-2024 The MAME Team