diff --git a/src/devices/bus/cpc/transtape.cpp b/src/devices/bus/cpc/transtape.cpp index adb3a152557..311918e9bda 100644 --- a/src/devices/bus/cpc/transtape.cpp +++ b/src/devices/bus/cpc/transtape.cpp @@ -61,7 +61,7 @@ void cpc_transtape_device::device_start() m_cpu = static_cast(machine().device("maincpu")); m_space = &m_cpu->space(AS_IO); - m_ram = auto_alloc_array_clear(machine(), UINT8, 0x2000); + m_ram = make_unique_clear(0x2000); m_space->install_write_handler(0xfbf0,0xfbf0,0,0,write8_delegate(FUNC(cpc_transtape_device::output_w),this)); m_space->install_read_handler(0xfbff,0xfbff,0,0,read8_delegate(FUNC(cpc_transtape_device::input_r),this)); @@ -88,10 +88,10 @@ void cpc_transtape_device::map_enable() } if(m_output & 0x01) // RAM enable { - membank(":bank7")->set_base(m_ram); - membank(":bank15")->set_base(m_ram); - membank(":bank8")->set_base(m_ram); // repeats in second 8kB - membank(":bank16")->set_base(m_ram); + membank(":bank7")->set_base(m_ram.get()); + membank(":bank15")->set_base(m_ram.get()); + membank(":bank8")->set_base(m_ram.get()); // repeats in second 8kB + membank(":bank16")->set_base(m_ram.get()); } } diff --git a/src/devices/bus/cpc/transtape.h b/src/devices/bus/cpc/transtape.h index ec177f8ed7e..bb1a70e6ecc 100644 --- a/src/devices/bus/cpc/transtape.h +++ b/src/devices/bus/cpc/transtape.h @@ -41,7 +41,7 @@ private: cpc_expansion_slot_device *m_slot; cpu_device* m_cpu; address_space* m_space; - UINT8* m_ram; // 8kB internal RAM + std::unique_ptr m_ram; // 8kB internal RAM bool m_rom_active; bool m_romen; UINT8 m_output; diff --git a/src/devices/bus/nubus/nubus_image.cpp b/src/devices/bus/nubus/nubus_image.cpp index e9c94e9c891..037414d2cef 100644 --- a/src/devices/bus/nubus/nubus_image.cpp +++ b/src/devices/bus/nubus/nubus_image.cpp @@ -58,7 +58,7 @@ public: virtual void device_reset() override; public: UINT32 m_size; - UINT8 *m_data; + std::unique_ptr m_data; bool m_ejected; }; @@ -86,7 +86,7 @@ void messimg_disk_image_device::device_config_complete() void messimg_disk_image_device::device_start() { - m_data = (UINT8 *)nullptr; + m_data = nullptr; if (exists() && fseek(0, SEEK_END) == 0) { @@ -105,9 +105,9 @@ bool messimg_disk_image_device::call_load() return IMAGE_INIT_FAIL; } - m_data = (UINT8 *)auto_alloc_array_clear(machine(), UINT32, m_size/sizeof(UINT32)); + m_data = make_unique_clear(m_size); fseek(0, SEEK_SET); - fread(m_data, m_size); + fread(m_data.get(), m_size); m_ejected = false; return IMAGE_INIT_PASS; @@ -117,7 +117,7 @@ void messimg_disk_image_device::call_unload() { // TODO: track dirty sectors and only write those fseek(0, SEEK_SET); - fwrite(m_data, m_size); + fwrite(m_data.get(), m_size); m_size = 0; //free(m_data); } @@ -255,7 +255,7 @@ READ32_MEMBER( nubus_image_device::image_r ) WRITE32_MEMBER( nubus_image_device::image_super_w ) { - UINT32 *image = (UINT32*)m_image->m_data; + UINT32 *image = (UINT32*)m_image->m_data.get(); data = ((data & 0xff) << 24) | ((data & 0xff00) << 8) | ((data & 0xff0000) >> 8) | ((data & 0xff000000) >> 24); mem_mask = ((mem_mask & 0xff) << 24) | ((mem_mask & 0xff00) << 8) | ((mem_mask & 0xff0000) >> 8) | ((mem_mask & 0xff000000) >> 24); @@ -264,7 +264,7 @@ WRITE32_MEMBER( nubus_image_device::image_super_w ) READ32_MEMBER( nubus_image_device::image_super_r ) { - UINT32 *image = (UINT32*)m_image->m_data; + UINT32 *image = (UINT32*)m_image->m_data.get(); UINT32 data = image[offset]; return ((data & 0xff) << 24) | ((data & 0xff00) << 8) | ((data & 0xff0000) >> 8) | ((data & 0xff000000) >> 24); } diff --git a/src/devices/cpu/alto2/a2mem.cpp b/src/devices/cpu/alto2/a2mem.cpp index d4118fa70b6..94697c38324 100644 --- a/src/devices/cpu/alto2/a2mem.cpp +++ b/src/devices/cpu/alto2/a2mem.cpp @@ -838,11 +838,9 @@ void alto2_cpu_device::exit_memory() void alto2_cpu_device::reset_memory() { if (m_mem.ram) { - auto_free(machine(), m_mem.ram); m_mem.ram = nullptr; } if (m_mem.hpb) { - auto_free(machine(), m_mem.hpb); m_mem.hpb = nullptr; } // allocate 64K or 128K words of main memory @@ -854,8 +852,8 @@ void alto2_cpu_device::reset_memory() m_mem.size = ALTO2_RAM_SIZE; logerror("Main memory %u KiB\n", static_cast(sizeof(UINT16) * m_mem.size / 1024)); - m_mem.ram = auto_alloc_array_clear(machine(), UINT32, sizeof(UINT16) * m_mem.size); - m_mem.hpb = auto_alloc_array_clear(machine(), UINT8, sizeof(UINT16) * m_mem.size); + m_mem.ram = make_unique_clear(sizeof(UINT16) * m_mem.size); + m_mem.hpb = make_unique_clear( sizeof(UINT16) * m_mem.size); #if USE_HAMMING_CHECK // Initialize the hamming codes and parity bit diff --git a/src/devices/cpu/alto2/a2mem.h b/src/devices/cpu/alto2/a2mem.h index c450693a22b..1f6b4ac0ef5 100644 --- a/src/devices/cpu/alto2/a2mem.h +++ b/src/devices/cpu/alto2/a2mem.h @@ -25,8 +25,8 @@ enum { struct { UINT32 size; //!< main memory size (64K or 128K) - UINT32* ram; //!< main memory organized as double-words - UINT8* hpb; //!< Hamming Code bits (6) and Parity bits (1) per double word + std::unique_ptr ram; //!< main memory organized as double-words + std::unique_ptr hpb; //!< Hamming Code bits (6) and Parity bits (1) per double word UINT32 mar; //!< memory address register UINT32 rmdd; //!< read memory data double-word UINT32 wmdd; //!< write memory data double-word diff --git a/src/devices/machine/smpc.cpp b/src/devices/machine/smpc.cpp index fcbda532e27..34a7cb87f05 100644 --- a/src/devices/machine/smpc.cpp +++ b/src/devices/machine/smpc.cpp @@ -219,10 +219,10 @@ void saturn_state::smpc_system_reset() memset(m_sound_ram,0x00,0x080000); memset(m_workram_h,0x00,0x100000); memset(m_workram_l,0x00,0x100000); - memset(m_vdp2_regs,0x00,0x040000); - memset(m_vdp2_vram,0x00,0x100000); - memset(m_vdp2_cram,0x00,0x080000); - memset(m_vdp1_vram,0x00,0x100000); + memset(m_vdp2_regs.get(),0x00,0x040000); + memset(m_vdp2_vram.get(),0x00,0x100000); + memset(m_vdp2_cram.get(),0x00,0x080000); + memset(m_vdp1_vram.get(),0x00,0x100000); //A-Bus m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); diff --git a/src/devices/sound/aica.cpp b/src/devices/sound/aica.cpp index c0a0915c96d..641b47c477c 100644 --- a/src/devices/sound/aica.cpp +++ b/src/devices/sound/aica.cpp @@ -521,8 +521,8 @@ void aica_device::Init() } AICALFO_Init(); - m_buffertmpl=auto_alloc_array_clear(machine(), signed int, 44100); - m_buffertmpr=auto_alloc_array_clear(machine(), signed int, 44100); + m_buffertmpl=make_unique_clear(44100); + m_buffertmpr=make_unique_clear(44100); // no "pend" m_udata.data[0xa0/2] = 0; diff --git a/src/devices/sound/aica.h b/src/devices/sound/aica.h index 5264c8cb9c6..0494ecafad6 100644 --- a/src/devices/sound/aica.h +++ b/src/devices/sound/aica.h @@ -159,7 +159,8 @@ private: UINT32 m_AICARAM_LENGTH, m_RAM_MASK, m_RAM_MASK16; sound_stream * m_stream; - INT32 *m_buffertmpl, *m_buffertmpr; + std::unique_ptr m_buffertmpl; + std::unique_ptr m_buffertmpr; UINT32 m_IrqTimA; UINT32 m_IrqTimBC; diff --git a/src/devices/sound/dmadac.cpp b/src/devices/sound/dmadac.cpp index 91e6216ef69..24e89835d06 100644 --- a/src/devices/sound/dmadac.cpp +++ b/src/devices/sound/dmadac.cpp @@ -47,7 +47,7 @@ void dmadac_sound_device::device_start() { /* allocate a clear a buffer */ - m_buffer = auto_alloc_array_clear(machine(), INT16, BUFFER_SIZE); + m_buffer = make_unique_clear(BUFFER_SIZE); /* reset the state */ m_volume = 0x100; @@ -61,7 +61,7 @@ void dmadac_sound_device::device_start() save_item(NAME(m_volume)); save_item(NAME(m_enabled)); save_item(NAME(m_frequency)); - save_pointer(NAME(m_buffer), BUFFER_SIZE); + save_pointer(NAME(m_buffer.get()), BUFFER_SIZE); } @@ -217,7 +217,7 @@ dmadac_sound_device::dmadac_sound_device(const machine_config &mconfig, const ch void dmadac_sound_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) { stream_sample_t *output = outputs[0]; - INT16 *source = m_buffer; + INT16 *source = m_buffer.get(); UINT32 curout = m_bufout; UINT32 curin = m_bufin; int volume = m_volume; diff --git a/src/devices/sound/dmadac.h b/src/devices/sound/dmadac.h index c4be88e5596..6e0c4f47dd6 100644 --- a/src/devices/sound/dmadac.h +++ b/src/devices/sound/dmadac.h @@ -35,7 +35,7 @@ private: // internal state /* sound stream and buffers */ sound_stream * m_channel; - INT16 * m_buffer; + std::unique_ptr m_buffer; UINT32 m_bufin; UINT32 m_bufout; diff --git a/src/devices/sound/es5506.cpp b/src/devices/sound/es5506.cpp index 6e47ed7977d..07c25e93151 100644 --- a/src/devices/sound/es5506.cpp +++ b/src/devices/sound/es5506.cpp @@ -228,7 +228,7 @@ void es5506_device::device_start() } /* allocate memory */ - m_scratch = auto_alloc_array_clear(machine(), INT32, 2 * MAX_SAMPLE_CHUNK); + m_scratch = make_unique_clear(2 * MAX_SAMPLE_CHUNK); /* register save */ save_item(NAME(m_sample_rate)); @@ -243,7 +243,7 @@ void es5506_device::device_start() save_item(NAME(m_lrend)); save_item(NAME(m_irqv)); - save_pointer(NAME(m_scratch), 2 * MAX_SAMPLE_CHUNK); + save_pointer(NAME(m_scratch.get()), 2 * MAX_SAMPLE_CHUNK); for (j = 0; j < 32; j++) { @@ -363,7 +363,7 @@ void es5505_device::device_start() } /* allocate memory */ - m_scratch = auto_alloc_array_clear(machine(), INT32, 2 * MAX_SAMPLE_CHUNK); + m_scratch = make_unique_clear(2 * MAX_SAMPLE_CHUNK); /* register save */ save_item(NAME(m_sample_rate)); @@ -378,7 +378,7 @@ void es5505_device::device_start() save_item(NAME(m_lrend)); save_item(NAME(m_irqv)); - save_pointer(NAME(m_scratch), 2 * MAX_SAMPLE_CHUNK); + save_pointer(NAME(m_scratch.get()), 2 * MAX_SAMPLE_CHUNK); for (j = 0; j < 32; j++) { @@ -452,7 +452,7 @@ void es550x_device::compute_tables() int i; /* allocate ulaw lookup table */ - m_ulaw_lookup = auto_alloc_array_clear(machine(), INT16, 1 << ULAW_MAXBITS); + m_ulaw_lookup = make_unique_clear(1 << ULAW_MAXBITS); /* generate ulaw lookup table */ for (i = 0; i < (1 << ULAW_MAXBITS); i++) @@ -471,7 +471,7 @@ void es550x_device::compute_tables() } /* allocate volume lookup table */ - m_volume_lookup = auto_alloc_array_clear(machine(), UINT16, 4096); + m_volume_lookup = make_unique_clear(4096); /* generate volume lookup table */ for (i = 0; i < 4096; i++) diff --git a/src/devices/sound/es5506.h b/src/devices/sound/es5506.h index 3995a97c931..4ccc9d2d3f6 100644 --- a/src/devices/sound/es5506.h +++ b/src/devices/sound/es5506.h @@ -154,10 +154,10 @@ protected: es550x_voice m_voice[32]; /* the 32 voices */ - INT32 * m_scratch; + std::unique_ptr m_scratch; - INT16 * m_ulaw_lookup; - UINT16 * m_volume_lookup; + std::unique_ptr m_ulaw_lookup; + std::unique_ptr m_volume_lookup; #if MAKE_WAVS void * m_wavraw; /* raw waveform */ diff --git a/src/devices/sound/scsp.cpp b/src/devices/sound/scsp.cpp index 10868deb158..1a81678fc31 100644 --- a/src/devices/sound/scsp.cpp +++ b/src/devices/sound/scsp.cpp @@ -617,8 +617,8 @@ void scsp_device::init() } LFO_Init(); - m_buffertmpl=auto_alloc_array_clear(machine(), signed int, 44100); - m_buffertmpr=auto_alloc_array_clear(machine(), signed int, 44100); + m_buffertmpl=make_unique_clear(44100); + m_buffertmpr=make_unique_clear(44100); // no "pend" m_udata.data[0x20/2] = 0; diff --git a/src/devices/sound/scsp.h b/src/devices/sound/scsp.h index d2242958ff5..981936f37db 100644 --- a/src/devices/sound/scsp.h +++ b/src/devices/sound/scsp.h @@ -123,7 +123,8 @@ private: char m_Master; sound_stream * m_stream; - INT32 *m_buffertmpl,*m_buffertmpr; + std::unique_ptr m_buffertmpl; + std::unique_ptr m_buffertmpr; UINT32 m_IrqTimA; UINT32 m_IrqTimBC; diff --git a/src/devices/sound/zsg2.cpp b/src/devices/sound/zsg2.cpp index f7f7f53ae16..805acd892cc 100644 --- a/src/devices/sound/zsg2.cpp +++ b/src/devices/sound/zsg2.cpp @@ -88,12 +88,12 @@ void zsg2_device::device_start() m_stream = stream_alloc(0, 2, clock() / 768); m_mem_blocks = m_mem_base.length(); - m_mem_copy = auto_alloc_array_clear(machine(), UINT32, m_mem_blocks); - m_full_samples = auto_alloc_array_clear(machine(), INT16, m_mem_blocks * 4 + 4); // +4 is for empty block + m_mem_copy = make_unique_clear(m_mem_blocks); + m_full_samples = make_unique_clear(m_mem_blocks * 4 + 4); // +4 is for empty block // register for savestates - save_pointer(NAME(m_mem_copy), m_mem_blocks / sizeof(UINT32)); - save_pointer(NAME(m_full_samples), (m_mem_blocks * 4 + 4) / sizeof(INT16)); + save_pointer(NAME(m_mem_copy.get()), m_mem_blocks / sizeof(UINT32)); + save_pointer(NAME(m_full_samples.get()), (m_mem_blocks * 4 + 4) / sizeof(INT16)); save_item(NAME(m_read_address)); for (int ch = 0; ch < 48; ch++) diff --git a/src/devices/sound/zsg2.h b/src/devices/sound/zsg2.h index ce953a5be48..c88e2c60cc5 100644 --- a/src/devices/sound/zsg2.h +++ b/src/devices/sound/zsg2.h @@ -70,9 +70,9 @@ private: required_region_ptr m_mem_base; UINT32 m_read_address; - UINT32 *m_mem_copy; + std::unique_ptr m_mem_copy; UINT32 m_mem_blocks; - INT16 *m_full_samples; + std::unique_ptr m_full_samples; sound_stream *m_stream; diff --git a/src/devices/video/gf4500.cpp b/src/devices/video/gf4500.cpp index f3061597002..d4b7e86f056 100644 --- a/src/devices/video/gf4500.cpp +++ b/src/devices/video/gf4500.cpp @@ -57,9 +57,9 @@ void gf4500_device::device_config_complete() void gf4500_device::device_start() { - m_data = auto_alloc_array_clear(machine(), UINT32, 0x140000/4); + m_data = make_unique_clear(0x140000/4); - save_pointer(NAME(m_data), 0x140000/4); + save_pointer(NAME(m_data.get()), 0x140000/4); save_item(NAME(m_screen_x)); save_item(NAME(m_screen_y)); save_item(NAME(m_screen_x_max)); @@ -83,7 +83,7 @@ void gf4500_device::vram_write16( UINT16 data ) { if ((m_screen_x < m_screen_x_max) && (m_screen_y < m_screen_y_max)) { - UINT16 *vram = (UINT16 *)((UINT8 *)m_data + GF4500_FRAMEBUF_OFFSET + (((m_screen_y_min + m_screen_y) * (320 + 1)) + (m_screen_x_min + m_screen_x)) * 2); + UINT16 *vram = (UINT16 *)((UINT8 *)m_data.get() + GF4500_FRAMEBUF_OFFSET + (((m_screen_y_min + m_screen_y) * (320 + 1)) + (m_screen_x_min + m_screen_x)) * 2); *vram = data; m_screen_x++; } @@ -100,7 +100,7 @@ static rgb_t gf4500_get_color_16( UINT16 data ) UINT32 gf4500_device::screen_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - UINT16 *vram = (UINT16 *)(m_data + GF4500_FRAMEBUF_OFFSET / 4); + UINT16 *vram = (UINT16 *)(m_data.get() + GF4500_FRAMEBUF_OFFSET / 4); int x, y; for (y = 0; y < 240; y++) { diff --git a/src/devices/video/gf4500.h b/src/devices/video/gf4500.h index 1a64abaded2..aa8bf8ebf63 100644 --- a/src/devices/video/gf4500.h +++ b/src/devices/video/gf4500.h @@ -35,7 +35,7 @@ private: void vram_write16(UINT16 data); - UINT32 *m_data; + std::unique_ptr m_data; int m_screen_x; int m_screen_y; int m_screen_x_max; diff --git a/src/devices/video/hd63484.cpp b/src/devices/video/hd63484.cpp index d23081564a6..9dab25d3669 100644 --- a/src/devices/video/hd63484.cpp +++ b/src/devices/video/hd63484.cpp @@ -70,9 +70,9 @@ hd63484_device::hd63484_device(const machine_config &mconfig, const char *tag, d void hd63484_device::device_start() { - m_ram = auto_alloc_array_clear(machine(), UINT16, HD63484_RAM_SIZE); + m_ram = make_unique_clear(HD63484_RAM_SIZE); - save_pointer(NAME(m_ram), HD63484_RAM_SIZE); + save_pointer(NAME(m_ram.get()), HD63484_RAM_SIZE); save_item(NAME(m_reg)); save_item(NAME(m_fifo_counter)); save_item(NAME(m_fifo)); diff --git a/src/devices/video/hd63484.h b/src/devices/video/hd63484.h index 8dc2cc25aa0..aca908fe008 100644 --- a/src/devices/video/hd63484.h +++ b/src/devices/video/hd63484.h @@ -46,7 +46,7 @@ protected: private: // internal state - UINT16 * m_ram; + std::unique_ptr m_ram; UINT16 m_reg[256/2]; int m_fifo_counter; diff --git a/src/devices/video/huc6270.cpp b/src/devices/video/huc6270.cpp index c0fe5225c8e..42527fbcf16 100644 --- a/src/devices/video/huc6270.cpp +++ b/src/devices/video/huc6270.cpp @@ -804,10 +804,10 @@ void huc6270_device::device_start() /* Resolve callbacks */ m_irq_changed_cb.resolve_safe(); - m_vram = auto_alloc_array_clear(machine(), UINT16, m_vram_size/sizeof(UINT16)); + m_vram = make_unique_clear(m_vram_size/sizeof(UINT16)); m_vram_mask = (m_vram_size >> 1) - 1; - save_pointer(NAME(m_vram), m_vram_size/sizeof(UINT16)); + save_pointer(NAME(m_vram.get()), m_vram_size/sizeof(UINT16)); save_item(NAME(m_register_index)); save_item(NAME(m_mawr)); diff --git a/src/devices/video/huc6270.h b/src/devices/video/huc6270.h index c104fe15347..fdaca3b4f5c 100644 --- a/src/devices/video/huc6270.h +++ b/src/devices/video/huc6270.h @@ -128,7 +128,7 @@ private: int m_sprites_this_line; int m_sprite_row_index; UINT16 m_sprite_row[1024]; - UINT16 *m_vram; + std::unique_ptr m_vram; UINT16 m_vram_mask; const static UINT8 vram_increments[4]; diff --git a/src/devices/video/m50458.cpp b/src/devices/video/m50458.cpp index e2121cf565d..38e5eeb6e9a 100644 --- a/src/devices/video/m50458.cpp +++ b/src/devices/video/m50458.cpp @@ -205,7 +205,7 @@ void m50458_device::device_start() /* Create an array for shadow gfx */ /* this will spread the source ROM into four directions (up-left, up-right, down-left, down-right) thus creating a working shadow copy */ - m_shadow_gfx = auto_alloc_array_clear(machine(), UINT8, 0x1200); + m_shadow_gfx = make_unique_clear(0x1200); for(tile=0;tile<0x80;tile++) { diff --git a/src/devices/video/m50458.h b/src/devices/video/m50458.h index fe6cc087f13..9744ff6d361 100644 --- a/src/devices/video/m50458.h +++ b/src/devices/video/m50458.h @@ -71,7 +71,7 @@ protected: UINT16 m_current_cmd; int m_cmd_stream_pos; UINT16 m_osd_addr; - UINT8 *m_shadow_gfx; + std::unique_ptr m_shadow_gfx; UINT8 m_bg_pen; UINT8 m_phase; diff --git a/src/devices/video/mb_vcu.cpp b/src/devices/video/mb_vcu.cpp index 8ee9e835ddc..eda7751a768 100644 --- a/src/devices/video/mb_vcu.cpp +++ b/src/devices/video/mb_vcu.cpp @@ -178,8 +178,8 @@ void mb_vcu_device::device_validity_check(validity_checker &valid) const void mb_vcu_device::device_start() { // TODO: m_screen_tag - m_ram = auto_alloc_array_clear(machine(), UINT8, 0x800); - m_palram = auto_alloc_array_clear(machine(), UINT8, 0x100); + m_ram = make_unique_clear(0x800); + m_palram = make_unique_clear(0x100); { static const int resistances_r[2] = { 4700, 2200 }; @@ -193,8 +193,8 @@ void mb_vcu_device::device_start() } save_item(NAME(m_status)); - save_pointer(NAME(m_ram), 0x800); - save_pointer(NAME(m_palram), 0x100); + save_pointer(NAME(m_ram.get()), 0x800); + save_pointer(NAME(m_palram.get()), 0x100); save_item(NAME(m_param_offset_latch)); save_item(NAME(m_xpos)); save_item(NAME(m_ypos)); diff --git a/src/devices/video/mb_vcu.h b/src/devices/video/mb_vcu.h index 8cdc0261be0..e5fe1b2e62e 100644 --- a/src/devices/video/mb_vcu.h +++ b/src/devices/video/mb_vcu.h @@ -55,8 +55,8 @@ private: const address_space_config m_videoram_space_config; const address_space_config m_paletteram_space_config; UINT8 m_status; - UINT8 *m_ram; - UINT8 *m_palram; + std::unique_ptr m_ram; + std::unique_ptr m_palram; UINT16 m_param_offset_latch; INT16 m_xpos, m_ypos; diff --git a/src/devices/video/poly.h b/src/devices/video/poly.h index 613ae78df14..2ecc72491f7 100644 --- a/src/devices/video/poly.h +++ b/src/devices/video/poly.h @@ -186,16 +186,16 @@ private: // construction poly_array(running_machine &machine, poly_manager &manager) : m_manager(manager), - m_base(auto_alloc_array_clear(machine, UINT8, k_itemsize * _Count)), + m_base(make_unique_clear(k_itemsize * _Count)), m_next(0), m_max(0), m_waits(0) { } // destruction - ~poly_array() { auto_free(m_manager.machine(), m_base); } + ~poly_array() { m_base = nullptr; } // operators - _Type &operator[](int index) const { assert(index >= 0 && index < _Count); return *reinterpret_cast<_Type *>(m_base + index * k_itemsize); } + _Type &operator[](int index) const { assert(index >= 0 && index < _Count); return *reinterpret_cast<_Type *>(m_base.get() + index * k_itemsize); } // getters int count() const { return m_next; } @@ -203,18 +203,18 @@ private: int waits() const { return m_waits; } int itemsize() const { return k_itemsize; } int allocated() const { return _Count; } - int indexof(_Type &item) const { int result = (reinterpret_cast(&item) - m_base) / k_itemsize; assert(result >= 0 && result < _Count); return result; } + int indexof(_Type &item) const { int result = (reinterpret_cast(&item) - m_base.get()) / k_itemsize; assert(result >= 0 && result < _Count); return result; } // operations void reset() { m_next = 0; } - _Type &next() { if (m_next > m_max) m_max = m_next; assert(m_next < _Count); return *new(m_base + m_next++ * k_itemsize) _Type; } + _Type &next() { if (m_next > m_max) m_max = m_next; assert(m_next < _Count); return *new(m_base.get() + m_next++ * k_itemsize) _Type; } _Type &last() const { return (*this)[m_next - 1]; } void wait_for_space(int count = 1) { while ((m_next + count) >= _Count) { m_waits++; m_manager.wait(""); } } private: // internal state poly_manager & m_manager; - UINT8 * m_base; + std::unique_ptr m_base; int m_next; int m_max; int m_waits; diff --git a/src/devices/video/psx.cpp b/src/devices/video/psx.cpp index f4d72e7a785..1caf2a92284 100644 --- a/src/devices/video/psx.cpp +++ b/src/devices/video/psx.cpp @@ -469,7 +469,7 @@ void psxgpu_device::psx_gpu_init( int n_gputype ) n_lightgun_y = 0; b_reverseflag = 0; - p_vram = auto_alloc_array_clear( machine(), UINT16, width * height ); + p_vram = make_unique_clear(width * height ); for( n_line = 0; n_line < 1024; n_line++ ) { @@ -570,7 +570,7 @@ void psxgpu_device::psx_gpu_init( int n_gputype ) // icky!!! machine().save().save_memory( this, "globals", nullptr, 0, "m_packet", (UINT8 *)&m_packet, 1, sizeof( m_packet ) ); - save_pointer(NAME(p_vram), width * height ); + save_pointer(NAME(p_vram.get()), width * height ); save_item(NAME(n_gpu_buffer_offset)); save_item(NAME(n_vramx)); save_item(NAME(n_vramy)); diff --git a/src/devices/video/psx.h b/src/devices/video/psx.h index d35c0789183..ae96761cb02 100644 --- a/src/devices/video/psx.h +++ b/src/devices/video/psx.h @@ -240,7 +240,7 @@ private: INT32 n_iy; INT32 n_ti; - UINT16 *p_vram; + std::unique_ptr p_vram; UINT32 n_vramx; UINT32 n_vramy; UINT32 n_twy; diff --git a/src/devices/video/ramdac.cpp b/src/devices/video/ramdac.cpp index 1cda8c4b658..b05cccfa10b 100644 --- a/src/devices/video/ramdac.cpp +++ b/src/devices/video/ramdac.cpp @@ -103,7 +103,7 @@ void ramdac_device::device_validity_check(validity_checker &valid) const void ramdac_device::device_start() { - m_palram = auto_alloc_array_clear(machine(), UINT8, 1 << 10); + m_palram = make_unique_clear(1 << 10); } diff --git a/src/devices/video/ramdac.h b/src/devices/video/ramdac.h index 4ad5b076a07..a006312c59f 100644 --- a/src/devices/video/ramdac.h +++ b/src/devices/video/ramdac.h @@ -71,7 +71,7 @@ private: UINT8 m_pal_index[2]; UINT8 m_pal_mask; UINT8 m_int_index[2]; - UINT8 *m_palram; + std::unique_ptr m_palram; const address_space_config m_space_config; required_device m_palette; diff --git a/src/devices/video/stvvdp1.cpp b/src/devices/video/stvvdp1.cpp index e30275fbc53..09ca2e81662 100644 --- a/src/devices/video/stvvdp1.cpp +++ b/src/devices/video/stvvdp1.cpp @@ -2121,8 +2121,8 @@ void saturn_state::stv_vdp1_state_save_postload( void ) 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_regs = make_unique_clear(0x020/2 ); + m_vdp1_vram = make_unique_clear(0x100000/4 ); m_vdp1.gfx_decode = std::make_unique(0x100000 ); stv_vdp1_shading_data = auto_alloc(machine(), struct stv_vdp1_poly_scanline_data); @@ -2147,8 +2147,8 @@ int saturn_state::stv_vdp1_start ( void ) m_vdp1.user_cliprect.set(0, 512, 0, 256); // save state - save_pointer(NAME(m_vdp1_regs), 0x020/2); - save_pointer(NAME(m_vdp1_vram), 0x100000/4); + save_pointer(NAME(m_vdp1_regs.get()), 0x020/2); + save_pointer(NAME(m_vdp1_vram.get()), 0x100000/4); save_item(NAME(m_vdp1.fbcr_accessed)); save_item(NAME(m_vdp1.framebuffer_current_display)); save_item(NAME(m_vdp1.framebuffer_current_draw)); diff --git a/src/devices/video/stvvdp2.cpp b/src/devices/video/stvvdp2.cpp index c456d28dc5b..fcdf2ce2eb2 100644 --- a/src/devices/video/stvvdp2.cpp +++ b/src/devices/video/stvvdp2.cpp @@ -4576,11 +4576,11 @@ void saturn_state::stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, { if ( STV_VDP2_CRKTE == 0 ) { - coeff_table_base = m_vdp2_vram; + coeff_table_base = m_vdp2_vram.get(); } else { - coeff_table_base = m_vdp2_cram; + coeff_table_base = m_vdp2_cram.get(); } if ( coeff_table_size == 0 ) { @@ -6101,9 +6101,9 @@ int saturn_state::stv_vdp2_start ( void ) { machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(saturn_state::stv_vdp2_exit), this)); - 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_regs = make_unique_clear(0x040000/2 ); + m_vdp2_vram = make_unique_clear(0x100000/4 ); + m_vdp2_cram = make_unique_clear(0x080000/4 ); m_vdp2.gfx_decode = std::make_unique(0x100000 ); // m_gfxdecode->gfx(0)->granularity()=4; @@ -6113,9 +6113,9 @@ int saturn_state::stv_vdp2_start ( void ) stv_rbg_cache_data.is_cache_dirty = 3; memset( &stv_vdp2_layer_data_placement, 0, sizeof(stv_vdp2_layer_data_placement)); - save_pointer(NAME(m_vdp2_regs), 0x040000/2); - save_pointer(NAME(m_vdp2_vram), 0x100000/4); - save_pointer(NAME(m_vdp2_cram), 0x080000/4); + save_pointer(NAME(m_vdp2_regs.get()), 0x040000/2); + save_pointer(NAME(m_vdp2_vram.get()), 0x100000/4); + save_pointer(NAME(m_vdp2_cram.get()), 0x080000/4); machine().save().register_postload(save_prepost_delegate(FUNC(saturn_state::stv_vdp2_state_save_postload), this)); return 0; diff --git a/src/emu/video/vector.cpp b/src/emu/video/vector.cpp index bcc3b3604b9..36c303eda42 100644 --- a/src/emu/video/vector.cpp +++ b/src/emu/video/vector.cpp @@ -163,7 +163,7 @@ void vector_device::device_start() m_vector_index = 0; /* allocate memory for tables */ - m_vector_list = auto_alloc_array_clear(machine(), point, MAX_POINTS); + m_vector_list = make_unique_clear(MAX_POINTS); } void vector_device::set_flicker(float newval) @@ -306,7 +306,7 @@ UINT32 vector_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, int lastx = 0; int lasty = 0; - curpoint = m_vector_list; + curpoint = m_vector_list.get(); screen.container().empty(); screen.container().add_rect(0.0f, 0.0f, 1.0f, 1.0f, rgb_t(0xff,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_VECTORBUF(1)); diff --git a/src/emu/video/vector.h b/src/emu/video/vector.h index 37a1587d01e..9ec843b76fe 100644 --- a/src/emu/video/vector.h +++ b/src/emu/video/vector.h @@ -65,7 +65,7 @@ private: static float m_beam_width_min; static float m_beam_width_max; static float m_beam_intensity_weight; - point *m_vector_list; + std::unique_ptr m_vector_list; static int m_vector_index; int m_min_intensity; int m_max_intensity; diff --git a/src/mame/audio/exidy440.cpp b/src/mame/audio/exidy440.cpp index 626bdc5ae9c..78c122a9caf 100644 --- a/src/mame/audio/exidy440.cpp +++ b/src/mame/audio/exidy440.cpp @@ -128,8 +128,8 @@ void exidy440_sound_device::device_start() reset_sound_cache(); /* allocate the mixer buffer */ - m_mixer_buffer_left = auto_alloc_array_clear(machine(), INT32, 2 * clock()); - m_mixer_buffer_right = m_mixer_buffer_left + clock(); + m_mixer_buffer_left = make_unique_clear(clock()); + m_mixer_buffer_right = make_unique_clear(clock()); if (SOUND_LOG) m_debuglog = fopen("sound.log", "w"); @@ -197,8 +197,8 @@ void exidy440_sound_device::add_and_scale_samples(int ch, INT32 *dest, int sampl void exidy440_sound_device::mix_to_16(int length, stream_sample_t *dest_left, stream_sample_t *dest_right) { - INT32 *mixer_left = m_mixer_buffer_left; - INT32 *mixer_right = m_mixer_buffer_right; + INT32 *mixer_left = m_mixer_buffer_left.get(); + INT32 *mixer_right = m_mixer_buffer_right.get(); int i, clippers = 0; for (i = 0; i < length; i++) @@ -804,8 +804,8 @@ void exidy440_sound_device::sound_stream_update(sound_stream &stream, stream_sam int ch; /* reset the mixer buffers */ - memset(m_mixer_buffer_left, 0, samples * sizeof(INT32)); - memset(m_mixer_buffer_right, 0, samples * sizeof(INT32)); + memset(m_mixer_buffer_left.get(), 0, samples * sizeof(INT32)); + memset(m_mixer_buffer_right.get(), 0, samples * sizeof(INT32)); /* loop over channels */ for (ch = 0; ch < 4; ch++) @@ -824,12 +824,12 @@ void exidy440_sound_device::sound_stream_update(sound_stream &stream, stream_sam /* get a pointer to the sample data and copy to the left */ volume = m_sound_volume[2 * ch + 0]; if (volume) - add_and_scale_samples(ch, m_mixer_buffer_left, length, volume); + add_and_scale_samples(ch, m_mixer_buffer_left.get(), length, volume); /* get a pointer to the sample data and copy to the left */ volume = m_sound_volume[2 * ch + 1]; if (volume) - add_and_scale_samples(ch, m_mixer_buffer_right, length, volume); + add_and_scale_samples(ch, m_mixer_buffer_right.get(), length, volume); /* update our counters */ channel->offset += length; diff --git a/src/mame/audio/exidy440.h b/src/mame/audio/exidy440.h index 2a5265c8793..0dafc17adf6 100644 --- a/src/mame/audio/exidy440.h +++ b/src/mame/audio/exidy440.h @@ -67,8 +67,8 @@ private: UINT8 m_sound_banks[4]; //UINT8 m_m6844_data[0x20]; UINT8 m_sound_volume[0x10]; - INT32 *m_mixer_buffer_left; - INT32 *m_mixer_buffer_right; + std::unique_ptr m_mixer_buffer_left; + std::unique_ptr m_mixer_buffer_right; sound_cache_entry *m_sound_cache; sound_cache_entry *m_sound_cache_end; sound_cache_entry *m_sound_cache_max; diff --git a/src/mame/audio/lynx.cpp b/src/mame/audio/lynx.cpp index ba31b88ba06..2d58677f373 100644 --- a/src/mame/audio/lynx.cpp +++ b/src/mame/audio/lynx.cpp @@ -159,8 +159,8 @@ void lynx_sound_device::register_save() void lynx_sound_device::init() { - m_shift_mask = auto_alloc_array_clear(machine(), int, 512); - m_shift_xor = auto_alloc_array_clear(machine(), int, 4096); + m_shift_mask = make_unique_clear(512); + m_shift_xor = make_unique_clear(4096); for (int i = 0; i < 512; i++) { diff --git a/src/mame/audio/lynx.h b/src/mame/audio/lynx.h index a3738f271b6..8bd8bdd3067 100644 --- a/src/mame/audio/lynx.h +++ b/src/mame/audio/lynx.h @@ -57,8 +57,8 @@ protected: lynx_sound_timer_delegate m_timer_delegate; // this calls lynx_timer_count_down from the driver state float m_usec_per_sample; - int *m_shift_mask; - int *m_shift_xor; + std::unique_ptr m_shift_mask; + std::unique_ptr m_shift_xor; UINT8 m_attenuation_enable; UINT8 m_master_enable; LYNX_AUDIO m_audio[4]; diff --git a/src/mame/audio/mac.cpp b/src/mame/audio/mac.cpp index 57ad49aa96f..821c15a9afb 100644 --- a/src/mame/audio/mac.cpp +++ b/src/mame/audio/mac.cpp @@ -62,13 +62,13 @@ void mac_sound_device::device_start() { mac_state *mac = machine().driver_data(); - m_snd_cache = auto_alloc_array_clear(machine(), UINT8, SND_CACHE_SIZE); + m_snd_cache = make_unique_clear(SND_CACHE_SIZE); m_mac_stream = machine().sound().stream_alloc(*this, 0, 1, MAC_SAMPLE_RATE); m_ram = machine().device(RAM_TAG); m_mac_model = mac->m_model; - save_pointer(NAME(m_snd_cache), SND_CACHE_SIZE); + save_pointer(NAME(m_snd_cache.get()), SND_CACHE_SIZE); save_item(NAME(m_sample_enable)); save_item(NAME(m_snd_cache_len)); save_item(NAME(m_snd_cache_head)); diff --git a/src/mame/audio/micro3d.cpp b/src/mame/audio/micro3d.cpp index 4e7cea003e9..aeed7f03bdf 100644 --- a/src/mame/audio/micro3d.cpp +++ b/src/mame/audio/micro3d.cpp @@ -68,9 +68,9 @@ static void filter_init(running_machine &machine, lp_filter *iir, double fs) iir->ProtoCoef[1].b1 = 1.847759; iir->ProtoCoef[1].b2 = 1.0; - iir->coef = (float *)auto_alloc_array_clear(machine, float, 4 * 2 + 1); + iir->coef = make_unique_clear(4 * 2 + 1); iir->fs = fs; - iir->history = (float *)auto_alloc_array_clear(machine, float, 2 * 2); + iir->history = make_unique_clear(2 * 2); } static void prewarp(double *a0, double *a1, double *a2,double fc, double fs) @@ -107,7 +107,7 @@ static void recompute_filter(lp_filter *iir, double k, double q, double fc) int nInd; double a0, a1, a2, b0, b1, b2; - float *coef = iir->coef + 1; + float *coef = iir->coef.get() + 1; for (nInd = 0; nInd < 2; nInd++) { @@ -270,9 +270,9 @@ void micro3d_sound_device::sound_stream_update(sound_stream &stream, stream_samp input += white; input *= 200.0f; - coef_ptr = iir->coef; + coef_ptr = iir->coef.get(); - hist1_ptr = iir->history; + hist1_ptr = iir->history.get(); hist2_ptr = hist1_ptr + 1; /* 1st number of coefficients array is overall input scale factor, * or filter gain */ diff --git a/src/mame/audio/pleiads.cpp b/src/mame/audio/pleiads.cpp index f5c00fc3fdf..b838998c971 100644 --- a/src/mame/audio/pleiads.cpp +++ b/src/mame/audio/pleiads.cpp @@ -653,7 +653,7 @@ void pleiads_sound_device::common_start() m_tms = machine().device("tms"); m_pc4.level = PC4_MIN; - m_poly18 = auto_alloc_array_clear(machine(), UINT32, 1ul << (18-5)); + m_poly18 = make_unique_clear(1ul << (18-5)); shiftreg = 0; for( i = 0; i < (1ul << (18-5)); i++ ) @@ -715,7 +715,7 @@ void pleiads_sound_device::common_start() save_item(NAME(m_noise.counter)); save_item(NAME(m_noise.polyoffs)); save_item(NAME(m_noise.freq)); - save_pointer(NAME(m_poly18), (1ul << (18-5))); + save_pointer(NAME(m_poly18.get()), (1ul << (18-5))); } //------------------------------------------------- diff --git a/src/mame/audio/pleiads.h b/src/mame/audio/pleiads.h index 3978cb6c6d1..e47b1b8e659 100644 --- a/src/mame/audio/pleiads.h +++ b/src/mame/audio/pleiads.h @@ -79,7 +79,7 @@ protected: int m_sound_latch_b; int m_sound_latch_c; /* part of the videoreg_w latch */ - UINT32 *m_poly18; + std::unique_ptr m_poly18; int m_polybit; pl_t_state m_tone1; diff --git a/src/mame/audio/seibu.cpp b/src/mame/audio/seibu.cpp index b78e142a99a..747af0bc422 100644 --- a/src/mame/audio/seibu.cpp +++ b/src/mame/audio/seibu.cpp @@ -115,13 +115,13 @@ void seibu_sound_device::device_start() case 1: get_custom_decrypt(); - memcpy(m_decrypted_opcodes, rom, length); - apply_decrypt(rom, m_decrypted_opcodes, 0x2000); + memcpy(m_decrypted_opcodes.get(), rom, length); + apply_decrypt(rom, m_decrypted_opcodes.get(), 0x2000); break; case 2: get_custom_decrypt(); - apply_decrypt(rom, m_decrypted_opcodes, length); + apply_decrypt(rom, m_decrypted_opcodes.get(), length); break; } @@ -182,18 +182,18 @@ static UINT8 decrypt_opcode(int a,int src) UINT8 *seibu_sound_device::get_custom_decrypt() { if (m_decrypted_opcodes) - return m_decrypted_opcodes; + return m_decrypted_opcodes.get(); int size = memregion(":audiocpu")->bytes(); - m_decrypted_opcodes = auto_alloc_array_clear(machine(), UINT8, size); - membank(":seibu_bank0d")->set_base(m_decrypted_opcodes); + m_decrypted_opcodes = make_unique_clear(size); + membank(":seibu_bank0d")->set_base(m_decrypted_opcodes.get()); if (size > 0x10000) { - membank(":seibu_bank1d")->configure_entries(0, (size - 0x10000) / 0x8000, m_decrypted_opcodes + 0x10000, 0x8000); + membank(":seibu_bank1d")->configure_entries(0, (size - 0x10000) / 0x8000, m_decrypted_opcodes.get() + 0x10000, 0x8000); membank(":seibu_bank1d")->set_entry(0); } else - membank(":seibu_bank1d")->set_base(m_decrypted_opcodes + 0x8000); + membank(":seibu_bank1d")->set_base(m_decrypted_opcodes.get() + 0x8000); - return m_decrypted_opcodes; + return m_decrypted_opcodes.get(); } void seibu_sound_device::apply_decrypt(UINT8 *rom, UINT8 *opcodes, int length) diff --git a/src/mame/audio/seibu.h b/src/mame/audio/seibu.h index 3a83f811e58..732ab5af314 100644 --- a/src/mame/audio/seibu.h +++ b/src/mame/audio/seibu.h @@ -72,7 +72,7 @@ protected: private: int m_encryption_mode; - UINT8 *m_decrypted_opcodes; + std::unique_ptr m_decrypted_opcodes; // internal state device_t *m_sound_cpu; diff --git a/src/mame/audio/snes_snd.cpp b/src/mame/audio/snes_snd.cpp index c37020bc504..a9295fd560c 100644 --- a/src/mame/audio/snes_snd.cpp +++ b/src/mame/audio/snes_snd.cpp @@ -179,7 +179,7 @@ void snes_sound_device::device_start() { m_channel = machine().sound().stream_alloc(*this, 0, 2, 32000); - m_ram = auto_alloc_array_clear(machine(), UINT8, SNES_SPCRAM_SIZE); + m_ram = make_unique_clear(SNES_SPCRAM_SIZE); /* put IPL image at the top of RAM */ memcpy(m_ipl_region, machine().root_device().memregion("sound_ipl")->base(), 64); @@ -196,7 +196,7 @@ void snes_sound_device::device_start() m_timer[2]->enable(false); state_register(); - save_pointer(NAME(m_ram), SNES_SPCRAM_SIZE); + save_pointer(NAME(m_ram.get()), SNES_SPCRAM_SIZE); } //------------------------------------------------- diff --git a/src/mame/audio/snes_snd.h b/src/mame/audio/snes_snd.h index 6862f7bc231..6d4e97b14a1 100644 --- a/src/mame/audio/snes_snd.h +++ b/src/mame/audio/snes_snd.h @@ -97,7 +97,7 @@ private: void state_register(); // internal state - UINT8 *m_ram; + std::unique_ptr m_ram; sound_stream *m_channel; UINT8 m_dsp_regs[256]; /* DSP registers */ UINT8 m_ipl_region[64]; /* SPC top 64 bytes */ diff --git a/src/mame/audio/taito_zm.cpp b/src/mame/audio/taito_zm.cpp index 069a6536759..a23967134c3 100644 --- a/src/mame/audio/taito_zm.cpp +++ b/src/mame/audio/taito_zm.cpp @@ -52,12 +52,12 @@ taito_zoom_device::taito_zoom_device(const machine_config &mconfig, const char * void taito_zoom_device::device_start() { - m_snd_shared_ram = auto_alloc_array_clear(machine(), UINT8, 0x100); + m_snd_shared_ram = make_unique_clear(0x100); // register for savestates save_item(NAME(m_reg_address)); save_item(NAME(m_tms_ctrl)); - save_pointer(NAME(m_snd_shared_ram), 0x100); + save_pointer(NAME(m_snd_shared_ram.get()), 0x100); } //------------------------------------------------- diff --git a/src/mame/audio/taito_zm.h b/src/mame/audio/taito_zm.h index d769618b0e5..610cdc807a8 100644 --- a/src/mame/audio/taito_zm.h +++ b/src/mame/audio/taito_zm.h @@ -42,7 +42,7 @@ private: // internal state UINT16 m_reg_address; UINT8 m_tms_ctrl; - UINT8* m_snd_shared_ram; + std::unique_ptr m_snd_shared_ram; }; extern const device_type TAITO_ZOOM; diff --git a/src/mame/audio/wiping.cpp b/src/mame/audio/wiping.cpp index 9fb41a4ce0c..38925e08c37 100644 --- a/src/mame/audio/wiping.cpp +++ b/src/mame/audio/wiping.cpp @@ -47,8 +47,8 @@ void wiping_sound_device::device_start() m_stream = machine().sound().stream_alloc(*this, 0, 1, samplerate); /* allocate a pair of buffers to mix into - 1 second's worth should be more than enough */ - m_mixer_buffer = auto_alloc_array_clear(machine(), short, 2 * samplerate); - m_mixer_buffer_2 = m_mixer_buffer + samplerate; + m_mixer_buffer = make_unique_clear(samplerate); + m_mixer_buffer_2 = make_unique_clear(samplerate); /* build the mixer table */ make_mixer_table(8, defgain); @@ -91,10 +91,10 @@ void wiping_sound_device::make_mixer_table(int voices, int gain) int i; /* allocate memory */ - m_mixer_table = auto_alloc_array_clear(machine(), INT16, 256 * voices); + m_mixer_table = make_unique_clear(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++) @@ -174,7 +174,7 @@ void wiping_sound_device::sound_stream_update(sound_stream &stream, stream_sampl } /* zap the contents of the mixer buffer */ - memset(m_mixer_buffer, 0, samples * sizeof(short)); + memset(m_mixer_buffer.get(), 0, samples * sizeof(short)); /* loop over each voice and add its contribution */ for (voice = m_channel_list; voice < m_last_channel; voice++) @@ -188,7 +188,7 @@ void wiping_sound_device::sound_stream_update(sound_stream &stream, stream_sampl const UINT8 *w = voice->wave; int c = voice->counter; - mix = m_mixer_buffer; + mix = m_mixer_buffer.get(); /* add our contribution */ for (i = 0; i < samples; i++) @@ -235,7 +235,7 @@ void wiping_sound_device::sound_stream_update(sound_stream &stream, stream_sampl } /* mix it down */ - mix = m_mixer_buffer; + mix = m_mixer_buffer.get(); for (i = 0; i < samples; i++) *buffer++ = m_mixer_lookup[*mix++]; } diff --git a/src/mame/audio/wiping.h b/src/mame/audio/wiping.h index d020f326e1b..f891ae8f5d8 100644 --- a/src/mame/audio/wiping.h +++ b/src/mame/audio/wiping.h @@ -45,10 +45,10 @@ private: sound_stream *m_stream; /* mixer tables and internal buffers */ - INT16 *m_mixer_table; + std::unique_ptr m_mixer_table; INT16 *m_mixer_lookup; - short *m_mixer_buffer; - short *m_mixer_buffer_2; + std::unique_ptr m_mixer_buffer; + std::unique_ptr m_mixer_buffer_2; UINT8 m_soundregs[0x4000]; diff --git a/src/mame/drivers/astrafr.cpp b/src/mame/drivers/astrafr.cpp index bbf281e33ba..578ac656b8a 100644 --- a/src/mame/drivers/astrafr.cpp +++ b/src/mame/drivers/astrafr.cpp @@ -33,11 +33,11 @@ public: UINT32* m_cpuregion; int m_cpuregion_size; - UINT32* m_mainram; + std::unique_ptr m_mainram; UINT32* m_slavecpuregion; int m_slavecpuregion_size; - UINT32* m_slaveram; + std::unique_ptr m_slaveram; @@ -270,11 +270,11 @@ MACHINE_START_MEMBER(astrafr_state,astra_common) { m_cpuregion = (UINT32*)memregion( "maincpu" )->base(); m_cpuregion_size = memregion( "maincpu" )->bytes()/4; - m_mainram = (UINT32*)auto_alloc_array_clear(machine(), UINT32, 0x10000); + m_mainram = make_unique_clear(0x10000); m_slavecpuregion = (UINT32*)memregion( "slavecpu" )->base(); m_slavecpuregion_size = memregion( "slavecpu" )->bytes()/4; - m_slaveram = (UINT32*)auto_alloc_array_clear(machine(), UINT32, 0x10000); + m_slaveram = make_unique_clear(0x10000); } diff --git a/src/mame/drivers/atarisy4.cpp b/src/mame/drivers/atarisy4.cpp index d03be4447b5..5213bbb8b9f 100644 --- a/src/mame/drivers/atarisy4.cpp +++ b/src/mame/drivers/atarisy4.cpp @@ -76,7 +76,7 @@ public: UINT8 m_b_color_table[256]; UINT16 m_dsp_bank[2]; UINT8 m_csr[2]; - UINT16 *m_shared_ram[2]; + std::unique_ptr m_shared_ram[2]; DECLARE_WRITE16_MEMBER(gpu_w); DECLARE_READ16_MEMBER(gpu_r); @@ -997,14 +997,14 @@ DRIVER_INIT_MEMBER(atarisy4_state,laststar) address_space &main = m_maincpu->space(AS_PROGRAM); /* Allocate 16kB of shared RAM */ - m_shared_ram[0] = auto_alloc_array_clear(machine(), UINT16, 0x2000); + m_shared_ram[0] = make_unique_clear(0x2000); /* Populate the 68000 address space with data from the HEX files */ load_hexfile(main, memregion("code")->base()); load_hexfile(main, memregion("data")->base()); /* Set up the DSP */ - membank("dsp0_bank0")->set_base(m_shared_ram[0]); + membank("dsp0_bank0")->set_base(m_shared_ram[0].get()); m_dsp0_bank1->set_base(&m_shared_ram[0][0x800]); load_ldafile(m_dsp0->space(AS_PROGRAM), memregion("dsp")->base()); } @@ -1012,19 +1012,19 @@ DRIVER_INIT_MEMBER(atarisy4_state,laststar) DRIVER_INIT_MEMBER(atarisy4_state,airrace) { /* Allocate two sets of 32kB shared RAM */ - m_shared_ram[0] = auto_alloc_array_clear(machine(), UINT16, 0x4000); - m_shared_ram[1] = auto_alloc_array_clear(machine(), UINT16, 0x4000); + m_shared_ram[0] = make_unique_clear(0x4000); + m_shared_ram[1] = make_unique_clear(0x4000); /* Populate RAM with data from the HEX files */ load_hexfile(m_maincpu->space(AS_PROGRAM), memregion("code")->base()); /* Set up the first DSP */ - membank("dsp0_bank0")->set_base(m_shared_ram[0]); + membank("dsp0_bank0")->set_base(m_shared_ram[0].get()); m_dsp0_bank1->set_base(&m_shared_ram[0][0x800]); load_ldafile(m_dsp0->space(AS_PROGRAM), memregion("dsp")->base()); /* Set up the second DSP */ - membank("dsp1_bank0")->set_base(m_shared_ram[1]); + membank("dsp1_bank0")->set_base(m_shared_ram[1].get()); m_dsp1_bank1->set_base(&m_shared_ram[1][0x800]); load_ldafile(m_dsp1->space(AS_PROGRAM), memregion("dsp")->base()); } diff --git a/src/mame/drivers/bfcobra.cpp b/src/mame/drivers/bfcobra.cpp index 9a992e15637..9466aacdc0f 100644 --- a/src/mame/drivers/bfcobra.cpp +++ b/src/mame/drivers/bfcobra.cpp @@ -250,8 +250,8 @@ public: } UINT8 m_bank_data[4]; - UINT8 *m_work_ram; - UINT8 *m_video_ram; + std::unique_ptr m_work_ram; + std::unique_ptr m_video_ram; UINT8 m_h_scroll; UINT8 m_v_scroll; UINT8 m_flip_8; @@ -1615,10 +1615,10 @@ INPUT_PORTS_END void bfcobra_state::init_ram() { /* 768kB work RAM */ - m_work_ram = auto_alloc_array_clear(machine(), UINT8, 0xC0000); + m_work_ram = make_unique_clear(0xC0000); /* 128kB video RAM */ - m_video_ram = auto_alloc_array_clear(machine(), UINT8, 0x20000); + m_video_ram = make_unique_clear(0x20000); } @@ -1708,8 +1708,8 @@ DRIVER_INIT_MEMBER(bfcobra_state,bfcobra) save_item(NAME(m_z80_int)); save_item(NAME(m_z80_inten)); save_item(NAME(m_bank_data)); - save_pointer(NAME(m_work_ram), 0xc0000); - save_pointer(NAME(m_video_ram), 0x20000); + save_pointer(NAME(m_work_ram.get()), 0xc0000); + save_pointer(NAME(m_video_ram.get()), 0x20000); } /* TODO */ diff --git a/src/mame/drivers/bfm_sc4h.cpp b/src/mame/drivers/bfm_sc4h.cpp index f6298442371..4a52131e01a 100644 --- a/src/mame/drivers/bfm_sc4h.cpp +++ b/src/mame/drivers/bfm_sc4h.cpp @@ -1031,7 +1031,7 @@ MACHINE_CONFIG_END MACHINE_START_MEMBER(sc4_adder4_state,adder4) { m_adder4cpuregion = (UINT32*)memregion( "adder4" )->base(); - m_adder4ram = (UINT32*)auto_alloc_array_clear(machine(), UINT32, 0x10000); + m_adder4ram = make_unique_clear(0x10000); MACHINE_START_CALL_MEMBER(sc4); } diff --git a/src/mame/drivers/bfm_swp.cpp b/src/mame/drivers/bfm_swp.cpp index 62c7405f489..5198984a975 100644 --- a/src/mame/drivers/bfm_swp.cpp +++ b/src/mame/drivers/bfm_swp.cpp @@ -114,7 +114,7 @@ public: { } UINT32* m_cpuregion; - UINT32* m_mainram; + std::unique_ptr m_mainram; DECLARE_READ32_MEMBER(bfm_swp_mem_r); DECLARE_WRITE32_MEMBER(bfm_swp_mem_w); @@ -191,7 +191,7 @@ INPUT_PORTS_END void bfm_swp_state::machine_start() { m_cpuregion = (UINT32*)memregion( "maincpu" )->base(); - m_mainram = (UINT32*)auto_alloc_array_clear(machine(), UINT32, 0x10000); + m_mainram = make_unique_clear(0x10000); } diff --git a/src/mame/drivers/casloopy.cpp b/src/mame/drivers/casloopy.cpp index 2b5f60f3a41..e1bd70ec6b0 100644 --- a/src/mame/drivers/casloopy.cpp +++ b/src/mame/drivers/casloopy.cpp @@ -175,9 +175,9 @@ public: required_device m_gfxdecode; required_device m_palette; - UINT16 *m_paletteram; - UINT8 *m_vram; - UINT8 *m_bitmap_vram; + std::unique_ptr m_paletteram; + std::unique_ptr m_vram; + std::unique_ptr m_bitmap_vram; UINT16 sh7021_regs[0x100]; int m_gfx_index; DECLARE_DRIVER_INIT(casloopy); @@ -225,9 +225,9 @@ static const gfx_layout casloopy_8bpp_layout = void casloopy_state::video_start() { /* TODO: proper sizes */ - m_paletteram = auto_alloc_array_clear(machine(), UINT16, 0x1000); - m_vram = auto_alloc_array_clear(machine(), UINT8, 0x10000); - m_bitmap_vram = auto_alloc_array_clear(machine(), UINT8, 0x20000); + m_paletteram = make_unique_clear(0x1000); + m_vram = make_unique_clear(0x10000); + m_bitmap_vram = make_unique_clear(0x20000); for (m_gfx_index = 0; m_gfx_index < MAX_GFX_ELEMENTS; m_gfx_index++) if (m_gfxdecode->gfx(m_gfx_index) == nullptr) @@ -236,8 +236,8 @@ void casloopy_state::video_start() for(int i=0;i<0x10000;i++) m_vram[i] = i & 0xff; - m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, casloopy_4bpp_layout, m_vram, 0, 0x10, 0))); - m_gfxdecode->set_gfx(m_gfx_index+1, global_alloc(gfx_element(m_palette, casloopy_8bpp_layout, m_vram, 0, 1, 0))); + m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, casloopy_4bpp_layout, m_vram.get(), 0, 0x10, 0))); + m_gfxdecode->set_gfx(m_gfx_index+1, global_alloc(gfx_element(m_palette, casloopy_8bpp_layout, m_vram.get(), 0, 1, 0))); } UINT32 casloopy_state::screen_update_casloopy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/drivers/chsuper.cpp b/src/mame/drivers/chsuper.cpp index 91391054baf..cb518967cba 100644 --- a/src/mame/drivers/chsuper.cpp +++ b/src/mame/drivers/chsuper.cpp @@ -42,7 +42,7 @@ public: int m_tilexor; UINT8 m_blacklamp; UINT8 m_redlamp; - UINT8 *m_vram; + std::unique_ptr m_vram; required_device m_maincpu; required_device m_gfxdecode; @@ -65,7 +65,7 @@ public: void chsuper_state::video_start() { - m_vram = auto_alloc_array_clear(machine(), UINT8, 1 << 14); + m_vram = make_unique_clear(1 << 14); } UINT32 chsuper_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) diff --git a/src/mame/drivers/coolridr.cpp b/src/mame/drivers/coolridr.cpp index 912c55d3afa..f7c0a2d8afa 100644 --- a/src/mame/drivers/coolridr.cpp +++ b/src/mame/drivers/coolridr.cpp @@ -451,9 +451,9 @@ public: int debug_randompal; - UINT16 *m_h1_vram; - UINT8 *m_h1_pcg; - UINT16 *m_h1_pal; + std::unique_ptr m_h1_vram; + std::unique_ptr m_h1_pcg; + std::unique_ptr m_h1_pal; int m_gfx_index; int m_color_bank; struct { @@ -573,7 +573,7 @@ void coolridr_state::video_start() m_screen->register_screen_bitmap(m_screen1_bitmap); m_screen->register_screen_bitmap(m_screen2_bitmap); - m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, h1_tile_layout, m_h1_pcg, 0, 8, 0))); + m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, h1_tile_layout, m_h1_pcg.get(), 0, 8, 0))); } /* @@ -3667,9 +3667,9 @@ void coolridr_state::machine_start() } } - m_h1_vram = auto_alloc_array_clear(machine(), UINT16, VRAM_SIZE); - m_h1_pcg = auto_alloc_array_clear(machine(), UINT8, VRAM_SIZE); - m_h1_pal = auto_alloc_array_clear(machine(), UINT16, VRAM_SIZE); + m_h1_vram = make_unique_clear(VRAM_SIZE); + m_h1_pcg = make_unique_clear(VRAM_SIZE); + m_h1_pal = make_unique_clear(VRAM_SIZE); m_cool_render_object_list1 = auto_alloc_array_clear(machine(), struct cool_render_object*, 1000000); m_listcount1 = 0; @@ -3683,9 +3683,9 @@ void coolridr_state::machine_start() decode[1].current_object = 0; debug_randompal = 9; - save_pointer(NAME(m_h1_vram), VRAM_SIZE); - save_pointer(NAME(m_h1_pcg), VRAM_SIZE); - save_pointer(NAME(m_h1_pal), VRAM_SIZE); + save_pointer(NAME(m_h1_vram.get()), VRAM_SIZE); + save_pointer(NAME(m_h1_pcg.get()), VRAM_SIZE); + save_pointer(NAME(m_h1_pal.get()), VRAM_SIZE); } void coolridr_state::machine_reset() diff --git a/src/mame/drivers/corona.cpp b/src/mame/drivers/corona.cpp index b2f752c08f7..d861d4bf7e0 100644 --- a/src/mame/drivers/corona.cpp +++ b/src/mame/drivers/corona.cpp @@ -330,7 +330,7 @@ public: UINT8 m_blitter_y_reg; UINT8 m_blitter_aux_reg; UINT8 m_blitter_unk_reg; - UINT8 *m_videobuf; + std::unique_ptr m_videobuf; UINT8 m_lamp; UINT8 m_lamp_old; int m_input_selector; @@ -462,7 +462,7 @@ WRITE8_MEMBER(corona_state::blitter_trig_wdht_w) void corona_state::video_start() { - m_videobuf = auto_alloc_array_clear(machine(), UINT8, VIDEOBUF_SIZE); + m_videobuf = make_unique_clear(VIDEOBUF_SIZE); } UINT32 corona_state::screen_update_winner(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/drivers/dreamwld.cpp b/src/mame/drivers/dreamwld.cpp index 6da2dc43890..85725dd36ab 100644 --- a/src/mame/drivers/dreamwld.cpp +++ b/src/mame/drivers/dreamwld.cpp @@ -122,7 +122,7 @@ public: required_shared_ptr m_vregs; required_shared_ptr m_workram; - UINT16* m_lineram16; + std::unique_ptr m_lineram16; DECLARE_READ16_MEMBER(lineram16_r) { return m_lineram16[offset]; } DECLARE_WRITE16_MEMBER(lineram16_w) { COMBINE_DATA(&m_lineram16[offset]); } @@ -274,8 +274,8 @@ void dreamwld_state::video_start() m_spritebuf1 = std::make_unique(0x2000 / 4); m_spritebuf2 = std::make_unique(0x2000 / 4); - m_lineram16 = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x400 / 2); - save_pointer(NAME(m_lineram16), 0x400/2); + m_lineram16 = make_unique_clear(0x400 / 2); + save_pointer(NAME(m_lineram16.get()), 0x400/2); } diff --git a/src/mame/drivers/fp200.cpp b/src/mame/drivers/fp200.cpp index 7dac2e3f148..0bf5c3a0239 100644 --- a/src/mame/drivers/fp200.cpp +++ b/src/mame/drivers/fp200.cpp @@ -43,8 +43,8 @@ public: UINT8 x; UINT8 y; UINT8 status; - UINT8 *vram; - UINT8 *attr; + std::unique_ptr vram; + std::unique_ptr attr; }m_lcd; UINT8 read_lcd_attr(UINT16 X, UINT16 Y); UINT8 read_lcd_vram(UINT16 X, UINT16 Y); @@ -76,8 +76,8 @@ protected: void fp200_state::video_start() { - m_lcd.vram = auto_alloc_array_clear(machine(), UINT8, 20*64); - m_lcd.attr = auto_alloc_array_clear(machine(), UINT8, 20*64); + m_lcd.vram = make_unique_clear(20*64); + m_lcd.attr = make_unique_clear(20*64); } /* TODO: Very preliminary, I actually believe that the LCDC writes in a blitter fashion ... */ diff --git a/src/mame/drivers/hornet.cpp b/src/mame/drivers/hornet.cpp index c919134bc0c..71f94ad4929 100644 --- a/src/mame/drivers/hornet.cpp +++ b/src/mame/drivers/hornet.cpp @@ -377,7 +377,7 @@ public: emu_timer *m_sound_irq_timer; UINT8 m_led_reg0; UINT8 m_led_reg1; - UINT8 *m_jvs_sdata; + std::unique_ptr m_jvs_sdata; UINT32 m_jvs_sdata_ptr; UINT16 m_gn680_latch; UINT16 m_gn680_ret0; @@ -928,7 +928,7 @@ INPUT_PORTS_END void hornet_state::machine_start() { m_jvs_sdata_ptr = 0; - m_jvs_sdata = auto_alloc_array_clear(machine(), UINT8, 1024); + m_jvs_sdata = make_unique_clear(1024); /* set conservative DRC options */ m_maincpu->ppcdrc_set_options(PPCDRC_COMPATIBLE_OPTIONS); @@ -938,7 +938,7 @@ void hornet_state::machine_start() save_item(NAME(m_led_reg0)); save_item(NAME(m_led_reg1)); - save_pointer(NAME(m_jvs_sdata), 1024); + save_pointer(NAME(m_jvs_sdata.get()), 1024); save_item(NAME(m_jvs_sdata_ptr)); m_sound_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hornet_state::sound_irq), this)); diff --git a/src/mame/drivers/model2.cpp b/src/mame/drivers/model2.cpp index e57eaf78641..6f5f5ca2c56 100644 --- a/src/mame/drivers/model2.cpp +++ b/src/mame/drivers/model2.cpp @@ -372,8 +372,8 @@ TIMER_DEVICE_CALLBACK_MEMBER(model2_state::model2_timer_cb) MACHINE_START_MEMBER(model2_state,model2) { - m_copro_fifoin_data = auto_alloc_array_clear(machine(), UINT32, COPRO_FIFOIN_SIZE); - m_copro_fifoout_data = auto_alloc_array_clear(machine(), UINT32, COPRO_FIFOOUT_SIZE); + m_copro_fifoin_data = make_unique_clear(COPRO_FIFOIN_SIZE); + m_copro_fifoout_data = make_unique_clear(COPRO_FIFOOUT_SIZE); } MACHINE_RESET_MEMBER(model2_state,model2_common) diff --git a/src/mame/drivers/model3.cpp b/src/mame/drivers/model3.cpp index 37d4d7339ad..aca17b6ecfc 100644 --- a/src/mame/drivers/model3.cpp +++ b/src/mame/drivers/model3.cpp @@ -1670,7 +1670,7 @@ READ64_MEMBER(model3_state::network_r) WRITE64_MEMBER(model3_state::network_w) { - COMBINE_DATA(m_network_ram + offset); + COMBINE_DATA(m_network_ram.get() + offset); osd_printf_debug("network_w: %02X, %08X%08X at %08X\n", offset, (UINT32)(data >> 32), (UINT32)(data), space.device().safe_pc()); } @@ -5820,7 +5820,7 @@ DRIVER_INIT_MEMBER(model3_state,harley) { DRIVER_INIT_CALL(model3_20); - m_network_ram = auto_alloc_array_clear(machine(), UINT64, 0x10000); + m_network_ram = make_unique_clear(0x10000); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xc0000000, 0xc00fffff, read64_delegate(FUNC(model3_state::network_r),this), write64_delegate(FUNC(model3_state::network_w),this)); } @@ -5828,7 +5828,7 @@ DRIVER_INIT_MEMBER(model3_state,harleya) { DRIVER_INIT_CALL(model3_20); - m_network_ram = auto_alloc_array_clear(machine(), UINT64, 0x10000); + m_network_ram = make_unique_clear(0x10000); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xc0000000, 0xc00fffff, read64_delegate(FUNC(model3_state::network_r),this), write64_delegate(FUNC(model3_state::network_w),this)); } diff --git a/src/mame/drivers/molecular.cpp b/src/mame/drivers/molecular.cpp index 440479c71bb..8915163ea43 100644 --- a/src/mame/drivers/molecular.cpp +++ b/src/mame/drivers/molecular.cpp @@ -72,8 +72,8 @@ public: UINT8 *m_file_rom; UINT8 *m_app_rom; - UINT8 *m_file_ram; - UINT8 *m_app_ram; + std::unique_ptr m_file_ram; + std::unique_ptr m_app_ram; DECLARE_READ8_MEMBER(file_r); DECLARE_WRITE8_MEMBER(file_w); @@ -267,8 +267,8 @@ void molecula_state::machine_start() m_file_rom = memregion("fileipl")->base(); m_app_rom = memregion("appipl")->base(); - m_file_ram = auto_alloc_array_clear(machine(), UINT8, 0x10000); - m_app_ram = auto_alloc_array_clear(machine(), UINT8, 0x10000); + m_file_ram = make_unique_clear(0x10000); + m_app_ram = make_unique_clear(0x10000); } void molecula_state::machine_reset() diff --git a/src/mame/drivers/mpu5hw.cpp b/src/mame/drivers/mpu5hw.cpp index c6065c3bf67..12fc17a2bd9 100644 --- a/src/mame/drivers/mpu5hw.cpp +++ b/src/mame/drivers/mpu5hw.cpp @@ -57,7 +57,7 @@ public: m_maincpu(*this, "maincpu") { } UINT32* m_cpuregion; - UINT32* m_mainram; + std::unique_ptr m_mainram; SEC sec; UINT8 m_led_strobe_temp; @@ -386,7 +386,7 @@ INPUT_PORTS_END void mpu5_state::machine_start() { m_cpuregion = (UINT32*)memregion( "maincpu" )->base(); - m_mainram = (UINT32*)auto_alloc_array_clear(machine(), UINT32, 0x10000); + m_mainram = make_unique_clear(0x10000); m_pic_output_bit =0; } diff --git a/src/mame/drivers/mz2500.cpp b/src/mame/drivers/mz2500.cpp index 63641ba66e9..4b979ec7d20 100644 --- a/src/mame/drivers/mz2500.cpp +++ b/src/mame/drivers/mz2500.cpp @@ -93,12 +93,12 @@ public: floppy_image_device *m_floppy; - UINT8 *m_main_ram; + std::unique_ptr m_main_ram; UINT8 *m_ipl_rom; UINT8 *m_kanji_rom; UINT8 *m_kanji2_rom; - UINT8 *m_pcg_ram; - UINT8 *m_emm_ram; + std::unique_ptr m_pcg_ram; + std::unique_ptr m_emm_ram; UINT8 *m_dic_rom; UINT8 *m_phone_rom; UINT8 *m_iplpro_rom; @@ -292,7 +292,7 @@ void mz2500_state::mz2500_draw_pixel(bitmap_ind16 &bitmap,int x,int y,UINT16 pe void mz2500_state::draw_80x25(bitmap_ind16 &bitmap,const rectangle &cliprect,UINT16 map_addr) { - UINT8 *vram = m_main_ram; // TODO + UINT8 *vram = m_main_ram.get(); // TODO int x,y,count,xi,yi; UINT8 *gfx_data; UINT8 y_step; @@ -317,7 +317,7 @@ void mz2500_state::draw_80x25(bitmap_ind16 &bitmap,const rectangle &cliprect,UIN int inv_col = (attr & 0x40) >> 6; if(gfx_sel & 8) // Xevious, PCG 8 colors have priority above kanji roms - gfx_data = m_pcg_ram; + gfx_data = m_pcg_ram.get(); else if(gfx_sel == 0x80) { gfx_data = m_kanji_rom; @@ -335,7 +335,7 @@ void mz2500_state::draw_80x25(bitmap_ind16 &bitmap,const rectangle &cliprect,UIN } else { - gfx_data = m_pcg_ram; + gfx_data = m_pcg_ram.get(); } for(yi=0;yi<8*y_step;yi++) @@ -381,7 +381,7 @@ void mz2500_state::draw_80x25(bitmap_ind16 &bitmap,const rectangle &cliprect,UIN void mz2500_state::draw_40x25(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,UINT16 map_addr) { - UINT8 *vram = m_main_ram; // TODO + UINT8 *vram = m_main_ram.get(); // TODO int x,y,count,xi,yi; UINT8 *gfx_data; UINT8 y_step; @@ -407,7 +407,7 @@ void mz2500_state::draw_40x25(bitmap_ind16 &bitmap,const rectangle &cliprect,int int inv_col = (attr & 0x40) >> 6; if(gfx_sel & 8) // Xevious, PCG 8 colors have priority above kanji roms - gfx_data = m_pcg_ram; + gfx_data = m_pcg_ram.get(); else if(gfx_sel == 0x80) { gfx_data = m_kanji_rom; @@ -425,7 +425,7 @@ void mz2500_state::draw_40x25(bitmap_ind16 &bitmap,const rectangle &cliprect,int } else { - gfx_data = m_pcg_ram; + gfx_data = m_pcg_ram.get(); } for(yi=0;yi<8*y_step;yi++) @@ -472,7 +472,7 @@ void mz2500_state::draw_40x25(bitmap_ind16 &bitmap,const rectangle &cliprect,int void mz2500_state::draw_cg4_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri) { UINT32 count; - UINT8 *vram = m_main_ram; // TODO + UINT8 *vram = m_main_ram.get(); // TODO UINT8 pen,pen_bit[2]; int x,y,xi,pen_i; int res_x,res_y; @@ -513,7 +513,7 @@ void mz2500_state::draw_cg4_screen(bitmap_ind16 &bitmap,const rectangle &cliprec void mz2500_state::draw_cg16_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int x_size,int pri) { UINT32 count; - UINT8 *vram = m_main_ram; //TODO + UINT8 *vram = m_main_ram.get(); //TODO UINT8 pen,pen_bit[4]; int x,y,xi,pen_i; UINT32 wa_reg; @@ -570,7 +570,7 @@ void mz2500_state::draw_cg16_screen(bitmap_ind16 &bitmap,const rectangle &clipre void mz2500_state::draw_cg256_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int plane,int pri) { UINT32 count; - UINT8 *vram = m_main_ram; + UINT8 *vram = m_main_ram.get(); UINT8 pen,pen_bit[8]; int x,y,xi,pen_i; UINT32 wa_reg; @@ -801,7 +801,7 @@ UINT8 mz2500_state::mz2500_cg_latch_compare() UINT8 mz2500_state::mz2500_ram_read(UINT16 offset, UINT8 bank_num) { - UINT8 *ram = m_main_ram; // TODO + UINT8 *ram = m_main_ram.get(); // TODO UINT8 cur_bank = m_bank_val[bank_num]; switch(cur_bank) @@ -859,7 +859,7 @@ UINT8 mz2500_state::mz2500_ram_read(UINT16 offset, UINT8 bank_num) void mz2500_state::mz2500_ram_write(UINT16 offset, UINT8 data, UINT8 bank_num) { - UINT8 *ram = m_main_ram; // TODO + UINT8 *ram = m_main_ram.get(); // TODO UINT8 cur_bank = m_bank_val[bank_num]; // if(cur_bank >= 0x30 && cur_bank <= 0x33) @@ -1361,7 +1361,7 @@ WRITE8_MEMBER(mz2500_state::mz2500_cg_data_w) if((m_cg_reg_index & 0x1f) == 0x05 && (m_cg_reg[0x05] & 0xc0) == 0x80) //clear bitmap buffer { UINT32 i; - UINT8 *vram = m_main_ram; // TODO + UINT8 *vram = m_main_ram.get(); // TODO UINT32 layer_bank; layer_bank = (m_cg_reg[0x0e] & 0x80) ? 0x10000 : 0x00000; @@ -1756,23 +1756,23 @@ static const gfx_layout mz2500_pcg_layout_3bpp = void mz2500_state::machine_start() { /* TODO: main RAM actually needs to be splitted */ - m_main_ram = auto_alloc_array_clear(machine(), UINT8, 0x80000); - m_pcg_ram = auto_alloc_array_clear(machine(), UINT8, 0x2000); + m_main_ram = make_unique_clear(0x80000); + m_pcg_ram = make_unique_clear(0x2000); m_ipl_rom = memregion("ipl")->base(); m_kanji_rom = memregion("kanji")->base(); m_kanji2_rom = memregion("kanji2")->base(); - m_emm_ram = auto_alloc_array_clear(machine(), UINT8, 0x100000); + m_emm_ram = make_unique_clear(0x100000); m_dic_rom = memregion("dictionary")->base(); m_phone_rom = memregion("phone")->base(); m_iplpro_rom = memregion("iplpro")->base(); - save_pointer(NAME(m_main_ram), 0x80000); - save_pointer(NAME(m_pcg_ram), 0x2000); - save_pointer(NAME(m_emm_ram), 0x100000); + save_pointer(NAME(m_main_ram.get()), 0x80000); + save_pointer(NAME(m_pcg_ram.get()), 0x2000); + save_pointer(NAME(m_emm_ram.get()), 0x100000); /* TODO: gfx[4] crashes as per now */ - m_gfxdecode->set_gfx(3, global_alloc(gfx_element(m_palette, mz2500_pcg_layout_1bpp, (UINT8 *)m_pcg_ram, 0, 0x10, 0))); - m_gfxdecode->set_gfx(4, global_alloc(gfx_element(m_palette, mz2500_pcg_layout_3bpp, (UINT8 *)m_pcg_ram, 0, 4, 0))); + m_gfxdecode->set_gfx(3, global_alloc(gfx_element(m_palette, mz2500_pcg_layout_1bpp, m_pcg_ram.get(), 0, 0x10, 0))); + m_gfxdecode->set_gfx(4, global_alloc(gfx_element(m_palette, mz2500_pcg_layout_3bpp, m_pcg_ram.get(), 0, 4, 0))); } void mz2500_state::machine_reset() diff --git a/src/mame/drivers/mz3500.cpp b/src/mame/drivers/mz3500.cpp index d81e75d8510..3ee4f6a785f 100644 --- a/src/mame/drivers/mz3500.cpp +++ b/src/mame/drivers/mz3500.cpp @@ -67,8 +67,8 @@ public: UINT8 *m_ipl_rom; UINT8 *m_basic_rom; - UINT8 *m_work_ram; - UINT8 *m_shared_ram; + std::unique_ptr m_work_ram; + std::unique_ptr m_shared_ram; UINT8 *m_char_rom; UINT8 m_ma,m_mo,m_ms,m_me2,m_me1; @@ -741,8 +741,8 @@ void mz3500_state::machine_start() m_ipl_rom = memregion("ipl")->base(); m_basic_rom = memregion("basic")->base(); m_char_rom = memregion("gfx1")->base(); - m_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x40000); - m_shared_ram = auto_alloc_array_clear(machine(), UINT8, 0x800); + m_work_ram = make_unique_clear(0x40000); + m_shared_ram = make_unique_clear(0x800); static const char *const m_fddnames[4] = { "upd765a:0", "upd765a:1", "upd765a:2", "upd765a:3"}; diff --git a/src/mame/drivers/ng_aes.cpp b/src/mame/drivers/ng_aes.cpp index c4f2fbc7620..aa7fdc6d904 100644 --- a/src/mame/drivers/ng_aes.cpp +++ b/src/mame/drivers/ng_aes.cpp @@ -195,7 +195,7 @@ public: IRQ_CALLBACK_MEMBER(neocd_int_callback); - UINT8 *m_meminternal_data; + std::unique_ptr m_meminternal_data; protected: required_ioport m_io_in2; required_ioport m_io_in0; @@ -1055,9 +1055,9 @@ MACHINE_START_MEMBER(ng_aes_state,neocd) /* initialize the memcard data structure */ /* NeoCD doesn't have memcard slots, rather, it has a larger internal memory which works the same */ - m_meminternal_data = auto_alloc_array_clear(machine(), UINT8, 0x2000); - machine().device("saveram")->set_base(m_meminternal_data, 0x2000); - save_pointer(NAME(m_meminternal_data), 0x2000); + m_meminternal_data = make_unique_clear(0x2000); + machine().device("saveram")->set_base(m_meminternal_data.get(), 0x2000); + save_pointer(NAME(m_meminternal_data.get()), 0x2000); //m_bank_vectors->set_entry(0); // default to the BIOS vectors m_use_cart_vectors = 0; diff --git a/src/mame/drivers/norautp.cpp b/src/mame/drivers/norautp.cpp index 849a198e2d9..aa3fec44bc2 100644 --- a/src/mame/drivers/norautp.cpp +++ b/src/mame/drivers/norautp.cpp @@ -567,7 +567,7 @@ void norautp_state::video_start() { - m_np_vram = auto_alloc_array_clear(machine(), UINT16, 0x1000/2); + m_np_vram = make_unique_clear(0x1000/2); } diff --git a/src/mame/drivers/nss.cpp b/src/mame/drivers/nss.cpp index 580d4e8cb86..95d3e58ca6b 100644 --- a/src/mame/drivers/nss.cpp +++ b/src/mame/drivers/nss.cpp @@ -315,7 +315,7 @@ public: optional_device m_palette; UINT8 m_wram_wp_flag; - UINT8 *m_wram; + std::unique_ptr m_wram; UINT8 m_nmi_enable; UINT8 m_cart_sel; UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); @@ -623,7 +623,7 @@ void nss_state::machine_start() snes_state::machine_start(); m_is_nss = 1; - m_wram = auto_alloc_array_clear(machine(), UINT8, 0x1000); + m_wram = make_unique_clear(0x1000); } diff --git a/src/mame/drivers/pc8801.cpp b/src/mame/drivers/pc8801.cpp index 1809fbf0039..b4b65d7bd86 100644 --- a/src/mame/drivers/pc8801.cpp +++ b/src/mame/drivers/pc8801.cpp @@ -324,10 +324,10 @@ public: required_device m_opn; required_device m_palette; - UINT8 *m_work_ram; - UINT8 *m_hi_work_ram; - UINT8 *m_ext_work_ram; - UINT8 *m_gvram; + std::unique_ptr m_work_ram; + std::unique_ptr m_hi_work_ram; + std::unique_ptr m_ext_work_ram; + std::unique_ptr m_gvram; UINT8 *m_n80rom; UINT8 *m_n88rom; UINT8 *m_kanji_rom; @@ -689,7 +689,7 @@ UINT8 pc8801_state::calc_cursor_pos(int x,int y,int yi) UINT8 pc8801_state::extract_text_attribute(UINT32 address,int x, UINT8 width, UINT8 &non_special) { - UINT8 *vram = m_work_ram; + UINT8 *vram = m_work_ram.get(); int i; int fifo_size; int offset; @@ -728,7 +728,7 @@ UINT8 pc8801_state::extract_text_attribute(UINT32 address,int x, UINT8 width, UI void pc8801_state::pc8801_draw_char(bitmap_ind16 &bitmap,int x,int y,int pal,UINT8 gfx_mode,UINT8 reverse,UINT8 secret,UINT8 blink,UINT8 upper,UINT8 lower,int y_size,int width, UINT8 non_special) { int xi,yi; - UINT8 *vram = m_work_ram; + UINT8 *vram = m_work_ram.get(); UINT8 is_cursor; UINT8 y_height, y_double; UINT8 y_step; @@ -2400,19 +2400,19 @@ void pc8801_state::machine_start() m_rtc->cs_w(1); m_rtc->oe_w(1); - m_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x10000); - m_hi_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x1000); - m_ext_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x8000*0x100); - m_gvram = auto_alloc_array_clear(machine(), UINT8, 0xc000); + m_work_ram = make_unique_clear(0x10000); + m_hi_work_ram = make_unique_clear(0x1000); + m_ext_work_ram = make_unique_clear(0x8000*0x100); + m_gvram = make_unique_clear(0xc000); m_n80rom = memregion("n80rom")->base(); m_n88rom = memregion("n88rom")->base(); m_kanji_rom = memregion("kanji")->base(); m_cg_rom = memregion("cgrom")->base(); - save_pointer(NAME(m_work_ram), 0x10000); - save_pointer(NAME(m_hi_work_ram), 0x1000); - save_pointer(NAME(m_ext_work_ram), 0x8000*0x100); - save_pointer(NAME(m_gvram), 0xc000); + save_pointer(NAME(m_work_ram.get()), 0x10000); + save_pointer(NAME(m_hi_work_ram.get()), 0x1000); + save_pointer(NAME(m_ext_work_ram.get()), 0x8000*0x100); + save_pointer(NAME(m_gvram.get()), 0xc000); } void pc8801_state::machine_reset() diff --git a/src/mame/drivers/pluto5.cpp b/src/mame/drivers/pluto5.cpp index 2d8aa4366b6..f231c634f8e 100644 --- a/src/mame/drivers/pluto5.cpp +++ b/src/mame/drivers/pluto5.cpp @@ -189,7 +189,7 @@ public: { } UINT32* m_cpuregion; - UINT32* m_mainram; + std::unique_ptr m_mainram; DECLARE_READ32_MEMBER(pluto5_mem_r); DECLARE_WRITE32_MEMBER(pluto5_mem_w); @@ -246,7 +246,7 @@ INPUT_PORTS_END void pluto5_state::machine_start() { m_cpuregion = (UINT32*)memregion( "maincpu" )->base(); - m_mainram = (UINT32*)auto_alloc_array_clear(machine(), UINT32, 0x10000); + m_mainram = make_unique_clear(0x10000); } diff --git a/src/mame/drivers/qx10.cpp b/src/mame/drivers/qx10.cpp index 3d631248096..e5098ce7d22 100644 --- a/src/mame/drivers/qx10.cpp +++ b/src/mame/drivers/qx10.cpp @@ -91,7 +91,7 @@ public: required_device m_kbd; UINT8 m_vram_bank; //required_shared_ptr m_video_ram; - UINT16 *m_video_ram; + std::unique_ptr m_video_ram; UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); @@ -620,7 +620,7 @@ GFXDECODE_END void qx10_state::video_start() { // allocate memory - m_video_ram = auto_alloc_array_clear(machine(), UINT16, 0x30000); + m_video_ram = make_unique_clear(0x30000); // find memory regions m_char_rom = memregion("chargen")->base(); diff --git a/src/mame/drivers/rabbit.cpp b/src/mame/drivers/rabbit.cpp index 757737584a6..82e8889a079 100644 --- a/src/mame/drivers/rabbit.cpp +++ b/src/mame/drivers/rabbit.cpp @@ -131,7 +131,7 @@ public: int m_vblirqlevel; int m_bltirqlevel; int m_banking; - UINT32 *m_tilemap_ram[4]; + std::unique_ptr m_tilemap_ram[4]; tilemap_t *m_tilemap[4]; DECLARE_WRITE32_MEMBER(tilemap0_w); @@ -414,10 +414,10 @@ void rabbit_state::video_start() { /* the tilemaps are bigger than the regions the cpu can see, need to allocate the ram here */ /* or maybe not for this game/hw .... */ - m_tilemap_ram[0] = auto_alloc_array_clear(machine(), UINT32, 0x20000/4); - m_tilemap_ram[1] = auto_alloc_array_clear(machine(), UINT32, 0x20000/4); - m_tilemap_ram[2] = auto_alloc_array_clear(machine(), UINT32, 0x20000/4); - m_tilemap_ram[3] = auto_alloc_array_clear(machine(), UINT32, 0x20000/4); + m_tilemap_ram[0] = make_unique_clear(0x20000/4); + m_tilemap_ram[1] = make_unique_clear(0x20000/4); + m_tilemap_ram[2] = make_unique_clear(0x20000/4); + m_tilemap_ram[3] = make_unique_clear(0x20000/4); m_tilemap[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(rabbit_state::get_tilemap0_tile_info),this),TILEMAP_SCAN_ROWS,16, 16, 128,32); m_tilemap[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(rabbit_state::get_tilemap1_tile_info),this),TILEMAP_SCAN_ROWS,16, 16, 128,32); @@ -437,10 +437,10 @@ void rabbit_state::video_start() m_sprite_bitmap = std::make_unique(0x1000,0x1000); m_sprite_clip.set(0, 0x1000-1, 0, 0x1000-1); - save_pointer(NAME(m_tilemap_ram[0]), 0x20000/4); - save_pointer(NAME(m_tilemap_ram[1]), 0x20000/4); - save_pointer(NAME(m_tilemap_ram[2]), 0x20000/4); - save_pointer(NAME(m_tilemap_ram[3]), 0x20000/4); + save_pointer(NAME(m_tilemap_ram[0].get()), 0x20000/4); + save_pointer(NAME(m_tilemap_ram[1].get()), 0x20000/4); + save_pointer(NAME(m_tilemap_ram[2].get()), 0x20000/4); + save_pointer(NAME(m_tilemap_ram[3].get()), 0x20000/4); } /* diff --git a/src/mame/drivers/raiden2.cpp b/src/mame/drivers/raiden2.cpp index c06b660c840..d6c01448171 100644 --- a/src/mame/drivers/raiden2.cpp +++ b/src/mame/drivers/raiden2.cpp @@ -479,15 +479,15 @@ TILE_GET_INFO_MEMBER(raiden2_state::get_text_tile_info) VIDEO_START_MEMBER(raiden2_state,raiden2) { - back_data = auto_alloc_array_clear(machine(), UINT16, 0x800/2); - fore_data = auto_alloc_array_clear(machine(), UINT16, 0x800/2); - mid_data = auto_alloc_array_clear(machine(), UINT16, 0x800/2); - text_data = auto_alloc_array_clear(machine(), UINT16, 0x1000/2); + back_data = make_unique_clear(0x800/2); + fore_data = make_unique_clear(0x800/2); + mid_data = make_unique_clear(0x800/2); + text_data = make_unique_clear(0x1000/2); - save_pointer(NAME(back_data), 0x800/2); - save_pointer(NAME(fore_data), 0x800/2); - save_pointer(NAME(mid_data), 0x800/2); - save_pointer(NAME(text_data), 0x1000/2); + save_pointer(NAME(back_data.get()), 0x800/2); + save_pointer(NAME(fore_data.get()), 0x800/2); + save_pointer(NAME(mid_data.get()), 0x800/2); + save_pointer(NAME(text_data.get()), 0x1000/2); text_layer = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(raiden2_state::get_text_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64,32 ); background_layer = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(raiden2_state::get_back_tile_info),this), TILEMAP_SCAN_ROWS, 16,16, 32,32 ); diff --git a/src/mame/drivers/roul.cpp b/src/mame/drivers/roul.cpp index 55226243fb5..acd3a3df1da 100644 --- a/src/mame/drivers/roul.cpp +++ b/src/mame/drivers/roul.cpp @@ -81,7 +81,7 @@ public: required_device m_soundcpu; UINT8 m_reg[0x10]; - UINT8 *m_videobuf; + std::unique_ptr m_videobuf; UINT8 m_lamp_old; DECLARE_READ8_MEMBER(blitter_status_r); @@ -222,10 +222,10 @@ ADDRESS_MAP_END void roul_state::video_start() { - m_videobuf = auto_alloc_array_clear(machine(), UINT8, VIDEOBUF_SIZE); + m_videobuf = make_unique_clear(VIDEOBUF_SIZE); save_item(NAME(m_reg)); - save_pointer(NAME(m_videobuf), VIDEOBUF_SIZE); + save_pointer(NAME(m_videobuf.get()), VIDEOBUF_SIZE); save_item(NAME(m_lamp_old)); } diff --git a/src/mame/drivers/rungun.cpp b/src/mame/drivers/rungun.cpp index 5656cbed9bf..4cc31afe1f2 100644 --- a/src/mame/drivers/rungun.cpp +++ b/src/mame/drivers/rungun.cpp @@ -388,7 +388,7 @@ void rungun_state::machine_start() m_roz_rom = memregion("gfx1")->base(); membank("bank2")->configure_entries(0, 8, &ROM[0x10000], 0x4000); - m_banked_ram = auto_alloc_array_clear(machine(), UINT16, 0x2000); + m_banked_ram = make_unique_clear(0x2000); m_pal_ram = make_unique_clear(0x800*2); membank("spriteram_bank")->configure_entries(0,2,&m_banked_ram[0],0x2000); diff --git a/src/mame/drivers/simpsons.cpp b/src/mame/drivers/simpsons.cpp index 2bba8f13379..5641f189a33 100644 --- a/src/mame/drivers/simpsons.cpp +++ b/src/mame/drivers/simpsons.cpp @@ -285,7 +285,7 @@ void simpsons_state::simpsons_objdma( ) m_k053246->k053247_get_ram(&dst); - src = m_spriteram; + src = m_spriteram.get(); num_inactive = counter = 256; do { diff --git a/src/mame/drivers/smc777.cpp b/src/mame/drivers/smc777.cpp index 77569df087a..ef7ab069e4f 100644 --- a/src/mame/drivers/smc777.cpp +++ b/src/mame/drivers/smc777.cpp @@ -112,11 +112,11 @@ private: required_device m_palette; UINT8 *m_ipl_rom; - UINT8 *m_work_ram; - UINT8 *m_vram; - UINT8 *m_attr; - UINT8 *m_gvram; - UINT8 *m_pcg; + std::unique_ptr m_work_ram; + std::unique_ptr m_vram; + std::unique_ptr m_attr; + std::unique_ptr m_gvram; + std::unique_ptr m_pcg; UINT8 m_keyb_press; UINT8 m_keyb_press_flag; @@ -903,19 +903,19 @@ static const gfx_layout smc777_charlayout = void smc777_state::machine_start() { m_ipl_rom = memregion("ipl")->base(); - m_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x10000); - m_vram = auto_alloc_array_clear(machine(), UINT8, 0x800); - m_attr = auto_alloc_array_clear(machine(), UINT8, 0x800); - m_gvram = auto_alloc_array_clear(machine(), UINT8, 0x8000); - m_pcg = auto_alloc_array_clear(machine(), UINT8, 0x800); + m_work_ram = make_unique_clear(0x10000); + m_vram = make_unique_clear(0x800); + m_attr = make_unique_clear(0x800); + m_gvram = make_unique_clear(0x8000); + m_pcg = make_unique_clear(0x800); - save_pointer(NAME(m_work_ram), 0x10000); - save_pointer(NAME(m_vram), 0x800); - save_pointer(NAME(m_attr), 0x800); - save_pointer(NAME(m_gvram), 0x8000); - save_pointer(NAME(m_pcg), 0x800); + save_pointer(NAME(m_work_ram.get()), 0x10000); + save_pointer(NAME(m_vram.get()), 0x800); + save_pointer(NAME(m_attr.get()), 0x800); + save_pointer(NAME(m_gvram.get()), 0x8000); + save_pointer(NAME(m_pcg.get()), 0x800); - m_gfxdecode->set_gfx(0, global_alloc(gfx_element(m_palette, smc777_charlayout, (UINT8 *)m_pcg, 0, 8, 0))); + m_gfxdecode->set_gfx(0, global_alloc(gfx_element(m_palette, smc777_charlayout, m_pcg.get(), 0, 8, 0))); } void smc777_state::machine_reset() diff --git a/src/mame/drivers/spc1000.cpp b/src/mame/drivers/spc1000.cpp index 88cf922725a..6b22b9c0e2a 100644 --- a/src/mame/drivers/spc1000.cpp +++ b/src/mame/drivers/spc1000.cpp @@ -183,7 +183,7 @@ private: UINT8 m_IPLK; UINT8 m_GMODE; UINT16 m_page; - UINT8 *m_work_ram; + std::unique_ptr m_work_ram; attotime m_time; bool m_centronics_busy; virtual void machine_start() override; @@ -409,7 +409,7 @@ void spc1000_state::machine_start() void spc1000_state::machine_reset() { - m_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x10000); + m_work_ram = make_unique_clear(0x10000); m_IPLK = 1; } diff --git a/src/mame/drivers/srmp6.cpp b/src/mame/drivers/srmp6.cpp index 032ca33c6b4..91ed631eae9 100644 --- a/src/mame/drivers/srmp6.cpp +++ b/src/mame/drivers/srmp6.cpp @@ -85,13 +85,13 @@ public: m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette") { } - UINT16* m_tileram; + std::unique_ptr m_tileram; required_shared_ptr m_sprram; required_shared_ptr m_chrram; optional_shared_ptr m_dmaram; required_shared_ptr m_video_regs; - UINT16 *m_sprram_old; + std::unique_ptr m_sprram_old; int m_brightness; UINT16 m_input_select; @@ -167,12 +167,12 @@ void srmp6_state::update_palette() void srmp6_state::video_start() { - m_tileram = auto_alloc_array_clear(machine(), UINT16, 0x100000*16/2); + m_tileram = make_unique_clear(0x100000*16/2); m_dmaram.allocate(0x100/2); - m_sprram_old = auto_alloc_array_clear(machine(), UINT16, 0x80000/2); + m_sprram_old = make_unique_clear(0x80000/2); /* create the char set (gfx will then be updated dynamically from RAM) */ - m_gfxdecode->set_gfx(0, global_alloc(gfx_element(m_palette, tiles8x8_layout, (UINT8*)m_tileram, 0, m_palette->entries() / 256, 0))); + m_gfxdecode->set_gfx(0, global_alloc(gfx_element(m_palette, tiles8x8_layout, (UINT8*)m_tileram.get(), 0, m_palette->entries() / 256, 0))); m_gfxdecode->gfx(0)->set_granularity(256); m_brightness = 0x60; @@ -186,7 +186,7 @@ UINT32 srmp6_state::screen_update_srmp6(screen_device &screen, bitmap_rgb32 &bit { int alpha; int x,y,tileno,height,width,xw,yw,sprite,xb,yb; - UINT16 *sprite_list = m_sprram_old; + UINT16 *sprite_list = m_sprram_old.get(); UINT16 mainlist_offset = 0; union @@ -292,12 +292,12 @@ UINT32 srmp6_state::screen_update_srmp6(screen_device &screen, bitmap_rgb32 &bit mainlist_offset+=8; } - memcpy(m_sprram_old, m_sprram, 0x80000); + memcpy(m_sprram_old.get(), m_sprram, 0x80000); if(machine().input().code_pressed_once(KEYCODE_Q)) { FILE *p=fopen("tileram.bin","wb"); - fwrite(m_tileram, 1, 0x100000*16, p); + fwrite(m_tileram.get(), 1, 0x100000*16, p); fclose(p); } @@ -386,7 +386,7 @@ UINT32 srmp6_state::process(UINT8 b,UINT32 dst_offset) { int l=0; - UINT8 *tram=(UINT8*)m_tileram; + UINT8 *tram=(UINT8*)m_tileram.get(); if (m_lastb == m_lastb2) //rle { diff --git a/src/mame/drivers/su2000.cpp b/src/mame/drivers/su2000.cpp index 7582673d6bb..2beaf6623ca 100644 --- a/src/mame/drivers/su2000.cpp +++ b/src/mame/drivers/su2000.cpp @@ -66,7 +66,7 @@ public: su2000_state(const machine_config &mconfig, device_type type, const char *tag) : pcat_base_state(mconfig, type, tag){ } - UINT32 *m_pc_ram; + std::unique_ptr m_pc_ram; virtual void machine_start() override; virtual void machine_reset() override; }; @@ -127,16 +127,16 @@ void su2000_state::machine_start() address_space &space = m_maincpu->space(AS_PROGRAM); /* Configure RAM */ - m_pc_ram = auto_alloc_array_clear(machine(), UINT32, PC_RAM_SIZE); + m_pc_ram = make_unique_clear(PC_RAM_SIZE); /* Conventional memory */ - membank("mem_bank")->set_base(m_pc_ram); + membank("mem_bank")->set_base(m_pc_ram.get()); /* HMA */ offs_t ram_limit = 0x100000 + PC_RAM_SIZE - 0x0a0000; space.install_read_bank(0x100000, ram_limit - 1, "hma_bank"); space.install_write_bank(0x100000, ram_limit - 1, "hma_bank"); - membank("hma_bank")->set_base(m_pc_ram + 0xa0000); + membank("hma_bank")->set_base(m_pc_ram.get() + 0xa0000); } void su2000_state::machine_reset() diff --git a/src/mame/drivers/tmmjprd.cpp b/src/mame/drivers/tmmjprd.cpp index e6184175af4..d684651ea06 100644 --- a/src/mame/drivers/tmmjprd.cpp +++ b/src/mame/drivers/tmmjprd.cpp @@ -58,7 +58,7 @@ public: required_shared_ptr m_spriteregs; required_shared_ptr m_spriteram; - UINT32 *m_tilemap_ram[4]; + std::unique_ptr m_tilemap_ram[4]; UINT8 m_mux_data; UINT8 m_system_in; double m_old_brt1; @@ -319,9 +319,9 @@ UINT32 tmmjprd_state::screen_update_left(screen_device &screen, bitmap_ind16 &bi bitmap.fill(m_palette->black_pen(), cliprect); - draw_tilemap(bitmap, cliprect, m_tilemap_ram[3], m_tilemap_regs[3], gfxroms ); + draw_tilemap(bitmap, cliprect, m_tilemap_ram[3].get(), m_tilemap_regs[3], gfxroms ); draw_sprites(bitmap,cliprect, 1); - draw_tilemap(bitmap, cliprect, m_tilemap_ram[2], m_tilemap_regs[2], gfxroms ); + draw_tilemap(bitmap, cliprect, m_tilemap_ram[2].get(), m_tilemap_regs[2], gfxroms ); /* popmessage("%08x %08x %08x %08x %08x %08x", @@ -353,9 +353,9 @@ UINT32 tmmjprd_state::screen_update_right(screen_device &screen, bitmap_ind16 &b bitmap.fill(m_palette->black_pen(), cliprect); - draw_tilemap(bitmap, cliprect, m_tilemap_ram[1], m_tilemap_regs[1], gfxroms ); + draw_tilemap(bitmap, cliprect, m_tilemap_ram[1].get(), m_tilemap_regs[1], gfxroms ); draw_sprites(bitmap,cliprect, 0); - draw_tilemap(bitmap, cliprect, m_tilemap_ram[0], m_tilemap_regs[0], gfxroms ); + draw_tilemap(bitmap, cliprect, m_tilemap_ram[0].get(), m_tilemap_regs[0], gfxroms ); return 0; } @@ -364,16 +364,16 @@ void tmmjprd_state::video_start() { /* the tilemaps are bigger than the regions the cpu can see, need to allocate the ram here */ /* or maybe not for this game/hw .... */ - m_tilemap_ram[0] = auto_alloc_array_clear(machine(), UINT32, 0x8000); - m_tilemap_ram[1] = auto_alloc_array_clear(machine(), UINT32, 0x8000); - m_tilemap_ram[2] = auto_alloc_array_clear(machine(), UINT32, 0x8000); - m_tilemap_ram[3] = auto_alloc_array_clear(machine(), UINT32, 0x8000); + m_tilemap_ram[0] = make_unique_clear(0x8000); + m_tilemap_ram[1] = make_unique_clear(0x8000); + m_tilemap_ram[2] = make_unique_clear(0x8000); + m_tilemap_ram[3] = make_unique_clear(0x8000); - save_pointer(NAME(m_tilemap_ram[0]), 0x8000); - save_pointer(NAME(m_tilemap_ram[1]), 0x8000); - save_pointer(NAME(m_tilemap_ram[2]), 0x8000); - save_pointer(NAME(m_tilemap_ram[3]), 0x8000); + save_pointer(NAME(m_tilemap_ram[0].get()), 0x8000); + save_pointer(NAME(m_tilemap_ram[1].get()), 0x8000); + save_pointer(NAME(m_tilemap_ram[2].get()), 0x8000); + save_pointer(NAME(m_tilemap_ram[3].get()), 0x8000); save_item(NAME(m_old_brt1)); save_item(NAME(m_old_brt2)); diff --git a/src/mame/drivers/vboy.cpp b/src/mame/drivers/vboy.cpp index 0ea093a5602..e7b5e802caa 100644 --- a/src/mame/drivers/vboy.cpp +++ b/src/mame/drivers/vboy.cpp @@ -182,16 +182,16 @@ public: DECLARE_WRITE8_MEMBER(lfb1_w); DECLARE_WRITE8_MEMBER(rfb0_w); DECLARE_WRITE8_MEMBER(rfb1_w); - UINT16 *m_font; + std::unique_ptr m_font; std::unique_ptr m_bgmap; - UINT8 *m_l_frame_0; - UINT8 *m_l_frame_1; - UINT8 *m_r_frame_0; - UINT8 *m_r_frame_1; + std::unique_ptr m_l_frame_0; + std::unique_ptr m_l_frame_1; + std::unique_ptr m_r_frame_0; + std::unique_ptr m_r_frame_1; vboy_regs_t m_vboy_regs; vip_regs_t m_vip_regs; vboy_timer_t m_vboy_timer; - INT32 *m_ovr_tempdraw_map; + std::unique_ptr m_ovr_tempdraw_map; UINT16 m_frame_count; UINT8 m_displayfb; UINT8 m_drawfb; @@ -226,15 +226,15 @@ public: void vboy_state::video_start() { // Allocate memory for temporary screens - m_ovr_tempdraw_map = auto_alloc_array_clear(machine(), INT32, 0x40); + m_ovr_tempdraw_map = make_unique_clear(0x40); // Allocate memory for framebuffers - m_l_frame_0 = auto_alloc_array_clear(machine(), UINT8, 0x6000); - m_l_frame_1 = auto_alloc_array_clear(machine(), UINT8, 0x6000); - m_r_frame_0 = auto_alloc_array_clear(machine(), UINT8, 0x6000); - m_r_frame_1 = auto_alloc_array_clear(machine(), UINT8, 0x6000); + m_l_frame_0 = make_unique_clear(0x6000); + m_l_frame_1 = make_unique_clear(0x6000); + m_r_frame_0 = make_unique_clear(0x6000); + m_r_frame_1 = make_unique_clear(0x6000); - m_font = auto_alloc_array_clear(machine(), UINT16, (0x8000 >> 1)*4 * 2); + m_font = make_unique_clear((0x8000 >> 1)*4 * 2); m_bgmap = make_unique_clear(0x20000 >> 1); } diff --git a/src/mame/drivers/x1.cpp b/src/mame/drivers/x1.cpp index f495eab522d..cf12dd691dd 100644 --- a/src/mame/drivers/x1.cpp +++ b/src/mame/drivers/x1.cpp @@ -224,11 +224,11 @@ VIDEO_START_MEMBER(x1_state,x1) { - m_avram = auto_alloc_array_clear(machine(), UINT8, 0x800); - m_tvram = auto_alloc_array_clear(machine(), UINT8, 0x800); - m_kvram = auto_alloc_array_clear(machine(), UINT8, 0x800); - m_gfx_bitmap_ram = auto_alloc_array_clear(machine(), UINT8, 0xc000*2); - m_pal_4096 = auto_alloc_array_clear(machine(), UINT8, 0x1000*3); + m_avram = make_unique_clear(0x800); + m_tvram = make_unique_clear(0x800); + m_kvram = make_unique_clear(0x800); + m_gfx_bitmap_ram = make_unique_clear(0xc000*2); + m_pal_4096 = make_unique_clear(0x1000*3); } void x1_state::x1_draw_pixel(bitmap_rgb32 &bitmap,int y,int x,UINT16 pen,UINT8 width,UINT8 height) @@ -340,7 +340,7 @@ void x1_state::draw_fgtilemap(bitmap_rgb32 &bitmap,const rectangle &cliprect) int width = BIT(m_avram[((x+y*x_size)+mc6845_start_addr) & 0x7ff], 7); int height = BIT(m_avram[((x+y*x_size)+mc6845_start_addr) & 0x7ff], 6); int pcg_bank = BIT(m_avram[((x+y*x_size)+mc6845_start_addr) & 0x7ff], 5); - UINT8 *gfx_data = pcg_bank ? m_pcg_ram : m_cg_rom; //machine.root_device().memregion(pcg_bank ? "pcg" : "cgrom")->base(); + UINT8 *gfx_data = pcg_bank ? m_pcg_ram.get() : m_cg_rom; //machine.root_device().memregion(pcg_bank ? "pcg" : "cgrom")->base(); int knj_enable = 0; int knj_side = 0; int knj_bank = 0; @@ -1132,7 +1132,7 @@ READ8_MEMBER( x1_state::x1_pcg_r ) UINT8 y_char_size; /* addr == 0 reads from the ANK rom */ - gfx_data = addr == 0 ? m_cg_rom : m_pcg_ram; + gfx_data = addr == 0 ? m_cg_rom : m_pcg_ram.get(); y_char_size = ((m_crtc_vreg[9]+1) > 8) ? 8 : m_crtc_vreg[9]+1; if(y_char_size == 0) { y_char_size = 1; } pcg_offset = m_tvram[get_pcg_addr(m_crtc_vreg[1], y_char_size)]*8; @@ -2332,7 +2332,7 @@ MACHINE_RESET_MEMBER(x1_state,x1) //UINT8 *ROM = memregion("x1_cpu")->base(); int i; - memset(m_gfx_bitmap_ram,0x00,0xc000*2); + memset(m_gfx_bitmap_ram.get(),0x00,0xc000*2); for(i=0;i<0x1800;i++) { @@ -2410,17 +2410,17 @@ MACHINE_START_MEMBER(x1_state,x1) } m_ipl_rom = memregion("ipl")->base(); - m_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x10000*0x10); - m_emm_ram = auto_alloc_array_clear(machine(), UINT8, 0x1000000); - m_pcg_ram = auto_alloc_array_clear(machine(), UINT8, 0x1800); + m_work_ram = make_unique_clear(0x10000*0x10); + m_emm_ram = make_unique_clear(0x1000000); + m_pcg_ram = make_unique_clear(0x1800); m_cg_rom = memregion("cgrom")->base(); m_kanji_rom = memregion("kanji")->base(); - save_pointer(NAME(m_work_ram), 0x10000*0x10); - save_pointer(NAME(m_emm_ram), 0x1000000); - save_pointer(NAME(m_pcg_ram), 0x1800); + save_pointer(NAME(m_work_ram.get()), 0x10000*0x10); + save_pointer(NAME(m_emm_ram.get()), 0x1000000); + save_pointer(NAME(m_pcg_ram.get()), 0x1800); - m_gfxdecode->set_gfx(3, global_alloc(gfx_element(m_palette, x1_pcg_8x8, (UINT8 *)m_pcg_ram, 0, 1, 0))); + m_gfxdecode->set_gfx(3, global_alloc(gfx_element(m_palette, x1_pcg_8x8, m_pcg_ram.get(), 0, 1, 0))); } PALETTE_INIT_MEMBER(x1_state,x1) diff --git a/src/mame/drivers/z100.cpp b/src/mame/drivers/z100.cpp index 071df17fc95..7addd6407cd 100644 --- a/src/mame/drivers/z100.cpp +++ b/src/mame/drivers/z100.cpp @@ -198,7 +198,7 @@ public: DECLARE_WRITE8_MEMBER(video_pia_B_w); DECLARE_WRITE_LINE_MEMBER(video_pia_CA2_w); DECLARE_WRITE_LINE_MEMBER(video_pia_CB2_w); - UINT8 *m_gvram; + std::unique_ptr m_gvram; UINT8 m_keyb_press,m_keyb_status; UINT8 m_vram_enable; UINT8 m_gbank; @@ -239,7 +239,7 @@ public: void z100_state::video_start() { - m_gvram = auto_alloc_array_clear(machine(), UINT8, 0x30000); + m_gvram = make_unique_clear(0x30000); } UINT32 z100_state::screen_update_z100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/includes/40love.h b/src/mame/includes/40love.h index dcc3cc63962..5adae2dc8b5 100644 --- a/src/mame/includes/40love.h +++ b/src/mame/includes/40love.h @@ -37,8 +37,8 @@ public: UINT8 m_flipscreen; UINT8 m_pix_redraw; UINT8 m_xoffset; - UINT8 *m_pixram1; - UINT8 *m_pixram2; + std::unique_ptr m_pixram1; + std::unique_ptr m_pixram2; bitmap_ind16 *m_pixel_bitmap1; bitmap_ind16 *m_pixel_bitmap2; int m_pixram_sel; diff --git a/src/mame/includes/apple2gs.h b/src/mame/includes/apple2gs.h index ed0ec08b870..6812cc2b466 100644 --- a/src/mame/includes/apple2gs.h +++ b/src/mame/includes/apple2gs.h @@ -113,7 +113,7 @@ public: required_ioport m_adb_mousex, m_adb_mousey; required_device m_palette; - UINT8 *m_slowmem; + std::unique_ptr m_slowmem; UINT8 m_newvideo; UINT16 m_bordercolor; UINT8 m_vgcint; diff --git a/src/mame/includes/bfm_sc45.h b/src/mame/includes/bfm_sc45.h index 690be3ce8e3..5844cdc9a1b 100644 --- a/src/mame/includes/bfm_sc45.h +++ b/src/mame/includes/bfm_sc45.h @@ -629,7 +629,7 @@ public: { } UINT32* m_adder4cpuregion; - UINT32* m_adder4ram; + std::unique_ptr m_adder4ram; DECLARE_READ32_MEMBER(adder4_mem_r); DECLARE_WRITE32_MEMBER(adder4_mem_w); diff --git a/src/mame/includes/cidelsa.h b/src/mame/includes/cidelsa.h index b89a544693a..a6f77e9eb2d 100644 --- a/src/mame/includes/cidelsa.h +++ b/src/mame/includes/cidelsa.h @@ -80,8 +80,8 @@ public: int m_cdp1869_pcb; UINT8 *m_pageram; - UINT8 *m_pcbram; - UINT8 *m_charram; + std::unique_ptr m_pcbram; + std::unique_ptr m_charram; protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; diff --git a/src/mame/includes/combatsc.h b/src/mame/includes/combatsc.h index 13eae759fd4..6d5871da384 100644 --- a/src/mame/includes/combatsc.h +++ b/src/mame/includes/combatsc.h @@ -27,7 +27,7 @@ public: UINT8 * m_videoram; UINT8 * m_scrollram; UINT8 * m_io_ram; - UINT8 * m_spriteram[2]; + std::unique_ptr m_spriteram[2]; /* video-related */ tilemap_t *m_bg_tilemap[2]; diff --git a/src/mame/includes/cps1.h b/src/mame/includes/cps1.h index b476d70d35e..6a0655b48ce 100644 --- a/src/mame/includes/cps1.h +++ b/src/mame/includes/cps1.h @@ -138,7 +138,7 @@ public: UINT16 * m_scroll3; UINT16 * m_obj; UINT16 * m_other; - UINT16 * m_buffered_obj; + std::unique_ptr m_buffered_obj; optional_shared_ptr m_qsound_sharedram1; optional_shared_ptr m_qsound_sharedram2; // cps2 @@ -148,7 +148,7 @@ public: optional_ioport m_io_in0; optional_ioport m_io_in1; - UINT16 * m_cps2_buffered_obj; + std::unique_ptr m_cps2_buffered_obj; // game-specific std::unique_ptr m_gigaman2_dummyqsound_ram; UINT16 sf2ceblp_prot; diff --git a/src/mame/includes/dooyong.h b/src/mame/includes/dooyong.h index 6b30492d5a9..4c51451c986 100644 --- a/src/mame/includes/dooyong.h +++ b/src/mame/includes/dooyong.h @@ -86,7 +86,7 @@ public: DECLARE_VIDEO_START(primella); required_shared_ptr m_txvideoram; - UINT8* m_paletteram_flytiger; + std::unique_ptr m_paletteram_flytiger; UINT8 m_sprites_disabled; UINT8 m_flytiger_pri; UINT8 m_tx_pri; diff --git a/src/mame/includes/gridlee.h b/src/mame/includes/gridlee.h index d776b69b7b6..4aea8304969 100644 --- a/src/mame/includes/gridlee.h +++ b/src/mame/includes/gridlee.h @@ -48,7 +48,7 @@ public: emu_timer *m_firq_off; emu_timer *m_firq_timer; UINT8 m_cocktail_flip; - UINT8 *m_local_videoram; + std::unique_ptr m_local_videoram; UINT8 m_palettebank_vis; DECLARE_READ8_MEMBER(analog_port_r); diff --git a/src/mame/includes/inufuku.h b/src/mame/includes/inufuku.h index 49bebe7dcef..24ed3325158 100644 --- a/src/mame/includes/inufuku.h +++ b/src/mame/includes/inufuku.h @@ -35,7 +35,7 @@ public: int m_bg_raster; int m_bg_palettebank; int m_tx_palettebank; - UINT16* m_spriteram1_old; + std::unique_ptr m_spriteram1_old; UINT32 inufuku_tile_callback( UINT32 code ); /* misc */ diff --git a/src/mame/includes/legionna.h b/src/mame/includes/legionna.h index 5bf076fdf5d..7565381ebfa 100644 --- a/src/mame/includes/legionna.h +++ b/src/mame/includes/legionna.h @@ -28,10 +28,10 @@ public: } required_shared_ptr m_spriteram; - UINT16* m_back_data; - UINT16* m_fore_data; - UINT16* m_mid_data; - UINT16* m_textram; + std::unique_ptr m_back_data; + std::unique_ptr m_fore_data; + std::unique_ptr m_mid_data; + std::unique_ptr m_textram; std::unique_ptr m_scrollram16; UINT16 m_layer_disable; int m_sprite_xoffs; diff --git a/src/mame/includes/leland.h b/src/mame/includes/leland.h index 464344e2f1c..ab2133cef3b 100644 --- a/src/mame/includes/leland.h +++ b/src/mame/includes/leland.h @@ -49,7 +49,7 @@ public: UINT8 m_dac_control; UINT8 *m_alleymas_kludge_mem; - UINT8 *m_ataxx_qram; + std::unique_ptr m_ataxx_qram; UINT8 m_gfx_control; UINT8 m_wcol_enable; emu_timer *m_master_int_timer; @@ -79,7 +79,7 @@ public: UINT8 m_battery_ram_enable; UINT8 *m_battery_ram; std::unique_ptr m_extra_tram; - UINT8 *m_video_ram; + std::unique_ptr m_video_ram; struct vram_state_data m_vram_state[2]; UINT16 m_xscroll; UINT16 m_yscroll; diff --git a/src/mame/includes/m107.h b/src/mame/includes/m107.h index 0cb4724f10a..f34df43c638 100644 --- a/src/mame/includes/m107.h +++ b/src/mame/includes/m107.h @@ -47,7 +47,7 @@ public: UINT16 m_raster_irq_position; pf_layer_info m_pf_layer[4]; UINT16 m_control[0x10]; - UINT16 *m_buffered_spriteram; + std::unique_ptr m_buffered_spriteram; DECLARE_WRITE16_MEMBER(coincounter_w); DECLARE_WRITE16_MEMBER(bankswitch_w); diff --git a/src/mame/includes/mac.h b/src/mame/includes/mac.h index 9817b2cea0c..69969c82280 100644 --- a/src/mame/includes/mac.h +++ b/src/mame/includes/mac.h @@ -175,7 +175,7 @@ private: sound_stream *m_mac_stream; int m_sample_enable; UINT16 *m_mac_snd_buf_ptr; - UINT8 *m_snd_cache; + std::unique_ptr m_snd_cache; int m_snd_cache_len; int m_snd_cache_head; int m_snd_cache_tail; diff --git a/src/mame/includes/macrossp.h b/src/mame/includes/macrossp.h index 36aad0fde03..b9380b25566 100644 --- a/src/mame/includes/macrossp.h +++ b/src/mame/includes/macrossp.h @@ -52,8 +52,8 @@ public: required_shared_ptr m_text_linezoom; required_shared_ptr m_text_videoregs; required_shared_ptr m_mainram; - UINT32 * m_spriteram_old; - UINT32 * m_spriteram_old2; + std::unique_ptr m_spriteram_old; + std::unique_ptr m_spriteram_old2; /* video-related */ tilemap_t *m_scra_tilemap; diff --git a/src/mame/includes/mcatadv.h b/src/mame/includes/mcatadv.h index eec74b2df5d..419cf623e1d 100644 --- a/src/mame/includes/mcatadv.h +++ b/src/mame/includes/mcatadv.h @@ -23,7 +23,7 @@ public: required_shared_ptr m_scroll1; required_shared_ptr m_scroll2; required_shared_ptr m_spriteram; - UINT16 * m_spriteram_old; + std::unique_ptr m_spriteram_old; required_shared_ptr m_vidregs; std::unique_ptr m_vidregs_old; diff --git a/src/mame/includes/micro3d.h b/src/mame/includes/micro3d.h index cde05482501..e6295b78ae0 100644 --- a/src/mame/includes/micro3d.h +++ b/src/mame/includes/micro3d.h @@ -213,8 +213,8 @@ struct biquad struct lp_filter { - float *history; - float *coef; + std::unique_ptr history; + std::unique_ptr coef; double fs; biquad ProtoCoef[2]; }; diff --git a/src/mame/includes/midyunit.h b/src/mame/includes/midyunit.h index f3feb79cead..6f77a89582f 100644 --- a/src/mame/includes/midyunit.h +++ b/src/mame/includes/midyunit.h @@ -83,7 +83,7 @@ public: UINT8 m_autoerase_enable; UINT32 m_palette_mask; pen_t * m_pen_map; - UINT16 * m_local_videoram; + std::unique_ptr m_local_videoram; UINT8 m_videobank_select; UINT8 m_yawdim_dma; UINT16 m_dma_register[16]; diff --git a/src/mame/includes/model1.h b/src/mame/includes/model1.h index ea8c5c55125..9a571433323 100644 --- a/src/mame/includes/model1.h +++ b/src/mame/includes/model1.h @@ -111,11 +111,11 @@ public: UINT16 m_listctl[2]; UINT16 *m_glist; int m_render_done; - UINT16 *m_tgp_ram; + std::unique_ptr m_tgp_ram; optional_shared_ptr m_paletteram16; required_device m_palette; UINT32 *m_poly_rom; - UINT32 *m_poly_ram; + std::unique_ptr m_poly_ram; UINT16 m_lamp_state; DECLARE_READ16_MEMBER(io_r); DECLARE_WRITE16_MEMBER(io_w); diff --git a/src/mame/includes/model2.h b/src/mame/includes/model2.h index e71cf24f55f..179d1b64fc2 100644 --- a/src/mame/includes/model2.h +++ b/src/mame/includes/model2.h @@ -46,7 +46,7 @@ public: required_shared_ptr m_workram; required_shared_ptr m_bufferram; - UINT16 *m_palram; + std::unique_ptr m_palram; required_shared_ptr m_colorxlat; required_shared_ptr m_textureram0; required_shared_ptr m_textureram1; @@ -85,11 +85,11 @@ public: int m_dsp_type; int m_copro_fifoin_rpos; int m_copro_fifoin_wpos; - UINT32 *m_copro_fifoin_data; + std::unique_ptr m_copro_fifoin_data; int m_copro_fifoin_num; int m_copro_fifoout_rpos; int m_copro_fifoout_wpos; - UINT32 *m_copro_fifoout_data; + std::unique_ptr m_copro_fifoout_data; int m_copro_fifoout_num; UINT16 m_cmd_data; UINT8 m_driveio_comm_data; diff --git a/src/mame/includes/model3.h b/src/mame/includes/model3.h index 4812025c31a..6944c3e7e5b 100644 --- a/src/mame/includes/model3.h +++ b/src/mame/includes/model3.h @@ -123,7 +123,7 @@ public: int m_lightgun_reg_sel; int m_adc_channel; UINT64 m_real3d_status; - UINT64 *m_network_ram; + std::unique_ptr m_network_ram; int m_prot_data_ptr; std::unique_ptr m_vrom; int m_step; @@ -140,14 +140,14 @@ public: UINT32 m_layer_modulate1; UINT32 m_layer_modulate2; UINT64 m_layer_scroll[2]; - UINT64 *m_m3_char_ram; - UINT64 *m_m3_tile_ram; - UINT32 *m_texture_fifo; + std::unique_ptr m_m3_char_ram; + std::unique_ptr m_m3_tile_ram; + std::unique_ptr m_texture_fifo; int m_texture_fifo_pos; std::unique_ptr m_texture_ram[2]; - UINT32 *m_display_list_ram; - UINT32 *m_culling_ram; - UINT32 *m_polygon_ram; + std::unique_ptr m_display_list_ram; + std::unique_ptr m_culling_ram; + std::unique_ptr m_polygon_ram; int m_real3d_display_list; rectangle m_clip3d; rectangle *m_screen_clip; diff --git a/src/mame/includes/namcos22.h b/src/mame/includes/namcos22.h index d37cd80e234..7b27a0818ef 100644 --- a/src/mame/includes/namcos22.h +++ b/src/mame/includes/namcos22.h @@ -238,7 +238,7 @@ public: bool m_dsp_irq_enabled; emu_timer *m_ar_tb_interrupt[2]; UINT16 m_dsp_master_bioz; - UINT32 *m_pointram; + std::unique_ptr m_pointram; UINT32 m_old_coin_state; UINT32 m_credits1; UINT32 m_credits2; @@ -264,9 +264,9 @@ public: int m_spot_enable; int m_spot_read_address; int m_spot_write_address; - UINT16 *m_spotram; - UINT16 *m_banked_czram[4]; - UINT8 *m_recalc_czram[4]; + std::unique_ptr m_spotram; + std::unique_ptr m_banked_czram[4]; + std::unique_ptr m_recalc_czram[4]; UINT32 m_cz_was_written[4]; int m_cz_adjust; namcos22_renderer *m_poly; diff --git a/src/mame/includes/nbmj8688.h b/src/mame/includes/nbmj8688.h index 8df14b9c0b8..c08991c7f7c 100644 --- a/src/mame/includes/nbmj8688.h +++ b/src/mame/includes/nbmj8688.h @@ -42,7 +42,7 @@ public: int m_flipscreen; int m_screen_refresh; std::unique_ptr m_tmpbitmap; - UINT16 *m_videoram; + std::unique_ptr m_videoram; std::unique_ptr m_clut; int m_flipscreen_old; emu_timer *m_blitter_timer; diff --git a/src/mame/includes/nbmj9195.h b/src/mame/includes/nbmj9195.h index 0906bc54397..ec36eb8f168 100644 --- a/src/mame/includes/nbmj9195.h +++ b/src/mame/includes/nbmj9195.h @@ -67,8 +67,8 @@ public: int m_nb19010_busyctr; int m_nb19010_busyflag; bitmap_ind16 m_tmpbitmap[VRAM_MAX]; - UINT16 *m_videoram[VRAM_MAX]; - UINT16 *m_videoworkram[VRAM_MAX]; + std::unique_ptr m_videoram[VRAM_MAX]; + std::unique_ptr m_videoworkram[VRAM_MAX]; std::unique_ptr m_clut[VRAM_MAX]; int m_flipscreen_old[VRAM_MAX]; emu_timer *m_blitter_timer; diff --git a/src/mame/includes/ninjakd2.h b/src/mame/includes/ninjakd2.h index 2ef48488ab5..45f35a3d42c 100644 --- a/src/mame/includes/ninjakd2.h +++ b/src/mame/includes/ninjakd2.h @@ -54,9 +54,9 @@ public: UINT8 m_robokid_bg0_bank; UINT8 m_robokid_bg1_bank; UINT8 m_robokid_bg2_bank; - UINT8* m_robokid_bg0_videoram; - UINT8* m_robokid_bg1_videoram; - UINT8* m_robokid_bg2_videoram; + std::unique_ptr m_robokid_bg0_videoram; + std::unique_ptr m_robokid_bg1_videoram; + std::unique_ptr m_robokid_bg2_videoram; UINT8 m_rom_bank_mask; void omegaf_io_protection_start(); diff --git a/src/mame/includes/niyanpai.h b/src/mame/includes/niyanpai.h index 98e65f868c8..2115240a0da 100644 --- a/src/mame/includes/niyanpai.h +++ b/src/mame/includes/niyanpai.h @@ -47,8 +47,8 @@ public: int m_nb19010_busyctr; int m_nb19010_busyflag; bitmap_ind16 m_tmpbitmap[VRAM_MAX]; - UINT16 *m_videoram[VRAM_MAX]; - UINT16 *m_videoworkram[VRAM_MAX]; + std::unique_ptr m_videoram[VRAM_MAX]; + std::unique_ptr m_videoworkram[VRAM_MAX]; std::unique_ptr m_palette_ptr; std::unique_ptr m_clut[VRAM_MAX]; int m_flipscreen_old[VRAM_MAX]; diff --git a/src/mame/includes/nmk16.h b/src/mame/includes/nmk16.h index fb1683e84d7..77cf7317a00 100644 --- a/src/mame/includes/nmk16.h +++ b/src/mame/includes/nmk16.h @@ -55,8 +55,8 @@ public: int mask[4*2]; int m_simple_scroll; int m_redraw_bitmap; - UINT16 *m_spriteram_old; - UINT16 *m_spriteram_old2; + std::unique_ptr m_spriteram_old; + std::unique_ptr m_spriteram_old2; int m_bgbank; int m_videoshift; int m_bioship_background_bank; diff --git a/src/mame/includes/norautp.h b/src/mame/includes/norautp.h index 94e8db65215..0053087ec91 100644 --- a/src/mame/includes/norautp.h +++ b/src/mame/includes/norautp.h @@ -18,7 +18,7 @@ public: m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette") { } - UINT16 *m_np_vram; + std::unique_ptr m_np_vram; UINT16 m_np_addr; DECLARE_READ8_MEMBER(test_r); DECLARE_READ8_MEMBER(vram_data_r); diff --git a/src/mame/includes/pastelg.h b/src/mame/includes/pastelg.h index 7875112bbb7..af0d87dc1f6 100644 --- a/src/mame/includes/pastelg.h +++ b/src/mame/includes/pastelg.h @@ -34,7 +34,7 @@ public: int m_blitter_direction_x; int m_blitter_direction_y; int m_palbank; - UINT8 *m_videoram; + std::unique_ptr m_videoram; int m_flipscreen_old; DECLARE_READ8_MEMBER(pastelg_sndrom_r); diff --git a/src/mame/includes/pgm.h b/src/mame/includes/pgm.h index 1c754170b53..daf39a83b5d 100644 --- a/src/mame/includes/pgm.h +++ b/src/mame/includes/pgm.h @@ -43,7 +43,7 @@ public: UINT16 * m_rowscrollram; std::unique_ptr m_sprite_a_region; size_t m_sprite_a_region_size; - UINT16 * m_spritebufferram; // buffered spriteram + std::unique_ptr m_spritebufferram; // buffered spriteram /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/includes/raiden2.h b/src/mame/includes/raiden2.h index 251eea2048e..26156ae9c4c 100644 --- a/src/mame/includes/raiden2.h +++ b/src/mame/includes/raiden2.h @@ -44,7 +44,10 @@ public: } - UINT16 *back_data, *fore_data, *mid_data, *text_data; // private buffers, allocated in init + std::unique_ptr back_data; + std::unique_ptr fore_data; + std::unique_ptr mid_data; + std::unique_ptr text_data; // private buffers, allocated in init required_shared_ptr sprites; required_device m_maincpu; optional_device m_seibu_sound; diff --git a/src/mame/includes/rungun.h b/src/mame/includes/rungun.h index 388e16bb952..e2d5e91e882 100644 --- a/src/mame/includes/rungun.h +++ b/src/mame/includes/rungun.h @@ -66,7 +66,7 @@ public: UINT8 m_sound_nmi_clk; bool m_video_priority_mode; - UINT16 *m_banked_ram; + std::unique_ptr m_banked_ram; bool m_single_screen_mode; UINT8 m_video_mux_bank; diff --git a/src/mame/includes/segas32.h b/src/mame/includes/segas32.h index 76a5f8fd161..11be547b559 100644 --- a/src/mame/includes/segas32.h +++ b/src/mame/includes/segas32.h @@ -42,7 +42,7 @@ public: struct layer_info { bitmap_ind16 *bitmap; - UINT8 *transparent; + std::unique_ptr transparent; }; struct extents_list diff --git a/src/mame/includes/seibuspi.h b/src/mame/includes/seibuspi.h index ded8ff27ed9..9199f018e64 100644 --- a/src/mame/includes/seibuspi.h +++ b/src/mame/includes/seibuspi.h @@ -68,9 +68,9 @@ public: int m_back_layer_d14; int m_midl_layer_d14; int m_fore_layer_d14; - UINT32 *m_tilemap_ram; - UINT32 *m_palette_ram; - UINT32 *m_sprite_ram; + std::unique_ptr m_tilemap_ram; + std::unique_ptr m_palette_ram; + std::unique_ptr m_sprite_ram; UINT32 m_tilemap_ram_size; UINT32 m_palette_ram_size; UINT32 m_sprite_ram_size; diff --git a/src/mame/includes/simpl156.h b/src/mame/includes/simpl156.h index 3da2f9e58e3..7fc91654160 100644 --- a/src/mame/includes/simpl156.h +++ b/src/mame/includes/simpl156.h @@ -31,13 +31,13 @@ public: required_device m_eeprom; required_device m_okimusic; /* memory pointers */ - UINT16 * m_pf1_rowscroll; - UINT16 * m_pf2_rowscroll; + std::unique_ptr m_pf1_rowscroll; + std::unique_ptr m_pf2_rowscroll; required_shared_ptr m_mainram; required_shared_ptr m_systemram; optional_device m_sprgen; required_device m_palette; - UINT16 *m_spriteram; + std::unique_ptr m_spriteram; size_t m_spriteram_size; DECO16IC_BANK_CB_MEMBER(bank_callback); DECOSPR_PRIORITY_CB_MEMBER(pri_callback); diff --git a/src/mame/includes/simpsons.h b/src/mame/includes/simpsons.h index fe70166dd3a..91c64dd3976 100644 --- a/src/mame/includes/simpsons.h +++ b/src/mame/includes/simpsons.h @@ -26,7 +26,7 @@ public: m_k053251(*this, "k053251") { } /* memory pointers */ - UINT16 * m_spriteram; + std::unique_ptr m_spriteram; /* video-related */ int m_sprite_colorbase; diff --git a/src/mame/includes/sms.h b/src/mame/includes/sms.h index 6fc09d3f1d9..ec9ae688698 100644 --- a/src/mame/includes/sms.h +++ b/src/mame/includes/sms.h @@ -83,7 +83,7 @@ public: required_memory_region m_region_maincpu; address_space *m_space; - UINT8 *m_mainram; + std::unique_ptr m_mainram; UINT8 *m_BIOS; // for 3D glass binocular hack diff --git a/src/mame/includes/snes.h b/src/mame/includes/snes.h index 423b2b16fc2..88435e46960 100644 --- a/src/mame/includes/snes.h +++ b/src/mame/includes/snes.h @@ -286,7 +286,7 @@ struct snes_cart_info { UINT8 *m_rom; UINT32 m_rom_size; - UINT8 *m_nvram; + std::unique_ptr m_nvram; UINT32 m_nvram_size; UINT8 mode; /* ROM memory mode */ UINT32 sram_max; /* Maximum amount sram in cart (based on ROM mode) */ diff --git a/src/mame/includes/stv.h b/src/mame/includes/stv.h index 1c317f7b805..51ea07b19c5 100644 --- a/src/mame/includes/stv.h +++ b/src/mame/includes/stv.h @@ -52,11 +52,11 @@ public: std::unique_ptr m_backupram; std::unique_ptr m_scu_regs; std::unique_ptr m_scsp_regs; - UINT16 *m_vdp2_regs; - UINT32 *m_vdp2_vram; - UINT32 *m_vdp2_cram; - UINT32 *m_vdp1_vram; - UINT16 *m_vdp1_regs; + std::unique_ptr m_vdp2_regs; + std::unique_ptr m_vdp2_vram; + std::unique_ptr m_vdp2_cram; + std::unique_ptr m_vdp1_vram; + std::unique_ptr m_vdp1_regs; UINT8 m_NMI_reset; UINT8 m_en_68k; diff --git a/src/mame/includes/system1.h b/src/mame/includes/system1.h index 24661f07012..8f3cf559276 100644 --- a/src/mame/includes/system1.h +++ b/src/mame/includes/system1.h @@ -34,7 +34,7 @@ public: optional_shared_ptr m_nob_mcu_status; required_shared_ptr m_paletteram; - UINT8 *m_videoram; + std::unique_ptr m_videoram; void (system1_state::*m_videomode_custom)(UINT8 data, UINT8 prevdata); UINT8 m_mute_xor; UINT8 m_dakkochn_mux_data; @@ -42,9 +42,9 @@ public: UINT8 m_mcu_control; UINT8 m_nob_maincpu_latch; int m_nobb_inport23_step; - UINT8 *m_mix_collide; + std::unique_ptr m_mix_collide; UINT8 m_mix_collide_summary; - UINT8 *m_sprite_collide; + std::unique_ptr m_sprite_collide; UINT8 m_sprite_collide_summary; bitmap_ind16 m_sprite_bitmap; UINT8 m_video_mode; diff --git a/src/mame/includes/taito_f2.h b/src/mame/includes/taito_f2.h index f97fd3cfed4..b020660421e 100644 --- a/src/mame/includes/taito_f2.h +++ b/src/mame/includes/taito_f2.h @@ -50,8 +50,8 @@ public: /* memory pointers */ optional_shared_ptr m_sprite_extension; required_shared_ptr m_spriteram; - UINT16 * m_spriteram_buffered; - UINT16 * m_spriteram_delayed; + std::unique_ptr m_spriteram_buffered; + std::unique_ptr m_spriteram_delayed; optional_shared_ptr m_cchip2_ram; // for megablst only /* video-related */ diff --git a/src/mame/includes/taito_f3.h b/src/mame/includes/taito_f3.h index 30d3fd67589..5b31c9db98c 100644 --- a/src/mame/includes/taito_f3.h +++ b/src/mame/includes/taito_f3.h @@ -82,12 +82,12 @@ public: optional_ioport m_eepromin; - UINT16 *m_videoram; - UINT16 *m_spriteram; - UINT16 *m_f3_vram; - UINT16 *m_f3_line_ram; - UINT16 *m_f3_pf_data; - UINT16 *m_f3_pivot_ram; + std::unique_ptr m_videoram; + std::unique_ptr m_spriteram; + std::unique_ptr m_f3_vram; + std::unique_ptr m_f3_line_ram; + std::unique_ptr m_f3_pf_data; + std::unique_ptr m_f3_pivot_ram; UINT32 m_coin_word[2]; int m_f3_game; diff --git a/src/mame/includes/taitojc.h b/src/mame/includes/taitojc.h index 7b9baf4bffa..76d1eaeb122 100644 --- a/src/mame/includes/taitojc.h +++ b/src/mame/includes/taitojc.h @@ -64,8 +64,8 @@ public: int m_gfx_index; - UINT32 *m_char_ram; - UINT32 *m_tile_ram; + std::unique_ptr m_char_ram; + std::unique_ptr m_tile_ram; tilemap_t *m_tilemap; UINT8 m_mcu_comm_main; diff --git a/src/mame/includes/tatsumi.h b/src/mame/includes/tatsumi.h index 2fe7083a416..0b1aac7f23f 100644 --- a/src/mame/includes/tatsumi.h +++ b/src/mame/includes/tatsumi.h @@ -86,7 +86,7 @@ public: UINT16 m_bigfight_last_bank; UINT8 m_roundupt_crt_selected_reg; UINT8 m_roundupt_crt_reg[64]; - UINT8* m_shadow_pen_array; + std::unique_ptr m_shadow_pen_array; DECLARE_READ16_MEMBER(cyclwarr_sprite_r); DECLARE_WRITE16_MEMBER(cyclwarr_sprite_w); DECLARE_WRITE16_MEMBER(bigfight_a20000_w); diff --git a/src/mame/includes/tceptor.h b/src/mame/includes/tceptor.h index 1454d8c3d5d..e0d18aa908a 100644 --- a/src/mame/includes/tceptor.h +++ b/src/mame/includes/tceptor.h @@ -44,7 +44,7 @@ public: INT32 m_bg2_scroll_x; INT32 m_bg2_scroll_y; bitmap_ind16 m_temp_bitmap; - UINT16 *m_sprite_ram_buffered; + std::unique_ptr m_sprite_ram_buffered; int m_is_mask_spr[1024/16]; DECLARE_READ8_MEMBER(m68k_shared_r); DECLARE_WRITE8_MEMBER(m68k_shared_w); diff --git a/src/mame/includes/thepit.h b/src/mame/includes/thepit.h index 121c50ad766..11852faab9e 100644 --- a/src/mame/includes/thepit.h +++ b/src/mame/includes/thepit.h @@ -27,7 +27,7 @@ public: UINT8 m_flip_y; tilemap_t *m_solid_tilemap; tilemap_t *m_tilemap; - UINT8 *m_dummy_tile; + std::unique_ptr m_dummy_tile; UINT8 m_nmi_mask; int m_question_address; diff --git a/src/mame/includes/thief.h b/src/mame/includes/thief.h index 03e8d2b6ae3..bc1d57ae8a8 100644 --- a/src/mame/includes/thief.h +++ b/src/mame/includes/thief.h @@ -20,7 +20,7 @@ public: m_tms(*this, "tms"), m_palette(*this, "palette") { } - UINT8 *m_videoram; + std::unique_ptr m_videoram; UINT8 m_input_select; UINT8 m_read_mask; UINT8 m_write_mask; diff --git a/src/mame/includes/ti85.h b/src/mame/includes/ti85.h index b4a738d3e11..4eff29fff9b 100644 --- a/src/mame/includes/ti85.h +++ b/src/mame/includes/ti85.h @@ -111,7 +111,7 @@ public: int m_ti_screen_x_size; int m_ti_screen_y_size; int m_ti_number_of_frames; - UINT8 * m_frames; + std::unique_ptr m_frames; UINT8 * m_bios; DECLARE_READ8_MEMBER(ti85_port_0000_r); DECLARE_READ8_MEMBER(ti8x_keypad_r); diff --git a/src/mame/includes/tiamc1.h b/src/mame/includes/tiamc1.h index 0bbe03fe83a..cb2377c329f 100644 --- a/src/mame/includes/tiamc1.h +++ b/src/mame/includes/tiamc1.h @@ -10,6 +10,7 @@ public: m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette") { } + std::unique_ptr m_videoram; UINT8 *m_tileram; UINT8 *m_charram; UINT8 *m_spriteram_x; diff --git a/src/mame/includes/toaplan1.h b/src/mame/includes/toaplan1.h index 6d1f773dc65..7c67523b40a 100644 --- a/src/mame/includes/toaplan1.h +++ b/src/mame/includes/toaplan1.h @@ -43,15 +43,15 @@ public: UINT8 m_vimana_credits; UINT8 m_vimana_latch; - UINT16 *m_pf4_tilevram16; /* || Drawn in this order */ - UINT16 *m_pf3_tilevram16; /* || */ - UINT16 *m_pf2_tilevram16; /* \||/ */ - UINT16 *m_pf1_tilevram16; /* \/ */ + std::unique_ptr m_pf4_tilevram16; /* || Drawn in this order */ + std::unique_ptr m_pf3_tilevram16; /* || */ + std::unique_ptr m_pf2_tilevram16; /* \||/ */ + std::unique_ptr m_pf1_tilevram16; /* \/ */ optional_shared_ptr m_spriteram; - UINT16 *m_buffered_spriteram; - UINT16 *m_spritesizeram16; - UINT16 *m_buffered_spritesizeram16; + std::unique_ptr m_buffered_spriteram; + std::unique_ptr m_spritesizeram16; + std::unique_ptr m_buffered_spritesizeram16; INT32 m_bcu_flipscreen; /* Tile controller flip flag */ INT32 m_fcu_flipscreen; /* Sprite controller flip flag */ diff --git a/src/mame/includes/twincobr.h b/src/mame/includes/twincobr.h index bd9ae4478d6..670c762a923 100644 --- a/src/mame/includes/twincobr.h +++ b/src/mame/includes/twincobr.h @@ -39,9 +39,9 @@ public: int m_dsp_execute; UINT32 m_dsp_addr_w; UINT32 m_main_ram_seg; - UINT16 *m_bgvideoram16; - UINT16 *m_fgvideoram16; - UINT16 *m_txvideoram16; + std::unique_ptr m_bgvideoram16; + std::unique_ptr m_fgvideoram16; + std::unique_ptr m_txvideoram16; size_t m_bgvideoram_size; size_t m_fgvideoram_size; size_t m_txvideoram_size; diff --git a/src/mame/includes/unico.h b/src/mame/includes/unico.h index bf97ff20ef4..26ac4e35f26 100644 --- a/src/mame/includes/unico.h +++ b/src/mame/includes/unico.h @@ -17,12 +17,12 @@ public: m_generic_paletteram_16(*this, "paletteram"), m_generic_paletteram_32(*this, "paletteram") { } - UINT16* m_vram; - UINT16* m_scroll; + std::unique_ptr m_vram; + std::unique_ptr m_scroll; tilemap_t *m_tilemap[3]; int m_sprites_scrolldx; int m_sprites_scrolldy; - UINT16* m_spriteram; + std::unique_ptr m_spriteram; DECLARE_WRITE16_MEMBER(zeropnt_sound_bank_w); DECLARE_READ16_MEMBER(unico_gunx_0_msb_r); DECLARE_READ16_MEMBER(unico_guny_0_msb_r); diff --git a/src/mame/includes/volfied.h b/src/mame/includes/volfied.h index e49fab85419..b809e001d8c 100644 --- a/src/mame/includes/volfied.h +++ b/src/mame/includes/volfied.h @@ -25,7 +25,7 @@ public: /* memory pointers */ std::unique_ptr m_video_ram; - UINT8 * m_cchip_ram; + std::unique_ptr m_cchip_ram; /* video-related */ UINT16 m_video_ctrl; diff --git a/src/mame/includes/x1.h b/src/mame/includes/x1.h index 216cbffa025..eb8d63182cd 100644 --- a/src/mame/includes/x1.h +++ b/src/mame/includes/x1.h @@ -104,13 +104,13 @@ public: required_device m_crtc; required_device m_ctc; - UINT8 *m_tvram; /**< Pointer for Text Video RAM */ - UINT8 *m_avram; /**< Pointer for Attribute Video RAM */ - UINT8 *m_kvram; /**< Pointer for Extended Kanji Video RAM (X1 Turbo) */ + std::unique_ptr m_tvram; /**< Pointer for Text Video RAM */ + std::unique_ptr m_avram; /**< Pointer for Attribute Video RAM */ + std::unique_ptr m_kvram; /**< Pointer for Extended Kanji Video RAM (X1 Turbo) */ UINT8 *m_ipl_rom; /**< Pointer for IPL ROM */ - UINT8 *m_work_ram; /**< Pointer for base work RAM */ - UINT8 *m_emm_ram; /**< Pointer for EMM RAM */ - UINT8 *m_pcg_ram; /**< Pointer for PCG GFX RAM */ + std::unique_ptr m_work_ram; /**< Pointer for base work RAM */ + std::unique_ptr m_emm_ram; /**< Pointer for EMM RAM */ + std::unique_ptr m_pcg_ram; /**< Pointer for PCG GFX RAM */ UINT8 *m_cg_rom; /**< Pointer for GFX ROM */ UINT8 *m_kanji_rom; /**< Pointer for Kanji ROMs */ int m_xstart, /**< Start X offset for screen drawing. */ @@ -121,7 +121,7 @@ public: UINT8 m_vsync; /**< Screen V-Sync bit, active low */ UINT8 m_vdisp; /**< Screen V-Disp bit, active high */ UINT8 m_io_bank_mode; /**< Helper for special bitmap RMW phase. */ - UINT8 *m_gfx_bitmap_ram; /**< Pointer for bitmap layer RAM. */ + std::unique_ptr m_gfx_bitmap_ram; /**< Pointer for bitmap layer RAM. */ UINT8 m_pcg_reset; /**< @todo Unused variable. */ UINT8 m_sub_obf; /**< MCU side: OBF flag active low, indicates that there are parameters in comm buffer. */ UINT8 m_ctc_irq_flag; /**< @todo Unused variable. */ @@ -156,7 +156,7 @@ public: UINT8 m_key_irq_flag; /**< Keyboard IRQ pending. */ UINT8 m_key_irq_vector; /**< Keyboard IRQ vector. */ UINT32 m_emm_addr; /**< EMM RAM current address */ - UINT8 *m_pal_4096; /**< X1 Turbo Z: pointer for 4096 palette entries */ + std::unique_ptr m_pal_4096; /**< X1 Turbo Z: pointer for 4096 palette entries */ UINT8 m_crtc_vreg[0x100], /**< CRTC register buffer. */ m_crtc_index; /**< CRTC register index. */ UINT8 m_is_turbo; /**< Machine type: (0) X1 Vanilla, (1) X1 Turbo */ diff --git a/src/mame/machine/alpha8201.cpp b/src/mame/machine/alpha8201.cpp index 5636a56ede1..88813b1be9f 100644 --- a/src/mame/machine/alpha8201.cpp +++ b/src/mame/machine/alpha8201.cpp @@ -295,7 +295,7 @@ alpha_8201_device::alpha_8201_device(const machine_config &mconfig, const char * void alpha_8201_device::device_start() { - m_shared_ram = auto_alloc_array_clear(machine(), UINT8, 0x400); + m_shared_ram = make_unique_clear(0x400); // zerofill m_bus = 0; @@ -304,7 +304,7 @@ void alpha_8201_device::device_start() memset(m_mcu_r, 0, sizeof(m_mcu_r)); // register for savestates - save_pointer(NAME(m_shared_ram), 0x400); + save_pointer(NAME(m_shared_ram.get()), 0x400); save_item(NAME(m_bus)); save_item(NAME(m_mcu_address)); save_item(NAME(m_mcu_d)); diff --git a/src/mame/machine/alpha8201.h b/src/mame/machine/alpha8201.h index 3e99a7a4e24..1db8eb64a3a 100644 --- a/src/mame/machine/alpha8201.h +++ b/src/mame/machine/alpha8201.h @@ -42,7 +42,7 @@ private: UINT16 m_mcu_address; // MCU side RAM address UINT16 m_mcu_d; // MCU D output data UINT8 m_mcu_r[4]; // MCU R0-R3 output data - UINT8* m_shared_ram; // 1KB RAM + std::unique_ptr m_shared_ram; // 1KB RAM void mcu_update_address(); void mcu_writeram(); diff --git a/src/mame/machine/apple2gs.cpp b/src/mame/machine/apple2gs.cpp index 132ed6e8dca..91430cdce15 100644 --- a/src/mame/machine/apple2gs.cpp +++ b/src/mame/machine/apple2gs.cpp @@ -1821,8 +1821,8 @@ void apple2gs_state::apple2gs_setup_memory() apple2_memmap_config cfg; /* allocate memory for E00000-E1FFFF */ - m_slowmem = auto_alloc_array_clear(machine(), UINT8, 128*1024); - save_pointer(m_slowmem, "APPLE2GS_SLOWMEM", 128*1024); + m_slowmem = make_unique_clear(128*1024); + save_pointer(m_slowmem.get(), "APPLE2GS_SLOWMEM", 128*1024); // install expanded memory // fair warning: other code assumes banks 0 and 1 are the first 128k of the RAM device, so you must install bank 1 at 0x10000 @@ -1857,7 +1857,7 @@ void apple2gs_state::apple2gs_setup_memory() space.install_write_handler(0xe02000, 0xe03fff, write8_delegate(FUNC(apple2gs_state::apple2gs_E02xxx_w),this)); space.install_write_handler(0xe10400, 0xe107ff, write8_delegate(FUNC(apple2gs_state::apple2gs_E104xx_w),this)); space.install_write_handler(0xe12000, 0xe13fff, write8_delegate(FUNC(apple2gs_state::apple2gs_E12xxx_w),this)); - membank("bank2")->set_base(m_slowmem); + membank("bank2")->set_base(m_slowmem.get()); /* install alternate ROM bank */ begin = 0x1000000 - memregion("maincpu")->bytes(); @@ -1885,7 +1885,7 @@ void apple2gs_state::apple2gs_setup_memory() memset(&cfg, 0, sizeof(cfg)); cfg.first_bank = 4; cfg.memmap = apple2gs_memmap_entries; - cfg.auxmem = m_slowmem; + cfg.auxmem = m_slowmem.get(); cfg.auxmem_length = 0x20000; apple2_setup_memory(&cfg); } diff --git a/src/mame/machine/fddebug.cpp b/src/mame/machine/fddebug.cpp index ce78ae294ea..fcb4a46bff8 100644 --- a/src/mame/machine/fddebug.cpp +++ b/src/mame/machine/fddebug.cpp @@ -496,7 +496,7 @@ void fd1094_init_debugging(running_machine &machine, const char *cpureg, const c assert(coderegion_words == keystatus_words); /* allocate memory for the ignore table */ - ignorepc = auto_alloc_array_clear(machine, UINT8, 1 << 23); + ignorepc = make_unique_clear(1 << 23); /* allocate memory for the undo buffer */ undobuff = std::make_unique(keystatus_words * 2); diff --git a/src/mame/machine/pce_cd.cpp b/src/mame/machine/pce_cd.cpp index 272a86c5ea9..26e730b491e 100644 --- a/src/mame/machine/pce_cd.cpp +++ b/src/mame/machine/pce_cd.cpp @@ -99,17 +99,17 @@ void pce_cd_device::device_start() m_nvram->set_base(m_bram.get(), PCE_BRAM_SIZE); /* set up adpcm related things */ - m_adpcm_ram = auto_alloc_array_clear(machine(), UINT8, PCE_ADPCM_RAM_SIZE); + m_adpcm_ram = make_unique_clear(PCE_ADPCM_RAM_SIZE); m_adpcm_clock_divider = 1; /* Set up cd command buffer */ - m_command_buffer = auto_alloc_array_clear(machine(), UINT8, PCE_CD_COMMAND_BUFFER_SIZE); + m_command_buffer = make_unique_clear(PCE_CD_COMMAND_BUFFER_SIZE); m_command_buffer_index = 0; /* Set up Arcade Card RAM buffer */ - m_acard_ram = auto_alloc_array_clear(machine(), UINT8, PCE_ACARD_RAM_SIZE); + m_acard_ram = make_unique_clear(PCE_ACARD_RAM_SIZE); - m_data_buffer = auto_alloc_array_clear(machine(), UINT8, 8192); + m_data_buffer = make_unique_clear(8192); m_data_buffer_size = 0; m_data_buffer_index = 0; @@ -135,7 +135,7 @@ void pce_cd_device::device_start() // TODO: add proper restore for the cd data... save_item(NAME(m_regs)); save_pointer(NAME(m_bram.get()), PCE_BRAM_SIZE * 2); - save_pointer(NAME(m_adpcm_ram), PCE_ADPCM_RAM_SIZE); + save_pointer(NAME(m_adpcm_ram.get()), PCE_ADPCM_RAM_SIZE); save_item(NAME(m_bram_locked)); save_item(NAME(m_adpcm_read_ptr)); save_item(NAME(m_adpcm_read_buf)); @@ -161,16 +161,16 @@ void pce_cd_device::device_start() save_item(NAME(m_scsi_last_RST)); save_item(NAME(m_cd_motor_on)); save_item(NAME(m_selected)); - save_pointer(NAME(m_command_buffer), PCE_CD_COMMAND_BUFFER_SIZE); + save_pointer(NAME(m_command_buffer.get()), PCE_CD_COMMAND_BUFFER_SIZE); save_item(NAME(m_command_buffer_index)); save_item(NAME(m_status_sent)); save_item(NAME(m_message_after_status)); save_item(NAME(m_message_sent)); - save_pointer(NAME(m_data_buffer), 8192); + save_pointer(NAME(m_data_buffer.get()), 8192); save_item(NAME(m_data_buffer_size)); save_item(NAME(m_data_buffer_index)); save_item(NAME(m_data_transferred)); - save_pointer(NAME(m_acard_ram), PCE_ACARD_RAM_SIZE); + save_pointer(NAME(m_acard_ram.get()), PCE_ACARD_RAM_SIZE); save_item(NAME(m_acard_latch)); save_item(NAME(m_acard_ctrl)); save_item(NAME(m_acard_base_addr)); @@ -945,7 +945,7 @@ TIMER_CALLBACK_MEMBER(pce_cd_device::data_timer_callback) { /* Read next data sector */ logerror("read sector %d\n", m_current_frame); - if (! cdrom_read_data(m_cd_file, m_current_frame, m_data_buffer, CD_TRACK_MODE1)) + if (! cdrom_read_data(m_cd_file, m_current_frame, m_data_buffer.get(), CD_TRACK_MODE1)) { logerror("Mode1 CD read failed for frame #%d\n", m_current_frame); } diff --git a/src/mame/machine/pce_cd.h b/src/mame/machine/pce_cd.h index 9e9e4a484d0..ebb39aeb680 100644 --- a/src/mame/machine/pce_cd.h +++ b/src/mame/machine/pce_cd.h @@ -97,7 +97,7 @@ private: UINT8 m_regs[16]; std::unique_ptr m_bram; - UINT8 *m_adpcm_ram; + std::unique_ptr m_adpcm_ram; int m_bram_locked; int m_adpcm_read_ptr; UINT8 m_adpcm_read_buf; @@ -125,18 +125,18 @@ private: int m_scsi_last_RST; /* To catch setting of RST signal */ int m_cd_motor_on; int m_selected; - UINT8 *m_command_buffer; + std::unique_ptr m_command_buffer; int m_command_buffer_index; int m_status_sent; int m_message_after_status; int m_message_sent; - UINT8 *m_data_buffer; + std::unique_ptr m_data_buffer; int m_data_buffer_size; int m_data_buffer_index; int m_data_transferred; /* Arcade Card specific */ - UINT8 *m_acard_ram; + std::unique_ptr m_acard_ram; UINT8 m_acard_latch; UINT8 m_acard_ctrl[4]; UINT32 m_acard_base_addr[4]; diff --git a/src/mame/machine/simpsons.cpp b/src/mame/machine/simpsons.cpp index aec4071ad56..b54da52e43c 100644 --- a/src/mame/machine/simpsons.cpp +++ b/src/mame/machine/simpsons.cpp @@ -63,7 +63,7 @@ WRITE8_MEMBER( simpsons_state::banking_callback ) void simpsons_state::machine_start() { - m_spriteram = auto_alloc_array_clear(machine(), UINT16, 0x1000 / 2); + m_spriteram = make_unique_clear(0x1000 / 2); membank("bank1")->configure_entries(0, 64, memregion("maincpu")->base(), 0x2000); @@ -74,7 +74,7 @@ void simpsons_state::machine_start() save_item(NAME(m_sprite_colorbase)); save_item(NAME(m_layer_colorbase)); save_item(NAME(m_layerpri)); - save_pointer(NAME(m_spriteram), 0x1000 / 2); + save_pointer(NAME(m_spriteram.get()), 0x1000 / 2); } void simpsons_state::machine_reset() diff --git a/src/mame/machine/sms.cpp b/src/mame/machine/sms.cpp index ac860bfb974..1db6896b820 100644 --- a/src/mame/machine/sms.cpp +++ b/src/mame/machine/sms.cpp @@ -892,8 +892,8 @@ MACHINE_START_MEMBER(sms_state,sms) if (m_mainram == nullptr) { - m_mainram = auto_alloc_array_clear(machine(), UINT8, 0x2000); - save_pointer(NAME(m_mainram), 0x2000); + m_mainram = make_unique_clear(0x2000); + save_pointer(NAME(m_mainram.get()), 0x2000); // alibaba and blockhol are ports of games for the MSX system. The // MSX bios usually initializes callback "vectors" at the top of RAM. @@ -909,7 +909,7 @@ MACHINE_START_MEMBER(sms_state,sms) // cartridge slot. if (m_has_jpn_sms_cart_slot) { - memset(m_mainram, 0xf0, 0x2000); + memset(m_mainram.get(), 0xf0, 0x2000); } } diff --git a/src/mame/machine/snes.cpp b/src/mame/machine/snes.cpp index 9c4253906e2..d4a4f9c88c0 100644 --- a/src/mame/machine/snes.cpp +++ b/src/mame/machine/snes.cpp @@ -1187,7 +1187,7 @@ DRIVER_INIT_MEMBER(snes_state,snes) if (nvram_size > 0x40000) nvram_size = 0x40000; - m_cart.m_nvram = auto_alloc_array_clear(machine(), UINT8, nvram_size); + m_cart.m_nvram = make_unique_clear(nvram_size); m_cart.m_nvram_size = nvram_size; } @@ -1208,7 +1208,7 @@ DRIVER_INIT_MEMBER(snes_state,snes_hirom) if (nvram_size > 0x40000) nvram_size = 0x40000; - m_cart.m_nvram = auto_alloc_array_clear(machine(), UINT8, nvram_size); + m_cart.m_nvram = make_unique_clear(nvram_size); m_cart.m_nvram_size = nvram_size; } diff --git a/src/mame/machine/st0016.cpp b/src/mame/machine/st0016.cpp index 08959876e99..54b36185a52 100644 --- a/src/mame/machine/st0016.cpp +++ b/src/mame/machine/st0016.cpp @@ -570,9 +570,9 @@ void st0016_cpu_device::st0016_save_init() save_item(NAME(st0016_char_bank)); //save_item(NAME(st0016_rom_bank)); save_item(NAME(st0016_vregs)); - save_pointer(NAME(m_charram), ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE); - save_pointer(NAME(st0016_paletteram), ST0016_MAX_PAL_BANK*ST0016_PAL_BANK_SIZE); - save_pointer(NAME(st0016_spriteram), ST0016_MAX_SPR_BANK*ST0016_SPR_BANK_SIZE); + save_pointer(NAME(m_charram.get()), ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE); + save_pointer(NAME(st0016_paletteram.get()), ST0016_MAX_PAL_BANK*ST0016_PAL_BANK_SIZE); + save_pointer(NAME(st0016_spriteram.get()), ST0016_MAX_SPR_BANK*ST0016_SPR_BANK_SIZE); } @@ -581,9 +581,9 @@ void st0016_cpu_device::startup() int gfx_index=0; macs_cart_slot = 0; - m_charram=auto_alloc_array_clear(machine(), UINT8, ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE); - st0016_spriteram=auto_alloc_array_clear(machine(), UINT8, ST0016_MAX_SPR_BANK*ST0016_SPR_BANK_SIZE); - st0016_paletteram=auto_alloc_array_clear(machine(), UINT8, ST0016_MAX_PAL_BANK*ST0016_PAL_BANK_SIZE); + m_charram=make_unique_clear(ST0016_MAX_CHAR_BANK*ST0016_CHAR_BANK_SIZE); + st0016_spriteram=make_unique_clear(ST0016_MAX_SPR_BANK*ST0016_SPR_BANK_SIZE); + st0016_paletteram=make_unique_clear(ST0016_MAX_PAL_BANK*ST0016_PAL_BANK_SIZE); /* find first empty slot to decode gfx */ for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++) @@ -593,7 +593,7 @@ void st0016_cpu_device::startup() assert(gfx_index != MAX_GFX_ELEMENTS); /* create the char set (gfx will then be updated dynamically from RAM) */ - m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_palette, charlayout, (UINT8 *) m_charram, 0, 0x40, 0))); + m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_palette, charlayout, m_charram.get(), 0, 0x40, 0))); st0016_ramgfx = gfx_index; spr_dx=0; @@ -718,7 +718,7 @@ UINT32 st0016_cpu_device::update(screen_device &screen, bitmap_ind16 &bitmap, co { int h,j; FILE *p=fopen("vram.bin","wb"); - fwrite(st0016_spriteram,1,0x1000*ST0016_MAX_SPR_BANK,p); + fwrite(st0016_spriteram.get(),1,0x1000*ST0016_MAX_SPR_BANK,p); fclose(p); p=fopen("vram.txt","wt"); diff --git a/src/mame/machine/st0016.h b/src/mame/machine/st0016.h index ae1a0ec713c..6401ddc5c19 100644 --- a/src/mame/machine/st0016.h +++ b/src/mame/machine/st0016.h @@ -64,7 +64,8 @@ public: UINT32 update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void st0016_draw_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - UINT8 *st0016_spriteram,*st0016_paletteram; + std::unique_ptr st0016_spriteram; + std::unique_ptr st0016_paletteram; UINT32 st0016_game; @@ -74,7 +75,7 @@ public: UINT8 st0016_vregs[0xc0]; int st0016_ramgfx; - UINT8 *m_charram; + std::unique_ptr m_charram; protected: // device-level overrides diff --git a/src/mame/machine/volfied.cpp b/src/mame/machine/volfied.cpp index 498093a5855..1835d285968 100644 --- a/src/mame/machine/volfied.cpp +++ b/src/mame/machine/volfied.cpp @@ -493,13 +493,13 @@ READ16_MEMBER(volfied_state::volfied_cchip_ram_r) void volfied_state::volfied_cchip_init( ) { - m_cchip_ram = auto_alloc_array_clear(machine(), UINT8, 0x400 * 8); + m_cchip_ram = make_unique_clear(0x400 * 8); save_item(NAME(m_current_bank)); save_item(NAME(m_current_cmd)); save_item(NAME(m_current_flag)); save_item(NAME(m_cc_port)); - save_pointer(NAME(m_cchip_ram), 0x400 * 8); + save_pointer(NAME(m_cchip_ram.get()), 0x400 * 8); } void volfied_state::volfied_cchip_reset( ) diff --git a/src/mame/video/40love.cpp b/src/mame/video/40love.cpp index 5cbd46c0d36..f95a12a5d26 100644 --- a/src/mame/video/40love.cpp +++ b/src/mame/video/40love.cpp @@ -103,8 +103,8 @@ void fortyl_state::redraw_pixels() void fortyl_state::video_start() { - m_pixram1 = auto_alloc_array_clear(machine(), UINT8, 0x4000); - m_pixram2 = auto_alloc_array_clear(machine(), UINT8, 0x4000); + m_pixram1 = make_unique_clear(0x4000); + m_pixram2 = make_unique_clear(0x4000); m_tmp_bitmap1 = std::make_unique(256, 256); m_tmp_bitmap2 = std::make_unique(256, 256); @@ -118,8 +118,8 @@ void fortyl_state::video_start() save_item(NAME(m_flipscreen)); save_item(NAME(m_pix_color)); - save_pointer(NAME(m_pixram1), 0x4000); - save_pointer(NAME(m_pixram2), 0x4000); + save_pointer(NAME(m_pixram1.get()), 0x4000); + save_pointer(NAME(m_pixram2.get()), 0x4000); save_item(NAME(*m_tmp_bitmap1)); save_item(NAME(*m_tmp_bitmap2)); save_item(NAME(m_pixram_sel)); diff --git a/src/mame/video/antic.cpp b/src/mame/video/antic.cpp index fab29e17e69..4174480ebcb 100644 --- a/src/mame/video/antic.cpp +++ b/src/mame/video/antic.cpp @@ -67,7 +67,7 @@ void antic_device::device_start() m_bitmap = std::make_unique(m_screen->width(), m_screen->height()); - m_cclk_expand = auto_alloc_array_clear(machine(), UINT32, 21 * 256); + m_cclk_expand = make_unique_clear(21 * 256); m_pf_21 = &m_cclk_expand[ 0 * 256]; m_pf_x10b = &m_cclk_expand[ 1 * 256]; @@ -97,7 +97,7 @@ void antic_device::device_start() cclk_init(); for (auto & elem : m_prio_table) - elem = auto_alloc_array_clear(machine(), UINT8, 8*256); + elem = make_unique_clear(8*256); LOG(("atari prio_init\n")); prio_init(); @@ -133,7 +133,7 @@ void antic_device::device_start() save_item(NAME(m_cclock)); save_item(NAME(m_pmbits)); - save_pointer(NAME(m_cclk_expand), 21 * 256); + save_pointer(NAME(m_cclk_expand.get()), 21 * 256); save_pointer(NAME(m_used_colors.get()), 21 * 256); } @@ -1804,7 +1804,7 @@ TIMER_CALLBACK_MEMBER( antic_device::scanline_render ) } if (m_scanline >= VBL_END && m_scanline < 256) - m_gtia->render((UINT8 *)m_pmbits + PMOFFSET, (UINT8 *)m_cclock + PMOFFSET - m_hscrol_old, (UINT8 *)m_prio_table[m_gtia->get_w_prior() & 0x3f], (UINT8 *)&m_pmbits); + m_gtia->render((UINT8 *)m_pmbits + PMOFFSET, (UINT8 *)m_cclock + PMOFFSET - m_hscrol_old, m_prio_table[m_gtia->get_w_prior() & 0x3f].get(), (UINT8 *)&m_pmbits); m_steal_cycles += CYCLES_REFRESH; LOG((" run CPU for %d cycles\n", CYCLES_HSYNC - CYCLES_HSTART - m_steal_cycles)); diff --git a/src/mame/video/antic.h b/src/mame/video/antic.h index 5ddfbe81b22..2b278c2a780 100644 --- a/src/mame/video/antic.h +++ b/src/mame/video/antic.h @@ -435,9 +435,9 @@ private: ANTIC_W m_w; /* ANTIC write registers */ UINT8 m_cclock[256+32]; /* color clock buffer filled by ANTIC */ UINT8 m_pmbits[256+32]; /* player missile buffer filled by GTIA */ - UINT8 *m_prio_table[64]; /* player/missile priority tables */ + std::unique_ptr m_prio_table[64]; /* player/missile priority tables */ VIDEO *m_video[312]; /* video buffer */ - UINT32 *m_cclk_expand; /* shared buffer for the following: */ + std::unique_ptr m_cclk_expand; /* shared buffer for the following: */ UINT32 *m_pf_21; /* 1cclk 2 color txt 2,3 */ UINT32 *m_pf_x10b; /* 1cclk 4 color txt 4,5, gfx D,E */ UINT32 *m_pf_3210b2; /* 1cclk 5 color txt 6,7, gfx 9,B,C */ diff --git a/src/mame/video/apple2gs.cpp b/src/mame/video/apple2gs.cpp index 1cefde0e248..eacb0e9c632 100644 --- a/src/mame/video/apple2gs.cpp +++ b/src/mame/video/apple2gs.cpp @@ -18,7 +18,7 @@ VIDEO_START_MEMBER(apple2gs_state,apple2gs) { m_bordercolor = 0; - apple2_video_start(m_slowmem, m_slowmem+0x10000, 0, 8); + apple2_video_start(m_slowmem.get(), m_slowmem.get()+0x10000, 0, 8); m_legacy_gfx = std::make_unique(560, 192); save_item(m_bordercolor, "BORDERCLR"); diff --git a/src/mame/video/cidelsa.cpp b/src/mame/video/cidelsa.cpp index f942bf187fb..2bda7fe88cc 100644 --- a/src/mame/video/cidelsa.cpp +++ b/src/mame/video/cidelsa.cpp @@ -118,13 +118,13 @@ ADDRESS_MAP_END void cidelsa_state::video_start() { // allocate memory - m_pcbram = auto_alloc_array_clear(machine(), UINT8, CIDELSA_CHARRAM_SIZE); - m_charram = auto_alloc_array_clear(machine(), UINT8, CIDELSA_CHARRAM_SIZE); + m_pcbram = make_unique_clear(CIDELSA_CHARRAM_SIZE); + m_charram = make_unique_clear(CIDELSA_CHARRAM_SIZE); // register for state saving save_item(NAME(m_cdp1869_pcb)); - save_pointer(NAME(m_pcbram), CIDELSA_CHARRAM_SIZE); - save_pointer(NAME(m_charram), CIDELSA_CHARRAM_SIZE); + save_pointer(NAME(m_pcbram.get()), CIDELSA_CHARRAM_SIZE); + save_pointer(NAME(m_charram.get()), CIDELSA_CHARRAM_SIZE); } /* AY-3-8910 */ diff --git a/src/mame/video/combatsc.cpp b/src/mame/video/combatsc.cpp index e02cb1eb618..c22edbce232 100644 --- a/src/mame/video/combatsc.cpp +++ b/src/mame/video/combatsc.cpp @@ -258,8 +258,8 @@ VIDEO_START_MEMBER(combatsc_state,combatsc) m_bg_tilemap[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(combatsc_state::get_tile_info1),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); m_textlayer = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(combatsc_state::get_text_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_spriteram[0] = auto_alloc_array_clear(machine(), UINT8, 0x800); - m_spriteram[1] = auto_alloc_array_clear(machine(), UINT8, 0x800); + m_spriteram[0] = make_unique_clear(0x800); + m_spriteram[1] = make_unique_clear(0x800); m_bg_tilemap[0]->set_transparent_pen(0); m_bg_tilemap[1]->set_transparent_pen(0); @@ -267,8 +267,8 @@ VIDEO_START_MEMBER(combatsc_state,combatsc) m_textlayer->set_scroll_rows(32); - save_pointer(NAME(m_spriteram[0]), 0x800); - save_pointer(NAME(m_spriteram[1]), 0x800); + save_pointer(NAME(m_spriteram[0].get()), 0x800); + save_pointer(NAME(m_spriteram[1].get()), 0x800); } VIDEO_START_MEMBER(combatsc_state,combatscb) @@ -277,8 +277,8 @@ VIDEO_START_MEMBER(combatsc_state,combatscb) m_bg_tilemap[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(combatsc_state::get_tile_info1_bootleg),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); m_textlayer = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(combatsc_state::get_text_info_bootleg),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_spriteram[0] = auto_alloc_array_clear(machine(), UINT8, 0x800); - m_spriteram[1] = auto_alloc_array_clear(machine(), UINT8, 0x800); + m_spriteram[0] = make_unique_clear(0x800); + m_spriteram[1] = make_unique_clear(0x800); m_bg_tilemap[0]->set_transparent_pen(0); m_bg_tilemap[1]->set_transparent_pen(0); @@ -287,8 +287,8 @@ VIDEO_START_MEMBER(combatsc_state,combatscb) m_bg_tilemap[0]->set_scroll_rows(32); m_bg_tilemap[1]->set_scroll_rows(32); - save_pointer(NAME(m_spriteram[0]), 0x800); - save_pointer(NAME(m_spriteram[1]), 0x800); + save_pointer(NAME(m_spriteram[0].get()), 0x800); + save_pointer(NAME(m_spriteram[1].get()), 0x800); } /*************************************************************************** @@ -330,9 +330,9 @@ WRITE8_MEMBER(combatsc_state::combatsc_pf_control_w) if (offset == 3) { if (data & 0x08) - memcpy(m_spriteram[m_video_circuit], m_page[m_video_circuit] + 0x1000, 0x800); + memcpy(m_spriteram[m_video_circuit].get(), m_page[m_video_circuit] + 0x1000, 0x800); else - memcpy(m_spriteram[m_video_circuit], m_page[m_video_circuit] + 0x1800, 0x800); + memcpy(m_spriteram[m_video_circuit].get(), m_page[m_video_circuit] + 0x1800, 0x800); } } @@ -406,8 +406,8 @@ UINT32 combatsc_state::screen_update_combatsc(screen_device &screen, bitmap_ind1 m_bg_tilemap[0]->draw(screen, bitmap, cliprect, 1, 2); /* we use the priority buffer so sprites are drawn front to back */ - draw_sprites(bitmap, cliprect, m_spriteram[1], 1, screen.priority(), 0x0f00); - draw_sprites(bitmap, cliprect, m_spriteram[0], 0, screen.priority(), 0x4444); + draw_sprites(bitmap, cliprect, m_spriteram[1].get(), 1, screen.priority(), 0x0f00); + draw_sprites(bitmap, cliprect, m_spriteram[0].get(), 0, screen.priority(), 0x4444); } else { @@ -417,8 +417,8 @@ UINT32 combatsc_state::screen_update_combatsc(screen_device &screen, bitmap_ind1 m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 8); /* we use the priority buffer so sprites are drawn front to back */ - draw_sprites(bitmap, cliprect, m_spriteram[1], 1, screen.priority(), 0x0f00); - draw_sprites(bitmap, cliprect, m_spriteram[0], 0, screen.priority(), 0x4444); + draw_sprites(bitmap, cliprect, m_spriteram[1].get(), 1, screen.priority(), 0x0f00); + draw_sprites(bitmap, cliprect, m_spriteram[0].get(), 0, screen.priority(), 0x4444); } if (m_k007121_1->ctrlram_r(space, 1) & 0x08) diff --git a/src/mame/video/cps1.cpp b/src/mame/video/cps1.cpp index 0e91647975c..f02f0a7864e 100644 --- a/src/mame/video/cps1.cpp +++ b/src/mame/video/cps1.cpp @@ -2222,10 +2222,10 @@ VIDEO_START_MEMBER(cps_state,cps) for (i = 0; i < cps1_palette_entries * 16; i++) m_palette->set_pen_color(i, rgb_t(0,0,0)); - m_buffered_obj = auto_alloc_array_clear(machine(), UINT16, m_obj_size / 2); + m_buffered_obj = make_unique_clear(m_obj_size / 2); if (m_cps_version == 2) - m_cps2_buffered_obj = auto_alloc_array_clear(machine(), UINT16, m_cps2_obj_size / 2); + m_cps2_buffered_obj = make_unique_clear(m_cps2_obj_size / 2); /* clear RAM regions */ memset(m_gfxram, 0, m_gfxram.bytes()); /* Clear GFX RAM */ @@ -2280,11 +2280,11 @@ VIDEO_START_MEMBER(cps_state,cps) save_item(NAME(m_pri_ctrl)); save_item(NAME(m_objram_bank)); - save_pointer(NAME(m_buffered_obj), m_obj_size / 2); + save_pointer(NAME(m_buffered_obj.get()), m_obj_size / 2); if (m_cps_version == 2) { save_item(NAME(m_cps2_last_sprite_offset)); - save_pointer(NAME(m_cps2_buffered_obj), m_cps2_obj_size / 2); + save_pointer(NAME(m_cps2_buffered_obj.get()), m_cps2_obj_size / 2); } machine().save().register_postload(save_prepost_delegate(FUNC(cps_state::cps1_get_video_base), this)); @@ -2443,7 +2443,7 @@ void cps_state::cps1_render_sprites( screen_device &screen, bitmap_ind16 &bitmap int i, baseadd; - UINT16 *base = m_buffered_obj; + UINT16 *base = m_buffered_obj.get(); /* some sf2 hacks draw the sprites in reverse order */ if ((m_game_config->bootleg_kludge == 1) || (m_game_config->bootleg_kludge == 2) || (m_game_config->bootleg_kludge == 3)) @@ -2636,7 +2636,7 @@ UINT16 *cps_state::cps2_objbase() void cps_state::cps2_find_last_sprite() /* Find the offset of last sprite */ { int offset = 0; - UINT16 *base = m_cps2_buffered_obj; + UINT16 *base = m_cps2_buffered_obj.get(); /* Locate the end of table marker */ while (offset < m_cps2_obj_size / 2) @@ -2675,7 +2675,7 @@ void cps_state::cps2_render_sprites( screen_device &screen, bitmap_ind16 &bitmap } int i; - UINT16 *base = m_cps2_buffered_obj; + UINT16 *base = m_cps2_buffered_obj.get(); int xoffs = 64 - m_output[CPS2_OBJ_XOFFS /2]; int yoffs = 16 - m_output[CPS2_OBJ_YOFFS /2]; @@ -3065,7 +3065,7 @@ void cps_state::screen_eof_cps1(screen_device &screen, bool state) if (m_cps_version == 1) { /* CPS1 sprites have to be delayed one frame */ - memcpy(m_buffered_obj, m_obj, m_obj_size); + memcpy(m_buffered_obj.get(), m_obj, m_obj_size); } } } @@ -3078,5 +3078,5 @@ void cps_state::cps2_set_sprite_priorities() void cps_state::cps2_objram_latch() { cps2_set_sprite_priorities(); - memcpy(m_cps2_buffered_obj, cps2_objbase(), m_cps2_obj_size); + memcpy(m_cps2_buffered_obj.get(), cps2_objbase(), m_cps2_obj_size); } diff --git a/src/mame/video/decbac06.cpp b/src/mame/video/decbac06.cpp index 32c2f7c1b4c..c974c4adf13 100644 --- a/src/mame/video/decbac06.cpp +++ b/src/mame/video/decbac06.cpp @@ -108,9 +108,9 @@ void deco_bac06_device::device_start() if(!m_gfxdecode->started()) throw device_missing_dependencies(); - m_pf_data = auto_alloc_array_clear(machine(), UINT16, 0x4000 / 2); // 0x2000 is the maximum needed, some games / chip setups map less and mirror - stadium hero banks this to 0x4000?! - m_pf_rowscroll = auto_alloc_array_clear(machine(), UINT16, 0x2000 / 2); - m_pf_colscroll = auto_alloc_array_clear(machine(), UINT16, 0x2000 / 2); + m_pf_data = make_unique_clear(0x4000 / 2); // 0x2000 is the maximum needed, some games / chip setups map less and mirror - stadium hero banks this to 0x4000?! + m_pf_rowscroll = make_unique_clear(0x2000 / 2); + m_pf_colscroll = make_unique_clear(0x2000 / 2); create_tilemaps(m_gfxregion8x8, m_gfxregion16x16); m_gfxcolmask = 0x0f; @@ -119,9 +119,9 @@ void deco_bac06_device::device_start() m_bppmask = 0x0f; m_rambank = 0; - save_pointer(NAME(m_pf_data), 0x4000/2); - save_pointer(NAME(m_pf_rowscroll), 0x2000/2); - save_pointer(NAME(m_pf_colscroll), 0x2000/2); + save_pointer(NAME(m_pf_data.get()), 0x4000/2); + save_pointer(NAME(m_pf_rowscroll.get()), 0x2000/2); + save_pointer(NAME(m_pf_colscroll.get()), 0x2000/2); save_item(NAME(m_pf_control_0)); save_item(NAME(m_pf_control_1)); save_item(NAME(m_gfxcolmask)); @@ -344,7 +344,7 @@ void deco_bac06_device::deco_bac06_pf_draw(bitmap_ind16 &bitmap,const rectangle } if (tm) - custom_tilemap_draw(bitmap,cliprect,tm,m_pf_rowscroll,m_pf_colscroll,m_pf_control_0,m_pf_control_1,flags, penmask, pencondition, colprimask, colpricondition); + custom_tilemap_draw(bitmap,cliprect,tm,m_pf_rowscroll.get(),m_pf_colscroll.get(),m_pf_control_0,m_pf_control_1,flags, penmask, pencondition, colprimask, colpricondition); } @@ -355,7 +355,7 @@ void deco_bac06_device::deco_bac06_pf_draw_bootleg(bitmap_ind16 &bitmap,const re if (!mode) tm = m_pf8x8_tilemap[type]; else tm = m_pf16x16_tilemap[type]; - custom_tilemap_draw(bitmap,cliprect,tm,m_pf_rowscroll,m_pf_colscroll,nullptr,nullptr,flags, 0, 0, 0, 0); + custom_tilemap_draw(bitmap,cliprect,tm,m_pf_rowscroll.get(),m_pf_colscroll.get(),nullptr,nullptr,flags, 0, 0, 0, 0); } diff --git a/src/mame/video/decbac06.h b/src/mame/video/decbac06.h index f163a4e8cf4..51a991636fa 100644 --- a/src/mame/video/decbac06.h +++ b/src/mame/video/decbac06.h @@ -21,8 +21,9 @@ public: static void static_set_gfxdecode_tag(device_t &device, const char *tag); static void set_gfx_region_wide(device_t &device, int region8x8, int region16x16, int wide); - UINT16* m_pf_data; - UINT16* m_pf_rowscroll, *m_pf_colscroll; + std::unique_ptr m_pf_data; + std::unique_ptr m_pf_rowscroll; + std::unique_ptr m_pf_colscroll; tilemap_t* m_pf8x8_tilemap[3]; tilemap_t* m_pf16x16_tilemap[3]; diff --git a/src/mame/video/deco16ic.cpp b/src/mame/video/deco16ic.cpp index a792ff6fb0c..fa5b1caba0a 100644 --- a/src/mame/video/deco16ic.cpp +++ b/src/mame/video/deco16ic.cpp @@ -259,9 +259,9 @@ void deco16ic_device::device_start() m_pf1_8bpp_mode = 0; - m_pf1_data = auto_alloc_array_clear(machine(), UINT16, 0x2000 / 2); - m_pf2_data = auto_alloc_array_clear(machine(), UINT16, 0x2000 / 2); - m_pf12_control = auto_alloc_array_clear(machine(), UINT16, 0x10 / 2); + m_pf1_data = make_unique_clear(0x2000 / 2); + m_pf2_data = make_unique_clear(0x2000 / 2); + m_pf12_control = make_unique_clear(0x10 / 2); save_item(NAME(m_use_custom_pf1)); @@ -275,9 +275,9 @@ void deco16ic_device::device_start() save_item(NAME(m_pf1_8bpp_mode)); - save_pointer(NAME(m_pf1_data), 0x2000 / 2); - save_pointer(NAME(m_pf2_data), 0x2000 / 2); - save_pointer(NAME(m_pf12_control), 0x10 / 2); + save_pointer(NAME(m_pf1_data.get()), 0x2000 / 2); + save_pointer(NAME(m_pf2_data.get()), 0x2000 / 2); + save_pointer(NAME(m_pf12_control.get()), 0x10 / 2); } //------------------------------------------------- diff --git a/src/mame/video/deco16ic.h b/src/mame/video/deco16ic.h index 9ae1d5bfd0d..5e45336c093 100644 --- a/src/mame/video/deco16ic.h +++ b/src/mame/video/deco16ic.h @@ -124,8 +124,9 @@ protected: private: // internal state - UINT16 *m_pf1_data, *m_pf2_data; - UINT16 *m_pf12_control; + std::unique_ptr m_pf1_data; + std::unique_ptr m_pf2_data; + std::unique_ptr m_pf12_control; const UINT16 *m_pf1_rowscroll_ptr, *m_pf2_rowscroll_ptr; diff --git a/src/mame/video/decocomn.cpp b/src/mame/video/decocomn.cpp index f0a5aa76c3f..f8bbb7f32bc 100644 --- a/src/mame/video/decocomn.cpp +++ b/src/mame/video/decocomn.cpp @@ -53,10 +53,10 @@ void decocomn_device::device_start() // width = m_screen->width(); // height = m_screen->height(); - m_dirty_palette = auto_alloc_array_clear(machine(), UINT8, 4096); + m_dirty_palette = make_unique_clear(4096); save_item(NAME(m_priority)); - save_pointer(NAME(m_dirty_palette), 4096); + save_pointer(NAME(m_dirty_palette.get()), 4096); } //------------------------------------------------- diff --git a/src/mame/video/decocomn.h b/src/mame/video/decocomn.h index 07be0f30281..b2c758c9d60 100644 --- a/src/mame/video/decocomn.h +++ b/src/mame/video/decocomn.h @@ -41,7 +41,7 @@ protected: private: // internal state - UINT8 *m_dirty_palette; + std::unique_ptr m_dirty_palette; UINT16 m_priority; required_device m_palette; required_shared_ptr m_generic_paletteram_16; diff --git a/src/mame/video/dooyong.cpp b/src/mame/video/dooyong.cpp index 048df826087..e0886cc9471 100644 --- a/src/mame/video/dooyong.cpp +++ b/src/mame/video/dooyong.cpp @@ -558,8 +558,8 @@ VIDEO_START_MEMBER(dooyong_z80_ym2203_state, pollux) m_fg_gfx = 3; m_tx_tilemap_mode = 0; - m_paletteram_flytiger = auto_alloc_array_clear(machine(), UINT8, 0x1000); - save_pointer(NAME(m_paletteram_flytiger), 0x1000); + m_paletteram_flytiger = make_unique_clear(0x1000); + save_pointer(NAME(m_paletteram_flytiger.get()), 0x1000); /* Create tilemaps */ m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS, @@ -631,8 +631,8 @@ VIDEO_START_MEMBER(dooyong_z80_state, flytiger) m_fg_gfx = 3; m_tx_tilemap_mode = 0; - m_paletteram_flytiger = auto_alloc_array_clear(machine(), UINT8, 0x1000); - save_pointer(NAME(m_paletteram_flytiger), 0x1000); + m_paletteram_flytiger = make_unique_clear(0x1000); + save_pointer(NAME(m_paletteram_flytiger.get()), 0x1000); /* Create tilemaps */ m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS, diff --git a/src/mame/video/excellent_spr.cpp b/src/mame/video/excellent_spr.cpp index 2b178641abd..f58f80f69d6 100644 --- a/src/mame/video/excellent_spr.cpp +++ b/src/mame/video/excellent_spr.cpp @@ -30,8 +30,8 @@ excellent_spr_device::excellent_spr_device(const machine_config &mconfig, const void excellent_spr_device::device_start() { - m_ram = auto_alloc_array_clear(this->machine(), UINT8, 0x1000); - save_pointer(NAME(m_ram), 0x1000); + m_ram = make_unique_clear(0x1000); + save_pointer(NAME(m_ram.get()), 0x1000); } @@ -154,7 +154,7 @@ void excellent_spr_device::aquarium_draw_sprites( bitmap_ind16 &bitmap, const re void excellent_spr_device::gcpinbal_draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int y_offs, int priority ) { - UINT8 *spriteram = m_ram; + UINT8 *spriteram = m_ram.get(); int offs, chain_pos; int x, y, curx, cury; // int priority = 0; diff --git a/src/mame/video/excellent_spr.h b/src/mame/video/excellent_spr.h index da4368ea0d4..ac79e260883 100644 --- a/src/mame/video/excellent_spr.h +++ b/src/mame/video/excellent_spr.h @@ -16,7 +16,7 @@ public: void gcpinbal_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int y_offs, int priority); protected: - UINT8* m_ram; + std::unique_ptr m_ram; virtual void device_start() override; virtual void device_reset() override; diff --git a/src/mame/video/fuukifg.cpp b/src/mame/video/fuukifg.cpp index 07257c8931d..bf891fc8201 100644 --- a/src/mame/video/fuukifg.cpp +++ b/src/mame/video/fuukifg.cpp @@ -23,18 +23,18 @@ void fuukivid_device::static_set_gfxdecode_tag(device_t &device, const char *tag void fuukivid_device::device_start() { - m_sprram = auto_alloc_array_clear(machine(), UINT16, 0x2000 / 2); + m_sprram = make_unique_clear(0x2000 / 2); // fuukifg3 clearly has buffered ram, it is unclear if fuukifg2 has // it is likely these render to a framebuffer as the tile bank (which is probably external hw) also needs to be banked // suggesting that the sprites are rendered earlier, then displayed from a buffer - m_sprram_old = auto_alloc_array_clear(machine(), UINT16, 0x2000 / 2); - m_sprram_old2 = auto_alloc_array_clear(machine(), UINT16, 0x2000 / 2); + m_sprram_old = make_unique_clear(0x2000 / 2); + m_sprram_old2 = make_unique_clear(0x2000 / 2); - save_pointer(NAME(m_sprram), 0x2000 / 2); - save_pointer(NAME(m_sprram_old), 0x2000 / 2); - save_pointer(NAME(m_sprram_old2), 0x2000 / 2); + save_pointer(NAME(m_sprram.get()), 0x2000 / 2); + save_pointer(NAME(m_sprram_old.get()), 0x2000 / 2); + save_pointer(NAME(m_sprram_old2.get()), 0x2000 / 2); } @@ -88,9 +88,9 @@ void fuukivid_device::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, bitmap_ind8 &priority_bitmap = screen.priority(); const rectangle &visarea = screen.visible_area(); - UINT16 *spriteram16 = m_sprram; + UINT16 *spriteram16 = m_sprram.get(); - if (tilebank) spriteram16 = m_sprram_old2; // so that FG3 uses the buffered RAM + if (tilebank) spriteram16 = m_sprram_old2.get(); // so that FG3 uses the buffered RAM int max_x = visarea.max_x + 1; int max_y = visarea.max_y + 1; @@ -180,6 +180,6 @@ void fuukivid_device::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, void fuukivid_device::buffer_sprites(void) { - memcpy(m_sprram_old2, m_sprram_old, 0x2000); - memcpy(m_sprram_old, m_sprram, 0x2000); + memcpy(m_sprram_old2.get(), m_sprram_old.get(), 0x2000); + memcpy(m_sprram_old.get(), m_sprram.get(), 0x2000); } diff --git a/src/mame/video/fuukifg.h b/src/mame/video/fuukifg.h index 28bfb4a0c79..41668672abf 100644 --- a/src/mame/video/fuukifg.h +++ b/src/mame/video/fuukifg.h @@ -13,9 +13,9 @@ public: static void static_set_gfxdecode_tag(device_t &device, const char *tag); void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int flip_screen, UINT32* tilebank); - UINT16* m_sprram; - UINT16* m_sprram_old; - UINT16* m_sprram_old2; + std::unique_ptr m_sprram; + std::unique_ptr m_sprram_old; + std::unique_ptr m_sprram_old2; DECLARE_WRITE16_MEMBER(fuuki_sprram_w) diff --git a/src/mame/video/gb_lcd.cpp b/src/mame/video/gb_lcd.cpp index 9e0db236901..c7560b485bf 100644 --- a/src/mame/video/gb_lcd.cpp +++ b/src/mame/video/gb_lcd.cpp @@ -218,13 +218,13 @@ void gb_lcd_device::common_start() { m_screen->register_screen_bitmap(m_bitmap); save_item(NAME(m_bitmap)); - m_oam = auto_alloc_array_clear(machine(), UINT8, 0x100); + m_oam = make_unique_clear(0x100); machine().save().register_postload(save_prepost_delegate(FUNC(gb_lcd_device::videoptr_restore), this)); m_maincpu = machine().device("maincpu"); - save_pointer(NAME(m_oam), 0x100); + save_pointer(NAME(m_oam.get()), 0x100); save_item(NAME(m_window_lines_drawn)); save_item(NAME(m_vid_regs)); save_item(NAME(m_bg_zbuf)); @@ -286,18 +286,18 @@ void gb_lcd_device::common_start() void gb_lcd_device::videoptr_restore() { - m_layer[0].bg_map = m_vram + m_gb_bgdtab_offs; - m_layer[0].bg_tiles = m_vram + m_gb_chrgen_offs; - m_layer[1].bg_map = m_vram + m_gb_wndtab_offs; - m_layer[1].bg_tiles = m_vram + m_gb_chrgen_offs; + m_layer[0].bg_map = m_vram.get() + m_gb_bgdtab_offs; + m_layer[0].bg_tiles = m_vram.get() + m_gb_chrgen_offs; + m_layer[1].bg_map = m_vram.get() + m_gb_wndtab_offs; + m_layer[1].bg_tiles = m_vram.get() + m_gb_chrgen_offs; } void cgb_lcd_device::videoptr_restore() { - m_layer[0].bg_map = m_vram + m_gb_bgdtab_offs; - m_layer[0].gbc_map = m_vram + m_gbc_bgdtab_offs; - m_layer[1].bg_map = m_vram + m_gb_wndtab_offs; - m_layer[1].gbc_map = m_vram + m_gbc_wndtab_offs; + m_layer[0].bg_map = m_vram.get() + m_gb_bgdtab_offs; + m_layer[0].gbc_map = m_vram.get() + m_gbc_bgdtab_offs; + m_layer[1].bg_map = m_vram.get() + m_gb_wndtab_offs; + m_layer[1].gbc_map = m_vram.get() + m_gbc_wndtab_offs; } @@ -306,10 +306,10 @@ void gb_lcd_device::device_start() common_start(); m_lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gb_lcd_device::lcd_timer_proc),this)); - m_vram = auto_alloc_array_clear(machine(), UINT8, 0x2000); - save_pointer(NAME(m_vram), 0x2000); + m_vram = make_unique_clear(0x2000); + save_pointer(NAME(m_vram.get()), 0x2000); - memcpy(m_oam, dmg_oam_fingerprint, 0x100); + memcpy(m_oam.get(), dmg_oam_fingerprint, 0x100); } void mgb_lcd_device::device_start() @@ -317,10 +317,10 @@ void mgb_lcd_device::device_start() common_start(); m_lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mgb_lcd_device::lcd_timer_proc),this)); - m_vram = auto_alloc_array_clear(machine(), UINT8, 0x2000); - save_pointer(NAME(m_vram), 0x2000); + m_vram = make_unique_clear(0x2000); + save_pointer(NAME(m_vram.get()), 0x2000); - memcpy(m_oam, mgb_oam_fingerprint, 0x100); + memcpy(m_oam.get(), mgb_oam_fingerprint, 0x100); } void sgb_lcd_device::device_start() @@ -328,11 +328,11 @@ void sgb_lcd_device::device_start() common_start(); m_lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sgb_lcd_device::lcd_timer_proc),this)); - m_vram = auto_alloc_array_clear(machine(), UINT8, 0x2000); - save_pointer(NAME(m_vram), 0x2000); + m_vram = make_unique_clear(0x2000); + save_pointer(NAME(m_vram.get()), 0x2000); - m_sgb_tile_data = auto_alloc_array_clear(machine(), UINT8, 0x2000); - save_pointer(NAME(m_sgb_tile_data), 0x2000); + m_sgb_tile_data = make_unique_clear(0x2000); + save_pointer(NAME(m_sgb_tile_data.get()), 0x2000); memset(m_sgb_tile_map, 0, sizeof(m_sgb_tile_map)); @@ -359,10 +359,10 @@ void cgb_lcd_device::device_start() common_start(); m_lcd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cgb_lcd_device::lcd_timer_proc),this)); - m_vram = auto_alloc_array_clear(machine(), UINT8, 0x4000); - save_pointer(NAME(m_vram), 0x4000); + m_vram = make_unique_clear(0x4000); + save_pointer(NAME(m_vram.get()), 0x4000); - memcpy(m_oam, cgb_oam_fingerprint, 0x100); + memcpy(m_oam.get(), cgb_oam_fingerprint, 0x100); /* Background is initialised as white */ for (int i = 0; i < 32; i++) @@ -447,7 +447,7 @@ void sgb_lcd_device::device_reset() { common_reset(); - memset(m_sgb_tile_data, 0, 0x2000); + memset(m_sgb_tile_data.get(), 0, 0x2000); m_sgb_window_mask = 0; @@ -484,7 +484,7 @@ inline void gb_lcd_device::plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 void gb_lcd_device::select_sprites() { int /*yindex,*/ line, height; - UINT8 *oam = m_oam + 39 * 4; + UINT8 *oam = m_oam.get() + 39 * 4; m_sprCount = 0; @@ -537,8 +537,8 @@ void gb_lcd_device::update_sprites() yindex = m_current_line; line = m_current_line + 16; - oam = m_oam + 39 * 4; - vram = m_vram; + oam = m_oam.get() + 39 * 4; + vram = m_vram.get(); for (int i = 39; i >= 0; i--) { /* if sprite is on current line && x-coordinate && x-coordinate is < 168 */ @@ -630,8 +630,8 @@ void gb_lcd_device::update_scanline() if (m_layer[0].enabled) { m_layer[0].bgline = (SCROLLY + m_current_line) & 0xFF; - m_layer[0].bg_map = m_vram + m_gb_bgdtab_offs; - m_layer[0].bg_tiles = m_vram + m_gb_chrgen_offs; + m_layer[0].bg_map = m_vram.get() + m_gb_bgdtab_offs; + m_layer[0].bg_tiles = m_vram.get() + m_gb_chrgen_offs; m_layer[0].xindex = SCROLLX >> 3; m_layer[0].xshift = SCROLLX & 7; m_layer[0].xstart = 0; @@ -645,8 +645,8 @@ void gb_lcd_device::update_scanline() xpos = 0; m_layer[1].bgline = m_window_lines_drawn; - m_layer[1].bg_map = m_vram + m_gb_wndtab_offs; - m_layer[1].bg_tiles = m_vram + m_gb_chrgen_offs; + m_layer[1].bg_map = m_vram.get() + m_gb_wndtab_offs; + m_layer[1].bg_tiles = m_vram.get() + m_gb_chrgen_offs; m_layer[1].xindex = 0; m_layer[1].xshift = 0; m_layer[1].xstart = xpos; @@ -771,8 +771,8 @@ void sgb_lcd_device::update_sprites() yindex = m_current_line + SGB_YOFFSET; line = m_current_line + 16; - oam = m_oam + 39 * 4; - vram = m_vram; + oam = m_oam.get() + 39 * 4; + vram = m_vram.get(); for (int i = 39; i >= 0; i--) { /* if sprite is on current line && x-coordinate && x-coordinate is < 168 */ @@ -860,9 +860,9 @@ void sgb_lcd_device::refresh_border() for (UINT16 xidx = 0; xidx < 64; xidx += 2) { if (map[xidx + 1] & 0x80) /* Vertical flip */ - tiles = m_sgb_tile_data + ((7 - (yidx % 8)) << 1); + tiles = m_sgb_tile_data.get() + ((7 - (yidx % 8)) << 1); else /* No vertical flip */ - tiles = m_sgb_tile_data + ((yidx % 8) << 1); + tiles = m_sgb_tile_data.get() + ((yidx % 8) << 1); tiles2 = tiles + 16; UINT8 pal = (map[xidx + 1] & 0x1C) >> 2; @@ -941,8 +941,8 @@ void sgb_lcd_device::update_scanline() if (m_layer[0].enabled) { m_layer[0].bgline = (SCROLLY + m_current_line) & 0xFF; - m_layer[0].bg_map = m_vram + m_gb_bgdtab_offs; - m_layer[0].bg_tiles = m_vram + m_gb_chrgen_offs; + m_layer[0].bg_map = m_vram.get() + m_gb_bgdtab_offs; + m_layer[0].bg_tiles = m_vram.get() + m_gb_chrgen_offs; m_layer[0].xindex = SCROLLX >> 3; m_layer[0].xshift = SCROLLX & 7; m_layer[0].xstart = 0; @@ -959,8 +959,8 @@ void sgb_lcd_device::update_scanline() xpos = 0; m_layer[1].bgline = m_window_lines_drawn; - m_layer[1].bg_map = m_vram + m_gb_wndtab_offs; - m_layer[1].bg_tiles = m_vram + m_gb_chrgen_offs; + m_layer[1].bg_map = m_vram.get() + m_gb_wndtab_offs; + m_layer[1].bg_tiles = m_vram.get() + m_gb_chrgen_offs; m_layer[1].xindex = 0; m_layer[1].xshift = 0; m_layer[1].xstart = xpos; @@ -1117,7 +1117,7 @@ void cgb_lcd_device::update_sprites() yindex = m_current_line; line = m_current_line + 16; - oam = m_oam + 39 * 4; + oam = m_oam.get() + 39 * 4; for (int i = 39; i >= 0; i--) { /* if sprite is on current line && x-coordinate && x-coordinate is < 168 */ @@ -1236,8 +1236,8 @@ void cgb_lcd_device::update_scanline() if (m_layer[0].enabled) { m_layer[0].bgline = (SCROLLY + m_current_line) & 0xFF; - m_layer[0].bg_map = m_vram + m_gb_bgdtab_offs; - m_layer[0].gbc_map = m_vram + m_gbc_bgdtab_offs; + m_layer[0].bg_map = m_vram.get() + m_gb_bgdtab_offs; + m_layer[0].gbc_map = m_vram.get() + m_gbc_bgdtab_offs; m_layer[0].xindex = SCROLLX >> 3; m_layer[0].xshift = SCROLLX & 7; m_layer[0].xstart = 0; @@ -1254,8 +1254,8 @@ void cgb_lcd_device::update_scanline() xpos = 0; m_layer[1].bgline = m_window_lines_drawn; - m_layer[1].bg_map = m_vram + m_gb_wndtab_offs; - m_layer[1].gbc_map = m_vram + m_gbc_wndtab_offs; + m_layer[1].bg_map = m_vram.get() + m_gb_wndtab_offs; + m_layer[1].gbc_map = m_vram.get() + m_gbc_wndtab_offs; m_layer[1].xindex = 0; m_layer[1].xshift = 0; m_layer[1].xstart = xpos; @@ -1287,7 +1287,7 @@ void cgb_lcd_device::update_scanline() } map = m_layer[l].bg_map + ((m_layer[l].bgline << 2) & 0x3E0); gbcmap = m_layer[l].gbc_map + ((m_layer[l].bgline << 2) & 0x3E0); - tiles = (gbcmap[m_layer[l].xindex] & 0x08) ? (m_vram + m_gbc_chrgen_offs) : (m_vram + m_gb_chrgen_offs); + tiles = (gbcmap[m_layer[l].xindex] & 0x08) ? (m_vram.get() + m_gbc_chrgen_offs) : (m_vram.get() + m_gb_chrgen_offs); /* Check for vertical flip */ if (gbcmap[m_layer[l].xindex] & 0x40) @@ -1352,7 +1352,7 @@ void cgb_lcd_device::update_scanline() m_layer[l].xindex = (m_layer[l].xindex + 1) & 31; m_layer[l].xshift = 0; - tiles = (gbcmap[m_layer[l].xindex] & 0x08) ? (m_vram + m_gbc_chrgen_offs) : (m_vram + m_gb_chrgen_offs); + tiles = (gbcmap[m_layer[l].xindex] & 0x08) ? (m_vram.get() + m_gbc_chrgen_offs) : (m_vram.get() + m_gb_chrgen_offs); /* Check for vertical flip */ if (gbcmap[m_layer[l].xindex] & 0x40) @@ -2181,7 +2181,7 @@ WRITE8_MEMBER(gb_lcd_device::video_w) break; case 0x06: /* DMA - DMA Transfer and Start Address */ { - UINT8 *P = m_oam; + UINT8 *P = m_oam.get(); offset = (UINT16) data << 8; for (data = 0; data < 0xA0; data++) *P++ = space.read_byte(offset++); @@ -2782,16 +2782,16 @@ void sgb_lcd_device::sgb_io_write_pal(int offs, UINT8 *data) break; case 0x13: /* CHR_TRN */ if (data[1] & 0x1) - memcpy(m_sgb_tile_data + 4096, m_vram + 0x0800, 4096); + memcpy(m_sgb_tile_data.get() + 4096, m_vram.get() + 0x0800, 4096); else - memcpy(m_sgb_tile_data, m_vram + 0x0800, 4096); + memcpy(m_sgb_tile_data.get(), m_vram.get() + 0x0800, 4096); break; case 0x14: /* PCT_TRN */ { UINT16 col; if (m_sgb_border_hack) { - memcpy(m_sgb_tile_map, m_vram + 0x1000, 2048); + memcpy(m_sgb_tile_map, m_vram.get() + 0x1000, 2048); for (int i = 0; i < 64; i++) { col = (m_vram[0x0800 + (i * 2) + 1 ] << 8) | m_vram[0x0800 + (i * 2)]; @@ -2800,7 +2800,7 @@ void sgb_lcd_device::sgb_io_write_pal(int offs, UINT8 *data) } else /* Do things normally */ { - memcpy(m_sgb_tile_map, m_vram + 0x0800, 2048); + memcpy(m_sgb_tile_map, m_vram.get() + 0x0800, 2048); for (int i = 0; i < 64; i++) { col = (m_vram[0x1000 + (i * 2) + 1] << 8) | m_vram[0x1000 + (i * 2)]; @@ -2810,7 +2810,7 @@ void sgb_lcd_device::sgb_io_write_pal(int offs, UINT8 *data) } break; case 0x15: /* ATTR_TRN */ - memcpy(m_sgb_atf_data, m_vram + 0x0800, 4050); + memcpy(m_sgb_atf_data, m_vram.get() + 0x0800, 4050); break; case 0x16: /* ATTR_SET */ { diff --git a/src/mame/video/gb_lcd.h b/src/mame/video/gb_lcd.h index b68648046b4..e35e55130ef 100644 --- a/src/mame/video/gb_lcd.h +++ b/src/mame/video/gb_lcd.h @@ -73,7 +73,7 @@ protected: UINT16 m_sgb_pal_data[4096]; UINT8 m_sgb_pal_map[20][18]; UINT16 m_sgb_pal[128]; - UINT8 *m_sgb_tile_data; + std::unique_ptr m_sgb_tile_data; UINT8 m_sgb_tile_map[2048]; UINT8 m_sgb_window_mask; @@ -119,8 +119,8 @@ protected: emu_timer *m_lcd_timer; int m_gbc_mode; - UINT8 *m_vram; // Pointer to VRAM - UINT8 *m_oam; // Pointer to OAM memory + std::unique_ptr m_vram; // Pointer to VRAM + std::unique_ptr m_oam; // Pointer to OAM memory UINT8 m_gb_tile_no_mod; UINT32 m_gb_chrgen_offs; // GB Character generator UINT32 m_gb_bgdtab_offs; // GB Background character table diff --git a/src/mame/video/gp9001.cpp b/src/mame/video/gp9001.cpp index 9a8c379bf7f..31d939db1dd 100644 --- a/src/mame/video/gp9001.cpp +++ b/src/mame/video/gp9001.cpp @@ -308,11 +308,11 @@ void gp9001vdp_device::create_tilemaps() void gp9001vdp_device::device_start() { - sp.vram16_buffer = auto_alloc_array_clear(machine(), UINT16, GP9001_SPRITERAM_SIZE/2); + sp.vram16_buffer = make_unique_clear(GP9001_SPRITERAM_SIZE/2); create_tilemaps(); - save_pointer(NAME(sp.vram16_buffer), GP9001_SPRITERAM_SIZE/2); + save_pointer(NAME(sp.vram16_buffer.get()), GP9001_SPRITERAM_SIZE/2); save_item(NAME(gp9001_scroll_reg)); save_item(NAME(gp9001_voffs)); @@ -680,7 +680,7 @@ void gp9001vdp_device::draw_sprites( bitmap_ind16 &bitmap, const rectangle &clip UINT16 *source; - if (sp.use_sprite_buffer) source = sp.vram16_buffer; + if (sp.use_sprite_buffer) source = sp.vram16_buffer.get(); else source = m_spriteram; int total_elements = m_gfx[1]->elements(); int total_colors = m_gfx[1]->colors(); @@ -936,5 +936,5 @@ void gp9001vdp_device::gp9001_render_vdp(bitmap_ind16 &bitmap, const rectangle & void gp9001vdp_device::gp9001_screen_eof(void) { /** Shift sprite RAM buffers *** Used to fix sprite lag **/ - if (sp.use_sprite_buffer) memcpy(sp.vram16_buffer,m_spriteram,GP9001_SPRITERAM_SIZE); + if (sp.use_sprite_buffer) memcpy(sp.vram16_buffer.get(),m_spriteram,GP9001_SPRITERAM_SIZE); } diff --git a/src/mame/video/gp9001.h b/src/mame/video/gp9001.h index 45bdd5faeb4..f7dcebe491c 100644 --- a/src/mame/video/gp9001.h +++ b/src/mame/video/gp9001.h @@ -26,7 +26,7 @@ struct gp9001tilemaplayer : gp9001layer struct gp9001spritelayer : gp9001layer { bool use_sprite_buffer; - UINT16 *vram16_buffer; // vram buffer for this layer + std::unique_ptr vram16_buffer; // vram buffer for this layer }; diff --git a/src/mame/video/gridlee.cpp b/src/mame/video/gridlee.cpp index 96b7fd0733f..60010d897d3 100644 --- a/src/mame/video/gridlee.cpp +++ b/src/mame/video/gridlee.cpp @@ -63,12 +63,12 @@ void gridlee_state::expand_pixels() void gridlee_state::video_start() { /* allocate a local copy of video RAM */ - m_local_videoram = auto_alloc_array_clear(machine(), UINT8, 256 * 256); + m_local_videoram = make_unique_clear(256 * 256); /* reset the palette */ m_palettebank_vis = 0; - save_pointer(NAME(m_local_videoram), 256 * 256); + save_pointer(NAME(m_local_videoram.get()), 256 * 256); save_item(NAME(m_cocktail_flip)); save_item(NAME(m_palettebank_vis)); machine().save().register_postload(save_prepost_delegate(FUNC(gridlee_state::expand_pixels), this)); diff --git a/src/mame/video/inufuku.cpp b/src/mame/video/inufuku.cpp index d9f896c9e95..35ce40a1df2 100644 --- a/src/mame/video/inufuku.cpp +++ b/src/mame/video/inufuku.cpp @@ -123,7 +123,7 @@ void inufuku_state::video_start() m_bg_tilemap->set_transparent_pen(255); m_tx_tilemap->set_transparent_pen(255); - m_spriteram1_old = auto_alloc_array_clear(machine(), UINT16, m_spriteram1.bytes()/2); + m_spriteram1_old = make_unique_clear(m_spriteram1.bytes()/2); } @@ -159,7 +159,7 @@ UINT32 inufuku_state::screen_update_inufuku(screen_device &screen, bitmap_ind16 m_tx_tilemap->set_scrolly(0, m_tx_scrolly); m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4); - m_spr->draw_sprites( m_spriteram1_old, m_spriteram1.bytes(), screen, bitmap, cliprect ); + m_spr->draw_sprites( m_spriteram1_old.get(), m_spriteram1.bytes(), screen, bitmap, cliprect ); return 0; } @@ -168,6 +168,6 @@ void inufuku_state::screen_eof_inufuku(screen_device &screen, bool state) // rising edge if (state) { - memcpy(m_spriteram1_old,m_spriteram1,m_spriteram1.bytes()); + memcpy(m_spriteram1_old.get(),m_spriteram1,m_spriteram1.bytes()); } } diff --git a/src/mame/video/jalblend.cpp b/src/mame/video/jalblend.cpp index 1220d2a3d09..93359334934 100644 --- a/src/mame/video/jalblend.cpp +++ b/src/mame/video/jalblend.cpp @@ -36,9 +36,9 @@ jaleco_blend_device::jaleco_blend_device(const machine_config &mconfig, const ch void jaleco_blend_device::device_start() { - m_table = auto_alloc_array_clear(machine(), UINT8, 0xc00); + m_table = make_unique_clear(0xc00); - save_pointer(NAME(m_table), 0xc00); + save_pointer(NAME(m_table.get()), 0xc00); } //------------------------------------------------- @@ -47,7 +47,7 @@ void jaleco_blend_device::device_start() void jaleco_blend_device::device_reset() { - memset(m_table, 0, 0xc00); + memset(m_table.get(), 0, 0xc00); } void jaleco_blend_device::set(int color, UINT8 val) diff --git a/src/mame/video/jalblend.h b/src/mame/video/jalblend.h index 109e4c66e44..721bf320676 100644 --- a/src/mame/video/jalblend.h +++ b/src/mame/video/jalblend.h @@ -22,7 +22,7 @@ protected: private: /* each palette entry contains a fourth 'alpha' value */ - UINT8 *m_table; + std::unique_ptr m_table; template void drawgfx_common(palette_device &palette,_BitmapClass &dest_bmp,const rectangle &clip,gfx_element *gfx, diff --git a/src/mame/video/k001006.cpp b/src/mame/video/k001006.cpp index a0524973494..1c60d4b56b0 100644 --- a/src/mame/video/k001006.cpp +++ b/src/mame/video/k001006.cpp @@ -20,7 +20,7 @@ k001006_device::k001006_device(const machine_config &mconfig, const char *tag, d m_unknown_ram(nullptr), m_addr(0), m_device_sel(0), - m_palette(nullptr), + m_palette(nullptr), m_gfx_region(nullptr), m_gfxrom(nullptr), m_tex_layout(0) { } @@ -41,18 +41,18 @@ void k001006_device::device_config_complete() void k001006_device::device_start() { - m_pal_ram = auto_alloc_array_clear(machine(), UINT16, 0x800); - m_unknown_ram = auto_alloc_array_clear(machine(), UINT16, 0x1000); - m_palette = auto_alloc_array_clear(machine(), UINT32, 0x800); + m_pal_ram = make_unique_clear(0x800); + m_unknown_ram = make_unique_clear(0x1000); + m_palette = make_unique_clear(0x800); m_gfxrom = machine().root_device().memregion(m_gfx_region)->base(); m_texrom = std::make_unique(0x800000); preprocess_texture_data(m_texrom.get(), m_gfxrom, 0x800000, m_tex_layout); - save_pointer(NAME(m_pal_ram), 0x800*sizeof(UINT16)); - save_pointer(NAME(m_unknown_ram), 0x1000*sizeof(UINT16)); - save_pointer(NAME(m_palette), 0x800*sizeof(UINT32)); + save_pointer(NAME(m_pal_ram.get()), 0x800*sizeof(UINT16)); + save_pointer(NAME(m_unknown_ram.get()), 0x1000*sizeof(UINT16)); + save_pointer(NAME(m_palette.get()), 0x800*sizeof(UINT32)); save_item(NAME(m_device_sel)); save_item(NAME(m_addr)); } @@ -65,7 +65,7 @@ void k001006_device::device_reset() { m_addr = 0; m_device_sel = 0; - memset(m_palette, 0, 0x800*sizeof(UINT32)); + memset(m_palette.get(), 0, 0x800*sizeof(UINT32)); } /***************************************************************************** diff --git a/src/mame/video/k001006.h b/src/mame/video/k001006.h index 2a2beb48895..6b3b23e41c2 100644 --- a/src/mame/video/k001006.h +++ b/src/mame/video/k001006.h @@ -30,14 +30,14 @@ protected: private: // internal state - UINT16 * m_pal_ram; - UINT16 * m_unknown_ram; + std::unique_ptr m_pal_ram; + std::unique_ptr m_unknown_ram; UINT32 m_addr; int m_device_sel; std::unique_ptr m_texrom; - UINT32 * m_palette; + std::unique_ptr m_palette; const char * m_gfx_region; UINT8 * m_gfxrom; diff --git a/src/mame/video/k001604.cpp b/src/mame/video/k001604.cpp index 474dddce394..449545f4466 100644 --- a/src/mame/video/k001604.cpp +++ b/src/mame/video/k001604.cpp @@ -24,7 +24,8 @@ k001604_device::k001604_device(const machine_config &mconfig, const char *tag, d m_layer_size(0), m_roz_size(0), m_txt_mem_offset(0), - m_roz_mem_offset(0), + m_roz_mem_offset(0), + m_layer_roz(nullptr), m_tile_ram(nullptr), m_char_ram(nullptr), m_reg(nullptr), @@ -81,9 +82,9 @@ void k001604_device::device_start() m_gfx_index[0] = m_gfx_index_1; m_gfx_index[1] = m_gfx_index_2; - m_char_ram = auto_alloc_array_clear(machine(), UINT32, 0x200000 / 4); - m_tile_ram = auto_alloc_array_clear(machine(), UINT32, 0x20000 / 4); - m_reg = auto_alloc_array_clear(machine(), UINT32, 0x400 / 4); + m_char_ram = make_unique_clear(0x200000 / 4); + m_tile_ram = make_unique_clear(0x20000 / 4); + m_reg = make_unique_clear(0x400 / 4); /* create tilemaps */ roz_tile_size = m_roz_size ? 16 : 8; @@ -109,9 +110,9 @@ void k001604_device::device_start() m_gfxdecode->set_gfx(m_gfx_index[0], global_alloc(gfx_element(m_palette, k001604_char_layout_layer_8x8, (UINT8*)&m_char_ram[0], 0, m_palette->entries() / 16, 0))); m_gfxdecode->set_gfx(m_gfx_index[1], global_alloc(gfx_element(m_palette, k001604_char_layout_layer_16x16, (UINT8*)&m_char_ram[0], 0, m_palette->entries() / 16, 0))); - save_pointer(NAME(m_reg), 0x400 / 4); - save_pointer(NAME(m_char_ram), 0x200000 / 4); - save_pointer(NAME(m_tile_ram), 0x20000 / 4); + save_pointer(NAME(m_reg.get()), 0x400 / 4); + save_pointer(NAME(m_char_ram.get()), 0x200000 / 4); + save_pointer(NAME(m_tile_ram.get()), 0x20000 / 4); } @@ -121,9 +122,9 @@ void k001604_device::device_start() void k001604_device::device_reset() { - memset(m_char_ram, 0, 0x200000); - memset(m_tile_ram, 0, 0x10000); - memset(m_reg, 0, 0x400); + memset(m_char_ram.get(), 0, 0x200000); + memset(m_tile_ram.get(), 0, 0x10000); + memset(m_reg.get(), 0, 0x400); } /***************************************************************************** @@ -337,7 +338,7 @@ READ32_MEMBER( k001604_device::reg_r ) WRITE32_MEMBER( k001604_device::tile_w ) { int x/*, y*/; - COMBINE_DATA(m_tile_ram + offset); + COMBINE_DATA(m_tile_ram.get() + offset); if (m_layer_size) { @@ -394,7 +395,7 @@ WRITE32_MEMBER( k001604_device::char_w ) addr = offset + ((set + (bank * 0x40000)) / 4); - COMBINE_DATA(m_char_ram + addr); + COMBINE_DATA(m_char_ram.get() + addr); m_gfxdecode->gfx(m_gfx_index[0])->mark_dirty(addr / 32); m_gfxdecode->gfx(m_gfx_index[1])->mark_dirty(addr / 128); @@ -402,7 +403,7 @@ WRITE32_MEMBER( k001604_device::char_w ) WRITE32_MEMBER( k001604_device::reg_w ) { - COMBINE_DATA(m_reg + offset); + COMBINE_DATA(m_reg.get() + offset); switch (offset) { diff --git a/src/mame/video/k001604.h b/src/mame/video/k001604.h index e33227328d1..d0719936029 100644 --- a/src/mame/video/k001604.h +++ b/src/mame/video/k001604.h @@ -47,9 +47,9 @@ private: tilemap_t *m_layer_roz; int m_gfx_index[2]; - UINT32 * m_tile_ram; - UINT32 * m_char_ram; - UINT32 * m_reg; + std::unique_ptr m_tile_ram; + std::unique_ptr m_char_ram; + std::unique_ptr m_reg; required_device m_gfxdecode; required_device m_palette; diff --git a/src/mame/video/k007342.cpp b/src/mame/video/k007342.cpp index 0cc57b6c826..e44dd84e068 100644 --- a/src/mame/video/k007342.cpp +++ b/src/mame/video/k007342.cpp @@ -81,8 +81,8 @@ void k007342_device::device_start() m_tilemap[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k007342_device::get_tile_info0),this), tilemap_mapper_delegate(FUNC(k007342_device::scan),this), 8, 8, 64, 32); m_tilemap[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k007342_device::get_tile_info1),this), tilemap_mapper_delegate(FUNC(k007342_device::scan),this), 8, 8, 64, 32); - m_ram = auto_alloc_array_clear(machine(), UINT8, 0x2000); - m_scroll_ram = auto_alloc_array_clear(machine(), UINT8, 0x0200); + m_ram = make_unique_clear(0x2000); + m_scroll_ram = make_unique_clear(0x0200); m_colorram_0 = &m_ram[0x0000]; m_colorram_1 = &m_ram[0x1000]; @@ -92,8 +92,8 @@ void k007342_device::device_start() m_tilemap[0]->set_transparent_pen(0); m_tilemap[1]->set_transparent_pen(0); - save_pointer(NAME(m_ram), 0x2000); - save_pointer(NAME(m_scroll_ram), 0x0200); + save_pointer(NAME(m_ram.get()), 0x2000); + save_pointer(NAME(m_scroll_ram.get()), 0x0200); save_item(NAME(m_int_enabled)); save_item(NAME(m_flipscreen)); save_item(NAME(m_scrollx)); diff --git a/src/mame/video/k007342.h b/src/mame/video/k007342.h index 5700c0aca76..edc307868fa 100644 --- a/src/mame/video/k007342.h +++ b/src/mame/video/k007342.h @@ -33,8 +33,8 @@ protected: virtual void device_reset() override; private: // internal state - UINT8 *m_ram; - UINT8 *m_scroll_ram; + std::unique_ptr m_ram; + std::unique_ptr m_scroll_ram; UINT8 *m_videoram_0; UINT8 *m_videoram_1; UINT8 *m_colorram_0; diff --git a/src/mame/video/k007420.cpp b/src/mame/video/k007420.cpp index d9806491022..9b539f23669 100644 --- a/src/mame/video/k007420.cpp +++ b/src/mame/video/k007420.cpp @@ -37,9 +37,9 @@ void k007420_device::device_start() // bind the init function m_callback.bind_relative_to(*owner()); - m_ram = auto_alloc_array_clear(machine(), UINT8, 0x200); + m_ram = make_unique_clear(0x200); - save_pointer(NAME(m_ram), 0x200); + save_pointer(NAME(m_ram.get()), 0x200); save_item(NAME(m_flipscreen)); // current one uses 7342 one save_item(NAME(m_regs)); // current one uses 7342 ones } diff --git a/src/mame/video/k007420.h b/src/mame/video/k007420.h index cc94cda3be1..471efe297b6 100644 --- a/src/mame/video/k007420.h +++ b/src/mame/video/k007420.h @@ -26,7 +26,7 @@ protected: virtual void device_reset() override; private: // internal state - UINT8 *m_ram; + std::unique_ptr m_ram; int m_flipscreen; // current code uses the 7342 flipscreen!! UINT8 m_regs[8]; // current code uses the 7342 regs!! (only [2]) diff --git a/src/mame/video/k037122.cpp b/src/mame/video/k037122.cpp index c5e42a8c4fc..a1ca84148ba 100644 --- a/src/mame/video/k037122.cpp +++ b/src/mame/video/k037122.cpp @@ -67,9 +67,9 @@ void k037122_device::device_start() if(!m_gfxdecode->started()) throw device_missing_dependencies(); - m_char_ram = auto_alloc_array_clear(machine(), UINT32, 0x200000 / 4); - m_tile_ram = auto_alloc_array_clear(machine(), UINT32, 0x20000 / 4); - m_reg = auto_alloc_array_clear(machine(), UINT32, 0x400 / 4); + m_char_ram = make_unique_clear(0x200000 / 4); + m_tile_ram = make_unique_clear(0x20000 / 4); + m_reg = make_unique_clear(0x400 / 4); m_layer[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k037122_device::tile_info_layer0),this), TILEMAP_SCAN_ROWS, 8, 8, 256, 64); m_layer[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(k037122_device::tile_info_layer1),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 64); @@ -77,11 +77,11 @@ void k037122_device::device_start() m_layer[0]->set_transparent_pen(0); m_layer[1]->set_transparent_pen(0); - m_gfxdecode->set_gfx(m_gfx_index,global_alloc(gfx_element(m_palette, k037122_char_layout, (UINT8*)m_char_ram, 0, m_palette->entries() / 16, 0))); + m_gfxdecode->set_gfx(m_gfx_index,global_alloc(gfx_element(m_palette, k037122_char_layout, (UINT8*)m_char_ram.get(), 0, m_palette->entries() / 16, 0))); - save_pointer(NAME(m_reg), 0x400 / 4); - save_pointer(NAME(m_char_ram), 0x200000 / 4); - save_pointer(NAME(m_tile_ram), 0x20000 / 4); + save_pointer(NAME(m_reg.get()), 0x400 / 4); + save_pointer(NAME(m_char_ram.get()), 0x200000 / 4); + save_pointer(NAME(m_tile_ram.get()), 0x20000 / 4); } @@ -91,9 +91,9 @@ void k037122_device::device_start() void k037122_device::device_reset() { - memset(m_char_ram, 0, 0x200000); - memset(m_tile_ram, 0, 0x20000); - memset(m_reg, 0, 0x400); + memset(m_char_ram.get(), 0, 0x200000); + memset(m_tile_ram.get(), 0, 0x20000); + memset(m_reg.get(), 0, 0x400); } /***************************************************************************** @@ -163,7 +163,7 @@ READ32_MEMBER( k037122_device::sram_r ) WRITE32_MEMBER( k037122_device::sram_w ) { - COMBINE_DATA(m_tile_ram + offset); + COMBINE_DATA(m_tile_ram.get() + offset); if (m_reg[0xc] & 0x10000) { @@ -210,7 +210,7 @@ WRITE32_MEMBER( k037122_device::char_w ) int bank = m_reg[0x30 / 4] & 0x7; UINT32 addr = offset + (bank * (0x40000/4)); - COMBINE_DATA(m_char_ram + addr); + COMBINE_DATA(m_char_ram.get() + addr); m_gfxdecode->gfx(m_gfx_index)->mark_dirty(addr / 32); } @@ -228,5 +228,5 @@ READ32_MEMBER( k037122_device::reg_r ) WRITE32_MEMBER( k037122_device::reg_w ) { - COMBINE_DATA(m_reg + offset); + COMBINE_DATA(m_reg.get() + offset); } diff --git a/src/mame/video/k037122.h b/src/mame/video/k037122.h index 086d9eb445f..181f28e355d 100644 --- a/src/mame/video/k037122.h +++ b/src/mame/video/k037122.h @@ -33,9 +33,9 @@ private: // internal state tilemap_t *m_layer[2]; - UINT32 * m_tile_ram; - UINT32 * m_char_ram; - UINT32 * m_reg; + std::unique_ptr m_tile_ram; + std::unique_ptr m_char_ram; + std::unique_ptr m_reg; int m_gfx_index; required_device m_gfxdecode; diff --git a/src/mame/video/k051960.cpp b/src/mame/video/k051960.cpp index 45f634e95ca..81eb58f45af 100644 --- a/src/mame/video/k051960.cpp +++ b/src/mame/video/k051960.cpp @@ -201,7 +201,7 @@ void k051960_device::device_start() if (VERBOSE && !(m_palette->shadows_enabled())) popmessage("driver should use VIDEO_HAS_SHADOWS"); - m_ram = auto_alloc_array_clear(machine(), UINT8, 0x400); + m_ram = make_unique_clear(0x400); // bind callbacks m_k051960_cb.bind_relative_to(*owner()); @@ -217,7 +217,7 @@ void k051960_device::device_start() save_item(NAME(m_readroms)); save_item(NAME(m_nmi_enabled)); save_item(NAME(m_spriterombank)); - save_pointer(NAME(m_ram), 0x400); + save_pointer(NAME(m_ram.get()), 0x400); } //------------------------------------------------- diff --git a/src/mame/video/k051960.h b/src/mame/video/k051960.h index c05afc3cadc..069f0f48440 100644 --- a/src/mame/video/k051960.h +++ b/src/mame/video/k051960.h @@ -87,7 +87,7 @@ protected: private: // internal state - UINT8 *m_ram; + std::unique_ptr m_ram; UINT8 *m_sprite_rom; UINT32 m_sprite_size; diff --git a/src/mame/video/k052109.cpp b/src/mame/video/k052109.cpp index 07e4e1ef80c..f0e3c640051 100644 --- a/src/mame/video/k052109.cpp +++ b/src/mame/video/k052109.cpp @@ -225,7 +225,7 @@ void k052109_device::device_start() decode_gfx(); m_gfx[0]->set_colors(m_palette->entries() / m_gfx[0]->depth()); - m_ram = auto_alloc_array_clear(machine(), UINT8, 0x6000); + m_ram = make_unique_clear(0x6000); m_colorram_F = &m_ram[0x0000]; m_colorram_A = &m_ram[0x0800]; @@ -253,7 +253,7 @@ void k052109_device::device_start() m_firq_handler.resolve_safe(); m_nmi_handler.resolve_safe(); - save_pointer(NAME(m_ram), 0x6000); + save_pointer(NAME(m_ram.get()), 0x6000); save_item(NAME(m_rmrd_line)); save_item(NAME(m_romsubbank)); save_item(NAME(m_scrollctrl)); diff --git a/src/mame/video/k052109.h b/src/mame/video/k052109.h index a8f893ee443..96f25882fa4 100644 --- a/src/mame/video/k052109.h +++ b/src/mame/video/k052109.h @@ -76,7 +76,7 @@ protected: private: // internal state - UINT8 *m_ram; + std::unique_ptr m_ram; UINT8 *m_videoram_F; UINT8 *m_videoram_A; UINT8 *m_videoram_B; diff --git a/src/mame/video/k053244_k053245.cpp b/src/mame/video/k053244_k053245.cpp index 8596af1ce54..66846c73aa6 100644 --- a/src/mame/video/k053244_k053245.cpp +++ b/src/mame/video/k053244_k053245.cpp @@ -131,14 +131,14 @@ void k05324x_device::device_start() m_ramsize = 0x800; m_z_rejection = -1; - m_ram = auto_alloc_array_clear(machine(), UINT16, m_ramsize / 2); - m_buffer = auto_alloc_array_clear(machine(), UINT16, m_ramsize / 2); + m_ram = make_unique_clear(m_ramsize / 2); + m_buffer = make_unique_clear(m_ramsize / 2); // bind callbacks m_k05324x_cb.bind_relative_to(*owner()); - save_pointer(NAME(m_ram), m_ramsize / 2); - save_pointer(NAME(m_buffer), m_ramsize / 2); + save_pointer(NAME(m_ram.get()), m_ramsize / 2); + save_pointer(NAME(m_buffer.get()), m_ramsize / 2); save_item(NAME(m_rombank)); save_item(NAME(m_z_rejection)); save_item(NAME(m_regs)); @@ -167,7 +167,7 @@ READ16_MEMBER( k05324x_device::k053245_word_r ) WRITE16_MEMBER( k05324x_device::k053245_word_w ) { - COMBINE_DATA(m_ram + offset); + COMBINE_DATA(m_ram.get() + offset); } READ8_MEMBER( k05324x_device::k053245_r ) @@ -197,7 +197,7 @@ void k05324x_device::clear_buffer() void k05324x_device::update_buffer() { - memcpy(m_buffer, m_ram, m_ramsize); + memcpy(m_buffer.get(), m_ram.get(), m_ramsize); } READ8_MEMBER( k05324x_device::k053244_r ) diff --git a/src/mame/video/k053244_k053245.h b/src/mame/video/k053244_k053245.h index 9b9c47055fa..924edc2a37f 100644 --- a/src/mame/video/k053244_k053245.h +++ b/src/mame/video/k053244_k053245.h @@ -64,8 +64,8 @@ protected: private: // internal state - UINT16 *m_ram; - UINT16 *m_buffer; + std::unique_ptr m_ram; + std::unique_ptr m_buffer; UINT8 *m_sprite_rom; UINT32 m_sprite_size; diff --git a/src/mame/video/k053936.cpp b/src/mame/video/k053936.cpp index 6a659216ee9..aa1fcdd9929 100644 --- a/src/mame/video/k053936.cpp +++ b/src/mame/video/k053936.cpp @@ -245,11 +245,11 @@ k053936_device::k053936_device(const machine_config &mconfig, const char *tag, d void k053936_device::device_start() { - m_ctrl = auto_alloc_array_clear(machine(), UINT16, 0x20); - m_linectrl = auto_alloc_array_clear(machine(), UINT16, 0x4000); + m_ctrl = make_unique_clear(0x20); + m_linectrl = make_unique_clear(0x4000); - save_pointer(NAME(m_ctrl), 0x20); - save_pointer(NAME(m_linectrl), 0x4000); + save_pointer(NAME(m_ctrl.get()), 0x20); + save_pointer(NAME(m_linectrl.get()), 0x4000); } //------------------------------------------------- @@ -258,7 +258,7 @@ void k053936_device::device_start() void k053936_device::device_reset() { - memset(m_ctrl, 0, 0x20); + memset(m_ctrl.get(), 0, 0x20); } @@ -335,7 +335,7 @@ void k053936_device::zoom_draw( screen_device &screen, bitmap_ind16 &bitmap, con while (y <= maxy) { - UINT16 *lineaddr = m_linectrl + 4 * ((y - m_yoff) & 0x1ff); + UINT16 *lineaddr = m_linectrl.get() + 4 * ((y - m_yoff) & 0x1ff); my_clip.min_y = my_clip.max_y = y; diff --git a/src/mame/video/k053936.h b/src/mame/video/k053936.h index 6b266d97a3c..311b2e198d9 100644 --- a/src/mame/video/k053936.h +++ b/src/mame/video/k053936.h @@ -46,8 +46,8 @@ protected: private: // internal state - UINT16 *m_ctrl; - UINT16 *m_linectrl; + std::unique_ptr m_ctrl; + std::unique_ptr m_linectrl; int m_wrap, m_xoff, m_yoff; }; diff --git a/src/mame/video/k1ge.cpp b/src/mame/video/k1ge.cpp index 4906fff945c..a32e760b385 100644 --- a/src/mame/video/k1ge.cpp +++ b/src/mame/video/k1ge.cpp @@ -802,10 +802,10 @@ void k1ge_device::device_start() m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(k1ge_device::timer_callback), this)); m_hblank_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(k1ge_device::hblank_on_timer_callback), this)); - m_vram = auto_alloc_array_clear(machine(), UINT8, 0x4000); + m_vram = make_unique_clear(0x4000); m_bitmap = std::make_unique(m_screen->width(), m_screen->height() ); - save_pointer(NAME(m_vram), 0x4000); + save_pointer(NAME(m_vram.get()), 0x4000); save_item(NAME(m_wba_h)); save_item(NAME(m_wba_v)); save_item(NAME(m_wsi_h)); diff --git a/src/mame/video/k1ge.h b/src/mame/video/k1ge.h index 93f4a0aa630..81f79d9eb3c 100644 --- a/src/mame/video/k1ge.h +++ b/src/mame/video/k1ge.h @@ -50,7 +50,7 @@ protected: devcb_write_line m_vblank_pin_w; devcb_write_line m_hblank_pin_w; - UINT8 *m_vram; + std::unique_ptr m_vram; UINT8 m_wba_h, m_wba_v, m_wsi_h, m_wsi_v; emu_timer *m_timer; diff --git a/src/mame/video/kaneko_grap2.cpp b/src/mame/video/kaneko_grap2.cpp index 11bbf227408..7a5bd2de907 100644 --- a/src/mame/video/kaneko_grap2.cpp +++ b/src/mame/video/kaneko_grap2.cpp @@ -43,15 +43,15 @@ void kaneko_grap2_device::static_set_palette_tag(device_t &device, const char *t void kaneko_grap2_device::device_start() { - m_framebuffer = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x80000/2); - m_framebuffer_palette = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x200/2); - m_framebuffer_unk1 = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x400/2); - m_framebuffer_unk2 = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x400/2); + m_framebuffer = make_unique_clear(0x80000/2); + m_framebuffer_palette = make_unique_clear(0x200/2); + m_framebuffer_unk1 = make_unique_clear(0x400/2); + m_framebuffer_unk2 = make_unique_clear(0x400/2); - save_pointer(NAME(m_framebuffer), 0x80000/2); - save_pointer(NAME(m_framebuffer_palette), 0x200/2); - save_pointer(NAME(m_framebuffer_unk1), 0x400/2); - save_pointer(NAME(m_framebuffer_unk2), 0x400/2); + save_pointer(NAME(m_framebuffer.get()), 0x80000/2); + save_pointer(NAME(m_framebuffer_palette.get()), 0x200/2); + save_pointer(NAME(m_framebuffer_unk1.get()), 0x400/2); + save_pointer(NAME(m_framebuffer_unk2.get()), 0x400/2); save_item(NAME(m_framebuffer_bgcol)); save_item(NAME(m_framebuffer_scrolly)); @@ -160,7 +160,7 @@ WRITE16_MEMBER(kaneko_grap2_device::galpani3_regs1_go_w) UINT8* rledata = memregion(":gfx2")->base(); // printf("galpani3_regs1_go_w? %08x\n",address ); - if ((data==0x2000) || (data==0x3000)) gp3_do_rle(address, m_framebuffer, rledata); + if ((data==0x2000) || (data==0x3000)) gp3_do_rle(address, m_framebuffer.get(), rledata); } diff --git a/src/mame/video/kaneko_grap2.h b/src/mame/video/kaneko_grap2.h index cc94af5b97b..cd801ad3b45 100644 --- a/src/mame/video/kaneko_grap2.h +++ b/src/mame/video/kaneko_grap2.h @@ -74,10 +74,10 @@ public: DECLARE_READ16_MEMBER( unk2_r ) { return m_framebuffer_unk2[offset]; } DECLARE_WRITE16_MEMBER( unk2_w ) { COMBINE_DATA(&m_framebuffer_unk2[offset]); } - UINT16* m_framebuffer; - UINT16* m_framebuffer_palette; - UINT16* m_framebuffer_unk1; - UINT16* m_framebuffer_unk2; + std::unique_ptr m_framebuffer; + std::unique_ptr m_framebuffer_palette; + std::unique_ptr m_framebuffer_unk1; + std::unique_ptr m_framebuffer_unk2; diff --git a/src/mame/video/kaneko_spr.cpp b/src/mame/video/kaneko_spr.cpp index 403af035443..d37d11bb672 100644 --- a/src/mame/video/kaneko_spr.cpp +++ b/src/mame/video/kaneko_spr.cpp @@ -71,12 +71,12 @@ void kaneko16_sprite_device::static_set_gfxdecode_tag(device_t &device, const ch void kaneko16_sprite_device::device_start() { m_first_sprite = auto_alloc_array(machine(), struct kan_tempsprite, 0x400); - m_sprites_regs = auto_alloc_array_clear(machine(), UINT16, 0x20/2); + m_sprites_regs = make_unique_clear(0x20/2); m_screen->register_screen_bitmap(m_sprites_bitmap); save_item(NAME(m_sprite_flipx)); save_item(NAME(m_sprite_flipy)); - save_pointer(NAME(m_sprites_regs), 0x20/2); + save_pointer(NAME(m_sprites_regs.get()), 0x20/2); save_item(NAME(m_keep_sprites)); save_item(NAME(m_sprites_bitmap)); } diff --git a/src/mame/video/kaneko_spr.h b/src/mame/video/kaneko_spr.h index 1afd5fd2ce4..1448a753265 100644 --- a/src/mame/video/kaneko_spr.h +++ b/src/mame/video/kaneko_spr.h @@ -79,7 +79,7 @@ private: // registers UINT16 m_sprite_flipx; UINT16 m_sprite_flipy; - UINT16* m_sprites_regs; + std::unique_ptr m_sprites_regs; struct kan_tempsprite *m_first_sprite; int m_keep_sprites; diff --git a/src/mame/video/kaneko_tmap.cpp b/src/mame/video/kaneko_tmap.cpp index d74b87f52d5..634753975c0 100644 --- a/src/mame/video/kaneko_tmap.cpp +++ b/src/mame/video/kaneko_tmap.cpp @@ -151,11 +151,11 @@ void kaneko_view2_tilemap_device::device_start() if(!m_gfxdecode->started()) throw device_missing_dependencies(); - m_vram[0] = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x1000/2); - m_vram[1] = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x1000/2); - m_vscroll[0] = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x1000/2); - m_vscroll[1] = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x1000/2); - m_regs = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x20/2); + m_vram[0] = make_unique_clear(0x1000/2); + m_vram[1] = make_unique_clear(0x1000/2); + m_vscroll[0] = make_unique_clear(0x1000/2); + m_vscroll[1] = make_unique_clear(0x1000/2); + m_regs = make_unique_clear(0x20/2); m_tmap[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(kaneko_view2_tilemap_device::get_tile_info_0),this), TILEMAP_SCAN_ROWS, 16,16, 0x20,0x20 ); @@ -175,11 +175,11 @@ void kaneko_view2_tilemap_device::device_start() m_tmap[0]->set_scrolldy(-m_dy, m_ydim + m_dy -1 ); m_tmap[1]->set_scrolldy(-m_dy, m_ydim + m_dy -1 ); - save_pointer(NAME(m_vram[0]), 0x1000/2); - save_pointer(NAME(m_vram[1]), 0x1000/2); - save_pointer(NAME(m_vscroll[0]), 0x1000/2); - save_pointer(NAME(m_vscroll[1]), 0x1000/2); - save_pointer(NAME(m_regs), 0x20/2); + save_pointer(NAME(m_vram[0].get()), 0x1000/2); + save_pointer(NAME(m_vram[1].get()), 0x1000/2); + save_pointer(NAME(m_vscroll[0].get()), 0x1000/2); + save_pointer(NAME(m_vscroll[1].get()), 0x1000/2); + save_pointer(NAME(m_regs.get()), 0x20/2); save_item(NAME(m_vram_tile_addition[0])); save_item(NAME(m_vram_tile_addition[1])); } diff --git a/src/mame/video/kaneko_tmap.h b/src/mame/video/kaneko_tmap.h index e689df23d1d..75a05e3039d 100644 --- a/src/mame/video/kaneko_tmap.h +++ b/src/mame/video/kaneko_tmap.h @@ -18,9 +18,9 @@ public: int m_dx, m_dy, m_xdim, m_ydim; int m_invert_flip; - UINT16* m_vram[2]; - UINT16* m_vscroll[2]; - UINT16* m_regs; + std::unique_ptr m_vram[2]; + std::unique_ptr m_vscroll[2]; + std::unique_ptr m_regs; tilemap_t* m_tmap[2]; UINT16 m_vram_tile_addition[2]; // galsnew diff --git a/src/mame/video/legionna.cpp b/src/mame/video/legionna.cpp index f9840cc3a98..8eb1a21daca 100644 --- a/src/mame/video/legionna.cpp +++ b/src/mame/video/legionna.cpp @@ -196,10 +196,10 @@ TILE_GET_INFO_MEMBER(legionna_state::get_text_tile_info) VIDEO_START_MEMBER(legionna_state,legionna) { - m_back_data = auto_alloc_array_clear(machine(), UINT16, 0x800/2); - m_fore_data = auto_alloc_array_clear(machine(), UINT16, 0x800/2); - m_mid_data = auto_alloc_array_clear(machine(), UINT16, 0x800/2); - m_textram = auto_alloc_array_clear(machine(), UINT16, 0x1000/2); + m_back_data = make_unique_clear(0x800/2); + m_fore_data = make_unique_clear(0x800/2); + m_mid_data = make_unique_clear(0x800/2); + m_textram = make_unique_clear(0x1000/2); m_background_layer = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(legionna_state::get_back_tile_info),this),TILEMAP_SCAN_ROWS,16,16,32,32); m_foreground_layer = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(legionna_state::get_fore_tile_info),this),TILEMAP_SCAN_ROWS,16,16,32,32); @@ -221,10 +221,10 @@ VIDEO_START_MEMBER(legionna_state,legionna) VIDEO_START_MEMBER(legionna_state,denjinmk) { - m_back_data = auto_alloc_array_clear(machine(), UINT16, 0x800/2); - m_fore_data = auto_alloc_array_clear(machine(), UINT16, 0x800/2); - m_mid_data = auto_alloc_array_clear(machine(), UINT16, 0x800/2); - m_textram = auto_alloc_array_clear(machine(), UINT16, 0x1000/2); + m_back_data = make_unique_clear(0x800/2); + m_fore_data = make_unique_clear(0x800/2); + m_mid_data = make_unique_clear(0x800/2); + m_textram = make_unique_clear(0x1000/2); m_background_layer = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(legionna_state::get_back_tile_info),this),TILEMAP_SCAN_ROWS,16,16,32,32); m_foreground_layer = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(legionna_state::get_fore_tile_info_denji),this),TILEMAP_SCAN_ROWS,16,16,32,32); @@ -246,10 +246,10 @@ VIDEO_START_MEMBER(legionna_state,denjinmk) VIDEO_START_MEMBER(legionna_state,cupsoc) { - m_back_data = auto_alloc_array_clear(machine(), UINT16, 0x800/2); - m_fore_data = auto_alloc_array_clear(machine(), UINT16, 0x800/2); - m_mid_data = auto_alloc_array_clear(machine(), UINT16, 0x800/2); - m_textram = auto_alloc_array_clear(machine(), UINT16, 0x1000/2); + m_back_data = make_unique_clear(0x800/2); + m_fore_data = make_unique_clear(0x800/2); + m_mid_data = make_unique_clear(0x800/2); + m_textram = make_unique_clear(0x1000/2); m_background_layer = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(legionna_state::get_back_tile_info),this),TILEMAP_SCAN_ROWS,16,16,32,32); m_foreground_layer = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(legionna_state::get_fore_tile_info),this),TILEMAP_SCAN_ROWS,16,16,32,32); diff --git a/src/mame/video/leland.cpp b/src/mame/video/leland.cpp index 3938b07e4c7..928a1e9ab78 100644 --- a/src/mame/video/leland.cpp +++ b/src/mame/video/leland.cpp @@ -58,7 +58,7 @@ TIMER_CALLBACK_MEMBER(leland_state::scanline_callback) VIDEO_START_MEMBER(leland_state,leland) { /* allocate memory */ - m_video_ram = auto_alloc_array_clear(machine(), UINT8, VRAM_SIZE); + m_video_ram = make_unique_clear(VRAM_SIZE); /* scanline timer */ m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(leland_state::scanline_callback),this)); @@ -68,10 +68,10 @@ VIDEO_START_MEMBER(leland_state,leland) VIDEO_START_MEMBER(leland_state,ataxx) { /* first do the standard stuff */ - m_video_ram = auto_alloc_array_clear(machine(), UINT8, VRAM_SIZE); + m_video_ram = make_unique_clear(VRAM_SIZE); /* allocate memory */ - m_ataxx_qram = auto_alloc_array_clear(machine(), UINT8, QRAM_SIZE); + m_ataxx_qram = make_unique_clear(QRAM_SIZE); } @@ -197,7 +197,7 @@ int leland_state::leland_vram_port_r(address_space &space, int offset, int num) void leland_state::leland_vram_port_w(address_space &space, int offset, int data, int num) { - UINT8 *video_ram = m_video_ram; + UINT8 *video_ram = m_video_ram.get(); struct vram_state_data *state = m_vram_state + num; int addr = state->m_addr; int inc = (offset >> 2) & 2; diff --git a/src/mame/video/m107.cpp b/src/mame/video/m107.cpp index d08d17845b9..557884f85ed 100644 --- a/src/mame/video/m107.cpp +++ b/src/mame/video/m107.cpp @@ -142,12 +142,12 @@ void m107_state::video_start() layer->tmap->set_transparent_pen(0); } - m_buffered_spriteram = auto_alloc_array_clear(machine(), UINT16, 0x1000/2); + m_buffered_spriteram = make_unique_clear(0x1000/2); save_item(NAME(m_sprite_display)); save_item(NAME(m_raster_irq_position)); save_item(NAME(m_control)); - save_pointer(NAME(m_buffered_spriteram), 0x1000/2); + save_pointer(NAME(m_buffered_spriteram.get()), 0x1000/2); for (int i = 0; i < 4; i++) { @@ -159,7 +159,7 @@ void m107_state::video_start() void m107_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - UINT16 *spriteram = m_buffered_spriteram; + UINT16 *spriteram = m_buffered_spriteram.get(); int offs; UINT8 *rom = memregion("user1")->base(); @@ -381,7 +381,7 @@ WRITE16_MEMBER(m107_state::spritebuffer_w) // logerror("%04x: buffered spriteram\n",space.device().safe_pc()); m_sprite_display = (!(data & 0x1000)); - memcpy(m_buffered_spriteram, m_spriteram, 0x1000); + memcpy(m_buffered_spriteram.get(), m_spriteram, 0x1000); } } diff --git a/src/mame/video/macrossp.cpp b/src/mame/video/macrossp.cpp index 98c452d05bc..9f744b42517 100644 --- a/src/mame/video/macrossp.cpp +++ b/src/mame/video/macrossp.cpp @@ -165,8 +165,8 @@ TILE_GET_INFO_MEMBER(macrossp_state::get_macrossp_text_tile_info) void macrossp_state::video_start() { - m_spriteram_old = auto_alloc_array_clear(machine(), UINT32, m_spriteram.bytes() / 4); - m_spriteram_old2 = auto_alloc_array_clear(machine(), UINT32, m_spriteram.bytes() / 4); + m_spriteram_old = make_unique_clear(m_spriteram.bytes() / 4); + m_spriteram_old2 = make_unique_clear(m_spriteram.bytes() / 4); m_text_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(macrossp_state::get_macrossp_text_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64); m_scra_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(macrossp_state::get_macrossp_scra_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64); @@ -183,8 +183,8 @@ void macrossp_state::video_start() m_gfxdecode->gfx(2)->set_granularity(64); m_gfxdecode->gfx(3)->set_granularity(64); - save_pointer(NAME(m_spriteram_old), m_spriteram.bytes() / 4); - save_pointer(NAME(m_spriteram_old2), m_spriteram.bytes() / 4); + save_pointer(NAME(m_spriteram_old.get()), m_spriteram.bytes() / 4); + save_pointer(NAME(m_spriteram_old2.get()), m_spriteram.bytes() / 4); } @@ -193,8 +193,8 @@ void macrossp_state::draw_sprites(screen_device &screen, bitmap_rgb32 &bitmap, c { gfx_element *gfx = m_gfxdecode->gfx(0); // UINT32 *source = m_spriteram; - UINT32 *source = (m_spriteram_old2 + m_spriteram.bytes() / 4) - 3; /* buffers by two frames */ - UINT32 *finish = m_spriteram_old2; + UINT32 *source = (m_spriteram_old2.get() + m_spriteram.bytes() / 4) - 3; /* buffers by two frames */ + UINT32 *finish = m_spriteram_old2.get(); /* reverse order */ while (source >= finish) @@ -463,7 +463,7 @@ void macrossp_state::screen_eof_macrossp(screen_device &screen, bool state) if (state) { /* looks like sprites are *two* frames ahead, like nmk16 */ - memcpy(m_spriteram_old2, m_spriteram_old, m_spriteram.bytes()); - memcpy(m_spriteram_old, m_spriteram, m_spriteram.bytes()); + memcpy(m_spriteram_old2.get(), m_spriteram_old.get(), m_spriteram.bytes()); + memcpy(m_spriteram_old.get(), m_spriteram, m_spriteram.bytes()); } } diff --git a/src/mame/video/mb60553.cpp b/src/mame/video/mb60553.cpp index e3fd96d0d28..f13a8f3e26c 100644 --- a/src/mame/video/mb60553.cpp +++ b/src/mame/video/mb60553.cpp @@ -35,11 +35,11 @@ void mb60553_zooming_tilemap_device::device_start() if(!m_gfxdecode->started()) throw device_missing_dependencies(); - m_lineram = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x1000/2); - m_vram = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x4000/2); + m_lineram = make_unique_clear(0x1000/2); + m_vram = make_unique_clear(0x4000/2); - save_pointer(NAME(m_lineram), 0x1000/2); - save_pointer(NAME(m_vram), 0x4000/2); + save_pointer(NAME(m_lineram.get()), 0x1000/2); + save_pointer(NAME(m_vram.get()), 0x4000/2); save_item(NAME(m_pal_base)); save_item(NAME(m_bank)); save_item(NAME(m_regs)); diff --git a/src/mame/video/mb60553.h b/src/mame/video/mb60553.h index b207dce947c..1c9c84e725c 100644 --- a/src/mame/video/mb60553.h +++ b/src/mame/video/mb60553.h @@ -12,7 +12,7 @@ public: static void set_gfx_region(device_t &device, int gfxregion); tilemap_t* m_tmap; - UINT16* m_vram; + std::unique_ptr m_vram; UINT16 m_regs[8]; UINT8 m_bank[8]; UINT16 m_pal_base; @@ -22,7 +22,7 @@ public: void draw( screen_device &screen, bitmap_ind16& bitmap, const rectangle &cliprect, int priority); tilemap_t* get_tilemap(); - UINT16* m_lineram; + std::unique_ptr m_lineram; TILEMAP_MAPPER_MEMBER(twc94_scan); diff --git a/src/mame/video/mcatadv.cpp b/src/mame/video/mcatadv.cpp index a14b5ba9f41..fccfd6ba21a 100644 --- a/src/mame/video/mcatadv.cpp +++ b/src/mame/video/mcatadv.cpp @@ -52,9 +52,9 @@ WRITE16_MEMBER(mcatadv_state::mcatadv_videoram2_w) void mcatadv_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) { - UINT16 *source = (m_spriteram_old + (m_spriteram.bytes() / 2) /2); + UINT16 *source = (m_spriteram_old.get() + (m_spriteram.bytes() / 2) /2); source -= 4; - UINT16 *finish = m_spriteram_old; + UINT16 *finish = m_spriteram_old.get(); int global_x = m_vidregs[0] - 0x184; int global_y = m_vidregs[1] - 0x1f1; @@ -271,13 +271,13 @@ void mcatadv_state::video_start() m_tilemap2 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(mcatadv_state::get_mcatadv_tile_info2),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); m_tilemap2->set_transparent_pen(0); - m_spriteram_old = auto_alloc_array_clear(machine(), UINT16, m_spriteram.bytes() / 2); + m_spriteram_old = make_unique_clear(m_spriteram.bytes() / 2); m_vidregs_old = std::make_unique((0x0f + 1) / 2); m_palette_bank1 = 0; m_palette_bank2 = 0; - save_pointer(NAME(m_spriteram_old), m_spriteram.bytes() / 2); + save_pointer(NAME(m_spriteram_old.get()), m_spriteram.bytes() / 2); save_pointer(NAME(m_vidregs_old.get()), (0x0f + 1) / 2); } @@ -286,7 +286,7 @@ void mcatadv_state::screen_eof_mcatadv(screen_device &screen, bool state) // rising edge if (state) { - memcpy(m_spriteram_old, m_spriteram, m_spriteram.bytes()); + memcpy(m_spriteram_old.get(), m_spriteram, m_spriteram.bytes()); memcpy(m_vidregs_old.get(), m_vidregs, 0xf); } } diff --git a/src/mame/video/midyunit.cpp b/src/mame/video/midyunit.cpp index 6bbfc2a5358..cca4343fde3 100644 --- a/src/mame/video/midyunit.cpp +++ b/src/mame/video/midyunit.cpp @@ -43,7 +43,7 @@ VIDEO_START_MEMBER(midyunit_state,common) { /* allocate memory */ m_cmos_ram = std::make_unique((0x2000 * 4)/2); - m_local_videoram = auto_alloc_array_clear(machine(), UINT16, 0x80000/2); + m_local_videoram = make_unique_clear(0x80000/2); m_pen_map = auto_alloc_array(machine(), pen_t, 65536); machine().device("nvram")->set_base(m_cmos_ram.get(), 0x2000 * 4); @@ -59,7 +59,7 @@ VIDEO_START_MEMBER(midyunit_state,common) /* register for state saving */ save_item(NAME(m_autoerase_enable)); - save_pointer(NAME(m_local_videoram), 0x80000/2); + save_pointer(NAME(m_local_videoram.get()), 0x80000/2); save_pointer(NAME(m_cmos_ram.get()), (0x2000 * 4)/2); save_item(NAME(m_videobank_select)); save_item(NAME(m_dma_register)); diff --git a/src/mame/video/model1.cpp b/src/mame/video/model1.cpp index 65d0b2846cc..9dbd6babefe 100644 --- a/src/mame/video/model1.cpp +++ b/src/mame/video/model1.cpp @@ -742,7 +742,7 @@ void model1_state::push_object(UINT32 tex_adr, UINT32 poly_adr, UINT32 size) float *poly_data; if(poly_adr & 0x800000) - poly_data=(float *) m_poly_ram; + poly_data=(float *) m_poly_ram.get(); else poly_data=(float *) m_poly_rom; @@ -1445,8 +1445,8 @@ VIDEO_START_MEMBER(model1_state,model1) m_view = auto_alloc_clear(machine(), struct view); m_poly_rom = (UINT32 *)memregion("user1")->base(); - m_poly_ram = auto_alloc_array_clear(machine(), UINT32, 0x400000); - m_tgp_ram = auto_alloc_array_clear(machine(), UINT16, 0x100000-0x40000); + m_poly_ram = make_unique_clear(0x400000); + m_tgp_ram = make_unique_clear(0x100000-0x40000); m_pointdb = auto_alloc_array_clear(machine(), struct m1_point, 1000000*2); m_quaddb = auto_alloc_array_clear(machine(), struct quad_m1, 1000000); m_quadind = auto_alloc_array_clear(machine(), struct quad_m1 *, 1000000); @@ -1455,8 +1455,8 @@ VIDEO_START_MEMBER(model1_state,model1) m_quadpt = m_quaddb; m_listctl[0] = m_listctl[1] = 0; - save_pointer(NAME(m_tgp_ram), 0x100000-0x40000); - save_pointer(NAME(m_poly_ram), 0x40000); + save_pointer(NAME(m_tgp_ram.get()), 0x100000-0x40000); + save_pointer(NAME(m_poly_ram.get()), 0x40000); save_item(NAME(m_listctl)); } diff --git a/src/mame/video/model2.cpp b/src/mame/video/model2.cpp index 8915d2ee5c1..248aec4b814 100644 --- a/src/mame/video/model2.cpp +++ b/src/mame/video/model2.cpp @@ -2601,7 +2601,7 @@ VIDEO_START_MEMBER(model2_state,model2) geo_init( machine(), (UINT32*)memregion("user2")->base() ); /* init various video-related pointers */ - m_palram = auto_alloc_array_clear(machine(), UINT16, 0x2000); + m_palram = make_unique_clear(0x2000); } UINT32 model2_state::screen_update_model2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) diff --git a/src/mame/video/model3.cpp b/src/mame/video/model3.cpp index c73b05c0a72..a6d0948212b 100644 --- a/src/mame/video/model3.cpp +++ b/src/mame/video/model3.cpp @@ -179,21 +179,21 @@ void model3_state::video_start() machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(model3_state::model3_exit), this)); - m_m3_char_ram = auto_alloc_array_clear(machine(), UINT64, 0x100000/8); - m_m3_tile_ram = auto_alloc_array_clear(machine(), UINT64, 0x8000/8); + m_m3_char_ram = make_unique_clear(0x100000/8); + m_m3_tile_ram = make_unique_clear(0x8000/8); - m_texture_fifo = auto_alloc_array_clear(machine(), UINT32, 0x100000/4); + m_texture_fifo = make_unique_clear(0x100000/4); /* 2x 4MB texture sheets */ m_texture_ram[0] = std::make_unique(0x400000/2); m_texture_ram[1] = std::make_unique(0x400000/2); /* 1MB Display List RAM */ - m_display_list_ram = auto_alloc_array_clear(machine(), UINT32, 0x100000/4); + m_display_list_ram = make_unique_clear(0x100000/4); /* 4MB for nodes (< Step 2.0 have only 2MB) */ - m_culling_ram = auto_alloc_array_clear(machine(), UINT32, 0x400000/4); + m_culling_ram = make_unique_clear(0x400000/4); /* 4MB Polygon RAM */ - m_polygon_ram = auto_alloc_array_clear(machine(), UINT32, 0x400000/4); + m_polygon_ram = make_unique_clear(0x400000/4); m_vid_reg0 = 0; @@ -207,10 +207,10 @@ void model3_state::video_start() m_layer8[3] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(model3_state::tile_info_layer3_8bit), this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); // 4-bit tiles - m_gfxdecode->set_gfx(0, global_alloc(gfx_element(m_palette, char4_layout, (UINT8*)m_m3_char_ram, 0, m_palette->entries() / 16, 0))); + m_gfxdecode->set_gfx(0, global_alloc(gfx_element(m_palette, char4_layout, (UINT8*)m_m3_char_ram.get(), 0, m_palette->entries() / 16, 0))); // 8-bit tiles - m_gfxdecode->set_gfx(1, global_alloc(gfx_element(m_palette, char8_layout, (UINT8*)m_m3_char_ram, 0, m_palette->entries() / 256, 0))); + m_gfxdecode->set_gfx(1, global_alloc(gfx_element(m_palette, char8_layout, (UINT8*)m_m3_char_ram.get(), 0, m_palette->entries() / 256, 0))); init_matrix_stack(); } diff --git a/src/mame/video/n64.cpp b/src/mame/video/n64.cpp index c9ba7a71f03..224bcb4464e 100644 --- a/src/mame/video/n64.cpp +++ b/src/mame/video/n64.cpp @@ -101,7 +101,7 @@ void n64_state::video_start() m_rdp->m_tex_pipe.set_machine(machine()); - m_rdp->m_aux_buf = auto_alloc_array_clear(machine(), UINT8, EXTENT_AUX_COUNT); + m_rdp->m_aux_buf = make_unique_clear(EXTENT_AUX_COUNT); if (LOG_RDP_EXECUTION) { @@ -2110,7 +2110,7 @@ void n64_rdp::draw_triangle(bool shade, bool texture, bool zbuffer, bool rect) new_object = false; } - spans[spanidx].userdata = (void*)((UINT8*)m_aux_buf + m_aux_buf_ptr); + spans[spanidx].userdata = (void*)((UINT8*)m_aux_buf.get() + m_aux_buf_ptr); valid = true; m_aux_buf_ptr += sizeof(rdp_span_aux); diff --git a/src/mame/video/n64.h b/src/mame/video/n64.h index bcaa05d7ad4..caab912b3db 100644 --- a/src/mame/video/n64.h +++ b/src/mame/video/n64.h @@ -307,7 +307,7 @@ public: void draw_triangle(bool shade, bool texture, bool zbuffer, bool rect); - void* m_aux_buf; + std::unique_ptr m_aux_buf; UINT32 m_aux_buf_ptr; UINT32 m_aux_buf_index; diff --git a/src/mame/video/namcos22.cpp b/src/mame/video/namcos22.cpp index 7a56a0b98a4..317b78cc12a 100644 --- a/src/mame/video/namcos22.cpp +++ b/src/mame/video/namcos22.cpp @@ -459,7 +459,7 @@ void namcos22_renderer::poly3d_drawquad(screen_device &screen, bitmap_rgb32 &bit { extra.zfog_enabled = 1; extra.cz_sdelta = delta; - extra.czram = m_state.m_recalc_czram[cztype]; + extra.czram = m_state.m_recalc_czram[cztype].get(); } } } @@ -2369,15 +2369,15 @@ void namcos22_state::init_tables() // init spotram (super22 only) if (m_is_ss22) - m_spotram = auto_alloc_array_clear(machine(), UINT16, SPOTRAM_SIZE); + m_spotram = make_unique_clear(SPOTRAM_SIZE); // init czram tables (super22 only) if (m_is_ss22) { for (int table = 0; table < 4; table++) { - m_banked_czram[table] = auto_alloc_array_clear(machine(), UINT16, 0x100); - m_recalc_czram[table] = auto_alloc_array_clear(machine(), UINT8, 0x2000); + m_banked_czram[table] = make_unique_clear(0x100); + m_recalc_czram[table] = make_unique_clear(0x2000); m_cz_was_written[table] = 1; } } @@ -2393,7 +2393,7 @@ void namcos22_state::init_tables() m_pointrom[i] = signed24(pointrom_high[i] << 16 | pointrom_mid[i] << 8 | pointrom_low[i]); } - m_pointram = auto_alloc_array_clear(machine(), UINT32, 0x20000); + m_pointram = make_unique_clear(0x20000); // force all texture tiles to be decoded now for (int i = 0; i < m_gfxdecode->gfx(1)->elements(); i++) diff --git a/src/mame/video/nbmj8688.cpp b/src/mame/video/nbmj8688.cpp index 4a2be6cb067..d418c6d698c 100644 --- a/src/mame/video/nbmj8688.cpp +++ b/src/mame/video/nbmj8688.cpp @@ -551,13 +551,13 @@ void nbmj8688_state::common_video_start() m_blitter_timer = timer_alloc(TIMER_BLITTER); m_tmpbitmap = std::make_unique(512, 256); - m_videoram = auto_alloc_array_clear(machine(), UINT16, 512 * 256); + m_videoram = make_unique_clear(512 * 256); m_clut = std::make_unique(0x20); m_scrolly = 0; // reset because crystalg/crystal2 don't write to this register m_screen_refresh = 1; - save_pointer(NAME(m_videoram), 512 * 256); + save_pointer(NAME(m_videoram.get()), 512 * 256); save_pointer(NAME(m_clut.get()), 0x20); save_item(NAME(m_scrolly)); save_item(NAME(m_blitter_destx)); diff --git a/src/mame/video/nbmj9195.cpp b/src/mame/video/nbmj9195.cpp index d22c52744c9..fc165da4898 100644 --- a/src/mame/video/nbmj9195.cpp +++ b/src/mame/video/nbmj9195.cpp @@ -376,7 +376,7 @@ VIDEO_START_MEMBER(nbmj9195_state,_1layer) m_blitter_timer = timer_alloc(TIMER_BLITTER); m_screen->register_screen_bitmap(m_tmpbitmap[0]); - m_videoram[0] = auto_alloc_array_clear(machine(), UINT16, width * height); + m_videoram[0] = make_unique_clear(width * height); m_clut[0] = std::make_unique(0x1000); m_scanline[0] = m_scanline[1] = SCANLINE_MIN; m_nb19010_busyflag = 1; @@ -401,7 +401,7 @@ VIDEO_START_MEMBER(nbmj9195_state,_1layer) save_item(NAME(m_gfxdraw_mode)); save_item(NAME(m_nb19010_busyctr)); save_item(NAME(m_nb19010_busyflag)); - save_pointer(NAME(m_videoram[0]), width * height); + save_pointer(NAME(m_videoram[0].get()), width * height); save_pointer(NAME(m_clut[0].get()), 0x1000); save_item(NAME(m_flipscreen_old)); machine().save().register_postload(save_prepost_delegate(FUNC(nbmj9195_state::postload), this)); @@ -416,8 +416,8 @@ void nbmj9195_state::video_start() m_screen->register_screen_bitmap(m_tmpbitmap[0]); m_screen->register_screen_bitmap(m_tmpbitmap[1]); - m_videoram[0] = auto_alloc_array_clear(machine(), UINT16, width * height); - m_videoram[1] = auto_alloc_array_clear(machine(), UINT16, width * height); + m_videoram[0] = make_unique_clear(width * height); + m_videoram[1] = make_unique_clear(width * height); m_clut[0] = std::make_unique(0x1000); m_clut[1] = std::make_unique(0x1000); m_scanline[0] = m_scanline[1] = SCANLINE_MIN; @@ -444,8 +444,8 @@ void nbmj9195_state::video_start() save_item(NAME(m_gfxdraw_mode)); save_item(NAME(m_nb19010_busyctr)); save_item(NAME(m_nb19010_busyflag)); - save_pointer(NAME(m_videoram[0]), width * height); - save_pointer(NAME(m_videoram[1]), width * height); + save_pointer(NAME(m_videoram[0].get()), width * height); + save_pointer(NAME(m_videoram[1].get()), width * height); save_pointer(NAME(m_clut[0].get()), 0x1000); save_pointer(NAME(m_clut[1].get()), 0x1000); save_item(NAME(m_flipscreen_old)); @@ -464,11 +464,11 @@ VIDEO_START_MEMBER(nbmj9195_state,nb22090) int width = m_screen->width(); int height = m_screen->height(); - m_videoworkram[0] = auto_alloc_array_clear(machine(), UINT16, width * height); - m_videoworkram[1] = auto_alloc_array_clear(machine(), UINT16, width * height); + m_videoworkram[0] = make_unique_clear(width * height); + m_videoworkram[1] = make_unique_clear(width * height); - save_pointer(NAME(m_videoworkram[0]), width * height); - save_pointer(NAME(m_videoworkram[1]), width * height); + save_pointer(NAME(m_videoworkram[0].get()), width * height); + save_pointer(NAME(m_videoworkram[1].get()), width * height); m_gfxdraw_mode = 2; } diff --git a/src/mame/video/newport.cpp b/src/mame/video/newport.cpp index 52aff54c3ce..51604b79326 100644 --- a/src/mame/video/newport.cpp +++ b/src/mame/video/newport.cpp @@ -105,9 +105,9 @@ void newport_video_device::device_config_complete() void newport_video_device::device_start() { - m_base = auto_alloc_array_clear(machine(), UINT32, (1280+64) * (1024+64)); + m_base = make_unique_clear((1280+64) * (1024+64)); - save_pointer(NAME(m_base), (1280+64) * (1024+64)); + save_pointer(NAME(m_base.get()), (1280+64) * (1024+64)); save_item(NAME(m_VC2.nRegister)); save_item(NAME(m_VC2.nRAM)); save_item(NAME(m_VC2.nRegIdx)); diff --git a/src/mame/video/newport.h b/src/mame/video/newport.h index 180aaf70bb6..1764913a85d 100644 --- a/src/mame/video/newport.h +++ b/src/mame/video/newport.h @@ -146,7 +146,7 @@ private: XMAP_t m_XMAP0; XMAP_t m_XMAP1; REX3_t m_REX3; - UINT32 *m_base; + std::unique_ptr m_base; UINT8 m_nDrawGreen; CMAP_t m_CMAP0; }; diff --git a/src/mame/video/ninjakd2.cpp b/src/mame/video/ninjakd2.cpp index 9ff710e57e4..9756e956e0f 100644 --- a/src/mame/video/ninjakd2.cpp +++ b/src/mame/video/ninjakd2.cpp @@ -87,17 +87,17 @@ void ninjakd2_state::robokid_get_bg_tile_info( tile_data& tileinfo, tilemap_memo TILE_GET_INFO_MEMBER(ninjakd2_state::robokid_get_bg0_tile_info) { - robokid_get_bg_tile_info(tileinfo, tile_index, 2, m_robokid_bg0_videoram); + robokid_get_bg_tile_info(tileinfo, tile_index, 2, m_robokid_bg0_videoram.get()); } TILE_GET_INFO_MEMBER(ninjakd2_state::robokid_get_bg1_tile_info) { - robokid_get_bg_tile_info(tileinfo, tile_index, 3, m_robokid_bg1_videoram); + robokid_get_bg_tile_info(tileinfo, tile_index, 3, m_robokid_bg1_videoram.get()); } TILE_GET_INFO_MEMBER(ninjakd2_state::robokid_get_bg2_tile_info) { - robokid_get_bg_tile_info(tileinfo, tile_index, 4, m_robokid_bg2_videoram); + robokid_get_bg_tile_info(tileinfo, tile_index, 4, m_robokid_bg2_videoram.get()); } @@ -113,13 +113,13 @@ void ninjakd2_state::video_init_common(UINT32 vram_alloc_size) // create video ram if (vram_alloc_size) { - m_robokid_bg0_videoram = auto_alloc_array_clear(machine(), UINT8, vram_alloc_size); - m_robokid_bg1_videoram = auto_alloc_array_clear(machine(), UINT8, vram_alloc_size); - m_robokid_bg2_videoram = auto_alloc_array_clear(machine(), UINT8, vram_alloc_size); + m_robokid_bg0_videoram = make_unique_clear(vram_alloc_size); + m_robokid_bg1_videoram = make_unique_clear(vram_alloc_size); + m_robokid_bg2_videoram = make_unique_clear(vram_alloc_size); - save_pointer(NAME(m_robokid_bg0_videoram), vram_alloc_size); - save_pointer(NAME(m_robokid_bg1_videoram), vram_alloc_size); - save_pointer(NAME(m_robokid_bg2_videoram), vram_alloc_size); + save_pointer(NAME(m_robokid_bg0_videoram.get()), vram_alloc_size); + save_pointer(NAME(m_robokid_bg1_videoram.get()), vram_alloc_size); + save_pointer(NAME(m_robokid_bg2_videoram.get()), vram_alloc_size); } m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(ninjakd2_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); diff --git a/src/mame/video/niyanpai.cpp b/src/mame/video/niyanpai.cpp index e6cdeffe70f..132570aa5dc 100644 --- a/src/mame/video/niyanpai.cpp +++ b/src/mame/video/niyanpai.cpp @@ -361,12 +361,12 @@ void niyanpai_state::video_start() m_screen->register_screen_bitmap(m_tmpbitmap[0]); m_screen->register_screen_bitmap(m_tmpbitmap[1]); m_screen->register_screen_bitmap(m_tmpbitmap[2]); - m_videoram[0] = auto_alloc_array_clear(machine(), UINT16, width * height); - m_videoram[1] = auto_alloc_array_clear(machine(), UINT16, width * height); - m_videoram[2] = auto_alloc_array_clear(machine(), UINT16, width * height); - m_videoworkram[0] = auto_alloc_array_clear(machine(), UINT16, width * height); - m_videoworkram[1] = auto_alloc_array_clear(machine(), UINT16, width * height); - m_videoworkram[2] = auto_alloc_array_clear(machine(), UINT16, width * height); + m_videoram[0] = make_unique_clear(width * height); + m_videoram[1] = make_unique_clear(width * height); + m_videoram[2] = make_unique_clear(width * height); + m_videoworkram[0] = make_unique_clear(width * height); + m_videoworkram[1] = make_unique_clear(width * height); + m_videoworkram[2] = make_unique_clear(width * height); m_palette_ptr = std::make_unique(0x480); m_clut[0] = std::make_unique(0x1000); m_clut[1] = std::make_unique(0x1000); @@ -393,12 +393,12 @@ void niyanpai_state::video_start() save_item(NAME(m_nb19010_busyflag)); save_item(NAME(m_flipscreen_old)); save_pointer(NAME(m_palette_ptr.get()), 0x480); - save_pointer(NAME(m_videoram[0]), width * height); - save_pointer(NAME(m_videoram[1]), width * height); - save_pointer(NAME(m_videoram[2]), width * height); - save_pointer(NAME(m_videoworkram[0]), width * height); - save_pointer(NAME(m_videoworkram[1]), width * height); - save_pointer(NAME(m_videoworkram[2]), width * height); + save_pointer(NAME(m_videoram[0].get()), width * height); + save_pointer(NAME(m_videoram[1].get()), width * height); + save_pointer(NAME(m_videoram[2].get()), width * height); + save_pointer(NAME(m_videoworkram[0].get()), width * height); + save_pointer(NAME(m_videoworkram[1].get()), width * height); + save_pointer(NAME(m_videoworkram[2].get()), width * height); save_pointer(NAME(m_clut[0].get()), 0x1000); save_pointer(NAME(m_clut[1].get()), 0x1000); save_pointer(NAME(m_clut[2].get()), 0x1000); diff --git a/src/mame/video/nmk16.cpp b/src/mame/video/nmk16.cpp index 8f3d65fe7a5..8e9adb08aa0 100644 --- a/src/mame/video/nmk16.cpp +++ b/src/mame/video/nmk16.cpp @@ -109,8 +109,8 @@ TILE_GET_INFO_MEMBER(nmk16_state::get_tile_info_0_8bit) void nmk16_state::nmk16_video_init() { - m_spriteram_old = auto_alloc_array_clear(machine(), UINT16, 0x1000/2); - m_spriteram_old2 = auto_alloc_array_clear(machine(), UINT16, 0x1000/2); + m_spriteram_old = make_unique_clear(0x1000/2); + m_spriteram_old2 = make_unique_clear(0x1000/2); m_videoshift = 0; /* 256x224 screen, no shift */ m_background_bitmap = nullptr; @@ -487,7 +487,7 @@ void nmk16_state::nmk16_draw_sprites_swap(bitmap_ind16 &bitmap, const rectangle for (i = 0; i < 0x100; i++) { int spr = BITSWAP8(i, bittbl[0], bittbl[1], bittbl[2], bittbl[3], bittbl[4], bittbl[5], bittbl[6], bittbl[7]); - nmk16_draw_sprite(bitmap, cliprect, m_spriteram_old2 + (spr * 16/2)); + nmk16_draw_sprite(bitmap, cliprect, m_spriteram_old2.get() + (spr * 16/2)); } } @@ -498,7 +498,7 @@ void nmk16_state::nmk16_draw_sprites_swap_flipsupported(bitmap_ind16 &bitmap, co for ( i = 0; i < 0x100; i++ ) { int spr = BITSWAP8(i, bittbl[0], bittbl[1], bittbl[2], bittbl[3], bittbl[4], bittbl[5], bittbl[6], bittbl[7]); - nmk16_draw_sprite_flipsupported(bitmap, cliprect, m_spriteram_old2 + (spr * 16/2)); + nmk16_draw_sprite_flipsupported(bitmap, cliprect, m_spriteram_old2.get() + (spr * 16/2)); } } @@ -508,7 +508,7 @@ void nmk16_state::nmk16_draw_sprites(bitmap_ind16 &bitmap, const rectangle &clip for (offs = 0; offs < 0x1000/2; offs += 8) { - nmk16_draw_sprite(bitmap, cliprect, m_spriteram_old2 + offs); + nmk16_draw_sprite(bitmap, cliprect, m_spriteram_old2.get() + offs); } } @@ -518,7 +518,7 @@ void nmk16_state::nmk16_draw_sprites_flipsupported(bitmap_ind16 &bitmap, const r for (offs = 0; offs < 0x1000/2; offs += 8) { - nmk16_draw_sprite_flipsupported(bitmap, cliprect, m_spriteram_old2 + offs); + nmk16_draw_sprite_flipsupported(bitmap, cliprect, m_spriteram_old2.get() + offs); } } @@ -796,8 +796,8 @@ UINT32 nmk16_state::screen_update_bjtwin(screen_device &screen, bitmap_ind16 &bi VIDEO_START_MEMBER(nmk16_state,afega) { - m_spriteram_old = auto_alloc_array_clear(machine(), UINT16, 0x1000/2); - m_spriteram_old2 = auto_alloc_array_clear(machine(), UINT16, 0x1000/2); + m_spriteram_old = make_unique_clear(0x1000/2); + m_spriteram_old2 = make_unique_clear(0x1000/2); m_bg_tilemap0 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(nmk16_state::macross_get_bg0_tile_info),this), tilemap_mapper_delegate(FUNC(nmk16_state::afega_tilemap_scan_pages),this), 16,16, @@ -813,8 +813,8 @@ VIDEO_START_MEMBER(nmk16_state,afega) VIDEO_START_MEMBER(nmk16_state,grdnstrm) { - m_spriteram_old = auto_alloc_array_clear(machine(), UINT16, 0x1000/2); - m_spriteram_old2 = auto_alloc_array_clear(machine(), UINT16, 0x1000/2); + m_spriteram_old = make_unique_clear(0x1000/2); + m_spriteram_old2 = make_unique_clear(0x1000/2); m_bg_tilemap0 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(nmk16_state::get_tile_info_0_8bit),this), tilemap_mapper_delegate(FUNC(nmk16_state::afega_tilemap_scan_pages),this), @@ -831,8 +831,8 @@ VIDEO_START_MEMBER(nmk16_state,grdnstrm) VIDEO_START_MEMBER(nmk16_state,firehawk) { - m_spriteram_old = auto_alloc_array_clear(machine(), UINT16, 0x1000/2); - m_spriteram_old2 = auto_alloc_array_clear(machine(), UINT16, 0x1000/2); + m_spriteram_old = make_unique_clear(0x1000/2); + m_spriteram_old2 = make_unique_clear(0x1000/2); m_bg_tilemap0 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(nmk16_state::get_tile_info_0_8bit),this), tilemap_mapper_delegate(FUNC(nmk16_state::afega_tilemap_scan_pages),this), diff --git a/src/mame/video/pastelg.cpp b/src/mame/video/pastelg.cpp index a783696bdce..e76239e9fd4 100644 --- a/src/mame/video/pastelg.cpp +++ b/src/mame/video/pastelg.cpp @@ -284,7 +284,7 @@ void pastelg_state::video_start() int width = m_screen->width(); int height = m_screen->height(); - m_videoram = auto_alloc_array_clear(machine(), UINT8, width * height); + m_videoram = make_unique_clear(width * height); save_item(NAME(m_blitter_desty)); save_item(NAME(m_blitter_sizex)); @@ -296,7 +296,7 @@ void pastelg_state::video_start() save_item(NAME(m_blitter_direction_x)); save_item(NAME(m_blitter_direction_y)); save_item(NAME(m_palbank)); - save_pointer(NAME(m_videoram), width*height); + save_pointer(NAME(m_videoram.get()), width*height); save_item(NAME(m_flipscreen_old)); } diff --git a/src/mame/video/pc080sn.cpp b/src/mame/video/pc080sn.cpp index 55c67ed2bfa..62736eecae8 100644 --- a/src/mame/video/pc080sn.cpp +++ b/src/mame/video/pc080sn.cpp @@ -128,14 +128,14 @@ void pc080sn_device::device_start() m_tilemap[1]->set_scroll_rows(512); } - m_ram = auto_alloc_array_clear(machine(), UINT16, PC080SN_RAM_SIZE / 2); + m_ram = make_unique_clear(PC080SN_RAM_SIZE / 2); - m_bg_ram[0] = m_ram + 0x0000 /2; - m_bg_ram[1] = m_ram + 0x8000 /2; - m_bgscroll_ram[0] = m_ram + 0x4000 /2; - m_bgscroll_ram[1] = m_ram + 0xc000 /2; + m_bg_ram[0] = m_ram.get() + 0x0000 /2; + m_bg_ram[1] = m_ram.get() + 0x8000 /2; + m_bgscroll_ram[0] = m_ram.get() + 0x4000 /2; + m_bgscroll_ram[1] = m_ram.get() + 0xc000 /2; - save_pointer(NAME(m_ram), PC080SN_RAM_SIZE / 2); + save_pointer(NAME(m_ram.get()), PC080SN_RAM_SIZE / 2); save_item(NAME(m_ctrl)); machine().save().register_postload(save_prepost_delegate(FUNC(pc080sn_device::restore_scroll), this)); diff --git a/src/mame/video/pc080sn.h b/src/mame/video/pc080sn.h index 56f67504a8f..945bc49a9b0 100644 --- a/src/mame/video/pc080sn.h +++ b/src/mame/video/pc080sn.h @@ -55,7 +55,7 @@ public: // internal state UINT16 m_ctrl[8]; - UINT16 *m_ram; + std::unique_ptr m_ram; UINT16 *m_bg_ram[2]; UINT16 *m_bgscroll_ram[2]; diff --git a/src/mame/video/pc090oj.cpp b/src/mame/video/pc090oj.cpp index 0aa609d093e..d7dc21c19c7 100644 --- a/src/mame/video/pc090oj.cpp +++ b/src/mame/video/pc090oj.cpp @@ -115,11 +115,11 @@ void pc090oj_device::static_set_palette_tag(device_t &device, const char *tag) void pc090oj_device::device_start() { - m_ram = auto_alloc_array_clear(machine(), UINT16, PC090OJ_RAM_SIZE / 2); - m_ram_buffered = auto_alloc_array_clear(machine(), UINT16, PC090OJ_RAM_SIZE / 2); + m_ram = make_unique_clear(PC090OJ_RAM_SIZE / 2); + m_ram_buffered = make_unique_clear(PC090OJ_RAM_SIZE / 2); - save_pointer(NAME(m_ram), PC090OJ_RAM_SIZE / 2); - save_pointer(NAME(m_ram_buffered), PC090OJ_RAM_SIZE / 2); + save_pointer(NAME(m_ram.get()), PC090OJ_RAM_SIZE / 2); + save_pointer(NAME(m_ram_buffered.get()), PC090OJ_RAM_SIZE / 2); save_item(NAME(m_ctrl)); save_item(NAME(m_sprite_ctrl)); // should this be set in intf?!? } diff --git a/src/mame/video/pc090oj.h b/src/mame/video/pc090oj.h index 6f3d9447edf..d1b63b1c7ea 100644 --- a/src/mame/video/pc090oj.h +++ b/src/mame/video/pc090oj.h @@ -47,8 +47,8 @@ private: UINT16 m_ctrl; UINT16 m_sprite_ctrl; - UINT16 * m_ram; - UINT16 * m_ram_buffered; + std::unique_ptr m_ram; + std::unique_ptr m_ram_buffered; int m_gfxnum; int m_x_offset, m_y_offset; diff --git a/src/mame/video/pgm.cpp b/src/mame/video/pgm.cpp index d8d27d359e1..7fb395fed0d 100644 --- a/src/mame/video/pgm.cpp +++ b/src/mame/video/pgm.cpp @@ -493,7 +493,7 @@ void pgm_state::draw_sprites( bitmap_ind16& spritebitmap, UINT16 *sprite_source, wwww wwwh hhhh hhhh */ - const UINT16 *finish = m_spritebufferram + (0xa00 / 2); + const UINT16 *finish = m_spritebufferram.get() + (0xa00 / 2); UINT16* start = sprite_source; @@ -629,9 +629,9 @@ VIDEO_START_MEMBER(pgm_state,pgm) for (i = 0; i < 0x1200 / 2; i++) m_palette->set_pen_color(i, rgb_t(0, 0, 0)); - m_spritebufferram = auto_alloc_array_clear(machine(), UINT16, 0xa00/2); + m_spritebufferram = make_unique_clear(0xa00/2); - save_pointer(NAME(m_spritebufferram), 0xa00/2); + save_pointer(NAME(m_spritebufferram.get()), 0xa00/2); } UINT32 pgm_state::screen_update_pgm(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) @@ -650,7 +650,7 @@ UINT32 pgm_state::screen_update_pgm(screen_device &screen, bitmap_ind16 &bitmap, m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 2); - draw_sprites(bitmap, m_spritebufferram, screen.priority()); + draw_sprites(bitmap, m_spritebufferram.get(), screen.priority()); m_tx_tilemap->set_scrolly(0, m_videoregs[0x5000/2]); m_tx_tilemap->set_scrollx(0, m_videoregs[0x6000/2]); // Check @@ -669,6 +669,6 @@ void pgm_state::screen_eof_pgm(screen_device &screen, bool state) if (state) { /* first 0xa00 of main ram = sprites, seems to be buffered, DMA? */ - memcpy(m_spritebufferram, m_mainram, 0xa00); + memcpy(m_spritebufferram.get(), m_mainram, 0xa00); } } diff --git a/src/mame/video/ppu2c0x.cpp b/src/mame/video/ppu2c0x.cpp index 5e140d7558f..19c0143ffd1 100644 --- a/src/mame/video/ppu2c0x.cpp +++ b/src/mame/video/ppu2c0x.cpp @@ -223,7 +223,7 @@ void ppu2c0x_device::device_start() /* allocate a screen bitmap, videomem and spriteram, a dirtychar array and the monochromatic colortable */ m_bitmap = std::make_unique(VISIBLE_SCREEN_WIDTH, VISIBLE_SCREEN_HEIGHT); - m_spriteram = auto_alloc_array_clear(machine(), UINT8, SPRITERAM_SIZE); + m_spriteram = make_unique_clear(SPRITERAM_SIZE); m_colortable = auto_alloc_array(machine(), pen_t, ARRAY_LENGTH(default_colortable)); m_colortable_mono = auto_alloc_array(machine(), pen_t, ARRAY_LENGTH(default_colortable_mono)); @@ -256,7 +256,7 @@ void ppu2c0x_device::device_start() save_item(NAME(m_palette_ram)); save_item(NAME(m_draw_phase)); save_item(NAME(m_tilecount)); - save_pointer(NAME(m_spriteram), SPRITERAM_SIZE); + save_pointer(NAME(m_spriteram.get()), SPRITERAM_SIZE); save_pointer(NAME(m_colortable), ARRAY_LENGTH(default_colortable)); save_pointer(NAME(m_colortable_mono), ARRAY_LENGTH(default_colortable_mono)); save_item(NAME(*m_bitmap)); diff --git a/src/mame/video/ppu2c0x.h b/src/mame/video/ppu2c0x.h index ec91bd4166b..09097b720a4 100644 --- a/src/mame/video/ppu2c0x.h +++ b/src/mame/video/ppu2c0x.h @@ -189,7 +189,7 @@ public: required_device m_cpu; std::unique_ptr m_bitmap; /* target bitmap */ - UINT8 *m_spriteram; /* sprite ram */ + std::unique_ptr m_spriteram; /* sprite ram */ pen_t *m_colortable; /* color table modified at run time */ pen_t *m_colortable_mono; /* monochromatic color table modified at run time */ int m_scanline; /* scanline count */ diff --git a/src/mame/video/segas32.cpp b/src/mame/video/segas32.cpp index 9466a0bb2d4..1212aa42b7a 100644 --- a/src/mame/video/segas32.cpp +++ b/src/mame/video/segas32.cpp @@ -240,7 +240,7 @@ void segas32_state::common_start(int multi32) for (tmap = 0; tmap < 9 + 2 * multi32; tmap++) { m_layer_data[tmap].bitmap = auto_alloc(machine(), bitmap_ind16(416, 224)); - m_layer_data[tmap].transparent = auto_alloc_array_clear(machine(), UINT8, 256); + m_layer_data[tmap].transparent = make_unique_clear(256); } /* allocate pre-rendered solid lines of 0's and ffff's */ diff --git a/src/mame/video/seibuspi.cpp b/src/mame/video/seibuspi.cpp index c89a5505f9d..cb267167789 100644 --- a/src/mame/video/seibuspi.cpp +++ b/src/mame/video/seibuspi.cpp @@ -224,7 +224,7 @@ WRITE16_MEMBER(seibuspi_state::sprite_dma_start_w) if (m_video_dma_address < 0x800) logerror("sprite_dma_start_w in I/O area: %X\n", m_video_dma_address); - memcpy(m_sprite_ram, &m_mainram[m_video_dma_address / 4], m_sprite_ram_size); + memcpy(m_sprite_ram.get(), &m_mainram[m_video_dma_address / 4], m_sprite_ram_size); } @@ -603,9 +603,9 @@ void seibuspi_state::video_start() m_sprite_ram_size = 0x1000; m_sprite_bpp = 6; - m_tilemap_ram = auto_alloc_array_clear(machine(), UINT32, m_tilemap_ram_size/4); - m_palette_ram = auto_alloc_array_clear(machine(), UINT32, m_palette_ram_size/4); - m_sprite_ram = auto_alloc_array_clear(machine(), UINT32, m_sprite_ram_size/4); + m_tilemap_ram = make_unique_clear(m_tilemap_ram_size/4); + m_palette_ram = make_unique_clear(m_palette_ram_size/4); + m_sprite_ram = make_unique_clear(m_sprite_ram_size/4); m_text_layer = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(seibuspi_state::get_text_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64,32); m_back_layer = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(seibuspi_state::get_back_tile_info),this), TILEMAP_SCAN_COLS, 16,16,32,32); @@ -666,8 +666,8 @@ VIDEO_START_MEMBER(seibuspi_state,sys386f) m_sprite_bpp = 8; m_tilemap_ram = nullptr; - m_palette_ram = auto_alloc_array_clear(machine(), UINT32, m_palette_ram_size/4); - m_sprite_ram = auto_alloc_array_clear(machine(), UINT32, m_sprite_ram_size/4); + m_palette_ram = make_unique_clear(m_palette_ram_size/4); + m_sprite_ram = make_unique_clear(m_sprite_ram_size/4); memset(m_alpha_table, 0, 0x2000); // no alpha blending @@ -691,7 +691,7 @@ void seibuspi_state::register_video_state() save_item(NAME(m_midl_layer_d14)); save_item(NAME(m_fore_layer_d14)); - if (m_tilemap_ram != nullptr) save_pointer(NAME(m_tilemap_ram), m_tilemap_ram_size/4); - save_pointer(NAME(m_palette_ram), m_palette_ram_size/4); - save_pointer(NAME(m_sprite_ram), m_sprite_ram_size/4); + if (m_tilemap_ram != nullptr) save_pointer(NAME(m_tilemap_ram.get()), m_tilemap_ram_size/4); + save_pointer(NAME(m_palette_ram.get()), m_palette_ram_size/4); + save_pointer(NAME(m_sprite_ram.get()), m_sprite_ram_size/4); } diff --git a/src/mame/video/simpl156.cpp b/src/mame/video/simpl156.cpp index 3eff8431aa8..dc79657a1c3 100644 --- a/src/mame/video/simpl156.cpp +++ b/src/mame/video/simpl156.cpp @@ -12,23 +12,23 @@ void simpl156_state::video_start() { /* allocate the ram as 16-bit (we do it here because the CPU is 32-bit) */ - m_pf1_rowscroll = auto_alloc_array_clear(machine(), UINT16, 0x800/2); - m_pf2_rowscroll = auto_alloc_array_clear(machine(), UINT16, 0x800/2); - m_spriteram = auto_alloc_array_clear(machine(), UINT16, 0x2000/2); + m_pf1_rowscroll = make_unique_clear(0x800/2); + m_pf2_rowscroll = make_unique_clear(0x800/2); + m_spriteram = make_unique_clear(0x2000/2); - memset(m_spriteram, 0xff, 0x2000); + memset(m_spriteram.get(), 0xff, 0x2000); /* and register the allocated ram so that save states still work */ - save_pointer(NAME(m_pf1_rowscroll), 0x800/2); - save_pointer(NAME(m_pf2_rowscroll), 0x800/2); - save_pointer(NAME(m_spriteram), 0x2000/2); + save_pointer(NAME(m_pf1_rowscroll.get()), 0x800/2); + save_pointer(NAME(m_pf2_rowscroll.get()), 0x800/2); + save_pointer(NAME(m_spriteram.get()), 0x2000/2); } UINT32 simpl156_state::screen_update_simpl156(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { screen.priority().fill(0); - m_deco_tilegen1->pf_update(m_pf1_rowscroll, m_pf2_rowscroll); + m_deco_tilegen1->pf_update(m_pf1_rowscroll.get(), m_pf2_rowscroll.get()); bitmap.fill(256, cliprect); @@ -38,6 +38,6 @@ UINT32 simpl156_state::screen_update_simpl156(screen_device &screen, bitmap_ind1 //FIXME: flip_screen_x should not be written! flip_screen_set_no_update(1); - m_sprgen->draw_sprites(bitmap, cliprect, m_spriteram, 0x1400/4); // 0x1400/4 seems right for charlien (doesn't initialize any more RAM, so will draw a garbage 0 with more) + m_sprgen->draw_sprites(bitmap, cliprect, m_spriteram.get(), 0x1400/4); // 0x1400/4 seems right for charlien (doesn't initialize any more RAM, so will draw a garbage 0 with more) return 0; } diff --git a/src/mame/video/st0020.cpp b/src/mame/video/st0020.cpp index 29bcee1e161..d9adf38eb38 100644 --- a/src/mame/video/st0020.cpp +++ b/src/mame/video/st0020.cpp @@ -73,21 +73,21 @@ static const gfx_layout layout_16x8x8_2 = void st0020_device::device_start() { - m_st0020_gfxram = auto_alloc_array_clear(machine(), UINT16, 4 * 0x100000 / 2); - m_st0020_spriteram = auto_alloc_array_clear(machine(), UINT16, 0x80000 / 2); - m_st0020_blitram = auto_alloc_array_clear(machine(), UINT16, 0x100 / 2); + m_st0020_gfxram = make_unique_clear(4 * 0x100000 / 2); + m_st0020_spriteram = make_unique_clear(0x80000 / 2); + m_st0020_blitram = make_unique_clear(0x100 / 2); for (m_gfx_index = 0; m_gfx_index < MAX_GFX_ELEMENTS; m_gfx_index++) if (m_gfxdecode->gfx(m_gfx_index) == nullptr) break; - m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, layout_16x8x8_2, (UINT8 *)m_st0020_gfxram, 0, m_palette->entries() / 64, 0))); + m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, layout_16x8x8_2, (UINT8 *)m_st0020_gfxram.get(), 0, m_palette->entries() / 64, 0))); m_gfxdecode->gfx(m_gfx_index)->set_granularity(64); /* 256 colour sprites with palette selectable on 64 colour boundaries */ - save_pointer(NAME(m_st0020_gfxram), 4 * 0x100000/2); - save_pointer(NAME(m_st0020_spriteram), 0x80000/2); - save_pointer(NAME(m_st0020_blitram), 0x100/2); + save_pointer(NAME(m_st0020_gfxram.get()), 4 * 0x100000/2); + save_pointer(NAME(m_st0020_spriteram.get()), 0x80000/2); + save_pointer(NAME(m_st0020_blitram.get()), 0x100/2); save_item(NAME(m_st0020_gfxram_bank)); } @@ -154,7 +154,7 @@ READ16_MEMBER(st0020_device::st0020_blitram_r) WRITE16_MEMBER(st0020_device::st0020_blit_w) { - UINT16 *st0020_blitram = m_st0020_blitram; + UINT16 *st0020_blitram = m_st0020_blitram.get(); COMBINE_DATA(&st0020_blitram[offset]); @@ -283,7 +283,7 @@ WRITE16_MEMBER(st0020_device::st0020_blitram_w) void st0020_device::st0020_draw_zooming_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority) { /* Sprites list */ - UINT16 *spriteram16_2 = m_st0020_spriteram; + UINT16 *spriteram16_2 = m_st0020_spriteram.get(); UINT16 *s1 = spriteram16_2; UINT16 *end1 = spriteram16_2 + 0x02000/2; diff --git a/src/mame/video/st0020.h b/src/mame/video/st0020.h index cff7f8f1f99..0282acd7699 100644 --- a/src/mame/video/st0020.h +++ b/src/mame/video/st0020.h @@ -39,9 +39,9 @@ protected: private: int m_st0020_gfxram_bank; - UINT16* m_st0020_gfxram; - UINT16* m_st0020_spriteram; - UINT16* m_st0020_blitram; + std::unique_ptr m_st0020_gfxram; + std::unique_ptr m_st0020_spriteram; + std::unique_ptr m_st0020_blitram; void st0020_draw_zooming_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority); DECLARE_READ16_MEMBER(st0020_blit_r); DECLARE_WRITE16_MEMBER(st0020_blit_w); diff --git a/src/mame/video/system1.cpp b/src/mame/video/system1.cpp index 85dd664f3b9..28b772beafc 100644 --- a/src/mame/video/system1.cpp +++ b/src/mame/video/system1.cpp @@ -121,19 +121,19 @@ void system1_state::video_start_common(int pagecount) int pagenum; /* allocate memory for the collision arrays */ - m_mix_collide = auto_alloc_array_clear(machine(), UINT8, 64); - m_sprite_collide = auto_alloc_array_clear(machine(), UINT8, 1024); + m_mix_collide = make_unique_clear(64); + m_sprite_collide = make_unique_clear(1024); /* allocate memory for videoram */ m_tilemap_pages = pagecount; - m_videoram = auto_alloc_array_clear(machine(), UINT8, 0x800 * pagecount); + m_videoram = make_unique_clear(0x800 * pagecount); /* create the tilemap pages */ for (pagenum = 0; pagenum < pagecount; pagenum++) { m_tilemap_page[pagenum] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(system1_state::tile_get_info),this), TILEMAP_SCAN_ROWS, 8,8, 32,32); m_tilemap_page[pagenum]->set_transparent_pen(0); - m_tilemap_page[pagenum]->set_user_data(m_videoram + 0x800 * pagenum); + m_tilemap_page[pagenum]->set_user_data(m_videoram.get() + 0x800 * pagenum); } /* allocate a temporary bitmap for sprite rendering */ @@ -144,9 +144,9 @@ void system1_state::video_start_common(int pagecount) save_item(NAME(m_mix_collide_summary)); save_item(NAME(m_sprite_collide_summary)); save_item(NAME(m_videoram_bank)); - save_pointer(NAME(m_videoram), 0x800 * pagecount); - save_pointer(NAME(m_mix_collide), 64); - save_pointer(NAME(m_sprite_collide), 1024); + save_pointer(NAME(m_videoram.get()), 0x800 * pagecount); + save_pointer(NAME(m_mix_collide.get()), 64); + save_pointer(NAME(m_sprite_collide.get()), 1024); } @@ -263,7 +263,7 @@ inline void system1_state::videoram_wait_states(cpu_device *cpu) READ8_MEMBER(system1_state::system1_videoram_r) { - UINT8 *videoram = m_videoram; + UINT8 *videoram = m_videoram.get(); videoram_wait_states(m_maincpu); offset |= 0x1000 * ((m_videoram_bank >> 1) % (m_tilemap_pages / 2)); return videoram[offset]; @@ -271,7 +271,7 @@ READ8_MEMBER(system1_state::system1_videoram_r) WRITE8_MEMBER(system1_state::system1_videoram_w) { - UINT8 *videoram = m_videoram; + UINT8 *videoram = m_videoram.get(); videoram_wait_states(m_maincpu); offset |= 0x1000 * ((m_videoram_bank >> 1) % (m_tilemap_pages / 2)); videoram[offset] = data; @@ -550,7 +550,7 @@ void system1_state::video_update_common(screen_device &screen, bitmap_ind16 &bit UINT32 system1_state::screen_update_system1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - UINT8 *videoram = m_videoram; + UINT8 *videoram = m_videoram.get(); bitmap_ind16 *bgpixmaps[4]; int bgrowscroll[32]; int xscroll, yscroll; @@ -585,7 +585,7 @@ UINT32 system1_state::screen_update_system1(screen_device &screen, bitmap_ind16 UINT32 system1_state::screen_update_system2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - UINT8 *videoram = m_videoram; + UINT8 *videoram = m_videoram.get(); bitmap_ind16 *bgpixmaps[4]; int rowscroll[32]; int xscroll, yscroll; @@ -627,7 +627,7 @@ UINT32 system1_state::screen_update_system2(screen_device &screen, bitmap_ind16 UINT32 system1_state::screen_update_system2_rowscroll(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - UINT8 *videoram = m_videoram; + UINT8 *videoram = m_videoram.get(); bitmap_ind16 *bgpixmaps[4]; int rowscroll[32]; int yscroll; diff --git a/src/mame/video/taito_f2.cpp b/src/mame/video/taito_f2.cpp index 76672f2e0c5..7818f7a4d73 100644 --- a/src/mame/video/taito_f2.cpp +++ b/src/mame/video/taito_f2.cpp @@ -34,8 +34,8 @@ void taitof2_state::taitof2_core_vh_start (int sprite_type, int hide, int flip_h m_hide_pixels = hide; m_flip_hide_pixels = flip_hide; - m_spriteram_delayed = auto_alloc_array_clear(machine(), UINT16, m_spriteram.bytes() / 2); - m_spriteram_buffered = auto_alloc_array_clear(machine(), UINT16, m_spriteram.bytes() / 2); + m_spriteram_delayed = make_unique_clear(m_spriteram.bytes() / 2); + m_spriteram_buffered = make_unique_clear(m_spriteram.bytes() / 2); m_spritelist = auto_alloc_array_clear(machine(), struct f2_tempsprite, 0x400); for (i = 0; i < 8; i ++) @@ -67,8 +67,8 @@ void taitof2_state::taitof2_core_vh_start (int sprite_type, int hide, int flip_h save_item(NAME(m_spritepri)); save_item(NAME(m_spriteblendmode)); save_item(NAME(m_prepare_sprites)); - save_pointer(NAME(m_spriteram_delayed), m_spriteram.bytes() / 2); - save_pointer(NAME(m_spriteram_buffered), m_spriteram.bytes() / 2); + save_pointer(NAME(m_spriteram_delayed.get()), m_spriteram.bytes() / 2); + save_pointer(NAME(m_spriteram_buffered.get()), m_spriteram.bytes() / 2); } /**************************************************************************************/ @@ -820,7 +820,7 @@ void taitof2_state::taitof2_handle_sprite_buffering( ) { if (m_prepare_sprites) /* no buffering */ { - memcpy(m_spriteram_buffered, m_spriteram, m_spriteram.bytes()); + memcpy(m_spriteram_buffered.get(), m_spriteram, m_spriteram.bytes()); m_prepare_sprites = 0; } } @@ -892,10 +892,10 @@ void taitof2_state::screen_eof_taitof2_full_buffer_delayed(screen_device &screen taitof2_update_sprites_active_area(); m_prepare_sprites = 0; - memcpy(m_spriteram_buffered, m_spriteram_delayed, m_spriteram.bytes()); + memcpy(m_spriteram_buffered.get(), m_spriteram_delayed.get(), m_spriteram.bytes()); for (i = 0; i < m_spriteram.bytes() / 2; i++) m_spriteram_buffered[i] = spriteram[i]; - memcpy(m_spriteram_delayed, spriteram, m_spriteram.bytes()); + memcpy(m_spriteram_delayed.get(), spriteram, m_spriteram.bytes()); } } @@ -910,10 +910,10 @@ void taitof2_state::screen_eof_taitof2_partial_buffer_delayed(screen_device &scr taitof2_update_sprites_active_area(); m_prepare_sprites = 0; - memcpy(m_spriteram_buffered, m_spriteram_delayed, m_spriteram.bytes()); + memcpy(m_spriteram_buffered.get(), m_spriteram_delayed.get(), m_spriteram.bytes()); for (i = 0;i < m_spriteram.bytes() / 2; i += 4) m_spriteram_buffered[i] = spriteram[i]; - memcpy(m_spriteram_delayed, spriteram, m_spriteram.bytes()); + memcpy(m_spriteram_delayed.get(), spriteram, m_spriteram.bytes()); } } @@ -928,14 +928,14 @@ void taitof2_state::screen_eof_taitof2_partial_buffer_delayed_thundfox(screen_de taitof2_update_sprites_active_area(); m_prepare_sprites = 0; - memcpy(m_spriteram_buffered, m_spriteram_delayed, m_spriteram.bytes()); + memcpy(m_spriteram_buffered.get(), m_spriteram_delayed.get(), m_spriteram.bytes()); for (i = 0; i < m_spriteram.bytes() / 2; i += 8) { m_spriteram_buffered[i] = spriteram[i]; m_spriteram_buffered[i + 1] = spriteram[i + 1]; m_spriteram_buffered[i + 4] = spriteram[i + 4]; } - memcpy(m_spriteram_delayed, spriteram, m_spriteram.bytes()); + memcpy(m_spriteram_delayed.get(), spriteram, m_spriteram.bytes()); } } @@ -953,7 +953,7 @@ void taitof2_state::screen_eof_taitof2_partial_buffer_delayed_qzchikyu(screen_de taitof2_update_sprites_active_area(); m_prepare_sprites = 0; - memcpy(m_spriteram_buffered, m_spriteram_delayed, m_spriteram.bytes()); + memcpy(m_spriteram_buffered.get(), m_spriteram_delayed.get(), m_spriteram.bytes()); for (i = 0; i < m_spriteram.bytes() / 2; i += 8) { m_spriteram_buffered[i] = spriteram[i]; @@ -963,7 +963,7 @@ void taitof2_state::screen_eof_taitof2_partial_buffer_delayed_qzchikyu(screen_de m_spriteram_buffered[i + 6] = spriteram[i + 6]; // not needed? m_spriteram_buffered[i + 7] = spriteram[i + 7]; // not needed? } - memcpy(m_spriteram_delayed, spriteram, m_spriteram.bytes()); + memcpy(m_spriteram_delayed.get(), spriteram, m_spriteram.bytes()); } } diff --git a/src/mame/video/taito_f3.cpp b/src/mame/video/taito_f3.cpp index e5598e41c68..97b93fafdab 100644 --- a/src/mame/video/taito_f3.cpp +++ b/src/mame/video/taito_f3.cpp @@ -327,7 +327,7 @@ pri_alp_bitmap void taito_f3_state::print_debug_info(bitmap_rgb32 &bitmap) { - UINT16 *f3_line_ram = m_f3_line_ram; + UINT16 *f3_line_ram = m_f3_line_ram.get(); int l[16]; char buf[64*16]; char *bufptr = buf; @@ -511,13 +511,13 @@ void taito_f3_state::screen_eof_f3(screen_device &screen, bool state) { get_sprite_info(m_spriteram16_buffered.get()); } - memcpy(m_spriteram16_buffered.get(),m_spriteram,0x10000); + memcpy(m_spriteram16_buffered.get(),m_spriteram.get(),0x10000); } else if (m_sprite_lag==1) { if (machine().video().skip_this_frame() == 0) { - get_sprite_info(m_spriteram); + get_sprite_info(m_spriteram.get()); } } } @@ -563,12 +563,12 @@ VIDEO_START_MEMBER(taito_f3_state,f3) m_f3_game_config=pCFG; - m_f3_vram = auto_alloc_array_clear(machine(), UINT16, 0x2000/2); - m_f3_pf_data = auto_alloc_array_clear(machine(), UINT16, 0xc000/2); - m_videoram = auto_alloc_array_clear(machine(), UINT16, 0x2000/2); - m_f3_line_ram = auto_alloc_array_clear(machine(), UINT16, 0x10000/2); - m_f3_pivot_ram = auto_alloc_array_clear(machine(), UINT16, 0x10000/2); - m_spriteram = auto_alloc_array_clear(machine(), UINT16, 0x10000/2); + m_f3_vram = make_unique_clear(0x2000/2); + m_f3_pf_data = make_unique_clear(0xc000/2); + m_videoram = make_unique_clear(0x2000/2); + m_f3_line_ram = make_unique_clear(0x10000/2); + m_f3_pivot_ram = make_unique_clear(0x10000/2); + m_spriteram = make_unique_clear(0x10000/2); if (m_f3_game_config->extend) { m_pf1_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(taito_f3_state::get_tile_info1),this),TILEMAP_SCAN_ROWS,16,16,64,32); @@ -576,10 +576,10 @@ VIDEO_START_MEMBER(taito_f3_state,f3) m_pf3_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(taito_f3_state::get_tile_info3),this),TILEMAP_SCAN_ROWS,16,16,64,32); m_pf4_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(taito_f3_state::get_tile_info4),this),TILEMAP_SCAN_ROWS,16,16,64,32); - m_f3_pf_data_1=m_f3_pf_data+(0x0000/2); - m_f3_pf_data_2=m_f3_pf_data+(0x2000/2); - m_f3_pf_data_3=m_f3_pf_data+(0x4000/2); - m_f3_pf_data_4=m_f3_pf_data+(0x6000/2); + m_f3_pf_data_1=m_f3_pf_data.get()+(0x0000/2); + m_f3_pf_data_2=m_f3_pf_data.get()+(0x2000/2); + m_f3_pf_data_3=m_f3_pf_data.get()+(0x4000/2); + m_f3_pf_data_4=m_f3_pf_data.get()+(0x6000/2); m_width_mask=0x3ff; m_twidth_mask=0x7f; @@ -601,14 +601,14 @@ VIDEO_START_MEMBER(taito_f3_state,f3) m_pf7_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(taito_f3_state::get_tile_info7),this),TILEMAP_SCAN_ROWS,16,16,32,32); m_pf8_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(taito_f3_state::get_tile_info8),this),TILEMAP_SCAN_ROWS,16,16,32,32); - m_f3_pf_data_1=m_f3_pf_data+(0x0000/2); - m_f3_pf_data_2=m_f3_pf_data+(0x1000/2); - m_f3_pf_data_3=m_f3_pf_data+(0x2000/2); - m_f3_pf_data_4=m_f3_pf_data+(0x3000/2); - m_f3_pf_data_5=m_f3_pf_data+(0x4000/2); - m_f3_pf_data_6=m_f3_pf_data+(0x5000/2); - m_f3_pf_data_7=m_f3_pf_data+(0x6000/2); - m_f3_pf_data_8=m_f3_pf_data+(0x7000/2); + m_f3_pf_data_1=m_f3_pf_data.get()+(0x0000/2); + m_f3_pf_data_2=m_f3_pf_data.get()+(0x1000/2); + m_f3_pf_data_3=m_f3_pf_data.get()+(0x2000/2); + m_f3_pf_data_4=m_f3_pf_data.get()+(0x3000/2); + m_f3_pf_data_5=m_f3_pf_data.get()+(0x4000/2); + m_f3_pf_data_6=m_f3_pf_data.get()+(0x5000/2); + m_f3_pf_data_7=m_f3_pf_data.get()+(0x6000/2); + m_f3_pf_data_8=m_f3_pf_data.get()+(0x7000/2); m_width_mask=0x1ff; m_twidth_mask=0x3f; @@ -647,13 +647,13 @@ VIDEO_START_MEMBER(taito_f3_state,f3) m_flipscreen = 0; memset(m_spriteram16_buffered.get(),0,0x10000); - memset(m_spriteram,0,0x10000); + memset(m_spriteram.get(),0,0x10000); save_item(NAME(m_f3_control_0)); save_item(NAME(m_f3_control_1)); - m_gfxdecode->gfx(0)->set_source((UINT8 *)m_f3_vram); - m_gfxdecode->gfx(3)->set_source((UINT8 *)m_f3_pivot_ram); + m_gfxdecode->gfx(0)->set_source((UINT8 *)m_f3_vram.get()); + m_gfxdecode->gfx(3)->set_source((UINT8 *)m_f3_pivot_ram.get()); m_f3_skip_this_frame=0; @@ -3172,7 +3172,7 @@ UINT32 taito_f3_state::screen_update_f3(screen_device &screen, bitmap_rgb32 &bit /* sprites */ if (m_sprite_lag==0) - get_sprite_info(m_spriteram); + get_sprite_info(m_spriteram.get()); /* Update sprite buffer */ draw_sprites(bitmap,cliprect); diff --git a/src/mame/video/taitojc.cpp b/src/mame/video/taitojc.cpp index 1d1a52236fa..379363480c2 100644 --- a/src/mame/video/taitojc.cpp +++ b/src/mame/video/taitojc.cpp @@ -63,13 +63,13 @@ READ32_MEMBER(taitojc_state::taitojc_char_r) WRITE32_MEMBER(taitojc_state::taitojc_tile_w) { - COMBINE_DATA(m_tile_ram + offset); + COMBINE_DATA(m_tile_ram.get() + offset); m_tilemap->mark_tile_dirty(offset); } WRITE32_MEMBER(taitojc_state::taitojc_char_w) { - COMBINE_DATA(m_char_ram + offset); + COMBINE_DATA(m_char_ram.get() + offset); m_gfxdecode->gfx(m_gfx_index)->mark_dirty(offset/32); } @@ -313,11 +313,11 @@ void taitojc_state::video_start() m_tilemap->set_transparent_pen(0); - m_char_ram = auto_alloc_array_clear(machine(), UINT32, 0x4000/4); - m_tile_ram = auto_alloc_array_clear(machine(), UINT32, 0x4000/4); + m_char_ram = make_unique_clear(0x4000/4); + m_tile_ram = make_unique_clear(0x4000/4); /* create the char set (gfx will then be updated dynamically from RAM) */ - m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, taitojc_char_layout, (UINT8 *)m_char_ram, 0, m_palette->entries() / 16, 0))); + m_gfxdecode->set_gfx(m_gfx_index, global_alloc(gfx_element(m_palette, taitojc_char_layout, (UINT8 *)m_char_ram.get(), 0, m_palette->entries() / 16, 0))); } UINT32 taitojc_state::screen_update_taitojc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/video/tatsumi.cpp b/src/mame/video/tatsumi.cpp index aafb99ff5bc..4c52d4def29 100644 --- a/src/mame/video/tatsumi.cpp +++ b/src/mame/video/tatsumi.cpp @@ -127,7 +127,7 @@ TILE_GET_INFO_MEMBER(tatsumi_state::get_tile_info_bigfight_1) VIDEO_START_MEMBER(tatsumi_state,apache3) { m_tx_layer = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tatsumi_state::get_text_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,64); - m_shadow_pen_array = auto_alloc_array_clear(machine(), UINT8, 8192); + m_shadow_pen_array = make_unique_clear(8192); m_temp_bitmap.allocate(512, 512); m_apache3_road_x_ram = std::make_unique(512); @@ -137,7 +137,7 @@ VIDEO_START_MEMBER(tatsumi_state,apache3) VIDEO_START_MEMBER(tatsumi_state,roundup5) { m_tx_layer = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tatsumi_state::get_text_tile_info),this),TILEMAP_SCAN_ROWS,8,8,128,64); - m_shadow_pen_array = auto_alloc_array_clear(machine(), UINT8, 8192); + m_shadow_pen_array = make_unique_clear(8192); m_roundup5_vram = std::make_unique((0x48000 * 4)/2); m_tx_layer->set_transparent_pen(0); @@ -153,7 +153,7 @@ VIDEO_START_MEMBER(tatsumi_state,cyclwarr) m_layer2 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tatsumi_state::get_tile_info_bigfight_1),this),TILEMAP_SCAN_ROWS,8,8,64,512); m_layer3 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tatsumi_state::get_tile_info_bigfight_1),this),TILEMAP_SCAN_ROWS,8,8,64,512); - m_shadow_pen_array = auto_alloc_array_clear(machine(), UINT8, 8192); + m_shadow_pen_array = make_unique_clear(8192); } VIDEO_START_MEMBER(tatsumi_state,bigfight) @@ -163,7 +163,7 @@ VIDEO_START_MEMBER(tatsumi_state,bigfight) m_layer2 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tatsumi_state::get_tile_info_bigfight_1),this),TILEMAP_SCAN_ROWS,8,8,128,256); m_layer3 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tatsumi_state::get_tile_info_bigfight_1),this),TILEMAP_SCAN_ROWS,8,8,128,256); - m_shadow_pen_array = auto_alloc_array_clear(machine(), UINT8, 8192); + m_shadow_pen_array = make_unique_clear(8192); } /********************************************************************/ diff --git a/src/mame/video/tc0080vco.cpp b/src/mame/video/tc0080vco.cpp index 40e7bd34f41..418e4a5049e 100644 --- a/src/mame/video/tc0080vco.cpp +++ b/src/mame/video/tc0080vco.cpp @@ -174,28 +174,28 @@ void tc0080vco_device::device_start() m_tilemap[2]->set_transparent_pen(0); - m_ram = auto_alloc_array_clear(machine(), UINT16, TC0080VCO_RAM_SIZE / 2); + m_ram = make_unique_clear(TC0080VCO_RAM_SIZE / 2); - m_char_ram = m_ram + 0x00000 / 2; /* continues at +0x10000 */ - m_tx_ram_0 = m_ram + 0x01000 / 2; - m_chain_ram_0 = m_ram + 0x00000 / 2; /* only used from +0x2000 */ + m_char_ram = m_ram.get() + 0x00000 / 2; /* continues at +0x10000 */ + m_tx_ram_0 = m_ram.get() + 0x01000 / 2; + m_chain_ram_0 = m_ram.get() + 0x00000 / 2; /* only used from +0x2000 */ - m_bg0_ram_0 = m_ram + 0x0c000 / 2; - m_bg1_ram_0 = m_ram + 0x0e000 / 2; + m_bg0_ram_0 = m_ram.get() + 0x0c000 / 2; + m_bg1_ram_0 = m_ram.get() + 0x0e000 / 2; - m_tx_ram_1 = m_ram + 0x11000 / 2; - m_chain_ram_1 = m_ram + 0x10000 / 2; /* only used from +0x12000 */ + m_tx_ram_1 = m_ram.get() + 0x11000 / 2; + m_chain_ram_1 = m_ram.get() + 0x10000 / 2; /* only used from +0x12000 */ - m_bg0_ram_1 = m_ram + 0x1c000 / 2; - m_bg1_ram_1 = m_ram + 0x1e000 / 2; - m_bgscroll_ram = m_ram + 0x20000 / 2; - m_spriteram = m_ram + 0x20400 / 2; - m_scroll_ram = m_ram + 0x20800 / 2; + m_bg0_ram_1 = m_ram.get() + 0x1c000 / 2; + m_bg1_ram_1 = m_ram.get() + 0x1e000 / 2; + m_bgscroll_ram = m_ram.get() + 0x20000 / 2; + m_spriteram = m_ram.get() + 0x20400 / 2; + m_scroll_ram = m_ram.get() + 0x20800 / 2; /* create the char set (gfx will then be updated dynamically from RAM) */ m_gfxdecode->set_gfx(m_txnum, global_alloc(gfx_element(m_palette, charlayout, (UINT8 *)m_char_ram, 0, 1, 512))); - save_pointer(NAME(m_ram), TC0080VCO_RAM_SIZE / 2); + save_pointer(NAME(m_ram.get()), TC0080VCO_RAM_SIZE / 2); machine().save().register_postload(save_prepost_delegate(FUNC(tc0080vco_device::postload), this)); } diff --git a/src/mame/video/tc0080vco.h b/src/mame/video/tc0080vco.h index 43a259ae483..c842e3a57b5 100644 --- a/src/mame/video/tc0080vco.h +++ b/src/mame/video/tc0080vco.h @@ -43,7 +43,7 @@ protected: private: // internal state - UINT16 * m_ram; + std::unique_ptr m_ram; UINT16 * m_bg0_ram_0; UINT16 * m_bg0_ram_1; UINT16 * m_bg1_ram_0; diff --git a/src/mame/video/tc0100scn.cpp b/src/mame/video/tc0100scn.cpp index e63bd9b0c25..76d6b21fe98 100644 --- a/src/mame/video/tc0100scn.cpp +++ b/src/mame/video/tc0100scn.cpp @@ -284,7 +284,7 @@ void tc0100scn_device::device_start() m_bg_tilemask = 0xffff; /* Mjnquest has 0x7fff tilemask */ - m_ram = auto_alloc_array_clear(machine(), UINT16, TC0100SCN_RAM_SIZE / 2); + m_ram = make_unique_clear(TC0100SCN_RAM_SIZE / 2); set_layer_ptrs(); @@ -302,7 +302,7 @@ void tc0100scn_device::device_start() set_colbanks(0, 0, 0); /* standard values, only Wgp & multiscreen games change them */ /* we call this here, so that they can be modified at video_start*/ - save_pointer(NAME(m_ram), TC0100SCN_RAM_SIZE / 2); + save_pointer(NAME(m_ram.get()), TC0100SCN_RAM_SIZE / 2); save_item(NAME(m_ctrl)); save_item(NAME(m_dblwidth)); save_item(NAME(m_gfxbank)); @@ -390,23 +390,23 @@ void tc0100scn_device::set_layer_ptrs() { if (!m_dblwidth) { - m_bg_ram = m_ram + 0x0; - m_tx_ram = m_ram + 0x4000 /2; - m_char_ram = m_ram + 0x6000 /2; - m_fg_ram = m_ram + 0x8000 /2; - m_bgscroll_ram = m_ram + 0xc000 /2; - m_fgscroll_ram = m_ram + 0xc400 /2; - m_colscroll_ram = m_ram + 0xe000 /2; + m_bg_ram = m_ram.get() + 0x0; + m_tx_ram = m_ram.get() + 0x4000 /2; + m_char_ram = m_ram.get() + 0x6000 /2; + m_fg_ram = m_ram.get() + 0x8000 /2; + m_bgscroll_ram = m_ram.get() + 0xc000 /2; + m_fgscroll_ram = m_ram.get() + 0xc400 /2; + m_colscroll_ram = m_ram.get() + 0xe000 /2; } else { - m_bg_ram = m_ram + 0x0; - m_fg_ram = m_ram + 0x08000 /2; - m_bgscroll_ram = m_ram + 0x10000 /2; - m_fgscroll_ram = m_ram + 0x10400 /2; - m_colscroll_ram = m_ram + 0x10800 /2; - m_char_ram = m_ram + 0x11000 /2; - m_tx_ram = m_ram + 0x12000 /2; + m_bg_ram = m_ram.get() + 0x0; + m_fg_ram = m_ram.get() + 0x08000 /2; + m_bgscroll_ram = m_ram.get() + 0x10000 /2; + m_fgscroll_ram = m_ram.get() + 0x10400 /2; + m_colscroll_ram = m_ram.get() + 0x10800 /2; + m_char_ram = m_ram.get() + 0x11000 /2; + m_tx_ram = m_ram.get() + 0x12000 /2; } } diff --git a/src/mame/video/tc0100scn.h b/src/mame/video/tc0100scn.h index 3727ca49327..5f07bbee7f2 100644 --- a/src/mame/video/tc0100scn.h +++ b/src/mame/video/tc0100scn.h @@ -76,7 +76,7 @@ private: // internal state UINT16 m_ctrl[8]; - UINT16 * m_ram; + std::unique_ptr m_ram; UINT16 * m_bg_ram; UINT16 * m_fg_ram; UINT16 * m_tx_ram; diff --git a/src/mame/video/tc0110pcr.cpp b/src/mame/video/tc0110pcr.cpp index 8c3fdf99d51..19eb43d7938 100644 --- a/src/mame/video/tc0110pcr.cpp +++ b/src/mame/video/tc0110pcr.cpp @@ -45,9 +45,9 @@ void tc0110pcr_device::static_set_palette_tag(device_t &device, const char *tag) void tc0110pcr_device::device_start() { - m_ram = auto_alloc_array_clear(machine(), UINT16, TC0110PCR_RAM_SIZE); + m_ram = make_unique_clear(TC0110PCR_RAM_SIZE); - save_pointer(NAME(m_ram), TC0110PCR_RAM_SIZE); + save_pointer(NAME(m_ram.get()), TC0110PCR_RAM_SIZE); save_item(NAME(m_type)); save_item(NAME(m_addr)); machine().save().register_postload(save_prepost_delegate(FUNC(tc0110pcr_device::restore_colors), this)); diff --git a/src/mame/video/tc0110pcr.h b/src/mame/video/tc0110pcr.h index 982cf49f8c4..1e8df12c79f 100644 --- a/src/mame/video/tc0110pcr.h +++ b/src/mame/video/tc0110pcr.h @@ -26,7 +26,7 @@ protected: virtual void device_reset() override; private: - UINT16 * m_ram; + std::unique_ptr m_ram; int m_type; int m_addr; required_device m_palette; diff --git a/src/mame/video/tc0180vcu.cpp b/src/mame/video/tc0180vcu.cpp index ff7a1df5ed7..9420114b3d9 100644 --- a/src/mame/video/tc0180vcu.cpp +++ b/src/mame/video/tc0180vcu.cpp @@ -53,11 +53,11 @@ void tc0180vcu_device::device_start() m_tilemap[1]->set_transparent_pen(0); m_tilemap[2]->set_transparent_pen(0); - m_ram = auto_alloc_array_clear(machine(), UINT16, TC0180VCU_RAM_SIZE / 2); - m_scrollram = auto_alloc_array_clear(machine(), UINT16, TC0180VCU_SCROLLRAM_SIZE / 2); + m_ram = make_unique_clear(TC0180VCU_RAM_SIZE / 2); + m_scrollram = make_unique_clear(TC0180VCU_SCROLLRAM_SIZE / 2); - save_pointer(NAME(m_ram), TC0180VCU_RAM_SIZE / 2); - save_pointer(NAME(m_scrollram), TC0180VCU_SCROLLRAM_SIZE / 2); + save_pointer(NAME(m_ram.get()), TC0180VCU_RAM_SIZE / 2); + save_pointer(NAME(m_scrollram.get()), TC0180VCU_SCROLLRAM_SIZE / 2); save_item(NAME(m_bg_rambank)); save_item(NAME(m_fg_rambank)); diff --git a/src/mame/video/tc0180vcu.h b/src/mame/video/tc0180vcu.h index 72436d0b68a..ddd7fbe92b4 100644 --- a/src/mame/video/tc0180vcu.h +++ b/src/mame/video/tc0180vcu.h @@ -35,8 +35,8 @@ private: // internal state UINT16 m_ctrl[0x10]; - UINT16 * m_ram; - UINT16 * m_scrollram; + std::unique_ptr m_ram; + std::unique_ptr m_scrollram; tilemap_t *m_tilemap[3]; diff --git a/src/mame/video/tc0280grd.cpp b/src/mame/video/tc0280grd.cpp index 8034de45c6f..d021893c1a7 100644 --- a/src/mame/video/tc0280grd.cpp +++ b/src/mame/video/tc0280grd.cpp @@ -59,9 +59,9 @@ void tc0280grd_device::device_start() m_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0280grd_device::tc0280grd_get_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); m_tilemap->set_transparent_pen(0); - m_ram = auto_alloc_array_clear(machine(), UINT16, TC0280GRD_RAM_SIZE / 2); + m_ram = make_unique_clear(TC0280GRD_RAM_SIZE / 2); - save_pointer(NAME(m_ram), TC0280GRD_RAM_SIZE / 2); + save_pointer(NAME(m_ram.get()), TC0280GRD_RAM_SIZE / 2); save_item(NAME(m_ctrl)); } diff --git a/src/mame/video/tc0280grd.h b/src/mame/video/tc0280grd.h index 679a45ef886..d9f8ffc2ee4 100644 --- a/src/mame/video/tc0280grd.h +++ b/src/mame/video/tc0280grd.h @@ -32,7 +32,7 @@ protected: private: // internal state - UINT16 * m_ram; + std::unique_ptr m_ram; tilemap_t *m_tilemap; diff --git a/src/mame/video/tceptor.cpp b/src/mame/video/tceptor.cpp index 55347e4ce08..56f5ca257ab 100644 --- a/src/mame/video/tceptor.cpp +++ b/src/mame/video/tceptor.cpp @@ -361,7 +361,7 @@ void tceptor_state::video_start() { int gfx_index; - m_sprite_ram_buffered = auto_alloc_array_clear(machine(), UINT16, 0x200/2); + m_sprite_ram_buffered = make_unique_clear(0x200/2); /* find first empty slot to decode gfx */ for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++) @@ -392,7 +392,7 @@ void tceptor_state::video_start() m_bg1_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tceptor_state::get_bg1_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); m_bg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tceptor_state::get_bg2_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); - save_pointer(NAME(m_sprite_ram_buffered), 0x200 / 2); + save_pointer(NAME(m_sprite_ram_buffered.get()), 0x200 / 2); save_item(NAME(m_bg1_scroll_x)); save_item(NAME(m_bg1_scroll_y)); save_item(NAME(m_bg2_scroll_x)); @@ -553,6 +553,6 @@ void tceptor_state::screen_eof_tceptor(screen_device &screen, bool state) // rising edge if (state) { - memcpy(m_sprite_ram_buffered, m_sprite_ram, 0x200); + memcpy(m_sprite_ram_buffered.get(), m_sprite_ram, 0x200); } } diff --git a/src/mame/video/thepit.cpp b/src/mame/video/thepit.cpp index be3cdcade76..1018eac40ee 100644 --- a/src/mame/video/thepit.cpp +++ b/src/mame/video/thepit.cpp @@ -104,7 +104,7 @@ TILE_GET_INFO_MEMBER(thepit_state::solid_get_tile_info) { UINT8 back_color = (m_colorram[tile_index] & 0x70) >> 4; int priority = (back_color != 0) && ((m_colorram[tile_index] & 0x80) == 0); - tileinfo.pen_data = m_dummy_tile; + tileinfo.pen_data = m_dummy_tile.get(); tileinfo.palette_base = back_color + 32; tileinfo.category = priority; } @@ -135,7 +135,7 @@ void thepit_state::video_start() m_solid_tilemap->set_scroll_cols(32); m_tilemap->set_scroll_cols(32); - m_dummy_tile = auto_alloc_array_clear(machine(), UINT8, 8*8); + m_dummy_tile = make_unique_clear(8*8); m_graphics_bank = 0; /* only used in intrepid */ diff --git a/src/mame/video/thief.cpp b/src/mame/video/thief.cpp index 1fc54b9d9d3..95583b76f9f 100644 --- a/src/mame/video/thief.cpp +++ b/src/mame/video/thief.cpp @@ -72,14 +72,14 @@ WRITE8_MEMBER(thief_state::thief_color_plane_w){ } READ8_MEMBER(thief_state::thief_videoram_r){ - UINT8 *videoram = m_videoram; + UINT8 *videoram = m_videoram.get(); UINT8 *source = &videoram[offset]; if( m_video_control&0x02 ) source+=0x2000*4; /* foreground/background */ return source[m_read_mask*0x2000]; } WRITE8_MEMBER(thief_state::thief_videoram_w){ - UINT8 *videoram = m_videoram; + UINT8 *videoram = m_videoram.get(); UINT8 *dest = &videoram[offset]; if( m_video_control&0x02 ) dest+=0x2000*4; /* foreground/background */ @@ -94,14 +94,14 @@ WRITE8_MEMBER(thief_state::thief_videoram_w){ void thief_state::video_start(){ memset( &m_coprocessor, 0x00, sizeof(m_coprocessor) ); - m_videoram = auto_alloc_array_clear(machine(), UINT8, 0x2000*4*2 ); + m_videoram = make_unique_clear(0x2000*4*2 ); m_coprocessor.image_ram = std::make_unique(0x2000 ); m_coprocessor.context_ram = std::make_unique(0x400 ); } UINT32 thief_state::screen_update_thief(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ - UINT8 *videoram = m_videoram; + UINT8 *videoram = m_videoram.get(); UINT32 offs; int flipscreen = m_video_control&1; const UINT8 *source = videoram; diff --git a/src/mame/video/ti85.cpp b/src/mame/video/ti85.cpp index 92ade7ae6fc..81410fb87df 100644 --- a/src/mame/video/ti85.cpp +++ b/src/mame/video/ti85.cpp @@ -140,7 +140,7 @@ PALETTE_INIT_MEMBER(ti85_state, ti85) return; } - m_frames = auto_alloc_array_clear(machine(), UINT8, m_ti_number_of_frames*m_ti_video_memory_size); + m_frames = make_unique_clear(m_ti_number_of_frames*m_ti_video_memory_size); } void ti85_state::video_start() @@ -165,22 +165,22 @@ UINT32 ti85_state::screen_update_ti85(screen_device &screen, bitmap_ind16 &bitma lcdmem = ((m_LCD_memory_base & 0x3F) + 0xc0) << 0x08; - memcpy (m_frames, m_frames+m_ti_video_memory_size, sizeof (UINT8) * (m_ti_number_of_frames-1) * m_ti_video_memory_size); + memcpy (m_frames.get(), m_frames.get()+m_ti_video_memory_size, sizeof (UINT8) * (m_ti_number_of_frames-1) * m_ti_video_memory_size); for (y=0; y>(7-b)) & 0x01) - + ((*(m_frames+1*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) - + ((*(m_frames+2*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) - + ((*(m_frames+3*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) - + ((*(m_frames+4*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) - + ((*(m_frames+5*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01); + brightnes = ((*(m_frames.get()+0*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + + ((*(m_frames.get()+1*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + + ((*(m_frames.get()+2*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + + ((*(m_frames.get()+3*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + + ((*(m_frames.get()+4*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01) + + ((*(m_frames.get()+5*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01); bitmap.pix16(y, x*8+b) = ti85_palette[m_LCD_contrast&0x1f][brightnes]; } diff --git a/src/mame/video/tiamc1.cpp b/src/mame/video/tiamc1.cpp index 460917a90d4..fc729293b15 100644 --- a/src/mame/video/tiamc1.cpp +++ b/src/mame/video/tiamc1.cpp @@ -124,19 +124,17 @@ TILE_GET_INFO_MEMBER(tiamc1_state::get_bg2_tile_info) void tiamc1_state::video_start() { - UINT8 *video_ram; + m_videoram = make_unique_clear(0x3040); - video_ram = auto_alloc_array_clear(machine(), UINT8, 0x3040); + m_charram = m_videoram.get() + 0x0800; /* Ram is banked */ + m_tileram = m_videoram.get() + 0x0000; - m_charram = video_ram + 0x0800; /* Ram is banked */ - m_tileram = video_ram + 0x0000; + m_spriteram_y = m_videoram.get() + 0x3000; + m_spriteram_x = m_videoram.get() + 0x3010; + m_spriteram_n = m_videoram.get() + 0x3020; + m_spriteram_a = m_videoram.get() + 0x3030; - m_spriteram_y = video_ram + 0x3000; - m_spriteram_x = video_ram + 0x3010; - m_spriteram_n = video_ram + 0x3020; - m_spriteram_a = video_ram + 0x3030; - - save_pointer(NAME(video_ram), 0x3040); + save_pointer(NAME(m_videoram.get()), 0x3040); m_bg_tilemap1 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tiamc1_state::get_bg1_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); diff --git a/src/mame/video/toaplan1.cpp b/src/mame/video/toaplan1.cpp index 2363ed2510b..fb99840329c 100644 --- a/src/mame/video/toaplan1.cpp +++ b/src/mame/video/toaplan1.cpp @@ -222,15 +222,15 @@ void toaplan1_state::toaplan1_create_tilemaps() void toaplan1_state::toaplan1_vram_alloc() { - m_pf1_tilevram16 = auto_alloc_array_clear(machine(), UINT16, TOAPLAN1_TILEVRAM_SIZE/2); - m_pf2_tilevram16 = auto_alloc_array_clear(machine(), UINT16, TOAPLAN1_TILEVRAM_SIZE/2); - m_pf3_tilevram16 = auto_alloc_array_clear(machine(), UINT16, TOAPLAN1_TILEVRAM_SIZE/2); - m_pf4_tilevram16 = auto_alloc_array_clear(machine(), UINT16, TOAPLAN1_TILEVRAM_SIZE/2); + m_pf1_tilevram16 = make_unique_clear(TOAPLAN1_TILEVRAM_SIZE/2); + m_pf2_tilevram16 = make_unique_clear(TOAPLAN1_TILEVRAM_SIZE/2); + m_pf3_tilevram16 = make_unique_clear(TOAPLAN1_TILEVRAM_SIZE/2); + m_pf4_tilevram16 = make_unique_clear(TOAPLAN1_TILEVRAM_SIZE/2); - save_pointer(NAME(m_pf1_tilevram16), TOAPLAN1_TILEVRAM_SIZE/2); - save_pointer(NAME(m_pf2_tilevram16), TOAPLAN1_TILEVRAM_SIZE/2); - save_pointer(NAME(m_pf3_tilevram16), TOAPLAN1_TILEVRAM_SIZE/2); - save_pointer(NAME(m_pf4_tilevram16), TOAPLAN1_TILEVRAM_SIZE/2); + save_pointer(NAME(m_pf1_tilevram16.get()), TOAPLAN1_TILEVRAM_SIZE/2); + save_pointer(NAME(m_pf2_tilevram16.get()), TOAPLAN1_TILEVRAM_SIZE/2); + save_pointer(NAME(m_pf3_tilevram16.get()), TOAPLAN1_TILEVRAM_SIZE/2); + save_pointer(NAME(m_pf4_tilevram16.get()), TOAPLAN1_TILEVRAM_SIZE/2); #ifdef MAME_DEBUG m_display_pf1 = 1; @@ -244,13 +244,13 @@ void toaplan1_state::toaplan1_vram_alloc() void toaplan1_state::toaplan1_spritevram_alloc() { m_spriteram.allocate(TOAPLAN1_SPRITERAM_SIZE/2); - m_buffered_spriteram = auto_alloc_array_clear(machine(), UINT16, TOAPLAN1_SPRITERAM_SIZE/2); - m_spritesizeram16 = auto_alloc_array_clear(machine(), UINT16, TOAPLAN1_SPRITESIZERAM_SIZE/2); - m_buffered_spritesizeram16 = auto_alloc_array_clear(machine(), UINT16, TOAPLAN1_SPRITESIZERAM_SIZE/2); + m_buffered_spriteram = make_unique_clear(TOAPLAN1_SPRITERAM_SIZE/2); + m_spritesizeram16 = make_unique_clear(TOAPLAN1_SPRITESIZERAM_SIZE/2); + m_buffered_spritesizeram16 = make_unique_clear(TOAPLAN1_SPRITESIZERAM_SIZE/2); - save_pointer(NAME(m_buffered_spriteram), TOAPLAN1_SPRITERAM_SIZE/2); - save_pointer(NAME(m_spritesizeram16), TOAPLAN1_SPRITESIZERAM_SIZE/2); - save_pointer(NAME(m_buffered_spritesizeram16), TOAPLAN1_SPRITESIZERAM_SIZE/2); + save_pointer(NAME(m_buffered_spriteram.get()), TOAPLAN1_SPRITERAM_SIZE/2); + save_pointer(NAME(m_spritesizeram16.get()), TOAPLAN1_SPRITESIZERAM_SIZE/2); + save_pointer(NAME(m_buffered_spritesizeram16.get()), TOAPLAN1_SPRITESIZERAM_SIZE/2); } void toaplan1_state::toaplan1_set_scrolls() @@ -294,8 +294,8 @@ VIDEO_START_MEMBER(toaplan1_rallybik_state,rallybik) toaplan1_create_tilemaps(); toaplan1_vram_alloc(); - m_buffered_spriteram = auto_alloc_array_clear(machine(), UINT16, m_spriteram.bytes()/2); - save_pointer(NAME(m_buffered_spriteram), m_spriteram.bytes()/2); + m_buffered_spriteram = make_unique_clear(m_spriteram.bytes()/2); + save_pointer(NAME(m_buffered_spriteram.get()), m_spriteram.bytes()/2); m_pf1_tilemap->set_scrolldx(-0x00d-6, -0x80+6); m_pf2_tilemap->set_scrolldx(-0x00d-4, -0x80+4); @@ -608,14 +608,14 @@ void toaplan1_state::toaplan1_log_vram() if ( machine().input().code_pressed(KEYCODE_M) ) { UINT16 *spriteram16 = m_spriteram; - UINT16 *buffered_spriteram16 = m_buffered_spriteram; + UINT16 *buffered_spriteram16 = m_buffered_spriteram.get(); offs_t sprite_voffs; while (machine().input().code_pressed(KEYCODE_M)) ; if (m_spritesizeram16) /* FCU controller */ { int schar,sattr,sxpos,sypos,bschar,bsattr,bsxpos,bsypos; - UINT16 *size = (UINT16 *)(m_spritesizeram16); - UINT16 *bsize = (UINT16 *)(m_buffered_spritesizeram16); + UINT16 *size = (UINT16 *)(m_spritesizeram16.get()); + UINT16 *bsize = (UINT16 *)(m_buffered_spritesizeram16.get()); logerror("Scrolls PF1-X PF1-Y PF2-X PF2-Y PF3-X PF3-Y PF4-X PF4-Y\n"); logerror("------> #%04x #%04x #%04x #%04x #%04x #%04x #%04x #%04x\n", m_pf1_scrollx, m_pf1_scrolly, m_pf2_scrollx, m_pf2_scrolly, m_pf3_scrollx, m_pf3_scrolly, m_pf4_scrollx, m_pf4_scrolly); @@ -659,8 +659,8 @@ void toaplan1_state::toaplan1_log_vram() if ( machine().input().code_pressed(KEYCODE_SLASH) ) { - UINT16 *size = (UINT16 *)(m_spritesizeram16); - UINT16 *bsize = (UINT16 *)(m_buffered_spritesizeram16); + UINT16 *size = (UINT16 *)(m_spritesizeram16.get()); + UINT16 *bsize = (UINT16 *)(m_buffered_spritesizeram16.get()); offs_t offs; while (machine().input().code_pressed(KEYCODE_SLASH)) ; if (m_spritesizeram16) /* FCU controller */ @@ -857,8 +857,8 @@ static void toaplan1_draw_sprite_custom(screen_device &screen, bitmap_ind16 &des void toaplan1_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) { - UINT16 *source = (UINT16 *)m_buffered_spriteram; - UINT16 *size = (UINT16 *)m_buffered_spritesizeram16; + UINT16 *source = (UINT16 *)m_buffered_spriteram.get(); + UINT16 *size = (UINT16 *)m_buffered_spritesizeram16.get(); int fcu_flipscreen = m_fcu_flipscreen; int offs; @@ -934,7 +934,7 @@ UINT32 toaplan1_rallybik_state::screen_update_rallybik(screen_device &screen, bi toaplan1_log_vram(); - m_spritegen->draw_sprites_to_tempbitmap(cliprect, m_buffered_spriteram, m_spriteram.bytes()); + m_spritegen->draw_sprites_to_tempbitmap(cliprect, m_buffered_spriteram.get(), m_spriteram.bytes()); // first draw everything, including "disabled" tiles and priority 0 m_pf1_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0); @@ -992,7 +992,7 @@ void toaplan1_rallybik_state::screen_eof_rallybik(screen_device &screen, bool st // rising edge if (state) { - memcpy(m_buffered_spriteram, m_spriteram, m_spriteram.bytes()); + memcpy(m_buffered_spriteram.get(), m_spriteram, m_spriteram.bytes()); } } @@ -1001,8 +1001,8 @@ void toaplan1_state::screen_eof_toaplan1(screen_device &screen, bool state) // rising edge if (state) { - memcpy(m_buffered_spriteram, m_spriteram, m_spriteram.bytes()); - memcpy(m_buffered_spritesizeram16, m_spritesizeram16, TOAPLAN1_SPRITESIZERAM_SIZE); + memcpy(m_buffered_spriteram.get(), m_spriteram, m_spriteram.bytes()); + memcpy(m_buffered_spritesizeram16.get(), m_spritesizeram16.get(), TOAPLAN1_SPRITESIZERAM_SIZE); } } @@ -1011,8 +1011,8 @@ void toaplan1_state::screen_eof_samesame(screen_device &screen, bool state) // rising edge if (state) { - memcpy(m_buffered_spriteram, m_spriteram, m_spriteram.bytes()); - memcpy(m_buffered_spritesizeram16, m_spritesizeram16, TOAPLAN1_SPRITESIZERAM_SIZE); + memcpy(m_buffered_spriteram.get(), m_spriteram, m_spriteram.bytes()); + memcpy(m_buffered_spritesizeram16.get(), m_spritesizeram16.get(), TOAPLAN1_SPRITESIZERAM_SIZE); m_maincpu->set_input_line(M68K_IRQ_2, HOLD_LINE); /* Frame done */ } } diff --git a/src/mame/video/twincobr.cpp b/src/mame/video/twincobr.cpp index 4f602dd688a..cff357a380a 100644 --- a/src/mame/video/twincobr.cpp +++ b/src/mame/video/twincobr.cpp @@ -93,15 +93,15 @@ VIDEO_START_MEMBER(twincobr_state,toaplan0) twincobr_create_tilemaps(); - m_txvideoram16 = auto_alloc_array_clear(machine(), UINT16, m_txvideoram_size); - m_fgvideoram16 = auto_alloc_array_clear(machine(), UINT16, m_fgvideoram_size); - m_bgvideoram16 = auto_alloc_array_clear(machine(), UINT16, m_bgvideoram_size); + m_txvideoram16 = make_unique_clear(m_txvideoram_size); + m_fgvideoram16 = make_unique_clear(m_fgvideoram_size); + m_bgvideoram16 = make_unique_clear(m_bgvideoram_size); m_display_on = 0; - save_pointer(NAME(m_txvideoram16), m_txvideoram_size); - save_pointer(NAME(m_fgvideoram16), m_fgvideoram_size); - save_pointer(NAME(m_bgvideoram16), m_bgvideoram_size); + save_pointer(NAME(m_txvideoram16.get()), m_txvideoram_size); + save_pointer(NAME(m_fgvideoram16.get()), m_fgvideoram_size); + save_pointer(NAME(m_bgvideoram16.get()), m_bgvideoram_size); save_item(NAME(m_txoffs)); save_item(NAME(m_fgoffs)); save_item(NAME(m_bgoffs)); diff --git a/src/mame/video/unico.cpp b/src/mame/video/unico.cpp index ff18803010f..a6c335a5625 100644 --- a/src/mame/video/unico.cpp +++ b/src/mame/video/unico.cpp @@ -102,7 +102,7 @@ READ16_MEMBER(unico_state::unico_vram_r) { return m_vram[offset]; } WRITE16_MEMBER(unico_state::unico_vram_w) { - UINT16 *vram = m_vram; + UINT16 *vram = m_vram.get(); int tile = ((offset / 0x2000) + 1) % 3; COMBINE_DATA(&vram[offset]); m_tilemap[tile]->mark_tile_dirty((offset & 0x1fff)/2); @@ -127,13 +127,13 @@ WRITE16_MEMBER(unico_state::unico_spriteram_w) { COMBINE_DATA(&m_spriteram[offs VIDEO_START_MEMBER(unico_state,unico) { - m_vram = auto_alloc_array_clear(machine(), UINT16, 0xc000 / 2); - m_scroll = auto_alloc_array_clear(machine(), UINT16, 0x18 / 2); - m_spriteram = auto_alloc_array_clear(machine(), UINT16, 0x800 / 2); + m_vram = make_unique_clear(0xc000 / 2); + m_scroll = make_unique_clear(0x18 / 2); + m_spriteram = make_unique_clear(0x800 / 2); - save_pointer(NAME(m_vram), 0xc000/2); - save_pointer(NAME(m_scroll), 0x18/2); - save_pointer(NAME(m_spriteram), 0x800/2); + save_pointer(NAME(m_vram.get()), 0xc000/2); + save_pointer(NAME(m_scroll.get()), 0x18/2); + save_pointer(NAME(m_spriteram.get()), 0x800/2); m_tilemap[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(unico_state::get_tile_info),this),TILEMAP_SCAN_ROWS, 16,16, 0x40, 0x40); @@ -191,7 +191,7 @@ VIDEO_START_MEMBER(unico_state,unico) void unico_state::unico_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect) { - UINT16 *spriteram16 = m_spriteram; + UINT16 *spriteram16 = m_spriteram.get(); int offs; /* Draw them backwards, for pdrawgfx */ diff --git a/src/mame/video/vs920a.cpp b/src/mame/video/vs920a.cpp index 6e88864c216..7d1c973af55 100644 --- a/src/mame/video/vs920a.cpp +++ b/src/mame/video/vs920a.cpp @@ -48,8 +48,8 @@ void vs920a_text_tilemap_device::device_start() if(!m_gfxdecode->started()) throw device_missing_dependencies(); - m_vram = (UINT16*)auto_alloc_array_clear(this->machine(), UINT16, 0x1000/2); - save_pointer(NAME(m_vram), 0x1000/2); + m_vram = make_unique_clear(0x1000/2); + save_pointer(NAME(m_vram.get()), 0x1000/2); save_item(NAME(m_pal_base)); diff --git a/src/mame/video/vs920a.h b/src/mame/video/vs920a.h index 15dee511634..5d945a86631 100644 --- a/src/mame/video/vs920a.h +++ b/src/mame/video/vs920a.h @@ -10,7 +10,7 @@ public: static void set_gfx_region(device_t &device, int gfxregion); tilemap_t* m_tmap; - UINT16* m_vram; + std::unique_ptr m_vram; UINT16 m_pal_base; TILE_GET_INFO_MEMBER(get_tile_info);