mirror of
https://github.com/holub/mame
synced 2025-07-01 08:18:59 +03:00
(From Oliver Stoneberg)
Fixed several memory leaks related to SCSI CD emulation.
This commit is contained in:
parent
1ea08b6933
commit
d7e58ce2d0
@ -698,6 +698,16 @@ extern void lsi53c810_init(const struct LSI53C810interface *interface)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void lsi53c810_exit(const struct LSI53C810interface *interface)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < interface->scsidevs->devs_present; i++)
|
||||||
|
{
|
||||||
|
SCSIDeleteInstance( devices[interface->scsidevs->devices[i].scsiID] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void lsi53c810_read_data(int bytes, UINT8 *pData)
|
void lsi53c810_read_data(int bytes, UINT8 *pData)
|
||||||
{
|
{
|
||||||
if (devices[last_id])
|
if (devices[last_id])
|
||||||
|
@ -12,6 +12,7 @@ struct LSI53C810interface
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern void lsi53c810_init(const struct LSI53C810interface *interface);
|
extern void lsi53c810_init(const struct LSI53C810interface *interface);
|
||||||
|
extern void lsi53c810_exit(const struct LSI53C810interface *interface);
|
||||||
|
|
||||||
extern void lsi53c810_read_data(int bytes, UINT8 *pData);
|
extern void lsi53c810_read_data(int bytes, UINT8 *pData);
|
||||||
extern void lsi53c810_write_data(int bytes, UINT8 *pData);
|
extern void lsi53c810_write_data(int bytes, UINT8 *pData);
|
||||||
|
@ -231,6 +231,16 @@ void am53cf96_init( const struct AM53CF96interface *interface )
|
|||||||
state_save_register_global(last_id);
|
state_save_register_global(last_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void am53cf96_exit( const struct AM53CF96interface *interface )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < interface->scsidevs->devs_present; i++)
|
||||||
|
{
|
||||||
|
SCSIDeleteInstance( devices[interface->scsidevs->devices[i].scsiID] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// retrieve data from the SCSI controller
|
// retrieve data from the SCSI controller
|
||||||
void am53cf96_read_data(int bytes, UINT8 *pData)
|
void am53cf96_read_data(int bytes, UINT8 *pData)
|
||||||
{
|
{
|
||||||
|
@ -15,6 +15,7 @@ struct AM53CF96interface
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern void am53cf96_init( const struct AM53CF96interface *interface );
|
extern void am53cf96_init( const struct AM53CF96interface *interface );
|
||||||
|
extern void am53cf96_exit( const struct AM53CF96interface *interface );
|
||||||
extern void am53cf96_read_data(int bytes, UINT8 *pData);
|
extern void am53cf96_read_data(int bytes, UINT8 *pData);
|
||||||
void am53cf96_write_data(int bytes, UINT8 *pData);
|
void am53cf96_write_data(int bytes, UINT8 *pData);
|
||||||
void *am53cf96_get_device(int id);
|
void *am53cf96_get_device(int id);
|
||||||
|
@ -809,6 +809,16 @@ extern void wd33c93_init( const struct WD33C93interface *interface )
|
|||||||
// state_save_register_item_array("wd33c93", 0, scsi_data);
|
// state_save_register_item_array("wd33c93", 0, scsi_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void wd33c93_exit( const struct WD33C93interface *interface )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < interface->scsidevs->devs_present; i++)
|
||||||
|
{
|
||||||
|
SCSIDeleteInstance( devices[interface->scsidevs->devices[i].scsiID] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void wd33c93_get_dma_data( int bytes, UINT8 *pData )
|
void wd33c93_get_dma_data( int bytes, UINT8 *pData )
|
||||||
{
|
{
|
||||||
int len = bytes;
|
int len = bytes;
|
||||||
|
@ -15,6 +15,7 @@ struct WD33C93interface
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern void wd33c93_init( const struct WD33C93interface *interface );
|
extern void wd33c93_init( const struct WD33C93interface *interface );
|
||||||
|
extern void wd33c93_exit( const struct WD33C93interface *interface );
|
||||||
extern void wd33c93_get_dma_data(int bytes, UINT8 *pData);
|
extern void wd33c93_get_dma_data(int bytes, UINT8 *pData);
|
||||||
extern void wd33c93_write_data(int bytes, UINT8 *pData);
|
extern void wd33c93_write_data(int bytes, UINT8 *pData);
|
||||||
extern void *wd33c93_get_device(int id);
|
extern void *wd33c93_get_device(int id);
|
||||||
|
@ -346,10 +346,16 @@ static DRIVER_INIT( konamigq )
|
|||||||
m_p_n_pcmram = memory_region( REGION_SOUND1 ) + 0x80000;
|
m_p_n_pcmram = memory_region( REGION_SOUND1 ) + 0x80000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void konamigq_exit(running_machine *machine)
|
||||||
|
{
|
||||||
|
am53cf96_exit(&scsi_intf);
|
||||||
|
}
|
||||||
|
|
||||||
static MACHINE_START( konamigq )
|
static MACHINE_START( konamigq )
|
||||||
{
|
{
|
||||||
/* init the scsi controller and hook up it's DMA */
|
/* init the scsi controller and hook up it's DMA */
|
||||||
am53cf96_init(&scsi_intf);
|
am53cf96_init(&scsi_intf);
|
||||||
|
add_exit_callback(machine, konamigq_exit);
|
||||||
psx_dma_install_read_handler(5, scsi_dma_read);
|
psx_dma_install_read_handler(5, scsi_dma_read);
|
||||||
psx_dma_install_write_handler(5, scsi_dma_write);
|
psx_dma_install_write_handler(5, scsi_dma_write);
|
||||||
|
|
||||||
|
@ -306,12 +306,18 @@ static const struct AM53CF96interface scsi_intf =
|
|||||||
&scsi_irq, /* command completion IRQ */
|
&scsi_irq, /* command completion IRQ */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void konamigv_exit(running_machine *machine)
|
||||||
|
{
|
||||||
|
am53cf96_exit(&scsi_intf);
|
||||||
|
}
|
||||||
|
|
||||||
static DRIVER_INIT( konamigv )
|
static DRIVER_INIT( konamigv )
|
||||||
{
|
{
|
||||||
psx_driver_init();
|
psx_driver_init();
|
||||||
|
|
||||||
/* init the scsi controller and hook up it's DMA */
|
/* init the scsi controller and hook up it's DMA */
|
||||||
am53cf96_init(&scsi_intf);
|
am53cf96_init(&scsi_intf);
|
||||||
|
add_exit_callback(machine, konamigv_exit);
|
||||||
psx_dma_install_read_handler(5, scsi_dma_read);
|
psx_dma_install_read_handler(5, scsi_dma_read);
|
||||||
psx_dma_install_write_handler(5, scsi_dma_write);
|
psx_dma_install_write_handler(5, scsi_dma_write);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user