summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/video
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/video
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/video')
-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
18 files changed, 114 insertions, 114 deletions
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;