summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2015-12-17 11:10:30 +0100
committer Miodrag Milanovic <mmicko@gmail.com>2015-12-17 11:10:30 +0100
commit174720a64ddeed98078139dc0e4dd7aed15f91d4 (patch)
treeb22e4fb4f1a210751cadc5aa01d73113b8e9857f /src/devices
parentbe38cd71bb958d651ba91db8db439edc9c31b21e (diff)
removed auto_bitmap_ind*_alloc and auto_bitmap_rgb32_alloc and replaced with std::unique_ptr (nw)
auto_alloc_array to unique_ptr Added make_unique_clear
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/bus/cpc/mface2.cpp6
-rw-r--r--src/devices/bus/cpc/mface2.h2
-rw-r--r--src/devices/bus/iq151/minigraf.cpp2
-rw-r--r--src/devices/bus/iq151/minigraf.h2
-rw-r--r--src/devices/bus/iq151/ms151a.cpp2
-rw-r--r--src/devices/bus/iq151/ms151a.h2
-rw-r--r--src/devices/bus/isa/aga.cpp24
-rw-r--r--src/devices/bus/isa/aga.h2
-rw-r--r--src/devices/bus/isa/mda.cpp6
-rw-r--r--src/devices/bus/isa/mda.h2
-rw-r--r--src/devices/bus/isa/pgc.cpp10
-rw-r--r--src/devices/bus/isa/pgc.h6
-rw-r--r--src/devices/bus/macpds/pds_tpdfpd.cpp8
-rw-r--r--src/devices/bus/macpds/pds_tpdfpd.h2
-rw-r--r--src/devices/bus/nes/disksys.cpp4
-rw-r--r--src/devices/bus/nes/disksys.h2
-rw-r--r--src/devices/bus/snes/sdd1.cpp6
-rw-r--r--src/devices/bus/snes/sdd1.h2
-rw-r--r--src/devices/bus/snes/spc7110.cpp4
-rw-r--r--src/devices/bus/snes/spc7110.h2
-rw-r--r--src/devices/cpu/alto2/a2disp.cpp8
-rw-r--r--src/devices/cpu/alto2/a2disp.h4
-rw-r--r--src/devices/cpu/alto2/a2ether.cpp8
-rw-r--r--src/devices/cpu/alto2/a2ether.h4
-rw-r--r--src/devices/cpu/alto2/a2ram.cpp4
-rw-r--r--src/devices/cpu/alto2/alto2cpu.cpp10
-rw-r--r--src/devices/cpu/alto2/alto2cpu.h2
-rw-r--r--src/devices/cpu/i386/cycles.h1
-rw-r--r--src/devices/cpu/i386/i386.cpp43
-rw-r--r--src/devices/cpu/i386/i386.h5
-rw-r--r--src/devices/cpu/z180/z180.cpp8
-rw-r--r--src/devices/machine/akiko.cpp6
-rw-r--r--src/devices/machine/akiko.h2
-rw-r--r--src/devices/machine/diablo_hd.cpp17
-rw-r--r--src/devices/machine/diablo_hd.h2
-rw-r--r--src/devices/machine/s3c2400.h2
-rw-r--r--src/devices/machine/s3c2410.h2
-rw-r--r--src/devices/machine/s3c2440.h2
-rw-r--r--src/devices/machine/s3c24xx.inc4
-rw-r--r--src/devices/machine/s3c44b0.cpp14
-rw-r--r--src/devices/machine/s3c44b0.h2
-rw-r--r--src/devices/machine/smpc.cpp4
-rw-r--r--src/devices/machine/strata.cpp16
-rw-r--r--src/devices/machine/strata.h2
-rw-r--r--src/devices/sound/c140.cpp16
-rw-r--r--src/devices/sound/c140.h4
-rw-r--r--src/devices/sound/cdda.cpp6
-rw-r--r--src/devices/sound/cdda.h2
-rw-r--r--src/devices/sound/cem3394.cpp22
-rw-r--r--src/devices/sound/cem3394.h4
-rw-r--r--src/devices/sound/k005289.cpp14
-rw-r--r--src/devices/sound/k005289.h4
-rw-r--r--src/devices/sound/k051649.cpp12
-rw-r--r--src/devices/sound/k051649.h4
-rw-r--r--src/devices/sound/k054539.cpp12
-rw-r--r--src/devices/sound/k054539.h2
-rw-r--r--src/devices/sound/mos6560.cpp4
-rw-r--r--src/devices/sound/mos6560.h4
-rw-r--r--src/devices/sound/mos7360.cpp2
-rw-r--r--src/devices/sound/mos7360.h2
-rw-r--r--src/devices/sound/segapcm.cpp8
-rw-r--r--src/devices/sound/segapcm.h2
-rw-r--r--src/devices/sound/sid.cpp8
-rw-r--r--src/devices/sound/sidvoice.cpp4
-rw-r--r--src/devices/sound/sp0256.cpp6
-rw-r--r--src/devices/sound/sp0256.h2
-rw-r--r--src/devices/sound/ymf271.cpp20
-rw-r--r--src/devices/sound/ymf271.h6
-rw-r--r--src/devices/sound/ymf278b.cpp8
-rw-r--r--src/devices/sound/ymf278b.h2
-rw-r--r--src/devices/sound/ymz280b.cpp12
-rw-r--r--src/devices/sound/ymz280b.h2
-rw-r--r--src/devices/video/315_5313.cpp82
-rw-r--r--src/devices/video/315_5313.h32
-rw-r--r--src/devices/video/epic12.cpp8
-rw-r--r--src/devices/video/epic12.h4
-rw-r--r--src/devices/video/fixfreq.cpp10
-rw-r--r--src/devices/video/fixfreq.h2
-rw-r--r--src/devices/video/huc6260.cpp2
-rw-r--r--src/devices/video/huc6260.h2
-rw-r--r--src/devices/video/huc6261.cpp2
-rw-r--r--src/devices/video/huc6261.h2
-rw-r--r--src/devices/video/psx.cpp2
-rw-r--r--src/devices/video/psx.h2
-rw-r--r--src/devices/video/snes_ppu.cpp24
-rw-r--r--src/devices/video/snes_ppu.h6
-rw-r--r--src/devices/video/stvvdp1.cpp10
-rw-r--r--src/devices/video/stvvdp2.cpp34
-rw-r--r--src/devices/video/vic4567.cpp2
-rw-r--r--src/devices/video/vic4567.h2
90 files changed, 343 insertions, 347 deletions
diff --git a/src/devices/bus/cpc/mface2.cpp b/src/devices/bus/cpc/mface2.cpp
index 3bb01352876..bb4354041bc 100644
--- a/src/devices/bus/cpc/mface2.cpp
+++ b/src/devices/bus/cpc/mface2.cpp
@@ -107,9 +107,9 @@ void cpc_multiface2_device::multiface_rethink_memory()
{
/* set bank addressess */
machine().root_device().membank("bank1")->set_base(multiface_rom);
- machine().root_device().membank("bank2")->set_base(m_multiface_ram);
+ machine().root_device().membank("bank2")->set_base(m_multiface_ram.get());
machine().root_device().membank("bank9")->set_base(multiface_rom);
- machine().root_device().membank("bank10")->set_base(m_multiface_ram);
+ machine().root_device().membank("bank10")->set_base(m_multiface_ram.get());
}
}
@@ -326,7 +326,7 @@ void cpc_multiface2_device::device_start()
m_multiface_flags = MULTIFACE_VISIBLE;
/* allocate ram */
- m_multiface_ram = auto_alloc_array(machine(), UINT8, 8192);
+ m_multiface_ram = std::make_unique<UINT8[]>(8192);
}
//-------------------------------------------------
diff --git a/src/devices/bus/cpc/mface2.h b/src/devices/bus/cpc/mface2.h
index c54e38ec889..c64872af18b 100644
--- a/src/devices/bus/cpc/mface2.h
+++ b/src/devices/bus/cpc/mface2.h
@@ -59,7 +59,7 @@ private:
DIRECT_UPDATE_MEMBER( amstrad_default );
DIRECT_UPDATE_MEMBER( amstrad_multiface_directoverride );
- unsigned char *m_multiface_ram;
+ std::unique_ptr<UINT8[]> m_multiface_ram;
unsigned long m_multiface_flags;
UINT8 m_romdis;
diff --git a/src/devices/bus/iq151/minigraf.cpp b/src/devices/bus/iq151/minigraf.cpp
index ca4ffdcc463..1a8e9d182a0 100644
--- a/src/devices/bus/iq151/minigraf.cpp
+++ b/src/devices/bus/iq151/minigraf.cpp
@@ -62,7 +62,7 @@ void iq151_minigraf_device::device_start()
m_rom = (UINT8*)memregion("minigraf")->base();
// allocate a bitmap for represent the paper
- m_paper = auto_bitmap_ind16_alloc(machine(), PAPER_WIDTH, PAPER_HEIGHT);
+ m_paper = std::make_unique<bitmap_ind16>(PAPER_WIDTH, PAPER_HEIGHT);
m_paper->fill(0);
m_pen = 0;
diff --git a/src/devices/bus/iq151/minigraf.h b/src/devices/bus/iq151/minigraf.h
index 311d79e97f1..6632fa31aa4 100644
--- a/src/devices/bus/iq151/minigraf.h
+++ b/src/devices/bus/iq151/minigraf.h
@@ -46,7 +46,7 @@ private:
UINT8 m_pen;
UINT8 m_control;
- bitmap_ind16 * m_paper;
+ std::unique_ptr<bitmap_ind16> m_paper;
};
diff --git a/src/devices/bus/iq151/ms151a.cpp b/src/devices/bus/iq151/ms151a.cpp
index 1a4ee73d586..99da92c6d61 100644
--- a/src/devices/bus/iq151/ms151a.cpp
+++ b/src/devices/bus/iq151/ms151a.cpp
@@ -61,7 +61,7 @@ void iq151_ms151a_device::device_start()
m_rom = (UINT8*)memregion("ms151a")->base();
// allocate a bitmap for represent the paper
- m_paper = auto_bitmap_ind16_alloc(machine(), PAPER_WIDTH, PAPER_HEIGHT);
+ m_paper = std::make_unique<bitmap_ind16>(PAPER_WIDTH, PAPER_HEIGHT);
m_paper->fill(0);
m_pen = 0;
diff --git a/src/devices/bus/iq151/ms151a.h b/src/devices/bus/iq151/ms151a.h
index 528ce9a9554..1d794e1081d 100644
--- a/src/devices/bus/iq151/ms151a.h
+++ b/src/devices/bus/iq151/ms151a.h
@@ -46,7 +46,7 @@ private:
INT32 m_posy;
UINT8 m_pen;
- bitmap_ind16 * m_paper;
+ std::unique_ptr<bitmap_ind16> m_paper;
};
diff --git a/src/devices/bus/isa/aga.cpp b/src/devices/bus/isa/aga.cpp
index 8149486ae7e..1e798680b58 100644
--- a/src/devices/bus/isa/aga.cpp
+++ b/src/devices/bus/isa/aga.cpp
@@ -107,7 +107,7 @@ void isa8_aga_device::device_start()
m_mode = AGA_COLOR;
m_mda_chr_gen = memregion("gfx1")->base() + 0x1000;
m_cga_chr_gen = memregion("gfx1")->base();
- m_videoram = auto_alloc_array(machine(), UINT8, 0x10000);
+ m_videoram = std::make_unique<UINT8[]>(0x10000);
set_isa_device();
m_isa->install_memory(0xb0000, 0xbffff, 0, 0, read8_delegate(FUNC(isa8_aga_device::pc_aga_videoram_r),this), write8_delegate(FUNC(isa8_aga_device::pc_aga_videoram_w),this));
@@ -194,7 +194,7 @@ void isa8_aga_pc200_device::device_start()
m_mode = AGA_COLOR;
m_mda_chr_gen = memregion("gfx1")->base();
m_cga_chr_gen = memregion("gfx1")->base() + 0x1000;
- m_videoram = auto_alloc_array(machine(), UINT8, 0x10000);
+ m_videoram = std::make_unique<UINT8[]>(0x10000);
set_isa_device();
m_isa->install_memory(0xb0000, 0xbffff, 0, 0, read8_delegate(FUNC(isa8_aga_pc200_device::pc200_videoram_r),this), write8_delegate(FUNC(isa8_aga_pc200_device::pc200_videoram_w),this));
@@ -315,7 +315,7 @@ machine_config_constructor isa8_aga_device::device_mconfig_additions() const
MC6845_UPDATE_ROW( isa8_aga_device::mda_text_inten_update_row )
{
const rgb_t *palette = m_palette->palette()->entry_list_raw();
- UINT8 *videoram = m_videoram;
+ UINT8 *videoram = m_videoram.get();
UINT32 *p = &bitmap.pix32(y);
UINT16 chr_base = ( ra & 0x08 ) ? 0x800 | ( ra & 0x07 ) : ra;
int i;
@@ -375,7 +375,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::mda_text_inten_update_row )
MC6845_UPDATE_ROW( isa8_aga_device::mda_text_blink_update_row )
{
- UINT8 *videoram = m_videoram;
+ UINT8 *videoram = m_videoram.get();
const rgb_t *palette = m_palette->palette()->entry_list_raw();
UINT32 *p = &bitmap.pix32(y);
UINT16 chr_base = ( ra & 0x08 ) ? 0x800 | ( ra & 0x07 ) : ra;
@@ -437,7 +437,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::mda_text_blink_update_row )
MC6845_UPDATE_ROW( isa8_aga_device::cga_text_inten_update_row )
{
- UINT8 *videoram = m_videoram;
+ UINT8 *videoram = m_videoram.get();
const rgb_t *palette = m_palette->palette()->entry_list_raw();
UINT32 *p = &bitmap.pix32(y);
int i;
@@ -469,7 +469,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_text_inten_update_row )
MC6845_UPDATE_ROW( isa8_aga_device::cga_text_inten_alt_update_row )
{
const rgb_t *palette = m_palette->palette()->entry_list_raw();
- UINT8 *videoram = m_videoram;
+ UINT8 *videoram = m_videoram.get();
UINT32 *p = &bitmap.pix32(y);
int i;
@@ -499,7 +499,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_text_inten_alt_update_row )
MC6845_UPDATE_ROW( isa8_aga_device::cga_text_blink_update_row )
{
const rgb_t *palette = m_palette->palette()->entry_list_raw();
- UINT8 *videoram = m_videoram;
+ UINT8 *videoram = m_videoram.get();
UINT32 *p = &bitmap.pix32(y);
int i;
@@ -533,7 +533,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_text_blink_update_row )
MC6845_UPDATE_ROW( isa8_aga_device::cga_text_blink_alt_update_row )
{
const rgb_t *palette = m_palette->palette()->entry_list_raw();
- UINT8 *videoram = m_videoram;
+ UINT8 *videoram = m_videoram.get();
UINT32 *p = &bitmap.pix32(y);
int i;
@@ -569,7 +569,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_text_blink_alt_update_row )
MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_4bppl_update_row )
{
const rgb_t *palette = m_palette->palette()->entry_list_raw();
- UINT8 *videoram = m_videoram;
+ UINT8 *videoram = m_videoram.get();
UINT32 *p = &bitmap.pix32(y);
int i;
@@ -594,7 +594,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_4bppl_update_row )
MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_4bpph_update_row )
{
- UINT8 *videoram = m_videoram;
+ UINT8 *videoram = m_videoram.get();
const rgb_t *palette = m_palette->palette()->entry_list_raw();
UINT32 *p = &bitmap.pix32(y);
int i;
@@ -628,7 +628,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_4bpph_update_row )
MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_2bpp_update_row )
{
- UINT8 *videoram = m_videoram;
+ UINT8 *videoram = m_videoram.get();
const rgb_t *palette = m_palette->palette()->entry_list_raw();
UINT32 *p = &bitmap.pix32(y);
int i;
@@ -654,7 +654,7 @@ MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_2bpp_update_row )
MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_1bpp_update_row )
{
- UINT8 *videoram = m_videoram;
+ UINT8 *videoram = m_videoram.get();
const rgb_t *palette = m_palette->palette()->entry_list_raw();
UINT32 *p = &bitmap.pix32(y);
UINT8 fg = m_cga_color_select & 0x0F;
diff --git a/src/devices/bus/isa/aga.h b/src/devices/bus/isa/aga.h
index 5ed2e560287..c0c80ac29bb 100644
--- a/src/devices/bus/isa/aga.h
+++ b/src/devices/bus/isa/aga.h
@@ -93,7 +93,7 @@ public:
UINT8 m_cga_palette_lut_2bpp[4];
- UINT8 *m_videoram;
+ std::unique_ptr<UINT8[]> m_videoram;
};
// device type definition
diff --git a/src/devices/bus/isa/mda.cpp b/src/devices/bus/isa/mda.cpp
index 713891a5186..c8456886f02 100644
--- a/src/devices/bus/isa/mda.cpp
+++ b/src/devices/bus/isa/mda.cpp
@@ -799,15 +799,15 @@ void isa8_ec1840_0002_device::device_start()
{
isa8_mda_device::device_start();
- m_soft_chr_gen = auto_alloc_array(machine(), UINT8, 0x2000);
- m_isa->install_bank(0xdc000, 0xddfff, 0, 0x2000, "bank_chargen", m_soft_chr_gen);
+ m_soft_chr_gen = std::make_unique<UINT8[]>(0x2000);
+ m_isa->install_bank(0xdc000, 0xddfff, 0, 0x2000, "bank_chargen", m_soft_chr_gen.get());
}
void isa8_ec1840_0002_device::device_reset()
{
isa8_mda_device::device_reset();
- m_chr_gen = m_soft_chr_gen;
+ m_chr_gen = m_soft_chr_gen.get();
}
diff --git a/src/devices/bus/isa/mda.h b/src/devices/bus/isa/mda.h
index cba94767b40..c6cf72b29ad 100644
--- a/src/devices/bus/isa/mda.h
+++ b/src/devices/bus/isa/mda.h
@@ -120,7 +120,7 @@ protected:
virtual void device_reset() override;
public:
- UINT8 *m_soft_chr_gen;
+ std::unique_ptr<UINT8[]> m_soft_chr_gen;
};
diff --git a/src/devices/bus/isa/pgc.cpp b/src/devices/bus/isa/pgc.cpp
index f551a0fc2ec..c22631d405b 100644
--- a/src/devices/bus/isa/pgc.cpp
+++ b/src/devices/bus/isa/pgc.cpp
@@ -237,14 +237,14 @@ void isa8_pgc_device::device_start()
m_palette->set_pen_color( i, 0, 0, 0 );
}
- m_bitmap = auto_bitmap_ind16_alloc(machine(), width, height);
+ m_bitmap = std::make_unique<bitmap_ind16>(width, height);
m_bitmap->fill(0);
- m_vram = auto_alloc_array(machine(), UINT8, 0x78000);
+ m_vram = std::make_unique<UINT8[]>(0x78000);
space.install_readwrite_bank(0x80000, 0xf7fff, "vram");
- membank("vram")->set_base(m_vram);
+ membank("vram")->set_base(m_vram.get());
- m_eram = auto_alloc_array(machine(), UINT8, 0x8000);
+ m_eram = std::make_unique<UINT8[]>(0x8000);
machine().add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(isa8_pgc_device::reset_common), this));
}
@@ -325,7 +325,7 @@ READ8_MEMBER( isa8_pgc_device::init_r ) {
DBG_LOG(1,"INIT",("mapping emulator RAM\n"));
space.install_readwrite_bank(0xf8000, 0xfffff, "eram");
- membank("eram")->set_base(m_eram);
+ membank("eram")->set_base(m_eram.get());
DBG_LOG(1,"INIT",("mapping LUT\n"));
space.install_write_handler(0xf8400, 0xf85ff,
diff --git a/src/devices/bus/isa/pgc.h b/src/devices/bus/isa/pgc.h
index 45eb4bfb25a..cf83eb8ae1d 100644
--- a/src/devices/bus/isa/pgc.h
+++ b/src/devices/bus/isa/pgc.h
@@ -55,11 +55,11 @@ private:
required_device<palette_device> m_palette;
UINT8 *m_commarea;
- UINT8 *m_vram;
- UINT8 *m_eram;
+ std::unique_ptr<UINT8[]> m_vram;
+ std::unique_ptr<UINT8[]> m_eram;
UINT8 m_stateparam[16];
UINT8 m_lut[256*3];
- bitmap_ind16 *m_bitmap;
+ std::unique_ptr<bitmap_ind16> m_bitmap;
};
diff --git a/src/devices/bus/macpds/pds_tpdfpd.cpp b/src/devices/bus/macpds/pds_tpdfpd.cpp
index 968eed3564f..f89a210888f 100644
--- a/src/devices/bus/macpds/pds_tpdfpd.cpp
+++ b/src/devices/bus/macpds/pds_tpdfpd.cpp
@@ -115,10 +115,10 @@ void macpds_sedisplay_device::device_start()
install_rom(this, SEDISPLAY_ROM_REGION, 0xc00000);
install_rom(this, SEDISPLAY_ROM_REGION, 0xf80000);
- m_vram = auto_alloc_array(machine(), UINT8, VRAM_SIZE);
+ m_vram = std::make_unique<UINT8[]>(VRAM_SIZE);
static const char bankname[] = { "radpds_ram" };
- m_macpds->install_bank(0xc40000, 0xc40000+VRAM_SIZE-1, 0, 0, bankname, m_vram);
+ m_macpds->install_bank(0xc40000, 0xc40000+VRAM_SIZE-1, 0, 0, bankname, m_vram.get());
m_macpds->install_device(0x770000, 0x77000f, read16_delegate(FUNC(macpds_sedisplay_device::ramdac_r), this), write16_delegate(FUNC(macpds_sedisplay_device::ramdac_w), this));
m_macpds->install_device(0xc10000, 0xc2ffff, read16_delegate(FUNC(macpds_sedisplay_device::sedisplay_r), this), write16_delegate(FUNC(macpds_sedisplay_device::sedisplay_w), this));
@@ -136,7 +136,7 @@ void macpds_sedisplay_device::device_reset()
m_count = 0;
m_clutoffs = 0;
m_vbl_disable = 1;
- memset(m_vram, 0, VRAM_SIZE);
+ memset(m_vram.get(), 0, VRAM_SIZE);
memset(m_palette, 0, sizeof(m_palette));
m_palette[0] = rgb_t(0, 0, 0);
@@ -166,7 +166,7 @@ UINT32 macpds_sedisplay_device::screen_update(screen_device &screen, bitmap_rgb3
int x, y;
UINT8 pixels, *vram;
- vram = m_vram;
+ vram = m_vram.get();
for (y = 0; y < 870; y++)
{
diff --git a/src/devices/bus/macpds/pds_tpdfpd.h b/src/devices/bus/macpds/pds_tpdfpd.h
index 0adf48c2765..218c30f959b 100644
--- a/src/devices/bus/macpds/pds_tpdfpd.h
+++ b/src/devices/bus/macpds/pds_tpdfpd.h
@@ -41,7 +41,7 @@ protected:
DECLARE_WRITE16_MEMBER(ramdac_w);
public:
- UINT8 *m_vram;
+ std::unique_ptr<UINT8[]> m_vram;
UINT32 m_vbl_disable;
UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs;
emu_timer *m_timer;
diff --git a/src/devices/bus/nes/disksys.cpp b/src/devices/bus/nes/disksys.cpp
index e89429dc0c4..d517b7d4a67 100644
--- a/src/devices/bus/nes/disksys.cpp
+++ b/src/devices/bus/nes/disksys.cpp
@@ -416,11 +416,11 @@ void nes_disksys_device::load_disk(device_image_interface &image)
m_fds_sides = (image.length() - header) / 65500;
if (!m_fds_data)
- m_fds_data = auto_alloc_array(machine(), UINT8, m_fds_sides * 65500);
+ m_fds_data = std::make_unique<UINT8[]>(m_fds_sides * 65500);
// if there is an header, skip it
image.fseek(header, SEEK_SET);
- image.fread(m_fds_data, 65500 * m_fds_sides);
+ image.fread(m_fds_data.get(), 65500 * m_fds_sides);
return;
}
diff --git a/src/devices/bus/nes/disksys.h b/src/devices/bus/nes/disksys.h
index 821cfb5614b..7dbefa37ee4 100644
--- a/src/devices/bus/nes/disksys.h
+++ b/src/devices/bus/nes/disksys.h
@@ -38,7 +38,7 @@ public:
private:
UINT8 *m_2c33_rom;
- UINT8 *m_fds_data; // here, we store a copy of the disk
+ std::unique_ptr<UINT8[]> m_fds_data; // here, we store a copy of the disk
required_device<legacy_floppy_image_device> m_disk;
static const device_timer_id TIMER_IRQ = 0;
diff --git a/src/devices/bus/snes/sdd1.cpp b/src/devices/bus/snes/sdd1.cpp
index 56376641705..f3282b27b84 100644
--- a/src/devices/bus/snes/sdd1.cpp
+++ b/src/devices/bus/snes/sdd1.cpp
@@ -428,7 +428,7 @@ void sns_rom_sdd1_device::device_start()
{
m_sdd1emu = auto_alloc(machine(), SDD1_emu(machine()));
- m_buffer.data = (UINT8*)auto_alloc_array(machine(), UINT8, 0x10000);
+ m_buffer.data = std::make_unique<UINT8[]>(0x10000);
m_buffer.ready = 0;
save_item(NAME(m_sdd1_enable));
@@ -441,7 +441,7 @@ void sns_rom_sdd1_device::device_start()
save_item(NAME(m_dma[i].size), i);
}
- save_pointer(NAME(m_buffer.data), 0x10000);
+ save_pointer(NAME(m_buffer.data.get()), 0x10000);
save_item(NAME(m_buffer.offset));
save_item(NAME(m_buffer.size));
save_item(NAME(m_buffer.ready));
@@ -567,7 +567,7 @@ UINT8 sns_rom_sdd1_device::read_helper(UINT32 addr)
// SDD1_emu calls this function; it needs to access uncompressed data;
// so temporarily disable decompression mode for decompress() call.
- m_sdd1emu->SDD1emu_decompress(m_rom, m_mmc, addr, m_buffer.size, m_buffer.data);
+ m_sdd1emu->SDD1emu_decompress(m_rom, m_mmc, addr, m_buffer.size, m_buffer.data.get());
m_buffer.ready = 1;
}
diff --git a/src/devices/bus/snes/sdd1.h b/src/devices/bus/snes/sdd1.h
index 24e8ecaf47a..6524a043b68 100644
--- a/src/devices/bus/snes/sdd1.h
+++ b/src/devices/bus/snes/sdd1.h
@@ -180,7 +180,7 @@ public:
struct
{
- UINT8 *data; // pointer to decompressed S-DD1 data (65536 bytes)
+ std::unique_ptr<UINT8[]> data; // pointer to decompressed S-DD1 data (65536 bytes)
UINT16 offset; // read index into S-DD1 decompression buffer
UINT32 size; // length of data buffer; reads decrement counter, set ready to false at 0
UINT8 ready; // 1 when data[] is valid; 0 to invoke sdd1emu.decompress()
diff --git a/src/devices/bus/snes/spc7110.cpp b/src/devices/bus/snes/spc7110.cpp
index a6ebbdab2df..0c7cc797316 100644
--- a/src/devices/bus/snes/spc7110.cpp
+++ b/src/devices/bus/snes/spc7110.cpp
@@ -300,7 +300,7 @@ static const UINT8 spc7110_mode2_context_table[32][2] =
SPC7110_Decomp::SPC7110_Decomp(running_machine &machine)
: m_machine(machine)
{
- m_decomp_buffer = (UINT8*)auto_alloc_array(machine, UINT8, SPC7110_DECOMP_BUFFER_SIZE);
+ m_decomp_buffer = std::make_unique<UINT8[]>(SPC7110_DECOMP_BUFFER_SIZE);
reset();
for (int i = 0; i < 256; i++)
@@ -325,7 +325,7 @@ SPC7110_Decomp::SPC7110_Decomp(running_machine &machine)
m_machine.save().save_item(m_decomp_mode, "SNES_SPC7110/m_decomp_mode");
m_machine.save().save_item(m_decomp_offset, "SNES_SPC7110/m_decomp_offset");
- m_machine.save().save_pointer(m_decomp_buffer, "SNES_SPC7110/m_decomp_buffer", SPC7110_DECOMP_BUFFER_SIZE);
+ m_machine.save().save_pointer(m_decomp_buffer.get(), "SNES_SPC7110/m_decomp_buffer", SPC7110_DECOMP_BUFFER_SIZE);
m_machine.save().save_item(m_decomp_buffer_rdoffset, "SNES_SPC7110/m_decomp_buffer_rdoffset");
m_machine.save().save_item(m_decomp_buffer_wroffset, "SNES_SPC7110/m_decomp_buffer_wroffset");
m_machine.save().save_item(m_decomp_buffer_length, "SNES_SPC7110/m_decomp_buffer_length");
diff --git a/src/devices/bus/snes/spc7110.h b/src/devices/bus/snes/spc7110.h
index ba356790d2f..7dd3710cc5d 100644
--- a/src/devices/bus/snes/spc7110.h
+++ b/src/devices/bus/snes/spc7110.h
@@ -50,7 +50,7 @@ private:
UINT32 m_decomp_mode;
UINT32 m_decomp_offset;
- UINT8 *m_decomp_buffer;
+ std::unique_ptr<UINT8[]> m_decomp_buffer;
UINT32 m_decomp_buffer_rdoffset;
UINT32 m_decomp_buffer_wroffset;
UINT32 m_decomp_buffer_length;
diff --git a/src/devices/cpu/alto2/a2disp.cpp b/src/devices/cpu/alto2/a2disp.cpp
index 82b0e083cf8..aedc0096f3a 100644
--- a/src/devices/cpu/alto2/a2disp.cpp
+++ b/src/devices/cpu/alto2/a2disp.cpp
@@ -286,7 +286,7 @@ void alto2_cpu_device::unload_word()
m_unload_time = -1;
return;
}
- UINT16* bitmap = m_dsp.raw_bitmap + y * ALTO2_DISPLAY_SCANLINE_WORDS;
+ UINT16* bitmap = m_dsp.raw_bitmap.get() + y * ALTO2_DISPLAY_SCANLINE_WORDS;
UINT16 word = m_dsp.inverse;
UINT8 a38 = m_disp_a38[m_dsp.ra * 16 + m_dsp.wa];
if (FIFO_MBEMPTY(a38))
@@ -532,12 +532,12 @@ void alto2_cpu_device::init_disp()
m_dsp.hlc = ALTO2_DISPLAY_HLC_START;
- m_dsp.raw_bitmap = auto_alloc_array(machine(), UINT16, ALTO2_DISPLAY_HEIGHT * ALTO2_DISPLAY_SCANLINE_WORDS);
+ m_dsp.raw_bitmap = std::make_unique<UINT16[]>(ALTO2_DISPLAY_HEIGHT * ALTO2_DISPLAY_SCANLINE_WORDS);
m_dsp.scanline = auto_alloc_array(machine(), UINT8*, ALTO2_DISPLAY_HEIGHT + ALTO2_FAKE_STATUS_H);
for (int y = 0; y < ALTO2_DISPLAY_HEIGHT + ALTO2_FAKE_STATUS_H; y++)
m_dsp.scanline[y] = auto_alloc_array(machine(), UINT8, ALTO2_DISPLAY_TOTAL_WIDTH);
- m_dsp.bitmap = auto_bitmap_ind16_alloc(machine(), ALTO2_DISPLAY_WIDTH, ALTO2_DISPLAY_HEIGHT + ALTO2_FAKE_STATUS_H);
+ m_dsp.bitmap = std::make_unique<bitmap_ind16>(ALTO2_DISPLAY_WIDTH, ALTO2_DISPLAY_HEIGHT + ALTO2_FAKE_STATUS_H);
m_dsp.state = 0;
}
@@ -567,7 +567,7 @@ void alto2_cpu_device::reset_disp()
m_dsp.curxpos = 0;
m_dsp.cursor0 = 0;
m_dsp.cursor1 = 0;
- memset(m_dsp.raw_bitmap, 0, sizeof(UINT16) * ALTO2_DISPLAY_HEIGHT * ALTO2_DISPLAY_SCANLINE_WORDS);
+ memset(m_dsp.raw_bitmap.get(), 0, sizeof(UINT16) * ALTO2_DISPLAY_HEIGHT * ALTO2_DISPLAY_SCANLINE_WORDS);
for (int y = 0; y < ALTO2_DISPLAY_HEIGHT; y++)
memset(m_dsp.scanline[y], 0, sizeof(UINT8) * ALTO2_DISPLAY_TOTAL_WIDTH);
m_dsp.odd_frame = false;
diff --git a/src/devices/cpu/alto2/a2disp.h b/src/devices/cpu/alto2/a2disp.h
index 80454eb4896..a8f4568f29d 100644
--- a/src/devices/cpu/alto2/a2disp.h
+++ b/src/devices/cpu/alto2/a2disp.h
@@ -192,9 +192,9 @@ struct {
UINT32 curxpos; //!< helper: first cursor word in scanline
UINT16 cursor0; //!< helper: shifted cursor data for left word
UINT16 cursor1; //!< helper: shifted cursor data for right word
- UINT16 *raw_bitmap; //!< array of words of the raw bitmap that is displayed
+ std::unique_ptr<UINT16[]> raw_bitmap; //!< array of words of the raw bitmap that is displayed
UINT8 **scanline; //!< array of scanlines with 1 byte per pixel
- bitmap_ind16 *bitmap; //!< MAME bitmap with 16 bit indices
+ std::unique_ptr<bitmap_ind16> bitmap; //!< MAME bitmap with 16 bit indices
bool odd_frame; //!< true, if odd frame is drawn
} m_dsp;
diff --git a/src/devices/cpu/alto2/a2ether.cpp b/src/devices/cpu/alto2/a2ether.cpp
index 2cd38bb48c6..c3fd5a5c87a 100644
--- a/src/devices/cpu/alto2/a2ether.cpp
+++ b/src/devices/cpu/alto2/a2ether.cpp
@@ -600,7 +600,7 @@ void alto2_cpu_device::bs_early_eidfct()
m_eth.rx_packet[m_eth.rx_count] = r;
m_eth.rx_count++;
if (ALTO2_ETHER_PACKET_SIZE == m_eth.rx_count) {
- dump_packet(this,"RX", m_eth.rx_packet, 0, m_eth.rx_count);
+ dump_packet(this,"RX", m_eth.rx_packet.get(), 0, m_eth.rx_count);
m_eth.rx_count = 0;
}
#endif
@@ -709,7 +709,7 @@ void alto2_cpu_device::f2_late_eodfct()
m_eth.tx_packet[m_eth.tx_count] = m_bus;
m_eth.tx_count++;
if (ALTO2_ETHER_PACKET_SIZE == m_eth.tx_count) {
- dump_packet(this,"TX", m_eth.tx_packet, 0, m_eth.tx_count);
+ dump_packet(this,"TX", m_eth.tx_packet.get(), 0, m_eth.tx_count);
m_eth.tx_count = 0;
}
#endif
@@ -1338,8 +1338,8 @@ void alto2_cpu_device::init_ether(int task)
m_active_callback[task] = &alto2_cpu_device::activate_eth;
- m_eth.rx_packet = auto_alloc_array(machine(), UINT16, sizeof(UINT16)*ALTO2_ETHER_PACKET_SIZE);
- m_eth.tx_packet = auto_alloc_array(machine(), UINT16, sizeof(UINT16)*ALTO2_ETHER_PACKET_SIZE);
+ m_eth.rx_packet = std::make_unique<UINT16[]>(sizeof(UINT16)*ALTO2_ETHER_PACKET_SIZE);
+ m_eth.tx_packet = std::make_unique<UINT16[]>(sizeof(UINT16)*ALTO2_ETHER_PACKET_SIZE);
m_eth.tx_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(alto2_cpu_device::tx_packet),this));
m_eth.tx_timer->reset();
diff --git a/src/devices/cpu/alto2/a2ether.h b/src/devices/cpu/alto2/a2ether.h
index 6bdbd24ce3e..484bd187f8c 100644
--- a/src/devices/cpu/alto2/a2ether.h
+++ b/src/devices/cpu/alto2/a2ether.h
@@ -57,8 +57,8 @@ struct {
UINT16 tx_crc; //!< transmitter CRC
UINT32 rx_count; //!< received words count
UINT32 tx_count; //!< transmitted words count
- UINT16* rx_packet; //!< buffer to collect received words
- UINT16* tx_packet; //!< buffer to collect transmitted words
+ std::unique_ptr<UINT16[]> rx_packet; //!< buffer to collect received words
+ std::unique_ptr<UINT16[]> tx_packet; //!< buffer to collect transmitted words
emu_timer* rx_timer; //!< receiver timer
emu_timer* tx_timer; //!< transmitter timer
jkff_t ff_10a; //!< JK flip-flop 10a IBUSY (Sheet 13)
diff --git a/src/devices/cpu/alto2/a2ram.cpp b/src/devices/cpu/alto2/a2ram.cpp
index 425f3f60634..159415d0605 100644
--- a/src/devices/cpu/alto2/a2ram.cpp
+++ b/src/devices/cpu/alto2/a2ram.cpp
@@ -10,11 +10,11 @@
#define DEBUG_WRTRAM 0 //!< define to 1 to printf disassembled CRAM writes
//! direct read access to the microcode CRAM
-#define RD_CRAM(addr) (*reinterpret_cast<UINT32 *>(m_ucode_cram + addr * 4))
+#define RD_CRAM(addr) (*reinterpret_cast<UINT32 *>(m_ucode_cram.get() + addr * 4))
//! direct write access to the microcode CRAM
#define WR_CRAM(addr,data) do { \
- *reinterpret_cast<UINT32 *>(m_ucode_cram + addr * 4) = data; \
+ *reinterpret_cast<UINT32 *>(m_ucode_cram.get() + addr * 4) = data; \
} while (0)
/**
diff --git a/src/devices/cpu/alto2/alto2cpu.cpp b/src/devices/cpu/alto2/alto2cpu.cpp
index 382732044ca..6b35a076ec3 100644
--- a/src/devices/cpu/alto2/alto2cpu.cpp
+++ b/src/devices/cpu/alto2/alto2cpu.cpp
@@ -819,10 +819,10 @@ void alto2_cpu_device::device_start()
m_ucode_crom = prom_load(machine(), pl_ucode, memregion("ucode_proms")->base(), ALTO2_UCODE_ROM_PAGES, 8);
// allocate micro code CRAM
- m_ucode_cram = auto_alloc_array(machine(), UINT8, sizeof(UINT32) * ALTO2_UCODE_RAM_PAGES * ALTO2_UCODE_PAGE_SIZE);
+ m_ucode_cram = std::make_unique<UINT8[]>(sizeof(UINT32) * ALTO2_UCODE_RAM_PAGES * ALTO2_UCODE_PAGE_SIZE);
// fill with the micro code inverted bits value
for (offs_t offset = 0; offset < ALTO2_UCODE_RAM_PAGES * ALTO2_UCODE_PAGE_SIZE; offset++)
- *reinterpret_cast<UINT32 *>(m_ucode_cram + offset * 4) = ALTO2_UCODE_INVERTED;
+ *reinterpret_cast<UINT32 *>(m_ucode_cram.get() + offset * 4) = ALTO2_UCODE_INVERTED;
// decode constant PROMs to m_const_data
m_const_data = prom_load(machine(), pl_const, memregion("const_proms")->base(), 1, 4);
@@ -1028,13 +1028,13 @@ READ32_MEMBER ( alto2_cpu_device::crom_r )
//! read microcode CRAM
READ32_MEMBER ( alto2_cpu_device::cram_r )
{
- return *reinterpret_cast<UINT32 *>(m_ucode_cram + offset * 4);
+ return *reinterpret_cast<UINT32 *>(m_ucode_cram.get() + offset * 4);
}
//! write microcode CRAM
WRITE32_MEMBER( alto2_cpu_device::cram_w )
{
- *reinterpret_cast<UINT32 *>(m_ucode_cram + offset * 4) = data;
+ *reinterpret_cast<UINT32 *>(m_ucode_cram.get() + offset * 4) = data;
}
//! read constants PROM
@@ -1046,7 +1046,7 @@ READ16_MEMBER ( alto2_cpu_device::const_r )
//! direct read access to the microcode CROM or CRAM
#define RD_UCODE(addr) (addr < ALTO2_UCODE_RAM_BASE ? \
*reinterpret_cast<UINT32 *>(m_ucode_crom + addr * 4) : \
- *reinterpret_cast<UINT32 *>(m_ucode_cram + (addr - ALTO2_UCODE_RAM_BASE) * 4))
+ *reinterpret_cast<UINT32 *>(m_ucode_cram.get() + (addr - ALTO2_UCODE_RAM_BASE) * 4))
//-------------------------------------------------
// device_reset - device-specific reset
diff --git a/src/devices/cpu/alto2/alto2cpu.h b/src/devices/cpu/alto2/alto2cpu.h
index daa66d81658..11208dbae83 100644
--- a/src/devices/cpu/alto2/alto2cpu.h
+++ b/src/devices/cpu/alto2/alto2cpu.h
@@ -231,7 +231,7 @@ private:
address_space* m_iomem;
UINT8* m_ucode_crom;
- UINT8* m_ucode_cram;
+ std::unique_ptr<UINT8[]> m_ucode_cram;
UINT8* m_const_data;
//! read microcode CROM
diff --git a/src/devices/cpu/i386/cycles.h b/src/devices/cpu/i386/cycles.h
index a04e54da8e0..62b6da2a80a 100644
--- a/src/devices/cpu/i386/cycles.h
+++ b/src/devices/cpu/i386/cycles.h
@@ -333,7 +333,6 @@ enum X86_CYCLES
};
-#define X86_NUM_CPUS 4
#define CPU_CYCLES_I386 0
#define CPU_CYCLES_I486 1
#define CPU_CYCLES_PENTIUM 2
diff --git a/src/devices/cpu/i386/i386.cpp b/src/devices/cpu/i386/i386.cpp
index 9017ffbaea7..77623b8f7d4 100644
--- a/src/devices/cpu/i386/i386.cpp
+++ b/src/devices/cpu/i386/i386.cpp
@@ -2769,9 +2769,6 @@ void i386_device::i386_protected_mode_iret(int operand32)
#include "cycles.h"
-static UINT8 *cycle_table_rm[X86_NUM_CPUS];
-static UINT8 *cycle_table_pm[X86_NUM_CPUS];
-
#define CYCLES_NUM(x) (m_cycles -= (x))
void i386_device::CYCLES(int x)
@@ -2817,8 +2814,8 @@ void i386_device::build_cycle_table()
int i, j;
for (j=0; j < X86_NUM_CPUS; j++)
{
- cycle_table_rm[j] = auto_alloc_array(machine(), UINT8, CYCLES_NUM_OPCODES);
- cycle_table_pm[j] = auto_alloc_array(machine(), UINT8, CYCLES_NUM_OPCODES);
+ cycle_table_rm[j] = std::make_unique<UINT8[]>(CYCLES_NUM_OPCODES);
+ cycle_table_pm[j] = std::make_unique<UINT8[]>(CYCLES_NUM_OPCODES);
for (i=0; i < sizeof(x86_cycle_table)/sizeof(X86_CYCLE_TABLE); i++)
{
@@ -3300,8 +3297,8 @@ void i386_device::device_start()
i386_common_init(32);
build_opcode_table(OP_I386);
- m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_I386];
- m_cycle_table_pm = cycle_table_pm[CPU_CYCLES_I386];
+ m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_I386].get();
+ m_cycle_table_pm = cycle_table_pm[CPU_CYCLES_I386].get();
register_state_i386();
}
@@ -3983,8 +3980,8 @@ void i486_device::device_start()
build_opcode_table(OP_I386 | OP_FPU | OP_I486);
build_x87_opcode_table();
- m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_I486];
- m_cycle_table_pm = cycle_table_pm[CPU_CYCLES_I486];
+ m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_I486].get();
+ m_cycle_table_pm = cycle_table_pm[CPU_CYCLES_I486].get();
register_state_i386_x87();
}
@@ -4042,8 +4039,8 @@ void pentium_device::device_start()
build_opcode_table(OP_I386 | OP_FPU | OP_I486 | OP_PENTIUM);
build_x87_opcode_table();
- m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_PENTIUM];
- m_cycle_table_pm = cycle_table_pm[CPU_CYCLES_PENTIUM];
+ m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_PENTIUM].get();
+ m_cycle_table_pm = cycle_table_pm[CPU_CYCLES_PENTIUM].get();
}
void pentium_device::device_reset()
@@ -4116,8 +4113,8 @@ void mediagx_device::device_start()
build_x87_opcode_table();
build_opcode_table(OP_I386 | OP_FPU | OP_I486 | OP_PENTIUM | OP_CYRIX);
- m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_MEDIAGX];
- m_cycle_table_pm = cycle_table_pm[CPU_CYCLES_MEDIAGX];
+ m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_MEDIAGX].get();
+ m_cycle_table_pm = cycle_table_pm[CPU_CYCLES_MEDIAGX].get();
}
void mediagx_device::device_reset()
@@ -4181,8 +4178,8 @@ void pentium_pro_device::device_start()
build_x87_opcode_table();
build_opcode_table(OP_I386 | OP_FPU | OP_I486 | OP_PENTIUM | OP_PPRO);
- m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
- m_cycle_table_pm = cycle_table_pm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
+ m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_PENTIUM].get(); // TODO: generate own cycle tables
+ m_cycle_table_pm = cycle_table_pm[CPU_CYCLES_PENTIUM].get(); // TODO: generate own cycle tables
}
void pentium_pro_device::device_reset()
@@ -4256,8 +4253,8 @@ void pentium_mmx_device::device_start()
build_x87_opcode_table();
build_opcode_table(OP_I386 | OP_FPU | OP_I486 | OP_PENTIUM | OP_MMX);
- m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
- m_cycle_table_pm = cycle_table_pm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
+ m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_PENTIUM].get(); // TODO: generate own cycle tables
+ m_cycle_table_pm = cycle_table_pm[CPU_CYCLES_PENTIUM].get(); // TODO: generate own cycle tables
}
void pentium_mmx_device::device_reset()
@@ -4329,8 +4326,8 @@ void pentium2_device::device_start()
build_x87_opcode_table();
build_opcode_table(OP_I386 | OP_FPU | OP_I486 | OP_PENTIUM | OP_PPRO | OP_MMX);
- m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
- m_cycle_table_pm = cycle_table_pm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
+ m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_PENTIUM].get(); // TODO: generate own cycle tables
+ m_cycle_table_pm = cycle_table_pm[CPU_CYCLES_PENTIUM].get(); // TODO: generate own cycle tables
}
void pentium2_device::device_reset()
@@ -4396,8 +4393,8 @@ void pentium3_device::device_start()
build_x87_opcode_table();
build_opcode_table(OP_I386 | OP_FPU | OP_I486 | OP_PENTIUM | OP_PPRO | OP_MMX | OP_SSE);
- m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
- m_cycle_table_pm = cycle_table_pm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
+ m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_PENTIUM].get(); // TODO: generate own cycle tables
+ m_cycle_table_pm = cycle_table_pm[CPU_CYCLES_PENTIUM].get(); // TODO: generate own cycle tables
}
void pentium3_device::device_reset()
@@ -4465,8 +4462,8 @@ void pentium4_device::device_start()
build_x87_opcode_table();
build_opcode_table(OP_I386 | OP_FPU | OP_I486 | OP_PENTIUM | OP_PPRO | OP_MMX | OP_SSE | OP_SSE2);
- m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
- m_cycle_table_pm = cycle_table_pm[CPU_CYCLES_PENTIUM]; // TODO: generate own cycle tables
+ m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_PENTIUM].get(); // TODO: generate own cycle tables
+ m_cycle_table_pm = cycle_table_pm[CPU_CYCLES_PENTIUM].get(); // TODO: generate own cycle tables
}
void pentium4_device::device_reset()
diff --git a/src/devices/cpu/i386/i386.h b/src/devices/cpu/i386/i386.h
index 60eea10264d..ed2cf432ee3 100644
--- a/src/devices/cpu/i386/i386.h
+++ b/src/devices/cpu/i386/i386.h
@@ -22,6 +22,7 @@
#define MCFG_I386_SMIACT(_devcb) \
i386_device::set_smiact(*device, DEVCB_##_devcb);
+#define X86_NUM_CPUS 4
class i386_device : public cpu_device
{
@@ -68,6 +69,10 @@ protected:
address_space_config m_program_config;
address_space_config m_io_config;
+ std::unique_ptr<UINT8[]> cycle_table_rm[X86_NUM_CPUS];
+ std::unique_ptr<UINT8[]> cycle_table_pm[X86_NUM_CPUS];
+
+
union I386_GPR {
UINT32 d[8];
UINT16 w[16];
diff --git a/src/devices/cpu/z180/z180.cpp b/src/devices/cpu/z180/z180.cpp
index 5a76f81ae76..214062cfe79 100644
--- a/src/devices/cpu/z180/z180.cpp
+++ b/src/devices/cpu/z180/z180.cpp
@@ -755,8 +755,8 @@ static UINT8 SZP[256]; /* zero, sign and parity flags */
static UINT8 SZHV_inc[256]; /* zero, sign, half carry and overflow flags INC r8 */
static UINT8 SZHV_dec[256]; /* zero, sign, half carry and overflow flags DEC r8 */
-static UINT8 *SZHVC_add;
-static UINT8 *SZHVC_sub;
+static std::unique_ptr<UINT8[]> SZHVC_add;
+static std::unique_ptr<UINT8[]> SZHVC_sub;
#include "z180ops.h"
#include "z180tbl.h"
@@ -1894,8 +1894,8 @@ void z180_device::device_start()
}
/* allocate big flag arrays once */
- SZHVC_add = auto_alloc_array(machine(), UINT8, 2*256*256);
- SZHVC_sub = auto_alloc_array(machine(), UINT8, 2*256*256);
+ SZHVC_add = std::make_unique<UINT8[]>(2*256*256);
+ SZHVC_sub = std::make_unique<UINT8[]>(2*256*256);
padd = &SZHVC_add[ 0*256];
padc = &SZHVC_add[256*256];
diff --git a/src/devices/machine/akiko.cpp b/src/devices/machine/akiko.cpp
index 0c7ef441ad2..85df5f0d66d 100644
--- a/src/devices/machine/akiko.cpp
+++ b/src/devices/machine/akiko.cpp
@@ -187,10 +187,10 @@ void akiko_device::device_reset()
m_cdrom_numtracks = cdrom_get_last_track(m_cdrom)+3;
- m_cdrom_toc = auto_alloc_array(machine(), UINT8, 13*m_cdrom_numtracks);
- memset( m_cdrom_toc, 0, 13*m_cdrom_numtracks);
+ m_cdrom_toc = std::make_unique<UINT8[]>(13*m_cdrom_numtracks);
+ memset( m_cdrom_toc.get(), 0, 13*m_cdrom_numtracks);
- p = m_cdrom_toc;
+ p = m_cdrom_toc.get();
p[1] = ((addrctrl & 0x0f) << 4) | ((addrctrl & 0xf0) >> 4);
p[3] = 0xa0; /* first track */
p[8] = 1;
diff --git a/src/devices/machine/akiko.h b/src/devices/machine/akiko.h
index 6886a4073a4..3fd1b586fb6 100644
--- a/src/devices/machine/akiko.h
+++ b/src/devices/machine/akiko.h
@@ -113,7 +113,7 @@ private:
cdda_device *m_cdda;
cdrom_file *m_cdrom;
- UINT8 *m_cdrom_toc;
+ std::unique_ptr<UINT8[]> m_cdrom_toc;
emu_timer *m_dma_timer;
emu_timer *m_frame_timer;
diff --git a/src/devices/machine/diablo_hd.cpp b/src/devices/machine/diablo_hd.cpp
index f067acd4742..f833cf54504 100644
--- a/src/devices/machine/diablo_hd.cpp
+++ b/src/devices/machine/diablo_hd.cpp
@@ -87,7 +87,6 @@ diablo_hd_device::diablo_hd_device(const machine_config &mconfig, const char *ta
m_head(-1),
m_sector(-1),
m_page(-1),
- m_cache(nullptr),
m_bits(nullptr),
m_rdfirst(-1),
m_rdlast(-1),
@@ -310,13 +309,12 @@ void diablo_hd_device::read_sector()
if (m_disk) {
// allocate a buffer for this page
- m_cache[m_page] = auto_alloc_array(machine(), UINT8, sizeof(diablo_sector_t));
+ m_cache[m_page] = std::make_unique<UINT8[]>(sizeof(diablo_sector_t));
// and read the page from the hard_disk image
- if (hard_disk_read(m_disk, m_page, m_cache[m_page])) {
+ if (hard_disk_read(m_disk, m_page, m_cache[m_page].get())) {
LOG_DRIVE((2,"[DHD%u] CHS:%03d/%d/%02d => page:%d loaded\n", m_unit, m_cylinder, m_head, m_sector, m_page));
} else {
LOG_DRIVE((0,"[DHD%u] CHS:%03d/%d/%02d => page:%d read failed\n", m_unit, m_cylinder, m_head, m_sector, m_page));
- auto_free(machine(), m_cache[m_page]);
m_cache[m_page] = nullptr;
}
} else {
@@ -442,7 +440,7 @@ UINT32* diablo_hd_device::expand_sector()
LOG_DRIVE((0,"[DHD%u] no image for page #%d\n", m_unit, m_page));
return nullptr;
}
- diablo_sector_t *s = reinterpret_cast<diablo_sector_t *>(m_cache[m_page]);
+ diablo_sector_t *s = reinterpret_cast<diablo_sector_t *>(m_cache[m_page].get());
/* allocate a bits image */
UINT32 *bits = auto_alloc_array_clear(machine(), UINT32, 400);
@@ -727,7 +725,7 @@ void diablo_hd_device::squeeze_sector()
UINT32 *bits = m_bits[m_page];
// pointer to sector buffer
- s = reinterpret_cast<diablo_sector_t *>(m_cache[m_page]);
+ s = reinterpret_cast<diablo_sector_t *>(m_cache[m_page].get());
// zap the sector first
memset(s, 0, sizeof(*s));
@@ -778,7 +776,7 @@ void diablo_hd_device::squeeze_sector()
m_bits[m_page] = nullptr;
if (m_disk) {
- if (!hard_disk_write(m_disk, m_page, m_cache[m_page])) {
+ if (!hard_disk_write(m_disk, m_page, m_cache[m_page].get())) {
LOG_DRIVE((0,"[DHD%u] write failed for page #%d\n", m_unit, m_page));
}
} else {
@@ -1334,9 +1332,7 @@ void diablo_hd_device::device_reset()
if (m_cache) {
for (int page = 0; page < m_pages; page++)
if (m_cache[page])
- auto_free(machine(), m_cache[page]);
- auto_free(machine(), m_cache);
- m_cache = nullptr;
+ m_cache[page] = nullptr;
}
// free previous bits cache
if (m_bits) {
@@ -1406,7 +1402,6 @@ void diablo_hd_device::device_reset()
if (!m_handle)
return;
// for units with a CHD assigned to them start the timer
- m_cache = auto_alloc_array_clear(machine(), UINT8*, m_pages);
m_bits = auto_alloc_array_clear(machine(), UINT32*, m_pages);
timer_set(m_sector_time - m_sector_mark_0_time, 1, 0);
read_sector();
diff --git a/src/devices/machine/diablo_hd.h b/src/devices/machine/diablo_hd.h
index 19b1b5c776b..c3fadd2a073 100644
--- a/src/devices/machine/diablo_hd.h
+++ b/src/devices/machine/diablo_hd.h
@@ -108,7 +108,7 @@ private:
int m_head; //!< current head (track) number on cylinder
int m_sector; //!< current sector number in track
int m_page; //!< current page (derived from cylinder, head and sector)
- UINT8** m_cache; //!< pages raw bytes
+ std::unique_ptr<UINT8[]> m_cache[2 * DIABLO_PAGES]; //!< pages raw bytes
UINT32** m_bits; //!< pages expanded to bits
int m_rdfirst; //!< set to first bit of a sector that is read from
int m_rdlast; //!< set to last bit of a sector that was read from
diff --git a/src/devices/machine/s3c2400.h b/src/devices/machine/s3c2400.h
index 5c8b6d3dcb9..fbd2e5e70d4 100644
--- a/src/devices/machine/s3c2400.h
+++ b/src/devices/machine/s3c2400.h
@@ -769,7 +769,7 @@ public:
{
s3c24xx_lcd_regs_t regs;
emu_timer *timer;
- bitmap_rgb32 *bitmap[2];
+ std::unique_ptr<bitmap_rgb32> bitmap[2];
UINT32 vramaddr_cur;
UINT32 vramaddr_max;
UINT32 offsize;
diff --git a/src/devices/machine/s3c2410.h b/src/devices/machine/s3c2410.h
index 33665eabbcb..6e9b28a9146 100644
--- a/src/devices/machine/s3c2410.h
+++ b/src/devices/machine/s3c2410.h
@@ -935,7 +935,7 @@ public:
{
s3c24xx_lcd_regs_t regs;
emu_timer *timer;
- bitmap_rgb32 *bitmap[2];
+ std::unique_ptr<bitmap_rgb32> bitmap[2];
UINT32 vramaddr_cur;
UINT32 vramaddr_max;
UINT32 offsize;
diff --git a/src/devices/machine/s3c2440.h b/src/devices/machine/s3c2440.h
index 9adfce38569..58976ddcf1a 100644
--- a/src/devices/machine/s3c2440.h
+++ b/src/devices/machine/s3c2440.h
@@ -1006,7 +1006,7 @@ public:
{
s3c24xx_lcd_regs_t regs;
emu_timer *timer;
- bitmap_rgb32 *bitmap[2];
+ std::unique_ptr<bitmap_rgb32> bitmap[2];
UINT32 vramaddr_cur;
UINT32 vramaddr_max;
UINT32 offsize;
diff --git a/src/devices/machine/s3c24xx.inc b/src/devices/machine/s3c24xx.inc
index 07193f890a4..e2c4800f077 100644
--- a/src/devices/machine/s3c24xx.inc
+++ b/src/devices/machine/s3c24xx.inc
@@ -716,8 +716,8 @@ TIMER_CALLBACK_MEMBER( S3C24_CLASS_NAME::s3c24xx_lcd_timer_exp )
void S3C24_CLASS_NAME::s3c24xx_video_start()
{
screen_device *screen = machine().first_screen();
- m_lcd.bitmap[0] = auto_bitmap_rgb32_alloc(machine(), screen->width(), screen->height());
- m_lcd.bitmap[1] = auto_bitmap_rgb32_alloc(machine(), screen->width(), screen->height());
+ m_lcd.bitmap[0] = std::make_unique<bitmap_rgb32>( screen->width(), screen->height());
+ m_lcd.bitmap[1] = std::make_unique<bitmap_rgb32>( screen->width(), screen->height());
}
void S3C24_CLASS_NAME::bitmap_blend( bitmap_rgb32 &bitmap_dst, bitmap_rgb32 &bitmap_src_1, bitmap_rgb32 &bitmap_src_2)
diff --git a/src/devices/machine/s3c44b0.cpp b/src/devices/machine/s3c44b0.cpp
index 37402f900b0..19579a1aa03 100644
--- a/src/devices/machine/s3c44b0.cpp
+++ b/src/devices/machine/s3c44b0.cpp
@@ -387,7 +387,7 @@ void s3c44b0_device::lcd_dma_read(int count, UINT8 *data)
void s3c44b0_device::lcd_render_stn_04()
{
- UINT8 *bitmap = m_lcd.bitmap + ((m_lcd.vpos - m_lcd.vpos_min) * (m_lcd.hpos_max - m_lcd.hpos_min + 1)) + (m_lcd.hpos - m_lcd.hpos_min);
+ UINT8 *bitmap = m_lcd.bitmap.get() + ((m_lcd.vpos - m_lcd.vpos_min) * (m_lcd.hpos_max - m_lcd.hpos_min + 1)) + (m_lcd.hpos - m_lcd.hpos_min);
UINT8 data[16];
lcd_dma_read(16, data);
for (auto & elem : data)
@@ -403,7 +403,7 @@ void s3c44b0_device::lcd_render_stn_04()
if (m_lcd.vpos > m_lcd.vpos_max)
{
m_lcd.vpos = m_lcd.vpos_min;
- bitmap = m_lcd.bitmap;
+ bitmap = m_lcd.bitmap.get();
}
m_lcd.hpos = m_lcd.hpos_min;
}
@@ -413,7 +413,7 @@ void s3c44b0_device::lcd_render_stn_04()
void s3c44b0_device::lcd_render_stn_08()
{
- UINT8 *bitmap = m_lcd.bitmap + ((m_lcd.vpos - m_lcd.vpos_min) * (m_lcd.hpos_max - m_lcd.hpos_min + 1)) + (m_lcd.hpos - m_lcd.hpos_min);
+ UINT8 *bitmap = m_lcd.bitmap.get() + ((m_lcd.vpos - m_lcd.vpos_min) * (m_lcd.hpos_max - m_lcd.hpos_min + 1)) + (m_lcd.hpos - m_lcd.hpos_min);
UINT8 data[16];
lcd_dma_read(16, data);
for (auto & elem : data)
@@ -432,7 +432,7 @@ void s3c44b0_device::lcd_render_stn_08()
if (m_lcd.vpos > m_lcd.vpos_max)
{
m_lcd.vpos = m_lcd.vpos_min;
- bitmap = m_lcd.bitmap;
+ bitmap = m_lcd.bitmap.get();
}
m_lcd.hpos = m_lcd.hpos_min;
}
@@ -510,7 +510,7 @@ UINT32 s3c44b0_device::video_update(screen_device &screen, bitmap_rgb32 &bitmap,
for (int y = 0; y < screen.height(); y++)
{
UINT32 *scanline = &bitmap.pix32(y);
- UINT8 *vram = m_lcd.bitmap + y * (m_lcd.hpos_max - m_lcd.hpos_min + 1);
+ UINT8 *vram = m_lcd.bitmap.get() + y * (m_lcd.hpos_max - m_lcd.hpos_min + 1);
for (int x = 0; x < screen.width(); x++)
{
*scanline++ = rgb_t(vram[0], vram[1], vram[2]);
@@ -596,9 +596,9 @@ void s3c44b0_device::lcd_configure()
verboselog( *this, 3, "LCD - min_x %d min_y %d max_x %d max_y %d\n", m_lcd.hpos_min, m_lcd.vpos_min, m_lcd.hpos_max, m_lcd.vpos_max);
if (m_lcd.bitmap)
{
- auto_free(machine(), m_lcd.bitmap);
+ m_lcd.bitmap = nullptr;
}
- m_lcd.bitmap = auto_alloc_array(machine(), UINT8, (m_lcd.hpos_max - m_lcd.hpos_min + 1) * (m_lcd.vpos_max - m_lcd.vpos_min + 1) * 3);
+ m_lcd.bitmap = std::make_unique<UINT8[]>((m_lcd.hpos_max - m_lcd.hpos_min + 1) * (m_lcd.vpos_max - m_lcd.vpos_min + 1) * 3);
m_lcd.frame_period = HZ_TO_ATTOSECONDS(m_lcd.framerate);
m_lcd.scantime = m_lcd.frame_period / m_lcd.vpos_end;
m_lcd.pixeltime = m_lcd.frame_period / (m_lcd.vpos_end * m_lcd.hpos_end);
diff --git a/src/devices/machine/s3c44b0.h b/src/devices/machine/s3c44b0.h
index cdf1fe6d72e..05b0c134532 100644
--- a/src/devices/machine/s3c44b0.h
+++ b/src/devices/machine/s3c44b0.h
@@ -505,7 +505,7 @@ struct s3c44b0_lcd_t
{
s3c44b0_lcd_regs_t regs;
emu_timer *timer;
- UINT8 *bitmap;
+ std::unique_ptr<UINT8[]> bitmap;
UINT32 vramaddr_cur;
UINT32 vramaddr_max;
UINT32 offsize;
diff --git a/src/devices/machine/smpc.cpp b/src/devices/machine/smpc.cpp
index caf0834da5a..fcbda532e27 100644
--- a/src/devices/machine/smpc.cpp
+++ b/src/devices/machine/smpc.cpp
@@ -214,8 +214,8 @@ TIMER_CALLBACK_MEMBER( saturn_state::smpc_cd_enable )
void saturn_state::smpc_system_reset()
{
/*Only backup ram and SMPC ram are retained after that this command is issued.*/
- memset(m_scu_regs ,0x00,0x000100);
- memset(m_scsp_regs,0x00,0x001000);
+ memset(m_scu_regs.get() ,0x00,0x000100);
+ memset(m_scsp_regs.get(),0x00,0x001000);
memset(m_sound_ram,0x00,0x080000);
memset(m_workram_h,0x00,0x100000);
memset(m_workram_l,0x00,0x100000);
diff --git a/src/devices/machine/strata.cpp b/src/devices/machine/strata.cpp
index 01651eb90bd..4f7006f4d99 100644
--- a/src/devices/machine/strata.cpp
+++ b/src/devices/machine/strata.cpp
@@ -59,7 +59,7 @@ strataflash_device::strataflash_device(const machine_config &mconfig, const char
void strataflash_device::nvram_default()
{
- memset(m_flashmemory, 0, COMPLETE_SIZE);
+ memset(m_flashmemory.get(), 0, COMPLETE_SIZE);
}
//-------------------------------------------------
@@ -69,7 +69,7 @@ void strataflash_device::nvram_default()
void strataflash_device::nvram_read(emu_file &file)
{
- file.read(m_flashmemory, COMPLETE_SIZE);
+ file.read(m_flashmemory.get(), COMPLETE_SIZE);
// TODO
@@ -173,7 +173,7 @@ void strataflash_device::nvram_write(emu_file &file)
return 0;
*/
- file.write(m_flashmemory, COMPLETE_SIZE);
+ file.write(m_flashmemory.get(), COMPLETE_SIZE);
}
//-------------------------------------------------
@@ -184,15 +184,15 @@ void strataflash_device::device_start(void)
m_mode = FM_NORMAL;
m_status = 0x80;
m_master_lock = 0;
- m_flashmemory = auto_alloc_array(machine(), UINT8, COMPLETE_SIZE);
+ m_flashmemory = std::make_unique<UINT8[]>(COMPLETE_SIZE);
- m_wrbuf = m_flashmemory + FEEPROM_SIZE;
+ m_wrbuf = m_flashmemory.get() + FEEPROM_SIZE;
m_prot_regs = m_wrbuf + WRBUF_SIZE;
m_blocklock = m_prot_regs + PROT_REGS_SIZE;
// clear various FEEPROM areas
memset(m_prot_regs, 0xff, 18);
- memset(m_flashmemory, 0xff, FEEPROM_SIZE);
+ memset(m_flashmemory.get(), 0xff, FEEPROM_SIZE);
memset(m_blocklock, 0x00, BLOCKLOCK_SIZE);
// set-up factory-programmed protection register segment
@@ -234,7 +234,7 @@ UINT16 strataflash_device::read8_16(address_space& space, offs_t offset, bus_wid
case bw_8:
return m_flashmemory[BYTE_XOR_LE(offset)];
case bw_16:
- return *(UINT16*)(m_flashmemory+offset);
+ return *(UINT16*)(m_flashmemory.get()+offset);
}
break;
case FM_READSTATUS:
@@ -562,7 +562,7 @@ void strataflash_device::write8_16(address_space& space, offs_t offset, UINT16 d
m_flashmemory[BYTE_XOR_LE(offset)] &= data;
break;
case bw_16:
- *(UINT16*)(m_flashmemory+offset) &= data;
+ *(UINT16*)(m_flashmemory.get()+offset) &= data;
break;
}
}
diff --git a/src/devices/machine/strata.h b/src/devices/machine/strata.h
index 1d1835f0812..5092d1e891e 100644
--- a/src/devices/machine/strata.h
+++ b/src/devices/machine/strata.h
@@ -64,7 +64,7 @@ private:
int m_wrbuf_len; // count converted into byte length in write buffer command
int m_wrbuf_count; // current count in write buffer command
UINT8* m_wrbuf; // write buffer used by write buffer command
- UINT8* m_flashmemory; // main FEEPROM area
+ std::unique_ptr<UINT8[]> m_flashmemory; // main FEEPROM area
UINT8* m_blocklock; // block lock flags
UINT8* m_prot_regs; // protection registers
};
diff --git a/src/devices/sound/c140.cpp b/src/devices/sound/c140.cpp
index 6e5ff8321bf..daaa33cd47e 100644
--- a/src/devices/sound/c140.cpp
+++ b/src/devices/sound/c140.cpp
@@ -132,8 +132,8 @@ void c140_device::device_start()
}
/* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */
- m_mixer_buffer_left = auto_alloc_array(machine(), INT16, 2 * m_sample_rate);
- m_mixer_buffer_right = m_mixer_buffer_left + m_sample_rate;
+ m_mixer_buffer_left = std::make_unique<INT16[]>(m_sample_rate);
+ m_mixer_buffer_right = std::make_unique<INT16[]>(m_sample_rate);;
save_item(NAME(m_REG));
@@ -181,8 +181,8 @@ void c140_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
if(samples>m_sample_rate) samples=m_sample_rate;
/* zap the contents of the mixer buffer */
- memset(m_mixer_buffer_left, 0, samples * sizeof(INT16));
- memset(m_mixer_buffer_right, 0, samples * sizeof(INT16));
+ memset(m_mixer_buffer_left.get(), 0, samples * sizeof(INT16));
+ memset(m_mixer_buffer_right.get(), 0, samples * sizeof(INT16));
/* get the number of voices to update */
voicecnt = (m_banking_type == C140_TYPE_ASIC219) ? 16 : 24;
@@ -208,8 +208,8 @@ void c140_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
rvol=(vreg->volume_right*32)/C140_MAX_VOICE;
/* Set mixer outputs base pointers */
- lmix = m_mixer_buffer_left;
- rmix = m_mixer_buffer_right;
+ lmix = m_mixer_buffer_left.get();
+ rmix = m_mixer_buffer_right.get();
/* Retrieve sample start/end and calculate size */
st=v->sample_start;
@@ -342,8 +342,8 @@ void c140_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
}
/* render to MAME's stream buffer */
- lmix = m_mixer_buffer_left;
- rmix = m_mixer_buffer_right;
+ lmix = m_mixer_buffer_left.get();
+ rmix = m_mixer_buffer_right.get();
{
stream_sample_t *dest1 = outputs[0];
stream_sample_t *dest2 = outputs[1];
diff --git a/src/devices/sound/c140.h b/src/devices/sound/c140.h
index 899045d03af..d94818e9df7 100644
--- a/src/devices/sound/c140.h
+++ b/src/devices/sound/c140.h
@@ -106,8 +106,8 @@ private:
sound_stream *m_stream;
int m_banking_type;
/* internal buffers */
- INT16 *m_mixer_buffer_left;
- INT16 *m_mixer_buffer_right;
+ std::unique_ptr<INT16[]> m_mixer_buffer_left;
+ std::unique_ptr<INT16[]> m_mixer_buffer_right;
int m_baserate;
INT8 *m_pRom;
diff --git a/src/devices/sound/cdda.cpp b/src/devices/sound/cdda.cpp
index 5bd6746e9d7..3223142a062 100644
--- a/src/devices/sound/cdda.cpp
+++ b/src/devices/sound/cdda.cpp
@@ -29,7 +29,7 @@ void cdda_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
void cdda_device::device_start()
{
/* allocate an audio cache */
- m_audio_cache = auto_alloc_array( machine(), UINT8, CD_MAX_SECTOR_DATA * MAX_SECTORS );
+ m_audio_cache = std::make_unique<UINT8[]>(CD_MAX_SECTOR_DATA * MAX_SECTORS );
m_stream = machine().sound().stream_alloc(*this, 0, 2, 44100);
@@ -47,7 +47,7 @@ void cdda_device::device_start()
save_item( NAME(m_audio_ended_normally) );
save_item( NAME(m_audio_lba) );
save_item( NAME(m_audio_length) );
- save_pointer( NAME(m_audio_cache), CD_MAX_SECTOR_DATA * MAX_SECTORS );
+ save_pointer( NAME(m_audio_cache.get()), CD_MAX_SECTOR_DATA * MAX_SECTORS );
save_item( NAME(m_audio_samples) );
save_item( NAME(m_audio_bptr) );
}
@@ -161,7 +161,7 @@ int cdda_device::audio_ended()
void cdda_device::get_audio_data(stream_sample_t *bufL, stream_sample_t *bufR, UINT32 samples_wanted)
{
int i;
- INT16 *audio_cache = (INT16 *) m_audio_cache;
+ INT16 *audio_cache = (INT16 *) m_audio_cache.get();
while (samples_wanted > 0)
{
diff --git a/src/devices/sound/cdda.h b/src/devices/sound/cdda.h
index 4e6da29919e..2d9b6d86584 100644
--- a/src/devices/sound/cdda.h
+++ b/src/devices/sound/cdda.h
@@ -46,7 +46,7 @@ private:
INT8 m_audio_playing, m_audio_pause, m_audio_ended_normally;
UINT32 m_audio_lba, m_audio_length;
- UINT8 * m_audio_cache;
+ std::unique_ptr<UINT8[]> m_audio_cache;
UINT32 m_audio_samples;
UINT32 m_audio_bptr;
INT16 m_audio_volume[2];
diff --git a/src/devices/sound/cem3394.cpp b/src/devices/sound/cem3394.cpp
index c64b2539482..5d345fa6507 100644
--- a/src/devices/sound/cem3394.cpp
+++ b/src/devices/sound/cem3394.cpp
@@ -176,7 +176,7 @@ void cem3394_device::sound_stream_update(sound_stream &stream, stream_sample_t *
INT16 last_ext = m_last_ext;
/* fetch the external data */
- m_ext_cb(samples, m_external_buffer);
+ m_ext_cb(samples, m_external_buffer.get());
/* compute the modulation depth, and adjust fstep to the maximum frequency */
/* we lop off 13 bits of depth so that we can multiply by stepadjust, below, */
@@ -187,7 +187,7 @@ void cem3394_device::sound_stream_update(sound_stream &stream, stream_sample_t *
/* "apply" the filter: note this is pretty cheesy; it basically just downsamples the
external sample to filter_freq by allowing only 2 transitions for every cycle */
- for (i = 0, ext = m_external_buffer, position = m_position; i < samples; i++, ext++)
+ for (i = 0, ext = m_external_buffer.get(), position = m_position; i < samples; i++, ext++)
{
UINT32 newposition;
INT32 stepadjust;
@@ -229,7 +229,7 @@ void cem3394_device::sound_stream_update(sound_stream &stream, stream_sample_t *
/* if the width is wider than the step, we're guaranteed to hit it once per cycle */
if (pulse_width >= step)
{
- for (i = 0, mix = m_mixer_buffer, position = m_position; i < samples; i++, mix++)
+ for (i = 0, mix = m_mixer_buffer.get(), position = m_position; i < samples; i++, mix++)
{
if (position < pulse_width)
*mix = 0x1932;
@@ -243,7 +243,7 @@ void cem3394_device::sound_stream_update(sound_stream &stream, stream_sample_t *
else
{
INT16 volume = 0x1932 * pulse_width / step;
- for (i = 0, mix = m_mixer_buffer, position = m_position; i < samples; i++, mix++)
+ for (i = 0, mix = m_mixer_buffer.get(), position = m_position; i < samples; i++, mix++)
{
UINT32 newposition = position + step;
if ((newposition ^ position) & ~FRACTION_MASK)
@@ -258,13 +258,13 @@ void cem3394_device::sound_stream_update(sound_stream &stream, stream_sample_t *
/* otherwise, clear the mixing buffer */
else
- memset(m_mixer_buffer, 0, sizeof(INT16) * samples);
+ memset(m_mixer_buffer.get(), 0, sizeof(INT16) * samples);
/* handle the sawtooth component; it maxes out at 0x2000, which is 27% larger */
/* than the pulse */
if (ENABLE_SAWTOOTH && (m_wave_select & WAVE_SAWTOOTH))
{
- for (i = 0, mix = m_mixer_buffer, position = m_position; i < samples; i++, mix++)
+ for (i = 0, mix = m_mixer_buffer.get(), position = m_position; i < samples; i++, mix++)
{
*mix += ((position >> (FRACTION_BITS - 14)) & 0x3fff) - 0x2000;
position += step;
@@ -277,7 +277,7 @@ void cem3394_device::sound_stream_update(sound_stream &stream, stream_sample_t *
/* a multiplication) */
if (ENABLE_TRIANGLE && (m_wave_select & WAVE_TRIANGLE))
{
- for (i = 0, mix = m_mixer_buffer, position = m_position; i < samples; i++, mix++)
+ for (i = 0, mix = m_mixer_buffer.get(), position = m_position; i < samples; i++, mix++)
{
INT16 value;
if (position & (1 << (FRACTION_BITS - 1)))
@@ -295,8 +295,8 @@ void cem3394_device::sound_stream_update(sound_stream &stream, stream_sample_t *
}
/* mix it down */
- mix = m_mixer_buffer;
- ext = m_external_buffer;
+ mix = m_mixer_buffer.get();
+ ext = m_external_buffer.get();
{
/* internal + external */
if (ext_volume != 0 && int_volume != 0)
@@ -336,8 +336,8 @@ void cem3394_device::device_start()
m_ext_cb.bind_relative_to(*owner());
/* allocate memory for a mixer buffer and external buffer (1 second should do it!) */
- m_mixer_buffer = auto_alloc_array(machine(), INT16, m_sample_rate);
- m_external_buffer = auto_alloc_array(machine(), INT16, m_sample_rate);
+ m_mixer_buffer = std::make_unique<INT16[]>(m_sample_rate);
+ m_external_buffer = std::make_unique<INT16[]>(m_sample_rate);
save_item(NAME(m_values));
save_item(NAME(m_wave_select));
diff --git a/src/devices/sound/cem3394.h b/src/devices/sound/cem3394.h
index 188ad9b069f..88d2608bec1 100644
--- a/src/devices/sound/cem3394.h
+++ b/src/devices/sound/cem3394.h
@@ -107,8 +107,8 @@ private:
double m_inv_sample_rate;
int m_sample_rate;
- INT16 *m_mixer_buffer;
- INT16 *m_external_buffer;
+ std::unique_ptr<INT16[]> m_mixer_buffer;
+ std::unique_ptr<INT16[]> m_external_buffer;
};
extern const device_type CEM3394;
diff --git a/src/devices/sound/k005289.cpp b/src/devices/sound/k005289.cpp
index dc349b7e211..b49d97b1555 100644
--- a/src/devices/sound/k005289.cpp
+++ b/src/devices/sound/k005289.cpp
@@ -77,7 +77,7 @@ void k005289_device::device_start()
m_stream = stream_alloc(0, 1, m_rate);
/* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */
- m_mixer_buffer = auto_alloc_array(machine(), short, 2 * m_rate);
+ m_mixer_buffer = std::make_unique<short[]>(2 * m_rate);
/* build the mixer table */
make_mixer_table(2);
@@ -113,7 +113,7 @@ void k005289_device::sound_stream_update(sound_stream &stream, stream_sample_t *
int i,v,f;
/* zap the contents of the mixer buffer */
- memset(m_mixer_buffer, 0, samples * sizeof(INT16));
+ memset(m_mixer_buffer.get(), 0, samples * sizeof(INT16));
v=m_volume[0];
f=m_frequency[0];
@@ -122,7 +122,7 @@ void k005289_device::sound_stream_update(sound_stream &stream, stream_sample_t *
const unsigned char *w = m_sound_prom + m_waveform[0];
int c = m_counter[0];
- mix = m_mixer_buffer;
+ mix = m_mixer_buffer.get();
/* add our contribution */
for (i = 0; i < samples; i++)
@@ -145,7 +145,7 @@ void k005289_device::sound_stream_update(sound_stream &stream, stream_sample_t *
const unsigned char *w = m_sound_prom + m_waveform[1];
int c = m_counter[1];
- mix = m_mixer_buffer;
+ mix = m_mixer_buffer.get();
/* add our contribution */
for (i = 0; i < samples; i++)
@@ -162,7 +162,7 @@ void k005289_device::sound_stream_update(sound_stream &stream, stream_sample_t *
}
/* mix it down */
- mix = m_mixer_buffer;
+ mix = m_mixer_buffer.get();
for (i = 0; i < samples; i++)
*buffer++ = m_mixer_lookup[*mix++];
}
@@ -180,10 +180,10 @@ void k005289_device::make_mixer_table(int voices)
int gain = 16;
/* allocate memory */
- m_mixer_table = auto_alloc_array(machine(), INT16, 256 * voices);
+ m_mixer_table = std::make_unique<INT16[]>(256 * voices);
/* find the middle of the table */
- m_mixer_lookup = m_mixer_table + (128 * voices);
+ m_mixer_lookup = m_mixer_table.get() + (128 * voices);
/* fill in the table - 16 bit case */
for (i = 0; i < count; i++)
diff --git a/src/devices/sound/k005289.h b/src/devices/sound/k005289.h
index 9112ca5458f..24f84638263 100644
--- a/src/devices/sound/k005289.h
+++ b/src/devices/sound/k005289.h
@@ -48,9 +48,9 @@ private:
int m_rate;
/* mixer tables and internal buffers */
- INT16 *m_mixer_table;
+ std::unique_ptr<INT16[]> m_mixer_table;
INT16 *m_mixer_lookup;
- short *m_mixer_buffer;
+ std::unique_ptr<short[]> m_mixer_buffer;
UINT32 m_counter[2];
UINT16 m_frequency[2];
diff --git a/src/devices/sound/k051649.cpp b/src/devices/sound/k051649.cpp
index 05c8fffae3f..dde61572d44 100644
--- a/src/devices/sound/k051649.cpp
+++ b/src/devices/sound/k051649.cpp
@@ -69,7 +69,7 @@ void k051649_device::device_start()
m_mclock = clock();
// allocate a buffer to mix into - 1 second's worth should be more than enough
- m_mixer_buffer = auto_alloc_array(machine(), short, 2 * m_rate);
+ m_mixer_buffer = std::make_unique<short[]>(2 * m_rate);
// build the mixer table
make_mixer_table(5);
@@ -111,7 +111,7 @@ void k051649_device::sound_stream_update(sound_stream &stream, stream_sample_t *
int i,j;
// zap the contents of the mixer buffer
- memset(m_mixer_buffer, 0, samples * sizeof(short));
+ memset(m_mixer_buffer.get(), 0, samples * sizeof(short));
for (j = 0; j < 5; j++)
{
@@ -123,7 +123,7 @@ void k051649_device::sound_stream_update(sound_stream &stream, stream_sample_t *
int c=voice[j].counter;
int step = ((INT64)m_mclock * (1 << FREQ_BITS)) / (float)((voice[j].frequency + 1) * 16 * (m_rate / 32)) + 0.5f;
- mix = m_mixer_buffer;
+ mix = m_mixer_buffer.get();
// add our contribution
for (i = 0; i < samples; i++)
@@ -141,7 +141,7 @@ void k051649_device::sound_stream_update(sound_stream &stream, stream_sample_t *
}
// mix it down
- mix = m_mixer_buffer;
+ mix = m_mixer_buffer.get();
for (i = 0; i < samples; i++)
*buffer++ = m_mixer_lookup[*mix++];
}
@@ -272,10 +272,10 @@ void k051649_device::make_mixer_table(int voices)
int i;
// allocate memory
- m_mixer_table = auto_alloc_array(machine(), INT16, 512 * voices);
+ m_mixer_table = std::make_unique<INT16[]>(512 * voices);
// find the middle of the table
- m_mixer_lookup = m_mixer_table + (256 * voices);
+ m_mixer_lookup = m_mixer_table.get() + (256 * voices);
// fill in the table - 16 bit case
for (i = 0; i < (voices * 256); i++)
diff --git a/src/devices/sound/k051649.h b/src/devices/sound/k051649.h
index 4fec1b7659f..f5e4997f02c 100644
--- a/src/devices/sound/k051649.h
+++ b/src/devices/sound/k051649.h
@@ -81,9 +81,9 @@ private:
int m_rate;
/* mixer tables and internal buffers */
- INT16 *m_mixer_table;
+ std::unique_ptr<INT16[]> m_mixer_table;
INT16 *m_mixer_lookup;
- short *m_mixer_buffer;
+ std::unique_ptr<short[]> m_mixer_buffer;
/* chip registers */
UINT8 m_test;
diff --git a/src/devices/sound/k054539.cpp b/src/devices/sound/k054539.cpp
index e619e53a0bd..5270f5b80d6 100644
--- a/src/devices/sound/k054539.cpp
+++ b/src/devices/sound/k054539.cpp
@@ -105,7 +105,7 @@ void k054539_device::sound_stream_update(sound_stream &stream, stream_sample_t *
};
- INT16 *rbase = (INT16 *)ram;
+ INT16 *rbase = (INT16 *)ram.get();
if(!(regs[0x22f] & 1))
return;
@@ -306,10 +306,10 @@ void k054539_device::init_chip()
memset(posreg_latch, 0, sizeof(posreg_latch)); //*
flags |= UPDATE_AT_KEYON; //* make it default until proven otherwise
- ram = auto_alloc_array(machine(), unsigned char, 0x4000);
+ ram = std::make_unique<UINT8[]>(0x4000);
reverb_pos = 0;
cur_ptr = 0;
- memset(ram, 0, 0x4000);
+ memset(ram.get(), 0, 0x4000);
memory_region *reg = (m_rgnoverride != nullptr) ? owner()->memregion(m_rgnoverride) : region();
rom = reg->base();
@@ -324,7 +324,7 @@ void k054539_device::init_chip()
stream = stream_alloc(0, 2, clock() / 384);
save_item(NAME(regs));
- save_pointer(NAME(ram), 0x4000);
+ save_pointer(NAME(ram.get()), 0x4000);
save_item(NAME(cur_ptr));
}
@@ -428,7 +428,7 @@ WRITE8_MEMBER(k054539_device::write)
case 0x22e:
cur_zone =
- data == 0x80 ? ram :
+ data == 0x80 ? ram.get() :
rom + 0x20000*data;
cur_limit = data == 0x80 ? 0x4000 : 0x20000;
cur_ptr = 0;
@@ -466,7 +466,7 @@ WRITE8_MEMBER(k054539_device::write)
void k054539_device::device_post_load()
{
int data = regs[0x22e];
- cur_zone = data == 0x80 ? ram : rom + 0x20000*data;
+ cur_zone = data == 0x80 ? ram.get() : rom + 0x20000*data;
cur_limit = data == 0x80 ? 0x4000 : 0x20000;
}
diff --git a/src/devices/sound/k054539.h b/src/devices/sound/k054539.h
index dea41388837..fd196d306b8 100644
--- a/src/devices/sound/k054539.h
+++ b/src/devices/sound/k054539.h
@@ -94,7 +94,7 @@ private:
int flags;
unsigned char regs[0x230];
- unsigned char *ram;
+ std::unique_ptr<UINT8[]> ram;
int reverb_pos;
INT32 cur_ptr;
diff --git a/src/devices/sound/mos6560.cpp b/src/devices/sound/mos6560.cpp
index 61ca40f5829..f7c31e96ea9 100644
--- a/src/devices/sound/mos6560.cpp
+++ b/src/devices/sound/mos6560.cpp
@@ -626,7 +626,7 @@ void mos6560_device::sound_start()
/* buffer for fastest played sample for 5 second so we have enough data for min 5 second */
m_noisesize = NOISE_FREQUENCY_MAX * NOISE_BUFFER_SIZE_SEC;
- m_noise = auto_alloc_array(machine(), INT8, m_noisesize);
+ m_noise = std::make_unique<INT8[]>(m_noisesize);
{
int noiseshift = 0x7ffff8;
char data;
@@ -661,7 +661,7 @@ void mos6560_device::sound_start()
if (m_tonesize > 0)
{
- m_tone = auto_alloc_array(machine(), INT16, m_tonesize);
+ m_tone = std::make_unique<INT16[]>(m_tonesize);
for (i = 0; i < m_tonesize; i++)
{
diff --git a/src/devices/sound/mos6560.h b/src/devices/sound/mos6560.h
index c5259f72659..d84897027d5 100644
--- a/src/devices/sound/mos6560.h
+++ b/src/devices/sound/mos6560.h
@@ -223,8 +223,8 @@ protected:
m_noisesamples; /* count of samples to give out per tone */
sound_stream *m_channel;
- INT16 *m_tone;
- INT8 *m_noise;
+ std::unique_ptr<INT16[]> m_tone;
+ std::unique_ptr<INT8[]> m_noise;
emu_timer *m_line_timer;
};
diff --git a/src/devices/sound/mos7360.cpp b/src/devices/sound/mos7360.cpp
index 1be8535b417..6478d931111 100644
--- a/src/devices/sound/mos7360.cpp
+++ b/src/devices/sound/mos7360.cpp
@@ -297,7 +297,7 @@ void mos7360_device::device_start()
// buffer for fastest played sample for 5 second so we have enough data for min 5 second
m_noisesize = NOISE_FREQUENCY_MAX * NOISE_BUFFER_SIZE_SEC;
- m_noise = auto_alloc_array(machine(), UINT8, m_noisesize);
+ m_noise = std::make_unique<UINT8[]>(m_noisesize);
{
int noiseshift = 0x7ffff8;
diff --git a/src/devices/sound/mos7360.h b/src/devices/sound/mos7360.h
index f1d755981b2..cba7b398762 100644
--- a/src/devices/sound/mos7360.h
+++ b/src/devices/sound/mos7360.h
@@ -185,7 +185,7 @@ protected:
double m_rastertime;
/* sound part */
- UINT8 *m_noise;
+ std::unique_ptr<UINT8[]> m_noise;
int m_tone1pos, m_tone2pos,
m_tone1samples, m_tone2samples,
m_noisesize, /* number of samples */
diff --git a/src/devices/sound/segapcm.cpp b/src/devices/sound/segapcm.cpp
index 8e92167c708..5ad1c6d7ebb 100644
--- a/src/devices/sound/segapcm.cpp
+++ b/src/devices/sound/segapcm.cpp
@@ -37,9 +37,9 @@ void segapcm_device::device_start()
{
int mask, rom_mask;
- m_ram = auto_alloc_array(machine(), UINT8, 0x800);
+ m_ram = std::make_unique<UINT8[]>(0x800);
- memset(m_ram, 0xff, 0x800);
+ memset(m_ram.get(), 0xff, 0x800);
m_bankshift = (UINT8) m_bank;
mask = m_bank >> 16;
@@ -54,7 +54,7 @@ void segapcm_device::device_start()
m_stream = stream_alloc(0, 2, clock() / 128);
save_item(NAME(m_low));
- save_pointer(NAME(m_ram), 0x800);
+ save_pointer(NAME(m_ram.get()), 0x800);
}
@@ -92,7 +92,7 @@ void segapcm_device::sound_stream_update(sound_stream &stream, stream_sample_t *
/* loop over channels */
for (int ch = 0; ch < 16; ch++)
{
- UINT8 *regs = m_ram+8*ch;
+ UINT8 *regs = m_ram.get()+8*ch;
/* only process active channels */
if (!(regs[0x86]&1))
diff --git a/src/devices/sound/segapcm.h b/src/devices/sound/segapcm.h
index a56a9062688..48474134b46 100644
--- a/src/devices/sound/segapcm.h
+++ b/src/devices/sound/segapcm.h
@@ -56,7 +56,7 @@ protected:
private:
required_region_ptr<UINT8> m_rom;
- UINT8* m_ram;
+ std::unique_ptr<UINT8[]> m_ram;
UINT8 m_low[16];
int m_bank;
int m_bankshift;
diff --git a/src/devices/sound/sid.cpp b/src/devices/sound/sid.cpp
index d040702eeae..a2a406c13d6 100644
--- a/src/devices/sound/sid.cpp
+++ b/src/devices/sound/sid.cpp
@@ -19,8 +19,8 @@
#include "sidenvel.h"
#include "sid.h"
-static float *filterTable;
-static float *bandPassParam;
+static std::unique_ptr<float[]> filterTable;
+static std::unique_ptr<float[]> bandPassParam;
#define lowPassParam filterTable
static float filterResTable[16];
@@ -168,8 +168,8 @@ static void filterTableInit(running_machine &machine)
float resDyMin;
float resDy;
- filterTable = auto_alloc_array(machine, float, 0x800);
- bandPassParam = auto_alloc_array(machine, float, 0x800);
+ filterTable = std::make_unique<float[]>(0x800);
+ bandPassParam = std::make_unique<float[]>(0x800);
uk = 0;
for ( rk = 0; rk < 0x800; rk++ )
diff --git a/src/devices/sound/sidvoice.cpp b/src/devices/sound/sidvoice.cpp
index 3104f69d680..33f4039891a 100644
--- a/src/devices/sound/sidvoice.cpp
+++ b/src/devices/sound/sidvoice.cpp
@@ -23,7 +23,7 @@ static const UINT8* waveform70;
static UINT8 noiseTableLSB[1<<8];
#endif
-static INT8* ampMod1x8;
+static std::unique_ptr<INT8[]> ampMod1x8;
static const UINT32 noiseSeed = 0x7ffff8;
@@ -35,7 +35,7 @@ void sidInitMixerEngine(running_machine &machine)
/* 8-bit volume modulation tables. */
float filterAmpl = 0.7f;
- ampMod1x8=auto_alloc_array(machine, INT8, 256*256);
+ ampMod1x8=std::make_unique<INT8[]>(256*256);
uk = 0;
for ( si = 0; si < 256; si++ )
diff --git a/src/devices/sound/sp0256.cpp b/src/devices/sound/sp0256.cpp
index 1ba54669ab2..9e5a95441e3 100644
--- a/src/devices/sound/sp0256.cpp
+++ b/src/devices/sound/sp0256.cpp
@@ -125,8 +125,8 @@ void sp0256_device::device_start()
/* -------------------------------------------------------------------- */
/* Allocate a scratch buffer for generating ~10kHz samples. */
/* -------------------------------------------------------------------- */
- m_scratch = auto_alloc_array(machine(), INT16, SCBUF_SIZE);
- save_pointer(NAME(m_scratch), SCBUF_SIZE);
+ m_scratch = std::make_unique<INT16[]>(SCBUF_SIZE);
+ save_pointer(NAME(m_scratch.get()), SCBUF_SIZE);
m_sc_head = m_sc_tail = 0;
@@ -1357,7 +1357,7 @@ void sp0256_device::sound_stream_update(sound_stream &stream, stream_sample_t **
else
{
did_samp += lpc12_update(&m_filt, do_samp,
- m_scratch, &m_sc_head);
+ m_scratch.get(), &m_sc_head);
}
m_sc_head &= SCBUF_MASK;
diff --git a/src/devices/sound/sp0256.h b/src/devices/sound/sp0256.h
index c1e486883d6..c7215cb4e6c 100644
--- a/src/devices/sound/sp0256.h
+++ b/src/devices/sound/sp0256.h
@@ -108,7 +108,7 @@ private:
int m_silent; /* Flag: SP0256 is silent. */
- INT16 *m_scratch; /* Scratch buffer for audio. */
+ std::unique_ptr<INT16[]> m_scratch; /* Scratch buffer for audio. */
UINT32 m_sc_head; /* Head pointer into scratch circular buf */
UINT32 m_sc_tail; /* Tail pointer into scratch circular buf */
diff --git a/src/devices/sound/ymf271.cpp b/src/devices/sound/ymf271.cpp
index 1d0eec4fa5d..81b657af7d4 100644
--- a/src/devices/sound/ymf271.cpp
+++ b/src/devices/sound/ymf271.cpp
@@ -544,12 +544,12 @@ void ymf271_device::sound_stream_update(sound_stream &stream, stream_sample_t **
int op;
INT32 *mixp;
- memset(m_mix_buffer, 0, sizeof(m_mix_buffer[0])*samples*2);
+ memset(m_mix_buffer.get(), 0, sizeof(m_mix_buffer[0])*samples*2);
for (j = 0; j < 12; j++)
{
YMF271Group *slot_group = &m_groups[j];
- mixp = m_mix_buffer;
+ mixp = m_mix_buffer.get();
if (slot_group->pfm && slot_group->sync != 3)
{
@@ -567,7 +567,7 @@ void ymf271_device::sound_stream_update(sound_stream &stream, stream_sample_t **
int slot2 = j + (1*12);
int slot3 = j + (2*12);
int slot4 = j + (3*12);
- mixp = m_mix_buffer;
+ mixp = m_mix_buffer.get();
if (m_slots[slot1].active)
{
@@ -794,7 +794,7 @@ void ymf271_device::sound_stream_update(sound_stream &stream, stream_sample_t **
int slot1 = j + ((op + 0) * 12);
int slot3 = j + ((op + 2) * 12);
- mixp = m_mix_buffer;
+ mixp = m_mix_buffer.get();
if (m_slots[slot1].active)
{
for (i = 0; i < samples; i++)
@@ -856,7 +856,7 @@ void ymf271_device::sound_stream_update(sound_stream &stream, stream_sample_t **
int slot1 = j + (0*12);
int slot2 = j + (1*12);
int slot3 = j + (2*12);
- mixp = m_mix_buffer;
+ mixp = m_mix_buffer.get();
if (m_slots[slot1].active)
{
@@ -959,7 +959,7 @@ void ymf271_device::sound_stream_update(sound_stream &stream, stream_sample_t **
}
}
- mixp = m_mix_buffer;
+ mixp = m_mix_buffer.get();
update_pcm(j + (3*12), mixp, samples);
break;
}
@@ -976,7 +976,7 @@ void ymf271_device::sound_stream_update(sound_stream &stream, stream_sample_t **
}
}
- mixp = m_mix_buffer;
+ mixp = m_mix_buffer.get();
for (i = 0; i < samples; i++)
{
outputs[0][i] = (*mixp++)>>2;
@@ -1505,13 +1505,13 @@ void ymf271_device::init_tables()
int i, j;
for (i = 0; i < 8; i++)
- m_lut_waves[i] = auto_alloc_array(machine(), INT16, SIN_LEN);
+ m_lut_waves[i] = std::make_unique<INT16[]>(SIN_LEN);
for (i = 0; i < 4*8; i++)
m_lut_plfo[i>>3][i&7] = auto_alloc_array(machine(), double, LFO_LENGTH);
for (i = 0; i < 4; i++)
- m_lut_alfo[i] = auto_alloc_array(machine(), int, LFO_LENGTH);
+ m_lut_alfo[i] = std::make_unique<int[]>(LFO_LENGTH);
for (i = 0; i < SIN_LEN; i++)
{
@@ -1717,7 +1717,7 @@ void ymf271_device::device_start()
init_state();
m_stream = machine().sound().stream_alloc(*this, 0, 2, clock()/384);
- m_mix_buffer = auto_alloc_array(machine(), INT32, 44100*2);
+ m_mix_buffer = std::make_unique<INT32[]>(44100*2);
}
//-------------------------------------------------
diff --git a/src/devices/sound/ymf271.h b/src/devices/sound/ymf271.h
index 81c59164512..d37c4895c5c 100644
--- a/src/devices/sound/ymf271.h
+++ b/src/devices/sound/ymf271.h
@@ -121,9 +121,9 @@ private:
inline bool check_envelope_end(YMF271Slot *slot);
// lookup tables
- INT16 *m_lut_waves[8];
+ std::unique_ptr<INT16[]> m_lut_waves[8];
double *m_lut_plfo[4][8];
- int *m_lut_alfo[4];
+ std::unique_ptr<int[]> m_lut_alfo[4];
double m_lut_ar[64];
double m_lut_dc[64];
double m_lut_lfo[256];
@@ -153,7 +153,7 @@ private:
emu_timer *m_timA, *m_timB;
sound_stream *m_stream;
- INT32 *m_mix_buffer;
+ std::unique_ptr<INT32[]> m_mix_buffer;
devcb_write_line m_irq_handler;
devcb_read8 m_ext_read_handler;
diff --git a/src/devices/sound/ymf278b.cpp b/src/devices/sound/ymf278b.cpp
index 160d609126d..5c696252728 100644
--- a/src/devices/sound/ymf278b.cpp
+++ b/src/devices/sound/ymf278b.cpp
@@ -231,7 +231,7 @@ void ymf278b_device::sound_stream_update(sound_stream &stream, stream_sample_t *
return;
}
- memset(m_mix_buffer, 0, sizeof(m_mix_buffer[0])*samples*2);
+ memset(m_mix_buffer.get(), 0, sizeof(m_mix_buffer[0])*samples*2);
for (i = 0; i < 24; i++)
{
@@ -239,7 +239,7 @@ void ymf278b_device::sound_stream_update(sound_stream &stream, stream_sample_t *
if (slot->active)
{
- mixp = m_mix_buffer;
+ mixp = m_mix_buffer.get();
for (j = 0; j < samples; j++)
{
@@ -299,7 +299,7 @@ void ymf278b_device::sound_stream_update(sound_stream &stream, stream_sample_t *
}
}
- mixp = m_mix_buffer;
+ mixp = m_mix_buffer.get();
vl = m_mix_level[m_pcm_l];
vr = m_mix_level[m_pcm_r];
for (i = 0; i < samples; i++)
@@ -985,7 +985,7 @@ void ymf278b_device::device_start()
}
m_stream = machine().sound().stream_alloc(*this, 0, 2, clock()/768);
- m_mix_buffer = auto_alloc_array(machine(), INT32, 44100*2);
+ m_mix_buffer = std::make_unique<INT32[]>(44100*2);
// rate tables
precompute_rate_tables();
diff --git a/src/devices/sound/ymf278b.h b/src/devices/sound/ymf278b.h
index 8037af45d82..6c750fcfd91 100644
--- a/src/devices/sound/ymf278b.h
+++ b/src/devices/sound/ymf278b.h
@@ -130,7 +130,7 @@ private:
int m_clock;
sound_stream * m_stream;
- INT32 *m_mix_buffer;
+ std::unique_ptr<INT32[]> m_mix_buffer;
direct_read_data * m_direct;
const address_space_config m_space_config;
devcb_write_line m_irq_handler;
diff --git a/src/devices/sound/ymz280b.cpp b/src/devices/sound/ymz280b.cpp
index c9c19277780..02c0283b4ae 100644
--- a/src/devices/sound/ymz280b.cpp
+++ b/src/devices/sound/ymz280b.cpp
@@ -451,7 +451,7 @@ void ymz280b_device::sound_stream_update(sound_stream &stream, stream_sample_t *
struct YMZ280BVoice *voice = &m_voice[v];
INT16 prev = voice->last_sample;
INT16 curr = voice->curr_sample;
- INT16 *curr_data = m_scratch;
+ INT16 *curr_data = m_scratch.get();
INT32 *ldest = lacc;
INT32 *rdest = racc;
UINT32 new_samples, samples_left;
@@ -496,10 +496,10 @@ void ymz280b_device::sound_stream_update(sound_stream &stream, stream_sample_t *
/* generate them into our buffer */
switch (voice->playing << 7 | voice->mode)
{
- case 0x81: samples_left = generate_adpcm(voice, m_scratch, new_samples); break;
- case 0x82: samples_left = generate_pcm8(voice, m_scratch, new_samples); break;
- case 0x83: samples_left = generate_pcm16(voice, m_scratch, new_samples); break;
- default: samples_left = 0; memset(m_scratch, 0, new_samples * sizeof(m_scratch[0])); break;
+ case 0x81: samples_left = generate_adpcm(voice, m_scratch.get(), new_samples); break;
+ case 0x82: samples_left = generate_pcm8(voice, m_scratch.get(), new_samples); break;
+ case 0x83: samples_left = generate_pcm16(voice, m_scratch.get(), new_samples); break;
+ default: samples_left = 0; memset(m_scratch.get(), 0, new_samples * sizeof(m_scratch[0])); break;
}
if (samples_left || voice->ended)
@@ -595,7 +595,7 @@ void ymz280b_device::device_start()
/* allocate memory */
assert(MAX_SAMPLE_CHUNK < 0x10000);
- m_scratch = auto_alloc_array(machine(), INT16, MAX_SAMPLE_CHUNK);
+ m_scratch = std::make_unique<INT16[]>(MAX_SAMPLE_CHUNK);
/* state save */
save_item(NAME(m_current_register));
diff --git a/src/devices/sound/ymz280b.h b/src/devices/sound/ymz280b.h
index 4f53d955499..44cd6e16665 100644
--- a/src/devices/sound/ymz280b.h
+++ b/src/devices/sound/ymz280b.h
@@ -121,7 +121,7 @@ private:
UINT8 *m_mem_base; /* pointer to the base of external memory */
UINT32 m_mem_size;
sound_stream *m_stream; /* which stream are we using */
- INT16 *m_scratch;
+ std::unique_ptr<INT16[]> m_scratch;
#if MAKE_WAVS
void *m_wavresample; /* resampled waveform */
#endif
diff --git a/src/devices/video/315_5313.cpp b/src/devices/video/315_5313.cpp
index 6a655874da4..d16874cdb59 100644
--- a/src/devices/video/315_5313.cpp
+++ b/src/devices/video/315_5313.cpp
@@ -113,24 +113,24 @@ void sega315_5313_device::device_start()
m_32x_interrupt_func.bind_relative_to(*owner());
m_32x_scanline_helper_func.bind_relative_to(*owner());
- m_vram = auto_alloc_array(machine(), UINT16, 0x10000/2);
- m_cram = auto_alloc_array(machine(), UINT16, 0x80/2);
- m_vsram = auto_alloc_array(machine(), UINT16, 0x80/2);
- m_regs = auto_alloc_array(machine(), UINT16, 0x40/2);
- m_internal_sprite_attribute_table = auto_alloc_array(machine(), UINT16, 0x400/2);
+ m_vram = std::make_unique<UINT16[]>(0x10000/2);
+ m_cram = std::make_unique<UINT16[]>(0x80/2);
+ m_vsram = std::make_unique<UINT16[]>(0x80/2);
+ m_regs = std::make_unique<UINT16[]>(0x40/2);
+ m_internal_sprite_attribute_table = std::make_unique<UINT16[]>(0x400/2);
- memset(m_vram, 0x00, 0x10000);
- memset(m_cram, 0x00, 0x80);
- memset(m_vsram, 0x00, 0x80);
- memset(m_regs, 0x00, 0x40);
- memset(m_internal_sprite_attribute_table, 0x00, 0x400);
+ memset(m_vram.get(), 0x00, 0x10000);
+ memset(m_cram.get(), 0x00, 0x80);
+ memset(m_vsram.get(), 0x00, 0x80);
+ memset(m_regs.get(), 0x00, 0x40);
+ memset(m_internal_sprite_attribute_table.get(), 0x00, 0x400);
- save_pointer(NAME(m_vram), 0x10000/2);
- save_pointer(NAME(m_cram), 0x80/2);
- save_pointer(NAME(m_vsram), 0x80/2);
- save_pointer(NAME(m_regs), 0x40/2);
- save_pointer(NAME(m_internal_sprite_attribute_table), 0x400/2);
+ save_pointer(NAME(m_vram.get()), 0x10000/2);
+ save_pointer(NAME(m_cram.get()), 0x80/2);
+ save_pointer(NAME(m_vsram.get()), 0x80/2);
+ save_pointer(NAME(m_regs.get()), 0x40/2);
+ save_pointer(NAME(m_internal_sprite_attribute_table.get()), 0x400/2);
save_item(NAME(m_command_pending));
save_item(NAME(m_command_part1));
@@ -152,42 +152,42 @@ void sega315_5313_device::device_start()
save_item(NAME(m_vblank_flag));
save_item(NAME(m_total_scanlines));
- m_sprite_renderline = auto_alloc_array(machine(), UINT8, 1024);
- m_highpri_renderline = auto_alloc_array(machine(), UINT8, 320);
- m_video_renderline = auto_alloc_array(machine(), UINT32, 320);
+ m_sprite_renderline = std::make_unique<UINT8[]>(1024);
+ m_highpri_renderline = std::make_unique<UINT8[]>(320);
+ m_video_renderline = std::make_unique<UINT32[]>(320);
- m_palette_lookup = auto_alloc_array(machine(), UINT16, 0x40);
- m_palette_lookup_sprite = auto_alloc_array(machine(), UINT16, 0x40);
+ m_palette_lookup = std::make_unique<UINT16[]>(0x40);
+ m_palette_lookup_sprite = std::make_unique<UINT16[]>(0x40);
- m_palette_lookup_shadow = auto_alloc_array(machine(), UINT16, 0x40);
- m_palette_lookup_highlight = auto_alloc_array(machine(), UINT16, 0x40);
+ m_palette_lookup_shadow = std::make_unique<UINT16[]>(0x40);
+ m_palette_lookup_highlight = std::make_unique<UINT16[]>(0x40);
- memset(m_palette_lookup,0x00,0x40*2);
- memset(m_palette_lookup_sprite,0x00,0x40*2);
+ memset(m_palette_lookup.get(),0x00,0x40*2);
+ memset(m_palette_lookup_sprite.get(),0x00,0x40*2);
- memset(m_palette_lookup_shadow,0x00,0x40*2);
- memset(m_palette_lookup_highlight,0x00,0x40*2);
+ memset(m_palette_lookup_shadow.get(),0x00,0x40*2);
+ memset(m_palette_lookup_highlight.get(),0x00,0x40*2);
if (!m_use_alt_timing)
- m_render_bitmap = auto_bitmap_ind16_alloc(machine(), 320, 512); // allocate maximum sizes we're going to use, it's safer.
+ m_render_bitmap = std::make_unique<bitmap_ind16>(320, 512); // allocate maximum sizes we're going to use, it's safer.
else
- m_render_line = auto_alloc_array(machine(), UINT16, 320);
+ m_render_line = std::make_unique<UINT16[]>(320);
- m_render_line_raw = auto_alloc_array(machine(), UINT16, 320);
+ m_render_line_raw = std::make_unique<UINT16[]>(320);
// FIXME: are these all needed? I'm pretty sure some of these (most?) are just helpers which don't need to be saved,
// but better safe than sorry...
- save_pointer(NAME(m_sprite_renderline), 1024);
- save_pointer(NAME(m_highpri_renderline), 320);
- save_pointer(NAME(m_video_renderline), 320/4);
- save_pointer(NAME(m_palette_lookup), 0x40);
- save_pointer(NAME(m_palette_lookup_sprite), 0x40);
- save_pointer(NAME(m_palette_lookup_shadow), 0x40);
- save_pointer(NAME(m_palette_lookup_highlight), 0x40);
- save_pointer(NAME(m_render_line_raw), 320/2);
+ save_pointer(NAME(m_sprite_renderline.get()), 1024);
+ save_pointer(NAME(m_highpri_renderline.get()), 320);
+ save_pointer(NAME(m_video_renderline.get()), 320/4);
+ save_pointer(NAME(m_palette_lookup.get()), 0x40);
+ save_pointer(NAME(m_palette_lookup_sprite.get()), 0x40);
+ save_pointer(NAME(m_palette_lookup_shadow.get()), 0x40);
+ save_pointer(NAME(m_palette_lookup_highlight.get()), 0x40);
+ save_pointer(NAME(m_render_line_raw.get()), 320/2);
if (m_use_alt_timing)
- save_pointer(NAME(m_render_line), 320/2);
+ save_pointer(NAME(m_render_line.get()), 320/2);
m_irq6_on_timer = machine().scheduler().timer_alloc(FUNC(irq6_on_timer_callback), (void*)this);
m_irq4_on_timer = machine().scheduler().timer_alloc(FUNC(irq4_on_timer_callback), (void*)this);
@@ -1310,7 +1310,7 @@ void sega315_5313_device::render_spriteline_to_spritebuffer(int scanline)
/* Clear our Render Buffer */
- memset(m_sprite_renderline, 0, 1024);
+ memset(m_sprite_renderline.get(), 0, 1024);
{
@@ -1517,7 +1517,7 @@ void sega315_5313_device::render_videoline_to_videobuffer(int scanline)
m_video_renderline[x]=MEGADRIVE_REG07_BGCOLOUR | 0x20000; // mark as BG
}
- memset(m_highpri_renderline, 0, 320);
+ memset(m_highpri_renderline.get(), 0, 320);
/* is this line enabled? */
if (!MEGADRIVE_REG01_DISP_ENABLE)
@@ -2518,7 +2518,7 @@ void sega315_5313_device::render_videobuffer_to_screenbuffer(int scanline)
}
else
- lineptr = m_render_line;
+ lineptr = m_render_line.get();
for (int x = 0; x < 320; x++)
{
diff --git a/src/devices/video/315_5313.h b/src/devices/video/315_5313.h
index 90f5f0a1cd2..5994d47bb47 100644
--- a/src/devices/video/315_5313.h
+++ b/src/devices/video/315_5313.h
@@ -240,9 +240,9 @@ public:
m_render_bitmap->fill(0);
}
- bitmap_ind16* m_render_bitmap;
- UINT16* m_render_line;
- UINT16* m_render_line_raw;
+ std::unique_ptr<bitmap_ind16> m_render_bitmap;
+ std::unique_ptr<UINT16[]> m_render_line;
+ std::unique_ptr<UINT16[]> m_render_line_raw;
TIMER_DEVICE_CALLBACK_MEMBER( megadriv_scanline_timer_callback_alt_timing );
TIMER_DEVICE_CALLBACK_MEMBER( megadriv_scanline_timer_callback );
@@ -294,14 +294,14 @@ private:
int m_vdp_pal;
int m_use_cram; // c2 uses it's own palette ram, so it sets this to 0
int m_dma_delay; // SVP and SegaCD have some 'lag' in DMA transfers
-
- UINT16* m_regs;
- UINT16* m_vram;
- UINT16* m_cram;
- UINT16* m_vsram;
+
+ std::unique_ptr<UINT16[]> m_regs;
+ std::unique_ptr<UINT16[]> m_vram;
+ std::unique_ptr<UINT16[]> m_cram;
+ std::unique_ptr<UINT16[]> m_vsram;
/* The VDP keeps a 0x400 byte on-chip cache of the Sprite Attribute Table
to speed up processing, Castlevania Bloodlines abuses this on the upside down level */
- UINT16* m_internal_sprite_attribute_table;
+ std::unique_ptr<UINT16[]> m_internal_sprite_attribute_table;
// these are used internally by the VDP to schedule when after the start of a scanline
// to trigger the various interrupts / rendering to our bitmap, bit of a hack really
@@ -342,13 +342,13 @@ private:
void render_videobuffer_to_screenbuffer(int scanline);
/* variables used during emulation - not saved */
- UINT8* m_sprite_renderline;
- UINT8* m_highpri_renderline;
- UINT32* m_video_renderline;
- UINT16* m_palette_lookup;
- UINT16* m_palette_lookup_sprite; // for C2
- UINT16* m_palette_lookup_shadow;
- UINT16* m_palette_lookup_highlight;
+ std::unique_ptr<UINT8[]> m_sprite_renderline;
+ std::unique_ptr<UINT8[]> m_highpri_renderline;
+ std::unique_ptr<UINT32[]> m_video_renderline;
+ std::unique_ptr<UINT16[]> m_palette_lookup;
+ std::unique_ptr<UINT16[]> m_palette_lookup_sprite; // for C2
+ std::unique_ptr<UINT16[]> m_palette_lookup_shadow;
+ std::unique_ptr<UINT16[]> m_palette_lookup_highlight;
address_space *m_space68k;
m68000_base_device* m_cpu68k;
diff --git a/src/devices/video/epic12.cpp b/src/devices/video/epic12.cpp
index fa9c8522198..fa168e5ac36 100644
--- a/src/devices/video/epic12.cpp
+++ b/src/devices/video/epic12.cpp
@@ -41,11 +41,11 @@ TIMER_CALLBACK_MEMBER( epic12_device::blitter_delay_callback )
void epic12_device::device_start()
{
m_gfx_size = 0x2000 * 0x1000;
- m_bitmaps = auto_bitmap_rgb32_alloc(machine(), 0x2000, 0x1000);
+ m_bitmaps = std::make_unique<bitmap_rgb32>( 0x2000, 0x1000);
m_clip = m_bitmaps->cliprect();
m_clip.set(0, 0x2000-1, 0, 0x1000-1);
- m_ram16_copy = auto_alloc_array(machine(), UINT16, m_main_ramsize/2);
+ m_ram16_copy = std::make_unique<UINT16[]>(m_main_ramsize/2);
m_blitter_delay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(epic12_device::blitter_delay_callback),this));
m_blitter_delay_timer->adjust(attotime::never);
@@ -60,7 +60,7 @@ void epic12_device::device_reset()
}
else
{
- m_use_ram = m_ram16_copy; // slow mode
+ m_use_ram = m_ram16_copy.get(); // slow mode
m_work_queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_HIGH_FREQ);
}
@@ -186,7 +186,7 @@ inline void epic12_device::gfx_upload(offs_t *addr)
}
}
-#define draw_params m_bitmaps, &m_clip, &m_bitmaps->pix(0,0),src_x,src_y, x,y, dimx,dimy, flipy, s_alpha, d_alpha, &tint_clr
+#define draw_params m_bitmaps.get(), &m_clip, &m_bitmaps->pix(0,0),src_x,src_y, x,y, dimx,dimy, flipy, s_alpha, d_alpha, &tint_clr
diff --git a/src/devices/video/epic12.h b/src/devices/video/epic12.h
index fac967b1a3d..5e6301b44f8 100644
--- a/src/devices/video/epic12.h
+++ b/src/devices/video/epic12.h
@@ -76,7 +76,7 @@ public:
UINT32 m_gfx_scroll_1_x, m_gfx_scroll_1_y;
int m_gfx_size;
- bitmap_rgb32 *m_bitmaps;
+ std::unique_ptr<bitmap_rgb32> m_bitmaps;
rectangle m_clip;
UINT16* m_use_ram;
@@ -95,7 +95,7 @@ public:
UINT32 m_gfx_addr_shadowcopy;
UINT32 m_gfx_scroll_0_x_shadowcopy, m_gfx_scroll_0_y_shadowcopy;
UINT32 m_gfx_scroll_1_x_shadowcopy, m_gfx_scroll_1_y_shadowcopy;
- UINT16* m_ram16_copy;
+ std::unique_ptr<UINT16[]> m_ram16_copy;
inline void gfx_upload_shadow_copy(address_space &space, offs_t *addr);
inline void gfx_create_shadow_copy(address_space &space);
inline UINT16 COPY_NEXT_WORD(address_space &space, offs_t *addr);
diff --git a/src/devices/video/fixfreq.cpp b/src/devices/video/fixfreq.cpp
index 355150ccfb6..d75232808e9 100644
--- a/src/devices/video/fixfreq.cpp
+++ b/src/devices/video/fixfreq.cpp
@@ -149,9 +149,9 @@ void fixedfreq_device::recompute_parameters(bool postload)
bool needs_realloc = (m_htotal != m_hbackporch) && (m_vtotal != m_vbackporch);
if (m_bitmap[0] != nullptr || needs_realloc)
- auto_free(machine(), m_bitmap[0]);
+ m_bitmap[0] = nullptr;
if (m_bitmap[1] != nullptr || needs_realloc)
- auto_free(machine(), m_bitmap[0]);
+ m_bitmap[1] = nullptr;
m_htotal = m_hbackporch;
m_vtotal = m_vbackporch;
@@ -162,8 +162,8 @@ void fixedfreq_device::recompute_parameters(bool postload)
m_mult = (double) (m_monitor_clock) / (double) m_htotal * 1.0; // / (3.0 + 3.0);
VERBOSE_OUT(("trigger %f with len %f\n", m_int_trig, 1e6 / m_mult));
- m_bitmap[0] = auto_bitmap_rgb32_alloc(machine(),m_htotal, m_vtotal);
- m_bitmap[1] = auto_bitmap_rgb32_alloc(machine(),m_htotal, m_vtotal);
+ m_bitmap[0] = std::make_unique<bitmap_rgb32>(m_htotal, m_vtotal);
+ m_bitmap[1] = std::make_unique<bitmap_rgb32>(m_htotal, m_vtotal);
rectangle visarea(
m_hbackporch - m_hfrontporch,
@@ -235,7 +235,7 @@ UINT32 fixedfreq_device::screen_update(screen_device &screen, bitmap_rgb32 &bitm
NETDEV_ANALOG_CALLBACK_MEMBER(fixedfreq_device::update_vid)
{
- bitmap_rgb32 *bm = m_bitmap[m_cur_bm];
+ bitmap_rgb32 *bm = m_bitmap[m_cur_bm].get();
const int has_fields = (m_fieldcount > 1) ? 1: 0;
int pixels = round((time - m_line_time).as_double() / m_clock_period.as_double());
diff --git a/src/devices/video/fixfreq.h b/src/devices/video/fixfreq.h
index b8cdc9c711e..38fde1c5f3b 100644
--- a/src/devices/video/fixfreq.h
+++ b/src/devices/video/fixfreq.h
@@ -126,7 +126,7 @@ private:
attotime m_last_vsync_time;
attotime m_refresh;
attotime m_clock_period;
- bitmap_rgb32 *m_bitmap[2];
+ std::unique_ptr<bitmap_rgb32> m_bitmap[2];
int m_cur_bm;
/* adjustable by drivers */
diff --git a/src/devices/video/huc6260.cpp b/src/devices/video/huc6260.cpp
index 7d3ccc75f78..ca9a9b0510d 100644
--- a/src/devices/video/huc6260.cpp
+++ b/src/devices/video/huc6260.cpp
@@ -253,7 +253,7 @@ WRITE8_MEMBER( huc6260_device::write )
void huc6260_device::device_start()
{
m_timer = timer_alloc();
- m_bmp = auto_bitmap_ind16_alloc( machine(), HUC6260_WPF, HUC6260_LPF );
+ m_bmp = std::make_unique<bitmap_ind16>(HUC6260_WPF, HUC6260_LPF );
/* Resolve callbacks */
m_hsync_changed_cb.resolve();
diff --git a/src/devices/video/huc6260.h b/src/devices/video/huc6260.h
index 36131787fbe..85552fbd265 100644
--- a/src/devices/video/huc6260.h
+++ b/src/devices/video/huc6260.h
@@ -88,7 +88,7 @@ private:
UINT8 m_pixel_clock;
emu_timer *m_timer;
- bitmap_ind16 *m_bmp;
+ std::unique_ptr<bitmap_ind16> m_bmp;
};
diff --git a/src/devices/video/huc6261.cpp b/src/devices/video/huc6261.cpp
index 295f8d8abf9..69caa26008e 100644
--- a/src/devices/video/huc6261.cpp
+++ b/src/devices/video/huc6261.cpp
@@ -398,7 +398,7 @@ void huc6261_device::device_start()
m_huc6270_a = machine().device<huc6270_device>(m_huc6270_a_tag);
m_huc6270_b = machine().device<huc6270_device>(m_huc6270_b_tag);
- m_bmp = auto_bitmap_rgb32_alloc( machine(), HUC6261_WPF, HUC6261_LPF );
+ m_bmp = std::make_unique<bitmap_rgb32>(HUC6261_WPF, HUC6261_LPF );
/* We want to have valid devices */
assert( m_huc6270_a != nullptr );
diff --git a/src/devices/video/huc6261.h b/src/devices/video/huc6261.h
index b8a86f0e69e..ab04cd01c22 100644
--- a/src/devices/video/huc6261.h
+++ b/src/devices/video/huc6261.h
@@ -70,7 +70,7 @@ private:
UINT8 m_pixel_clock;
emu_timer *m_timer;
- bitmap_rgb32 *m_bmp;
+ std::unique_ptr<bitmap_rgb32> m_bmp;
INT32 m_uv_lookup[65536][3];
};
diff --git a/src/devices/video/psx.cpp b/src/devices/video/psx.cpp
index 9268c6dc575..f4d72e7a785 100644
--- a/src/devices/video/psx.cpp
+++ b/src/devices/video/psx.cpp
@@ -127,7 +127,7 @@ void psxgpu_device::DebugMeshInit( void )
m_debug.b_clear = 1;
m_debug.n_coord = 0;
m_debug.n_skip = 0;
- m_debug.mesh = auto_bitmap_ind16_alloc( machine(), width, height );
+ m_debug.mesh = std::make_unique<bitmap_ind16>(width, height );
}
void psxgpu_device::DebugMesh( int n_coordx, int n_coordy )
diff --git a/src/devices/video/psx.h b/src/devices/video/psx.h
index f1767df722d..d35c0789183 100644
--- a/src/devices/video/psx.h
+++ b/src/devices/video/psx.h
@@ -58,7 +58,7 @@ extern const device_type CXD8654Q;
struct psx_gpu_debug
{
- bitmap_ind16 *mesh;
+ std::unique_ptr<bitmap_ind16> mesh;
int b_clear;
int b_mesh;
int n_skip;
diff --git a/src/devices/video/snes_ppu.cpp b/src/devices/video/snes_ppu.cpp
index 134f3e84a97..ed8fafeefbc 100644
--- a/src/devices/video/snes_ppu.cpp
+++ b/src/devices/video/snes_ppu.cpp
@@ -216,9 +216,9 @@ void snes_ppu_device::device_start()
{
m_openbus_cb.resolve_safe(0);
- m_vram = auto_alloc_array(machine(), UINT8, SNES_VRAM_SIZE);
- m_cgram = auto_alloc_array(machine(), UINT16, SNES_CGRAM_SIZE/2);
- m_oam_ram = auto_alloc_array(machine(), UINT16, SNES_OAM_SIZE/2);
+ m_vram = std::make_unique<UINT8[]>(SNES_VRAM_SIZE);
+ m_cgram = std::make_unique<UINT16[]>(SNES_CGRAM_SIZE/2);
+ m_oam_ram = std::make_unique<UINT16[]>(SNES_OAM_SIZE/2);
for (int i = 0; i < 2; i++)
{
@@ -355,9 +355,9 @@ void snes_ppu_device::device_start()
save_item(NAME(m_regs));
- save_pointer(NAME(m_vram), SNES_VRAM_SIZE);
- save_pointer(NAME(m_cgram), SNES_CGRAM_SIZE/2);
- save_pointer(NAME(m_oam_ram), SNES_OAM_SIZE/2);
+ save_pointer(NAME(m_vram.get()), SNES_VRAM_SIZE);
+ save_pointer(NAME(m_cgram.get()), SNES_CGRAM_SIZE/2);
+ save_pointer(NAME(m_oam_ram.get()), SNES_OAM_SIZE/2);
}
void snes_ppu_device::device_reset()
@@ -393,13 +393,13 @@ void snes_ppu_device::device_reset()
}
/* Init VRAM */
- memset(m_vram, 0, SNES_VRAM_SIZE);
+ memset(m_vram.get(), 0, SNES_VRAM_SIZE);
/* Init Palette RAM */
- memset((UINT8 *)m_cgram, 0, SNES_CGRAM_SIZE);
+ memset((UINT8 *)m_cgram.get(), 0, SNES_CGRAM_SIZE);
/* Init oam RAM */
- memset((UINT8 *)m_oam_ram, 0xff, SNES_OAM_SIZE);
+ memset((UINT8 *)m_oam_ram.get(), 0xff, SNES_OAM_SIZE);
m_stat78 = 0;
@@ -1156,7 +1156,7 @@ void snes_ppu_device::update_obsel( void )
void snes_ppu_device::oam_list_build( void )
{
- UINT8 *oamram = (UINT8 *)m_oam_ram;
+ UINT8 *oamram = (UINT8 *)m_oam_ram.get();
INT16 oam = 0x1ff;
UINT16 oam_extra = oam + 0x20;
UINT16 extra = 0;
@@ -2222,7 +2222,7 @@ READ8_MEMBER( snes_ppu_device::cgram_read )
}
#endif
- res = ((UINT8 *)m_cgram)[offset];
+ res = ((UINT8 *)m_cgram.get())[offset];
// CGRAM palette data format is 15-bits (0,bbbbb,ggggg,rrrrr).
// Highest bit is simply ignored.
@@ -2255,7 +2255,7 @@ WRITE8_MEMBER( snes_ppu_device::cgram_write )
if (offset & 0x01)
data &= 0x7f;
- ((UINT8 *)m_cgram)[offset] = data;
+ ((UINT8 *)m_cgram.get())[offset] = data;
}
UINT8 snes_ppu_device::read(address_space &space, UINT32 offset, UINT8 wrio_bit7)
diff --git a/src/devices/video/snes_ppu.h b/src/devices/video/snes_ppu.h
index f9fa754b549..0fa3f830aef 100644
--- a/src/devices/video/snes_ppu.h
+++ b/src/devices/video/snes_ppu.h
@@ -267,9 +267,9 @@ public:
DECLARE_WRITE8_MEMBER( cgram_write );
DECLARE_READ8_MEMBER( vram_read );
DECLARE_WRITE8_MEMBER( vram_write );
- UINT16 *m_oam_ram; /* Object Attribute Memory */
- UINT16 *m_cgram; /* Palette RAM */
- UINT8 *m_vram; /* Video RAM (TODO: Should be 16-bit, but it's easier this way) */
+ std::unique_ptr<UINT16[]> m_oam_ram; /* Object Attribute Memory */
+ std::unique_ptr<UINT16[]> m_cgram; /* Palette RAM */
+ std::unique_ptr<UINT8[]> m_vram; /* Video RAM (TODO: Should be 16-bit, but it's easier this way) */
protected:
// device-level overrides
diff --git a/src/devices/video/stvvdp1.cpp b/src/devices/video/stvvdp1.cpp
index e467bb4a68c..e30275fbc53 100644
--- a/src/devices/video/stvvdp1.cpp
+++ b/src/devices/video/stvvdp1.cpp
@@ -337,7 +337,7 @@ READ32_MEMBER ( saturn_state::saturn_vdp1_vram_r )
WRITE32_MEMBER ( saturn_state::saturn_vdp1_vram_w )
{
- UINT8 *vdp1 = m_vdp1.gfx_decode;
+ UINT8 *vdp1 = m_vdp1.gfx_decode.get();
COMBINE_DATA (&m_vdp1_vram[offset]);
@@ -2099,7 +2099,7 @@ void saturn_state::video_update_vdp1( void )
void saturn_state::stv_vdp1_state_save_postload( void )
{
- UINT8 *vdp1 = m_vdp1.gfx_decode;
+ UINT8 *vdp1 = m_vdp1.gfx_decode.get();
int offset;
UINT32 data;
@@ -2123,12 +2123,12 @@ int saturn_state::stv_vdp1_start ( void )
{
m_vdp1_regs = auto_alloc_array_clear(machine(), UINT16, 0x020/2 );
m_vdp1_vram = auto_alloc_array_clear(machine(), UINT32, 0x100000/4 );
- m_vdp1.gfx_decode = auto_alloc_array(machine(), UINT8, 0x100000 );
+ m_vdp1.gfx_decode = std::make_unique<UINT8[]>(0x100000 );
stv_vdp1_shading_data = auto_alloc(machine(), struct stv_vdp1_poly_scanline_data);
- m_vdp1.framebuffer[0] = auto_alloc_array(machine(), UINT16, 1024 * 256 * 2 ); /* *2 is for double interlace */
- m_vdp1.framebuffer[1] = auto_alloc_array(machine(), UINT16, 1024 * 256 * 2 );
+ m_vdp1.framebuffer[0] = std::make_unique<UINT16[]>(1024 * 256 * 2 ); /* *2 is for double interlace */
+ m_vdp1.framebuffer[1] = std::make_unique<UINT16[]>(1024 * 256 * 2 );
m_vdp1.framebuffer_display_lines = auto_alloc_array(machine(), UINT16 *, 512);
m_vdp1.framebuffer_draw_lines = auto_alloc_array(machine(), UINT16 *, 512);
diff --git a/src/devices/video/stvvdp2.cpp b/src/devices/video/stvvdp2.cpp
index 07b718741c2..c456d28dc5b 100644
--- a/src/devices/video/stvvdp2.cpp
+++ b/src/devices/video/stvvdp2.cpp
@@ -2580,7 +2580,7 @@ void saturn_state::stv_vdp2_drawgfxzoom_rgb555(
rectangle myclip;
UINT8* gfxdata;
- gfxdata = m_vdp2.gfx_decode + code * 0x20;
+ gfxdata = m_vdp2.gfx_decode.get() + code * 0x20;
if(stv2_current_tilemap.window_control.enabled[0] ||
stv2_current_tilemap.window_control.enabled[1])
@@ -2806,7 +2806,7 @@ void saturn_state::stv_vdp2_drawgfx_rgb555( bitmap_rgb32 &dest_bmp, const rectan
UINT8* gfxdata;
int sprite_screen_width, sprite_screen_height;
- gfxdata = m_vdp2.gfx_decode + code * 0x20;
+ gfxdata = m_vdp2.gfx_decode.get() + code * 0x20;
sprite_screen_width = sprite_screen_height = 8;
if(stv2_current_tilemap.window_control.enabled[0] ||
@@ -2920,7 +2920,7 @@ void saturn_state::stv_vdp2_drawgfx_rgb888( bitmap_rgb32 &dest_bmp, const rectan
UINT8* gfxdata;
int sprite_screen_width, sprite_screen_height;
- gfxdata = m_vdp2.gfx_decode + code * 0x20;
+ gfxdata = m_vdp2.gfx_decode.get() + code * 0x20;
sprite_screen_width = sprite_screen_height = 8;
if(stv2_current_tilemap.window_control.enabled[0] ||
@@ -3185,7 +3185,7 @@ void saturn_state::draw_4bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &clipr
int xsize, ysize, xsize_mask, ysize_mask;
int xsrc,ysrc,xdst,ydst;
int src_offs;
- UINT8* vram = m_vdp2.gfx_decode;
+ UINT8* vram = m_vdp2.gfx_decode.get();
UINT32 map_offset = stv2_current_tilemap.bitmap_map * 0x20000;
int scrollx = stv2_current_tilemap.scrollx;
int scrolly = stv2_current_tilemap.scrolly;
@@ -3241,7 +3241,7 @@ void saturn_state::draw_8bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &clipr
int xsize, ysize, xsize_mask, ysize_mask;
int xsrc,ysrc,xdst,ydst;
int src_offs;
- UINT8* vram = m_vdp2.gfx_decode;
+ UINT8* vram = m_vdp2.gfx_decode.get();
UINT32 map_offset = stv2_current_tilemap.bitmap_map * 0x20000;
int scrollx = stv2_current_tilemap.scrollx;
int scrolly = stv2_current_tilemap.scrolly;
@@ -3300,7 +3300,7 @@ void saturn_state::draw_11bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &clip
int xsize, ysize, xsize_mask, ysize_mask;
int xsrc,ysrc,xdst,ydst;
int src_offs;
- UINT8* vram = m_vdp2.gfx_decode;
+ UINT8* vram = m_vdp2.gfx_decode.get();
UINT32 map_offset = stv2_current_tilemap.bitmap_map * 0x20000;
int scrollx = stv2_current_tilemap.scrollx;
int scrolly = stv2_current_tilemap.scrolly;
@@ -3358,7 +3358,7 @@ void saturn_state::draw_rgb15_bitmap(bitmap_rgb32 &bitmap, const rectangle &clip
int xsize, ysize, xsize_mask, ysize_mask;
int xsrc,ysrc,xdst,ydst;
int src_offs;
- UINT8* vram = m_vdp2.gfx_decode;
+ UINT8* vram = m_vdp2.gfx_decode.get();
UINT32 map_offset = stv2_current_tilemap.bitmap_map * 0x20000;
int scrollx = stv2_current_tilemap.scrollx;
int scrolly = stv2_current_tilemap.scrolly;
@@ -3416,7 +3416,7 @@ void saturn_state::draw_rgb32_bitmap(bitmap_rgb32 &bitmap, const rectangle &clip
int xsize, ysize, xsize_mask, ysize_mask;
int xsrc,ysrc,xdst,ydst;
int src_offs;
- UINT8* vram = m_vdp2.gfx_decode;
+ UINT8* vram = m_vdp2.gfx_decode.get();
UINT32 map_offset = stv2_current_tilemap.bitmap_map * 0x20000;
int scrollx = stv2_current_tilemap.scrollx;
int scrolly = stv2_current_tilemap.scrolly;
@@ -4327,7 +4327,7 @@ void saturn_state::stv_vdp2_check_tilemap_with_linescroll(bitmap_rgb32 &bitmap,
void saturn_state::stv_vdp2_draw_line(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
int x,y;
- UINT8* gfxdata = m_vdp2.gfx_decode;
+ UINT8* gfxdata = m_vdp2.gfx_decode.get();
UINT32 base_offs,base_mask;
UINT32 pix;
UINT8 interlace;
@@ -5581,7 +5581,7 @@ void saturn_state::stv_vdp2_draw_RBG0(bitmap_rgb32 &bitmap, const rectangle &cli
void saturn_state::stv_vdp2_draw_back(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
int x,y;
- UINT8* gfxdata = m_vdp2.gfx_decode;
+ UINT8* gfxdata = m_vdp2.gfx_decode.get();
UINT32 base_offs,base_mask;
UINT8 interlace;
@@ -5627,7 +5627,7 @@ READ32_MEMBER ( saturn_state::saturn_vdp2_vram_r )
WRITE32_MEMBER ( saturn_state::saturn_vdp2_vram_w )
{
- UINT8* gfxdata = m_vdp2.gfx_decode;
+ UINT8* gfxdata = m_vdp2.gfx_decode.get();
COMBINE_DATA(&m_vdp2_vram[offset]);
@@ -6057,7 +6057,7 @@ int saturn_state::get_vcounter( void )
void saturn_state::stv_vdp2_state_save_postload( void )
{
- UINT8 *gfxdata = m_vdp2.gfx_decode;
+ UINT8 *gfxdata = m_vdp2.gfx_decode.get();
int offset;
UINT32 data;
@@ -6104,7 +6104,7 @@ int saturn_state::stv_vdp2_start ( void )
m_vdp2_regs = auto_alloc_array_clear(machine(), UINT16, 0x040000/2 );
m_vdp2_vram = auto_alloc_array_clear(machine(), UINT32, 0x100000/4 );
m_vdp2_cram = auto_alloc_array_clear(machine(), UINT32, 0x080000/4 );
- m_vdp2.gfx_decode = auto_alloc_array(machine(), UINT8, 0x100000 );
+ m_vdp2.gfx_decode = std::make_unique<UINT8[]>(0x100000 );
// m_gfxdecode->gfx(0)->granularity()=4;
// m_gfxdecode->gfx(1)->granularity()=4;
@@ -6129,10 +6129,10 @@ VIDEO_START_MEMBER(saturn_state,stv_vdp2)
stv_vdp2_start();
stv_vdp1_start();
m_vdpdebug_roz = 0;
- m_gfxdecode->gfx(0)->set_source(m_vdp2.gfx_decode);
- m_gfxdecode->gfx(1)->set_source(m_vdp2.gfx_decode);
- m_gfxdecode->gfx(2)->set_source(m_vdp2.gfx_decode);
- m_gfxdecode->gfx(3)->set_source(m_vdp2.gfx_decode);
+ m_gfxdecode->gfx(0)->set_source(m_vdp2.gfx_decode.get());
+ m_gfxdecode->gfx(1)->set_source(m_vdp2.gfx_decode.get());
+ m_gfxdecode->gfx(2)->set_source(m_vdp2.gfx_decode.get());
+ m_gfxdecode->gfx(3)->set_source(m_vdp2.gfx_decode.get());
/* calc V counter offsets */
/* 224 mode */
diff --git a/src/devices/video/vic4567.cpp b/src/devices/video/vic4567.cpp
index e04a4851dcc..8df490408f8 100644
--- a/src/devices/video/vic4567.cpp
+++ b/src/devices/video/vic4567.cpp
@@ -172,7 +172,7 @@ void vic3_device::device_start()
width = m_screen->width();
height = m_screen->height();
- m_bitmap = auto_bitmap_ind16_alloc(machine(), width, height);
+ m_bitmap = std::make_unique<bitmap_ind16>(width, height);
m_dma_read_cb.resolve_safe(0);
m_dma_read_color_cb.resolve_safe(0);
diff --git a/src/devices/video/vic4567.h b/src/devices/video/vic4567.h
index ddf17a6a6b3..b4b179d43d5 100644
--- a/src/devices/video/vic4567.h
+++ b/src/devices/video/vic4567.h
@@ -185,7 +185,7 @@ private:
UINT16 m_chargenaddr, m_videoaddr, m_bitmapaddr;
- bitmap_ind16 *m_bitmap;
+ std::unique_ptr<bitmap_ind16> m_bitmap;
int m_x_begin, m_x_end;
int m_y_begin, m_y_end;