diff options
69 files changed, 207 insertions, 229 deletions
diff --git a/src/devices/bus/snes/bsx.cpp b/src/devices/bus/snes/bsx.cpp index 450bcadcbce..a534018f78d 100644 --- a/src/devices/bus/snes/bsx.cpp +++ b/src/devices/bus/snes/bsx.cpp @@ -70,7 +70,7 @@ sns_rom_bsmempak_device::sns_rom_bsmempak_device(const machine_config &mconfig, void sns_rom_bsx_device::device_start() { - m_base_unit = auto_alloc(machine(), BSX_base(machine())); + m_base_unit = std::make_unique<BSX_base>(machine()); m_base_unit->init(); memset(m_cart_regs, 0x00, sizeof(m_cart_regs)); diff --git a/src/devices/bus/snes/bsx.h b/src/devices/bus/snes/bsx.h index d4df9529326..43ee42f7b4a 100644 --- a/src/devices/bus/snes/bsx.h +++ b/src/devices/bus/snes/bsx.h @@ -51,7 +51,7 @@ public: virtual DECLARE_WRITE8_MEMBER(chip_write) override; // base regs - BSX_base *m_base_unit; + std::unique_ptr<BSX_base> m_base_unit; // cart regs UINT8 m_cart_regs[16]; diff --git a/src/devices/bus/snes/sdd1.cpp b/src/devices/bus/snes/sdd1.cpp index f3282b27b84..87041e3ffb8 100644 --- a/src/devices/bus/snes/sdd1.cpp +++ b/src/devices/bus/snes/sdd1.cpp @@ -369,20 +369,20 @@ void SDD1_OL::OL_launch(UINT8 *ROM, UINT32 *mmc) SDD1_emu::SDD1_emu(running_machine &machine) : m_machine(machine) { - m_IM = auto_alloc(machine, SDD1_IM()); - m_GCD = auto_alloc(machine, SDD1_GCD(m_IM)); - m_BG0 = auto_alloc(machine, SDD1_BG(m_GCD, 0)); - m_BG1 = auto_alloc(machine, SDD1_BG(m_GCD, 1)); - m_BG2 = auto_alloc(machine, SDD1_BG(m_GCD, 2)); - m_BG3 = auto_alloc(machine, SDD1_BG(m_GCD, 3)); - m_BG4 = auto_alloc(machine, SDD1_BG(m_GCD, 4)); - m_BG5 = auto_alloc(machine, SDD1_BG(m_GCD, 5)); - m_BG6 = auto_alloc(machine, SDD1_BG(m_GCD, 6)); - m_BG7 = auto_alloc(machine, SDD1_BG(m_GCD, 7)); - m_PEM = auto_alloc(machine, SDD1_PEM(m_BG0, m_BG1, m_BG2, m_BG3, - m_BG4, m_BG5, m_BG6, m_BG7)); - m_CM = auto_alloc(machine, SDD1_CM(m_PEM)); - m_OL = auto_alloc(machine, SDD1_OL(m_CM)); + m_IM = std::make_unique<SDD1_IM>(); + m_GCD = std::make_unique<SDD1_GCD>(m_IM.get()); + m_BG0 = std::make_unique<SDD1_BG>(m_GCD.get(), 0); + m_BG1 = std::make_unique<SDD1_BG>(m_GCD.get(), 1); + m_BG2 = std::make_unique<SDD1_BG>(m_GCD.get(), 2); + m_BG3 = std::make_unique<SDD1_BG>(m_GCD.get(), 3); + m_BG4 = std::make_unique<SDD1_BG>(m_GCD.get(), 4); + m_BG5 = std::make_unique<SDD1_BG>(m_GCD.get(), 5); + m_BG6 = std::make_unique<SDD1_BG>(m_GCD.get(), 6); + m_BG7 = std::make_unique<SDD1_BG>(m_GCD.get(), 7); + m_PEM = std::make_unique<SDD1_PEM>(m_BG0.get(), m_BG1.get(), m_BG2.get(), m_BG3.get(), + m_BG4.get(), m_BG5.get(), m_BG6.get(), m_BG7.get()); + m_CM = std::make_unique<SDD1_CM>(m_PEM.get()); + m_OL = std::make_unique<SDD1_OL>(m_CM.get()); } void SDD1_emu::SDD1emu_decompress(UINT8 *ROM, UINT32 *mmc, UINT32 in_buf, UINT16 out_len, UINT8 *out_buf) @@ -426,7 +426,7 @@ sns_rom_sdd1_device::sns_rom_sdd1_device(const machine_config &mconfig, const ch void sns_rom_sdd1_device::device_start() { - m_sdd1emu = auto_alloc(machine(), SDD1_emu(machine())); + m_sdd1emu = std::make_unique<SDD1_emu>(machine()); m_buffer.data = std::make_unique<UINT8[]>(0x10000); m_buffer.ready = 0; diff --git a/src/devices/bus/snes/sdd1.h b/src/devices/bus/snes/sdd1.h index 6524a043b68..e9dcc9e71e1 100644 --- a/src/devices/bus/snes/sdd1.h +++ b/src/devices/bus/snes/sdd1.h @@ -126,13 +126,19 @@ public: running_machine &machine() const { return m_machine; } - SDD1_IM* m_IM; - SDD1_GCD* m_GCD; - SDD1_BG* m_BG0; SDD1_BG* m_BG1; SDD1_BG* m_BG2; SDD1_BG* m_BG3; - SDD1_BG* m_BG4; SDD1_BG* m_BG5; SDD1_BG* m_BG6; SDD1_BG* m_BG7; - SDD1_PEM* m_PEM; - SDD1_CM* m_CM; - SDD1_OL* m_OL; + std::unique_ptr<SDD1_IM> m_IM; + std::unique_ptr<SDD1_GCD> m_GCD; + std::unique_ptr<SDD1_BG> m_BG0; + std::unique_ptr<SDD1_BG> m_BG1; + std::unique_ptr<SDD1_BG> m_BG2; + std::unique_ptr<SDD1_BG> m_BG3; + std::unique_ptr<SDD1_BG> m_BG4; + std::unique_ptr<SDD1_BG> m_BG5; + std::unique_ptr<SDD1_BG> m_BG6; + std::unique_ptr<SDD1_BG> m_BG7; + std::unique_ptr<SDD1_PEM> m_PEM; + std::unique_ptr<SDD1_CM> m_CM; + std::unique_ptr<SDD1_OL> m_OL; void SDD1emu_decompress(UINT8 *ROM, UINT32 *mmc, UINT32 in_buf, UINT16 out_len, UINT8 *out_buf); @@ -176,7 +182,7 @@ public: UINT16 size; // $43x5-$43x6 -- DMA transfer size } m_dma[8]; - SDD1_emu* m_sdd1emu; + std::unique_ptr<SDD1_emu> m_sdd1emu; struct { diff --git a/src/devices/bus/snes/spc7110.cpp b/src/devices/bus/snes/spc7110.cpp index 0c7cc797316..5e5561af3d7 100644 --- a/src/devices/bus/snes/spc7110.cpp +++ b/src/devices/bus/snes/spc7110.cpp @@ -50,7 +50,7 @@ sns_rom_spc7110rtc_device::sns_rom_spc7110rtc_device(const machine_config &mconf void sns_rom_spc7110_device::spc7110_start() { - m_decomp = auto_alloc(machine(), SPC7110_Decomp(machine())); + m_decomp = std::make_unique<SPC7110_Decomp>(machine()); // The SPC7110 works in conjunction with 0x2000 of RAM, which is battery backed up (and hence emulated by our m_nvram) diff --git a/src/devices/bus/snes/spc7110.h b/src/devices/bus/snes/spc7110.h index 7dd3710cc5d..33d7170d02c 100644 --- a/src/devices/bus/snes/spc7110.h +++ b/src/devices/bus/snes/spc7110.h @@ -130,7 +130,7 @@ public: UINT8 m_r480b; // decompression control register UINT8 m_r480c; // decompression status - SPC7110_Decomp* m_decomp; + std::unique_ptr<SPC7110_Decomp> m_decomp; UINT8 m_r4811; // data pointer low UINT8 m_r4812; // data pointer high diff --git a/src/devices/cpu/mips/mips3.cpp b/src/devices/cpu/mips/mips3.cpp index ed95f09d418..3588db1b888 100644 --- a/src/devices/cpu/mips/mips3.cpp +++ b/src/devices/cpu/mips/mips3.cpp @@ -203,12 +203,10 @@ void mips3_device::device_stop() if (m_drcfe != nullptr) { - auto_free(machine(), m_drcfe); m_drcfe = nullptr; } if (m_drcuml != nullptr) { - auto_free(machine(), m_drcuml); m_drcuml = nullptr; } } @@ -357,7 +355,7 @@ void mips3_device::device_start() UINT32 flags = 0; /* initialize the UML generator */ - m_drcuml = auto_alloc(machine(), drcuml_state(*this, m_cache, flags, 8, 32, 2)); + m_drcuml = std::make_unique<drcuml_state>(*this, m_cache, flags, 8, 32, 2); /* add symbols for our stuff */ m_drcuml->symbol_add(&m_core->pc, sizeof(m_core->pc), "pc"); @@ -403,7 +401,7 @@ void mips3_device::device_start() m_drcuml->symbol_add(&m_fpmode, sizeof(m_fpmode), "fpmode"); /* initialize the front-end helper */ - m_drcfe = auto_alloc(machine(), mips3_frontend(this, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE)); + m_drcfe = std::make_unique<mips3_frontend>(this, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE); /* allocate memory for cache-local state and initialize it */ memcpy(m_fpmode, fpmode_source, sizeof(fpmode_source)); diff --git a/src/devices/cpu/mips/mips3.h b/src/devices/cpu/mips/mips3.h index 1b76e37fe3f..e87f8862f40 100644 --- a/src/devices/cpu/mips/mips3.h +++ b/src/devices/cpu/mips/mips3.h @@ -409,8 +409,8 @@ private: /* core state */ drc_cache m_cache; /* pointer to the DRC code cache */ - drcuml_state * m_drcuml; /* DRC UML generator state */ - mips3_frontend * m_drcfe; /* pointer to the DRC front-end state */ + std::unique_ptr<drcuml_state> m_drcuml; /* DRC UML generator state */ + std::unique_ptr<mips3_frontend> m_drcfe; /* pointer to the DRC front-end state */ UINT32 m_drcoptions; /* configurable DRC options */ /* internal stuff */ diff --git a/src/devices/cpu/mips/mips3drc.cpp b/src/devices/cpu/mips/mips3drc.cpp index 02d73de3b14..4e6e9771a38 100644 --- a/src/devices/cpu/mips/mips3drc.cpp +++ b/src/devices/cpu/mips/mips3drc.cpp @@ -280,7 +280,7 @@ void mips3_device::code_flush_cache() void mips3_device::code_compile_block(UINT8 mode, offs_t pc) { - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); compiler_state compiler = { 0 }; const opcode_desc *seqhead, *seqlast; const opcode_desc *desclist; @@ -553,7 +553,7 @@ static void cfunc_unimplemented(void *param) void mips3_device::static_generate_entry_point() { - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); code_label skip = 1; drcuml_block *block; @@ -601,7 +601,7 @@ void mips3_device::static_generate_entry_point() void mips3_device::static_generate_nocode_handler() { - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); drcuml_block *block; /* begin generating */ @@ -626,7 +626,7 @@ void mips3_device::static_generate_nocode_handler() void mips3_device::static_generate_out_of_cycles() { - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); drcuml_block *block; /* begin generating */ @@ -651,7 +651,7 @@ void mips3_device::static_generate_out_of_cycles() void mips3_device::static_generate_tlb_mismatch() { - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); drcuml_block *block; /* forward references */ @@ -702,7 +702,7 @@ void mips3_device::static_generate_tlb_mismatch() void mips3_device::static_generate_exception(UINT8 exception, int recover, const char *name) { code_handle *&exception_handle = recover ? m_exception[exception] : m_exception_norecover[exception]; - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); UINT32 offset = 0x180; code_label next = 1; code_label skip = 2; @@ -805,7 +805,7 @@ void mips3_device::static_generate_memory_accessor(int mode, int size, int iswri code_handle &exception_tlb = *m_exception[iswrite ? EXCEPTION_TLBSTORE : EXCEPTION_TLBLOAD]; code_handle &exception_tlbfill = *m_exception[iswrite ? EXCEPTION_TLBSTORE_FILL : EXCEPTION_TLBLOAD_FILL]; code_handle &exception_addrerr = *m_exception[iswrite ? EXCEPTION_ADDRSTORE : EXCEPTION_ADDRLOAD]; - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); drcuml_block *block; int tlbmiss = 0; int label = 1; diff --git a/src/devices/cpu/powerpc/ppc.h b/src/devices/cpu/powerpc/ppc.h index 3a0e9b9b2f3..a73accb6409 100644 --- a/src/devices/cpu/powerpc/ppc.h +++ b/src/devices/cpu/powerpc/ppc.h @@ -537,8 +537,8 @@ protected: /* core state */ drc_cache m_cache; /* pointer to the DRC code cache */ - drcuml_state * m_drcuml; /* DRC UML generator state */ - ppc_frontend * m_drcfe; /* pointer to the DRC front-end state */ + std::unique_ptr<drcuml_state> m_drcuml; /* DRC UML generator state */ + std::unique_ptr<ppc_frontend> m_drcfe; /* pointer to the DRC front-end state */ UINT32 m_drcoptions; /* configurable DRC options */ /* parameters for subroutines */ diff --git a/src/devices/cpu/powerpc/ppccom.cpp b/src/devices/cpu/powerpc/ppccom.cpp index 6c8d4397206..25c39516c73 100644 --- a/src/devices/cpu/powerpc/ppccom.cpp +++ b/src/devices/cpu/powerpc/ppccom.cpp @@ -882,7 +882,7 @@ void ppc_device::device_start() UINT32 flags = 0; /* initialize the UML generator */ - m_drcuml = auto_alloc(machine(), drcuml_state(*this, m_cache, flags, 8, 32, 2)); + m_drcuml = std::make_unique<drcuml_state>(*this, m_cache, flags, 8, 32, 2); /* add symbols for our stuff */ m_drcuml->symbol_add(&m_core->pc, sizeof(m_core->pc), "pc"); @@ -928,7 +928,7 @@ void ppc_device::device_start() m_drcuml->symbol_add(&m_fcmp_cr_table, sizeof(m_fcmp_cr_table), "fcmp_cr_table"); /* initialize the front-end helper */ - m_drcfe = auto_alloc(machine(), ppc_frontend(this, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE)); + m_drcfe = std::make_unique<ppc_frontend>(this, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE); /* compute the register parameters */ for (int regnum = 0; regnum < 32; regnum++) @@ -1151,10 +1151,6 @@ void ppc_device::device_stop() if (m_vtlb != nullptr) vtlb_free(m_vtlb); m_vtlb = nullptr; - - /* clean up the DRC */ - auto_free(machine(), m_drcfe); - auto_free(machine(), m_drcuml); } diff --git a/src/devices/cpu/powerpc/ppcdrc.cpp b/src/devices/cpu/powerpc/ppcdrc.cpp index 57b6290a191..ed502d344de 100644 --- a/src/devices/cpu/powerpc/ppcdrc.cpp +++ b/src/devices/cpu/powerpc/ppcdrc.cpp @@ -369,7 +369,7 @@ void ppc_device::code_compile_block(UINT8 mode, offs_t pc) /* get a description of this sequence */ desclist = m_drcfe->describe_code(pc); if (m_drcuml->logging() || m_drcuml->logging_native()) - log_opcode_desc(m_drcuml, desclist, 0); + log_opcode_desc(m_drcuml.get(), desclist, 0); bool succeeded = false; while (!succeeded) @@ -641,10 +641,10 @@ void ppc_device::static_generate_entry_point() block = m_drcuml->begin_block(20); /* forward references */ - alloc_handle(m_drcuml, &m_nocode, "nocode"); - alloc_handle(m_drcuml, &m_exception_norecover[EXCEPTION_EI], "exception_ei_norecover"); + alloc_handle(m_drcuml.get(), &m_nocode, "nocode"); + alloc_handle(m_drcuml.get(), &m_exception_norecover[EXCEPTION_EI], "exception_ei_norecover"); - alloc_handle(m_drcuml, &m_entry, "entry"); + alloc_handle(m_drcuml.get(), &m_entry, "entry"); UML_HANDLE(block, *m_entry); // handle entry /* reset the FPU mode */ @@ -685,7 +685,7 @@ void ppc_device::static_generate_nocode_handler() block = m_drcuml->begin_block(10); /* generate a hash jump via the current mode and PC */ - alloc_handle(m_drcuml, &m_nocode, "nocode"); + alloc_handle(m_drcuml.get(), &m_nocode, "nocode"); UML_HANDLE(block, *m_nocode); // handle nocode UML_GETEXP(block, I0); // getexp i0 UML_MOV(block, mem(&m_core->pc), I0); // mov [pc],i0 @@ -709,7 +709,7 @@ void ppc_device::static_generate_out_of_cycles() block = m_drcuml->begin_block(10); /* generate a hash jump via the current mode and PC */ - alloc_handle(m_drcuml, &m_out_of_cycles, "out_of_cycles"); + alloc_handle(m_drcuml.get(), &m_out_of_cycles, "out_of_cycles"); UML_HANDLE(block, *m_out_of_cycles); // handle out_of_cycles UML_GETEXP(block, I0); // getexp i0 UML_MOV(block, mem(&m_core->pc), I0); // mov <pc>,i0 @@ -731,15 +731,15 @@ void ppc_device::static_generate_tlb_mismatch() int isi, exit, label = 1; /* forward references */ - alloc_handle(m_drcuml, &m_exception[EXCEPTION_ISI], "exception_isi"); + alloc_handle(m_drcuml.get(), &m_exception[EXCEPTION_ISI], "exception_isi"); if (m_cap & PPCCAP_603_MMU) - alloc_handle(m_drcuml, &m_exception[EXCEPTION_ITLBMISS], "exception_itlb_miss"); + alloc_handle(m_drcuml.get(), &m_exception[EXCEPTION_ITLBMISS], "exception_itlb_miss"); /* begin generating */ block = m_drcuml->begin_block(20); /* generate a hash jump via the current mode and PC */ - alloc_handle(m_drcuml, &m_tlb_mismatch, "tlb_mismatch"); + alloc_handle(m_drcuml.get(), &m_tlb_mismatch, "tlb_mismatch"); UML_HANDLE(block, *m_tlb_mismatch); // handle tlb_mismatch UML_RECOVER(block, I0, MAPVAR_PC); // recover i0,PC UML_SHR(block, I1, I0, 12); // shr i1,i0,12 @@ -792,7 +792,7 @@ void ppc_device::static_generate_exception(UINT8 exception, int recover, const c block = m_drcuml->begin_block(1024); /* add a global entry for this */ - alloc_handle(m_drcuml, &exception_handle, name); + alloc_handle(m_drcuml.get(), &exception_handle, name); UML_HANDLE(block, *exception_handle); // handle name /* exception parameter is expected to be the fault address in this case */ @@ -981,7 +981,7 @@ void ppc_device::static_generate_memory_accessor(int mode, int size, int iswrite block = m_drcuml->begin_block(1024); /* add a global entry for this */ - alloc_handle(m_drcuml, &handleptr, name); + alloc_handle(m_drcuml.get(), &handleptr, name); UML_HANDLE(block, *handleptr); // handle *handleptr /* check for unaligned accesses and break into two */ @@ -1388,7 +1388,7 @@ void ppc_device::static_generate_swap_tgpr() block = m_drcuml->begin_block(30); /* generate a hash jump via the current mode and PC */ - alloc_handle(m_drcuml, &m_swap_tgpr, "swap_tgpr"); + alloc_handle(m_drcuml.get(), &m_swap_tgpr, "swap_tgpr"); UML_HANDLE(block, *m_swap_tgpr); // handle swap_tgpr for (regnum = 0; regnum < 4; regnum++) { @@ -1423,7 +1423,7 @@ void ppc_device::static_generate_lsw_entries(int mode) /* allocate a handle */ sprintf(temp, "lsw%d", regnum); - alloc_handle(m_drcuml, &m_lsw[mode][regnum], temp); + alloc_handle(m_drcuml.get(), &m_lsw[mode][regnum], temp); UML_HANDLE(block, *m_lsw[mode][regnum]); // handle lsw<regnum> UML_LABEL(block, regnum); // regnum: UML_ADD(block, I0, mem(&m_core->updateaddr), 0); // add i0,[updateaddr],0 @@ -1477,7 +1477,7 @@ void ppc_device::static_generate_stsw_entries(int mode) /* allocate a handle */ sprintf(temp, "stsw%d", regnum); - alloc_handle(m_drcuml, &m_stsw[mode][regnum], temp); + alloc_handle(m_drcuml.get(), &m_stsw[mode][regnum], temp); UML_HANDLE(block, *m_stsw[mode][regnum]); // handle stsw<regnum> UML_LABEL(block, regnum); // regnum: UML_ADD(block, I0, mem(&m_core->updateaddr), 0); // add i0,[updateaddr],0 diff --git a/src/devices/cpu/rsp/rsp.cpp b/src/devices/cpu/rsp/rsp.cpp index c8cbbfe24d1..5541c643c6b 100644 --- a/src/devices/cpu/rsp/rsp.cpp +++ b/src/devices/cpu/rsp/rsp.cpp @@ -373,11 +373,11 @@ void rsp_device::device_start() if (m_isdrc) { - m_cop2 = auto_alloc(machine(), rsp_cop2_drc(*this, machine())); + m_cop2 = std::make_unique<rsp_cop2_drc>(*this, machine()); } else { - m_cop2 = auto_alloc(machine(), rsp_cop2(*this, machine())); + m_cop2 = std::make_unique<rsp_cop2>(*this, machine()); } m_cop2->init(); m_cop2->start(); @@ -393,7 +393,7 @@ void rsp_device::device_start() /* initialize the UML generator */ UINT32 drc_flags = 0; - m_drcuml = auto_alloc(machine(), drcuml_state(*this, m_cache, drc_flags, 8, 32, 2)); + m_drcuml = std::make_unique<drcuml_state>(*this, m_cache, drc_flags, 8, 32, 2); /* add symbols for our stuff */ m_drcuml->symbol_add(&m_rsp_state->pc, sizeof(m_rsp_state->pc), "pc"); @@ -411,7 +411,7 @@ void rsp_device::device_start() m_drcuml->symbol_add(&m_numcycles, sizeof(m_numcycles), "numcycles"); /* initialize the front-end helper */ - m_drcfe = auto_alloc(machine(), rsp_frontend(*this, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE)); + m_drcfe = std::make_unique<rsp_frontend>(*this, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE); /* compute the register parameters */ for (int regnum = 0; regnum < 32; regnum++) @@ -596,21 +596,6 @@ void rsp_device::device_stop() if (m_exec_output) fclose(m_exec_output); m_exec_output = nullptr; - - /* clean up the DRC */ - if (m_drcuml) - { - auto_free(machine(), m_drcuml); - } - if (m_drcfe) - { - auto_free(machine(), m_drcfe); - } - - if (m_cop2) - { - auto_free(machine(), m_cop2); - } } void rsp_device::device_reset() diff --git a/src/devices/cpu/rsp/rsp.h b/src/devices/cpu/rsp/rsp.h index 1f92aac50d9..958c4268bb8 100644 --- a/src/devices/cpu/rsp/rsp.h +++ b/src/devices/cpu/rsp/rsp.h @@ -217,8 +217,8 @@ private: /* core state */ drc_cache m_cache; /* pointer to the DRC code cache */ - drcuml_state * m_drcuml; /* DRC UML generator state */ - rsp_frontend * m_drcfe; /* pointer to the DRC front-end state */ + std::unique_ptr<drcuml_state> m_drcuml; /* DRC UML generator state */ + std::unique_ptr<rsp_frontend> m_drcfe; /* pointer to the DRC front-end state */ UINT32 m_drcoptions; /* configurable DRC options */ /* internal stuff */ @@ -269,7 +269,7 @@ protected: direct_read_data *m_direct; private: - rsp_cop2 *m_cop2; + std::unique_ptr<rsp_cop2> m_cop2; UINT32 *m_dmem32; UINT16 *m_dmem16; diff --git a/src/devices/cpu/rsp/rspcp2.h b/src/devices/cpu/rsp/rspcp2.h index 909b0ae4172..8911eeb1838 100644 --- a/src/devices/cpu/rsp/rspcp2.h +++ b/src/devices/cpu/rsp/rspcp2.h @@ -78,9 +78,10 @@ class rsp_cop2 { friend class rsp_device; -protected: +public: rsp_cop2(rsp_device &rsp, running_machine &machine); +protected: virtual void init(); virtual void start(); diff --git a/src/devices/cpu/rsp/rspcp2d.h b/src/devices/cpu/rsp/rspcp2d.h index ef727e37b95..c918d825e60 100644 --- a/src/devices/cpu/rsp/rspcp2d.h +++ b/src/devices/cpu/rsp/rspcp2d.h @@ -21,9 +21,9 @@ class rsp_cop2_drc : public rsp_cop2 { friend class rsp_device; - +public: rsp_cop2_drc(rsp_device &rsp, running_machine &machine) : rsp_cop2(rsp, machine) { } - +private: virtual int generate_cop2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc) override; virtual int generate_lwc2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc) override; virtual int generate_swc2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc) override; diff --git a/src/devices/cpu/rsp/rspdrc.cpp b/src/devices/cpu/rsp/rspdrc.cpp index 097a8c39507..c581cfb3aba 100644 --- a/src/devices/cpu/rsp/rspdrc.cpp +++ b/src/devices/cpu/rsp/rspdrc.cpp @@ -260,7 +260,7 @@ void cfunc_sp_set_status_cb(void *param) void rsp_device::execute_run_drc() { - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); int execute_result; /* reset the cache if dirty */ @@ -350,7 +350,7 @@ void rsp_device::code_flush_cache() void rsp_device::code_compile_block(offs_t pc) { - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); compiler_state compiler = { 0 }; const opcode_desc *seqhead, *seqlast; const opcode_desc *desclist; @@ -490,7 +490,7 @@ static void cfunc_fatalerror(void *param) void rsp_device::static_generate_entry_point() { - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); drcuml_block *block; /* begin generating */ @@ -518,7 +518,7 @@ void rsp_device::static_generate_entry_point() void rsp_device::static_generate_nocode_handler() { - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); drcuml_block *block; /* begin generating */ @@ -543,7 +543,7 @@ void rsp_device::static_generate_nocode_handler() void rsp_device::static_generate_out_of_cycles() { - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); drcuml_block *block; /* begin generating */ @@ -569,7 +569,7 @@ void rsp_device::static_generate_memory_accessor(int size, int iswrite, const ch /* on entry, address is in I0; data for writes is in I1 */ /* on exit, read result is in I0 */ /* routine trashes I0-I1 */ - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); drcuml_block *block; /* begin generating */ diff --git a/src/devices/cpu/sh2/sh2.cpp b/src/devices/cpu/sh2/sh2.cpp index 7cd45505c9b..71b960ac341 100644 --- a/src/devices/cpu/sh2/sh2.cpp +++ b/src/devices/cpu/sh2/sh2.cpp @@ -199,11 +199,6 @@ sh2_device::sh2_device(const machine_config &mconfig, const char *tag, device_t void sh2_device::device_stop() { - /* clean up the DRC */ - if ( m_drcuml ) - { - auto_free(machine(), m_drcuml); - } } @@ -2536,7 +2531,7 @@ void sh2_device::device_start() /* initialize the UML generator */ UINT32 flags = 0; - m_drcuml = auto_alloc(machine(), drcuml_state(*this, m_cache, flags, 1, 32, 1)); + m_drcuml = std::make_unique<drcuml_state>(*this, m_cache, flags, 1, 32, 1); /* add symbols for our stuff */ m_drcuml->symbol_add(&m_sh2_state->pc, sizeof(m_sh2_state->pc), "pc"); @@ -2555,7 +2550,7 @@ void sh2_device::device_start() m_drcuml->symbol_add(&m_sh2_state->mach, sizeof(m_sh2_state->macl), "mach"); /* initialize the front-end helper */ - m_drcfe = auto_alloc(machine(), sh2_frontend(this, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE)); + m_drcfe = std::make_unique<sh2_frontend>(this, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE); /* compute the register parameters */ for (int regnum = 0; regnum < 16; regnum++) diff --git a/src/devices/cpu/sh2/sh2.h b/src/devices/cpu/sh2/sh2.h index 6a32072ada5..da6c928b939 100644 --- a/src/devices/cpu/sh2/sh2.h +++ b/src/devices/cpu/sh2/sh2.h @@ -219,8 +219,8 @@ private: sh2_ftcsr_read_delegate m_ftcsr_read_cb; drc_cache m_cache; /* pointer to the DRC code cache */ - drcuml_state * m_drcuml; /* DRC UML generator state */ - sh2_frontend * m_drcfe; /* pointer to the DRC front-end state */ + std::unique_ptr<drcuml_state> m_drcuml; /* DRC UML generator state */ + std::unique_ptr<sh2_frontend> m_drcfe; /* pointer to the DRC front-end state */ UINT32 m_drcoptions; /* configurable DRC options */ internal_sh2_state *m_sh2_state; diff --git a/src/devices/cpu/sh2/sh2drc.cpp b/src/devices/cpu/sh2/sh2drc.cpp index 6f112eb0db5..db732e57b40 100644 --- a/src/devices/cpu/sh2/sh2drc.cpp +++ b/src/devices/cpu/sh2/sh2drc.cpp @@ -586,7 +586,7 @@ void sh2_device::func_SUBV() {} void sh2_device::code_flush_cache() { - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); /* empty the transient cache contents */ drcuml->reset(); @@ -617,7 +617,7 @@ void sh2_device::code_flush_cache() /* Execute cycles - returns number of cycles actually run */ void sh2_device::execute_run_drc() { - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); int execute_result; // run any active DMAs now @@ -665,7 +665,7 @@ void sh2_device::execute_run_drc() void sh2_device::code_compile_block(UINT8 mode, offs_t pc) { - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); compiler_state compiler = { 0 }; const opcode_desc *seqhead, *seqlast; const opcode_desc *desclist; @@ -781,7 +781,7 @@ void sh2_device::code_compile_block(UINT8 mode, offs_t pc) void sh2_device::static_generate_entry_point() { - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); code_label skip = 1; drcuml_block *block; @@ -861,7 +861,7 @@ void sh2_device::static_generate_entry_point() void sh2_device::static_generate_nocode_handler() { - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); drcuml_block *block; /* begin generating */ @@ -886,7 +886,7 @@ void sh2_device::static_generate_nocode_handler() void sh2_device::static_generate_out_of_cycles() { - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); drcuml_block *block; /* begin generating */ @@ -912,7 +912,7 @@ void sh2_device::static_generate_memory_accessor(int size, int iswrite, const ch /* on entry, address is in I0; data for writes is in I1 */ /* on exit, read result is in I0 */ /* routine trashes I0 */ - drcuml_state *drcuml = m_drcuml; + drcuml_state *drcuml = m_drcuml.get(); drcuml_block *block; int label = 1; diff --git a/src/devices/sound/ymf271.cpp b/src/devices/sound/ymf271.cpp index 81b657af7d4..28c4a37f4f3 100644 --- a/src/devices/sound/ymf271.cpp +++ b/src/devices/sound/ymf271.cpp @@ -399,7 +399,7 @@ void ymf271_device::update_lfo(YMF271Slot *slot) slot->lfo_phase += slot->lfo_step; slot->lfo_amplitude = m_lut_alfo[slot->lfowave][(slot->lfo_phase >> LFO_SHIFT) & (LFO_LENGTH-1)]; - slot->lfo_phasemod = m_lut_plfo[slot->lfowave][slot->pms][(slot->lfo_phase >> LFO_SHIFT) & (LFO_LENGTH-1)]; + slot->lfo_phasemod = m_lut_plfo[slot->lfowave][slot->pms].get()[(slot->lfo_phase >> LFO_SHIFT) & (LFO_LENGTH-1)]; calculate_step(slot); } @@ -1508,7 +1508,7 @@ void ymf271_device::init_tables() m_lut_waves[i] = std::make_unique<INT16[]>(SIN_LEN); for (i = 0; i < 4*8; i++) - m_lut_plfo[i>>3][i&7] = auto_alloc_array(machine(), double, LFO_LENGTH); + m_lut_plfo[i>>3][i&7] = std::make_unique<double[]>(LFO_LENGTH); for (i = 0; i < 4; i++) m_lut_alfo[i] = std::make_unique<int[]>(LFO_LENGTH); @@ -1568,14 +1568,14 @@ void ymf271_device::init_tables() for (j = 0; j < 4; j++) { - m_lut_plfo[j][0][i] = pow(2.0, 0.0); - m_lut_plfo[j][1][i] = pow(2.0, (3.378 * plfo[j]) / 1200.0); - m_lut_plfo[j][2][i] = pow(2.0, (5.0646 * plfo[j]) / 1200.0); - m_lut_plfo[j][3][i] = pow(2.0, (6.7495 * plfo[j]) / 1200.0); - m_lut_plfo[j][4][i] = pow(2.0, (10.1143 * plfo[j]) / 1200.0); - m_lut_plfo[j][5][i] = pow(2.0, (20.1699 * plfo[j]) / 1200.0); - m_lut_plfo[j][6][i] = pow(2.0, (40.1076 * plfo[j]) / 1200.0); - m_lut_plfo[j][7][i] = pow(2.0, (79.307 * plfo[j]) / 1200.0); + m_lut_plfo[j][0].get()[i] = pow(2.0, 0.0); + m_lut_plfo[j][1].get()[i] = pow(2.0, (3.378 * plfo[j]) / 1200.0); + m_lut_plfo[j][2].get()[i] = pow(2.0, (5.0646 * plfo[j]) / 1200.0); + m_lut_plfo[j][3].get()[i] = pow(2.0, (6.7495 * plfo[j]) / 1200.0); + m_lut_plfo[j][4].get()[i] = pow(2.0, (10.1143 * plfo[j]) / 1200.0); + m_lut_plfo[j][5].get()[i] = pow(2.0, (20.1699 * plfo[j]) / 1200.0); + m_lut_plfo[j][6].get()[i] = pow(2.0, (40.1076 * plfo[j]) / 1200.0); + m_lut_plfo[j][7].get()[i] = pow(2.0, (79.307 * plfo[j]) / 1200.0); } // LFO amplitude modulation diff --git a/src/devices/sound/ymf271.h b/src/devices/sound/ymf271.h index d37c4895c5c..b4fbcead1af 100644 --- a/src/devices/sound/ymf271.h +++ b/src/devices/sound/ymf271.h @@ -122,7 +122,7 @@ private: // lookup tables std::unique_ptr<INT16[]> m_lut_waves[8]; - double *m_lut_plfo[4][8]; + std::unique_ptr<double[]> m_lut_plfo[4][8]; std::unique_ptr<int[]> m_lut_alfo[4]; double m_lut_ar[64]; double m_lut_dc[64]; diff --git a/src/devices/video/stvvdp1.cpp b/src/devices/video/stvvdp1.cpp index 09ca2e81662..a98dc8fe709 100644 --- a/src/devices/video/stvvdp1.cpp +++ b/src/devices/video/stvvdp1.cpp @@ -2125,7 +2125,7 @@ int saturn_state::stv_vdp1_start ( void ) m_vdp1_vram = make_unique_clear<UINT32[]>(0x100000/4 ); m_vdp1.gfx_decode = std::make_unique<UINT8[]>(0x100000 ); - stv_vdp1_shading_data = auto_alloc(machine(), struct stv_vdp1_poly_scanline_data); + stv_vdp1_shading_data = std::make_unique<struct stv_vdp1_poly_scanline_data>(); m_vdp1.framebuffer[0] = std::make_unique<UINT16[]>(1024 * 256 * 2 ); /* *2 is for double interlace */ m_vdp1.framebuffer[1] = std::make_unique<UINT16[]>(1024 * 256 * 2 ); diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index 3a95a823594..a075696b348 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -1690,8 +1690,6 @@ device_debug::device_debug(device_t &device) device_debug::~device_debug() { - auto_free(m_device.machine(), m_trace); - // free breakpoints and watchpoints breakpoint_clear_all(); watchpoint_clear_all(); @@ -2759,12 +2757,11 @@ UINT32 device_debug::compute_opcode_crc32(offs_t pc) const void device_debug::trace(FILE *file, bool trace_over, const char *action) { // delete any existing tracers - auto_free(m_device.machine(), m_trace); m_trace = nullptr; // if we have a new file, make a new tracer if (file != nullptr) - m_trace = auto_alloc(m_device.machine(), tracer(*this, *file, trace_over, action)); + m_trace = std::make_unique<tracer>(*this, *file, trace_over, action); } diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h index 33c17253354..754411cb3f0 100644 --- a/src/emu/debug/debugcpu.h +++ b/src/emu/debug/debugcpu.h @@ -360,7 +360,7 @@ private: // (0 = not tracing over, // ~0 = not currently tracing over) }; - tracer * m_trace; // tracer state + std::unique_ptr<tracer> m_trace; // tracer state // hotspots struct hotspot_entry diff --git a/src/mame/drivers/cubeqst.cpp b/src/mame/drivers/cubeqst.cpp index 6ed299afaef..2c7ccc972d7 100644 --- a/src/mame/drivers/cubeqst.cpp +++ b/src/mame/drivers/cubeqst.cpp @@ -49,7 +49,7 @@ public: required_device<cquestsnd_cpu_device> m_soundcpu; required_device<screen_device> m_screen; required_shared_ptr<UINT16> m_generic_paletteram_16; - rgb_t *m_colormap; + std::unique_ptr<rgb_t[]> m_colormap; DECLARE_WRITE16_MEMBER(palette_w); DECLARE_READ16_MEMBER(line_r); DECLARE_WRITE16_MEMBER(laserdisc_w); @@ -444,7 +444,7 @@ void cubeqst_state::machine_start() /* TODO: Use resistor values */ int i; - m_colormap = auto_alloc_array(machine(), rgb_t, 65536); + m_colormap = std::make_unique<rgb_t[]>(65536); for (i = 0; i < 65536; ++i) { UINT8 a, r, g, b, y; diff --git a/src/mame/drivers/igs017.cpp b/src/mame/drivers/igs017.cpp index bc90f39bfb3..ffa5cc3abdf 100644 --- a/src/mame/drivers/igs017.cpp +++ b/src/mame/drivers/igs017.cpp @@ -247,7 +247,7 @@ void igs017_state::decrypt_program_rom(int mask, int a7, int a6, int a5, int a4, { int length = memregion("maincpu")->bytes(); UINT8 *rom = memregion("maincpu")->base(); - UINT8 *tmp = auto_alloc_array(machine(), UINT8, length); + std::unique_ptr<UINT8[]> tmp = std::make_unique<UINT8[]>(length); int i; // decrypt the program ROM @@ -283,7 +283,7 @@ void igs017_state::decrypt_program_rom(int mask, int a7, int a6, int a5, int a4, } } - memcpy(tmp,rom,length); + memcpy(tmp.get(),rom,length); // address lines swap for (i = 0;i < length;i++) @@ -347,11 +347,11 @@ void igs017_state::tjsb_decrypt_sprites() { int length = memregion("sprites")->bytes(); UINT8 *rom = memregion("sprites")->base(); - UINT8 *tmp = auto_alloc_array(machine(), UINT8, length); + std::unique_ptr<UINT8[]> tmp = std::make_unique<UINT8[]>(length); int i, addr; // address lines swap - memcpy(tmp, rom, length); + memcpy(tmp.get(), rom, length); for (i = 0; i < length; i++) { addr = (i & ~0xff) | BITSWAP8(i,7,6,5,2,1,4,3,0); @@ -739,11 +739,11 @@ void igs017_state::lhzb2_decrypt_sprites() { int length = memregion("sprites")->bytes(); UINT8 *rom = memregion("sprites")->base(); - UINT8 *tmp = auto_alloc_array(machine(), UINT8, length); + std::unique_ptr<UINT8[]> tmp = std::make_unique<UINT8[]>(length); int i, addr; // address lines swap - memcpy(tmp, rom, length); + memcpy(tmp.get(), rom, length); for (i = 0; i < length; i++) { addr = (i & ~0xffff) | BITSWAP16(i,15,14,13,6,7,10,9,8,11,12,5,4,3,2,1,0); @@ -1053,11 +1053,11 @@ void igs017_state::spkrform_decrypt_sprites() { int length = memregion("sprites")->bytes(); UINT8 *rom = memregion("sprites")->base(); - UINT8 *tmp = auto_alloc_array(machine(), UINT8, length); + std::unique_ptr<UINT8[]> tmp = std::make_unique<UINT8[]>(length); int i, addr; // address lines swap - memcpy(tmp, rom, length); + memcpy(tmp.get(), rom, length); for (i = 0; i < length; i++) { if (i & 0x80000) diff --git a/src/mame/drivers/namcos21.cpp b/src/mame/drivers/namcos21.cpp index 10e02334f17..4a9b4f51038 100644 --- a/src/mame/drivers/namcos21.cpp +++ b/src/mame/drivers/namcos21.cpp @@ -811,7 +811,7 @@ int namcos21_state::init_dsp() pMem[0x8000] = 0xFF80; pMem[0x8001] = 0x0000; - m_mpDspState = auto_alloc_clear(machine(), dsp_state); + m_mpDspState = make_unique_clear<dsp_state>(); return 0; } diff --git a/src/mame/drivers/namcos23.cpp b/src/mame/drivers/namcos23.cpp index 0bda3aa8cb0..92c3471e849 100644 --- a/src/mame/drivers/namcos23.cpp +++ b/src/mame/drivers/namcos23.cpp @@ -1384,7 +1384,7 @@ struct c404_t struct render_t { - namcos23_renderer *polymgr; + std::unique_ptr<namcos23_renderer> polymgr; int cur; int poly_count; int count[2]; @@ -2380,7 +2380,7 @@ VIDEO_START_MEMBER(namcos23_state,s23) m_bgtilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(namcos23_state::TextTilemapGetInfo),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64); m_bgtilemap->set_transparent_pen(0xf); m_bgtilemap->set_scrolldx(860, 860); - m_render.polymgr = auto_alloc(machine(), namcos23_renderer(*this)); + m_render.polymgr = std::make_unique<namcos23_renderer>(*this); } diff --git a/src/mame/drivers/pcat_nit.cpp b/src/mame/drivers/pcat_nit.cpp index 0987b296837..25b02276175 100644 --- a/src/mame/drivers/pcat_nit.cpp +++ b/src/mame/drivers/pcat_nit.cpp @@ -99,7 +99,7 @@ public: m_uart(*this, "ns16450_0"), m_microtouch(*this, "microtouch") { } - UINT8 *m_banked_nvram; + std::unique_ptr<UINT8[]> m_banked_nvram; required_device<ns16450_device> m_uart; required_device<microtouch_device> m_microtouch; @@ -140,7 +140,7 @@ WRITE8_MEMBER(pcat_nit_state::pcat_nit_rombank_w) space.install_readwrite_bank(0x000d8000, 0x000d9fff, "nvrambank" ); - membank("nvrambank")->set_base(m_banked_nvram); + membank("nvrambank")->set_base(m_banked_nvram.get()); } } @@ -413,8 +413,8 @@ ROM_END DRIVER_INIT_MEMBER(pcat_nit_state,pcat_nit) { - m_banked_nvram = auto_alloc_array(machine(), UINT8, 0x2000); - machine().device<nvram_device>("nvram")->set_base(m_banked_nvram, 0x2000); + m_banked_nvram = std::make_unique<UINT8[]>(0x2000); + machine().device<nvram_device>("nvram")->set_base(m_banked_nvram.get(), 0x2000); } GAME( 1993, streetg, 0, pcat_nit, pcat_nit, pcat_nit_state, pcat_nit, ROT0, "New Image Technologies", "Street Games (Revision 4)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/rollext.cpp b/src/mame/drivers/rollext.cpp index d2159024613..a973103f67d 100644 --- a/src/mame/drivers/rollext.cpp +++ b/src/mame/drivers/rollext.cpp @@ -302,7 +302,7 @@ public: DECLARE_WRITE32_MEMBER(cmd_callback); std::unique_ptr<UINT8[]> m_texture; - rollext_renderer* m_renderer; + std::unique_ptr<rollext_renderer> m_renderer; INTERRUPT_GEN_MEMBER(vblank_interrupt); DECLARE_DRIVER_INIT(rollext); @@ -339,7 +339,7 @@ void rollext_state::video_start() preprocess_texture_data(); - m_renderer = auto_alloc(machine(), rollext_renderer(*m_screen)); + m_renderer = std::make_unique<rollext_renderer>(*m_screen); m_renderer->set_texture_ram(m_texture.get()); m_renderer->set_palette_ram((UINT16*)&m_palette_ram[0]); } diff --git a/src/mame/drivers/royalmah.cpp b/src/mame/drivers/royalmah.cpp index 0d49e09ae8c..e89aacc7be1 100644 --- a/src/mame/drivers/royalmah.cpp +++ b/src/mame/drivers/royalmah.cpp @@ -119,7 +119,7 @@ public: UINT8 m_dsw_select; UINT8 m_rombank; int m_palette_base; - UINT8 *m_janptr96_nvram; + std::unique_ptr<UINT8[]> m_janptr96_nvram; UINT8 m_suzume_bank; UINT8 m_gfx_adr_l; UINT8 m_gfx_adr_m; @@ -883,7 +883,7 @@ WRITE8_MEMBER(royalmah_state::janptr96_rombank_w) WRITE8_MEMBER(royalmah_state::janptr96_rambank_w) { - membank("bank2")->set_base(m_janptr96_nvram + 0x1000 + 0x1000 * data); + membank("bank2")->set_base(m_janptr96_nvram.get() + 0x1000 + 0x1000 * data); } READ8_MEMBER(royalmah_state::janptr96_unknown_r) @@ -4901,9 +4901,9 @@ DRIVER_INIT_MEMBER(royalmah_state,ippatsu) DRIVER_INIT_MEMBER(royalmah_state,janptr96) { - m_janptr96_nvram = auto_alloc_array(machine(), UINT8, 0x1000 * 9); - membank("bank3")->set_base(m_janptr96_nvram); - machine().device<nvram_device>("nvram")->set_base(m_janptr96_nvram, 0x1000 * 9); + m_janptr96_nvram = std::make_unique<UINT8[]>(0x1000 * 9); + membank("bank3")->set_base(m_janptr96_nvram.get()); + machine().device<nvram_device>("nvram")->set_base(m_janptr96_nvram.get(), 0x1000 * 9); } GAME( 1981, royalmj, 0, royalmah, royalmah, driver_device, 0, ROT0, "Nichibutsu", "Royal Mahjong (Japan, v1.13)", 0 ) diff --git a/src/mame/drivers/taitopjc.cpp b/src/mame/drivers/taitopjc.cpp index 47a6e3197a3..1ece5d25454 100644 --- a/src/mame/drivers/taitopjc.cpp +++ b/src/mame/drivers/taitopjc.cpp @@ -145,8 +145,8 @@ public: UINT16 m_dsp_ram[0x1000]; UINT16 m_io_share_ram[0x2000]; - UINT32 *m_screen_ram; - UINT32 *m_pal_ram; + std::unique_ptr<UINT32[]> m_screen_ram; + std::unique_ptr<UINT32[]> m_pal_ram; UINT32 m_video_address; @@ -183,15 +183,15 @@ void taitopjc_state::video_exit() void taitopjc_state::video_start() { - m_screen_ram = auto_alloc_array(machine(), UINT32, 0x40000); - m_pal_ram = auto_alloc_array(machine(), UINT32, 0x8000); + m_screen_ram = std::make_unique<UINT32[]>(0x40000); + m_pal_ram = std::make_unique<UINT32[]>(0x8000); machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(taitopjc_state::video_exit), this)); } UINT32 taitopjc_state::screen_update_taitopjc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - UINT8 *s = (UINT8*)m_screen_ram; + UINT8 *s = (UINT8*)m_screen_ram.get(); int x,y,t,u; bitmap.fill(0x000000, cliprect); diff --git a/src/mame/drivers/taitotz.cpp b/src/mame/drivers/taitotz.cpp index f9f251d39c5..96857812d50 100644 --- a/src/mame/drivers/taitotz.cpp +++ b/src/mame/drivers/taitotz.cpp @@ -593,7 +593,7 @@ public: UINT32 m_displist_addr; int m_count; - taitotz_renderer *m_renderer; + std::unique_ptr<taitotz_renderer> m_renderer; DECLARE_DRIVER_INIT(batlgr2a); DECLARE_DRIVER_INIT(batlgr2); DECLARE_DRIVER_INIT(pwrshovl); @@ -747,7 +747,7 @@ void taitotz_state::video_start() m_texture_ram = std::make_unique<UINT32[]>(0x800000); /* create renderer */ - m_renderer = auto_alloc(machine(), taitotz_renderer(*this, width, height, m_texture_ram.get())); + m_renderer = std::make_unique<taitotz_renderer>(*this, width, height, m_texture_ram.get()); //machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(taitotz_exit), &machine())); } diff --git a/src/mame/includes/apple2.h b/src/mame/includes/apple2.h index 9c2e9624708..0216a80236e 100644 --- a/src/mame/includes/apple2.h +++ b/src/mame/includes/apple2.h @@ -177,7 +177,7 @@ public: double m_joystick_x2_time; double m_joystick_y2_time; apple2_memmap_config m_mem_config; - apple2_meminfo *m_current_meminfo; + std::unique_ptr<apple2_meminfo[]> m_current_meminfo; int m_fdc_diskreg; const UINT8 *m_a2_videoram, *m_a2_videoaux, *m_textgfx_data; UINT32 m_a2_videomask, m_textgfx_datalen; diff --git a/src/mame/includes/gaelco3d.h b/src/mame/includes/gaelco3d.h index cf1bbf93e65..8aaf90e1dc9 100644 --- a/src/mame/includes/gaelco3d.h +++ b/src/mame/includes/gaelco3d.h @@ -96,12 +96,12 @@ public: offs_t m_adsp_incs; offs_t m_adsp_size; dmadac_sound_device *m_dmadac[SOUND_CHANNELS]; - rgb_t *m_palette; + std::unique_ptr<rgb_t[]> m_palette; std::unique_ptr<UINT32[]> m_polydata_buffer; UINT32 m_polydata_count; int m_lastscan; int m_video_changed; - gaelco3d_renderer *m_poly; + std::unique_ptr<gaelco3d_renderer> m_poly; DECLARE_WRITE16_MEMBER(irq_ack_w); DECLARE_WRITE32_MEMBER(irq_ack32_w); DECLARE_WRITE16_MEMBER(sound_data_w); diff --git a/src/mame/includes/galastrm.h b/src/mame/includes/galastrm.h index e5c1be6f2b6..171e06a2467 100644 --- a/src/mame/includes/galastrm.h +++ b/src/mame/includes/galastrm.h @@ -81,7 +81,7 @@ public: struct gs_tempsprite *m_spritelist; struct gs_tempsprite *m_sprite_ptr_pre; bitmap_ind16 m_tmpbitmaps; - galastrm_renderer *m_poly; + std::unique_ptr<galastrm_renderer> m_poly; int m_rsxb; int m_rsyb; diff --git a/src/mame/includes/hng64.h b/src/mame/includes/hng64.h index d35571f41dc..d12beddeba9 100644 --- a/src/mame/includes/hng64.h +++ b/src/mame/includes/hng64.h @@ -340,7 +340,7 @@ public: DECLARE_CUSTOM_INPUT_MEMBER(acc_down_r); DECLARE_CUSTOM_INPUT_MEMBER(brake_down_r); - hng64_poly_renderer* m_poly_renderer; + std::unique_ptr<hng64_poly_renderer> m_poly_renderer; TIMER_CALLBACK_MEMBER(hng64_3dfifo_processed); diff --git a/src/mame/includes/midvunit.h b/src/mame/includes/midvunit.h index e0e6dad9073..196f4e64bb4 100644 --- a/src/mame/includes/midvunit.h +++ b/src/mame/includes/midvunit.h @@ -90,7 +90,7 @@ public: UINT16 m_page_control; UINT8 m_video_changed; emu_timer *m_scanline_timer; - midvunit_renderer *m_poly; + std::unique_ptr<midvunit_renderer> m_poly; DECLARE_WRITE32_MEMBER(midvunit_dma_queue_w); DECLARE_READ32_MEMBER(midvunit_dma_queue_entries_r); DECLARE_READ32_MEMBER(midvunit_dma_trigger_r); diff --git a/src/mame/includes/midyunit.h b/src/mame/includes/midyunit.h index 6f77a89582f..b6b03c975bf 100644 --- a/src/mame/includes/midyunit.h +++ b/src/mame/includes/midyunit.h @@ -82,7 +82,7 @@ public: UINT8 *m_cvsd_protection_base; UINT8 m_autoerase_enable; UINT32 m_palette_mask; - pen_t * m_pen_map; + std::unique_ptr<pen_t[]> m_pen_map; std::unique_ptr<UINT16[]> m_local_videoram; UINT8 m_videobank_select; UINT8 m_yawdim_dma; diff --git a/src/mame/includes/namcos21.h b/src/mame/includes/namcos21.h index 2a80cf7e32f..e35265aa830 100644 --- a/src/mame/includes/namcos21.h +++ b/src/mame/includes/namcos21.h @@ -78,7 +78,7 @@ public: std::unique_ptr<UINT8[]> m_pointram; int m_pointram_idx; UINT16 m_pointram_control; - dsp_state *m_mpDspState; + std::unique_ptr<dsp_state> m_mpDspState; int m_mbNeedsKickstart; UINT32 m_pointrom_idx; UINT8 m_mPointRomMSB; diff --git a/src/mame/includes/stv.h b/src/mame/includes/stv.h index 51ea07b19c5..44c765eac2a 100644 --- a/src/mame/includes/stv.h +++ b/src/mame/includes/stv.h @@ -293,7 +293,7 @@ public: struct stv_vdp1_poly_scanline scanline[512]; }; - struct stv_vdp1_poly_scanline_data* stv_vdp1_shading_data; + std::unique_ptr<struct stv_vdp1_poly_scanline_data> stv_vdp1_shading_data; struct stv_vdp2_sprite_list { diff --git a/src/mame/includes/taito_f2.h b/src/mame/includes/taito_f2.h index b020660421e..1d75ce57e28 100644 --- a/src/mame/includes/taito_f2.h +++ b/src/mame/includes/taito_f2.h @@ -55,7 +55,7 @@ public: optional_shared_ptr<UINT16> m_cchip2_ram; // for megablst only /* video-related */ - struct f2_tempsprite *m_spritelist; + std::unique_ptr<struct f2_tempsprite[]> m_spritelist; int m_sprite_type; UINT16 m_spritebank[8]; diff --git a/src/mame/includes/tiamc1.h b/src/mame/includes/tiamc1.h index cb2377c329f..a6a7096efb7 100644 --- a/src/mame/includes/tiamc1.h +++ b/src/mame/includes/tiamc1.h @@ -22,7 +22,7 @@ public: UINT8 m_bg_hshift; tilemap_t *m_bg_tilemap1; tilemap_t *m_bg_tilemap2; - rgb_t *m_palette_ptr; + std::unique_ptr<rgb_t[]> m_palette_ptr; DECLARE_WRITE8_MEMBER(tiamc1_control_w); DECLARE_WRITE8_MEMBER(tiamc1_videoram_w); DECLARE_WRITE8_MEMBER(tiamc1_bankswitch_w); diff --git a/src/mame/includes/williams.h b/src/mame/includes/williams.h index 1a586791475..a647edc287d 100644 --- a/src/mame/includes/williams.h +++ b/src/mame/includes/williams.h @@ -46,7 +46,7 @@ public: UINT8 m_blitter_window_enable; UINT8 m_cocktail; UINT8 m_port_select; - rgb_t *m_palette_lookup; + std::unique_ptr<rgb_t[]> m_palette_lookup; UINT8 m_blitterram[8]; UINT8 m_blitter_xor; UINT8 m_blitter_remap_index; diff --git a/src/mame/includes/xbox.h b/src/mame/includes/xbox.h index 8dd923394f0..eec1d3655de 100644 --- a/src/mame/includes/xbox.h +++ b/src/mame/includes/xbox.h @@ -310,7 +310,7 @@ public: OHCIIsochronousTransferDescriptor isochronous_transfer_descriptor; } ohcist; UINT8 pic16lc_buffer[0xff]; - nv2a_renderer *nvidia_nv2a; + std::unique_ptr<nv2a_renderer> nvidia_nv2a; bool debug_irq_active; int debug_irq_number; required_device<cpu_device> m_maincpu; diff --git a/src/mame/machine/apple2.cpp b/src/mame/machine/apple2.cpp index 27378e5d97f..dd227dc5f93 100644 --- a/src/mame/machine/apple2.cpp +++ b/src/mame/machine/apple2.cpp @@ -72,7 +72,7 @@ void apple2_state::apple2_update_memory() { for (i = 0; m_mem_config.memmap[i].end; i++) ; - m_current_meminfo = auto_alloc_array(machine(), apple2_meminfo, i); + m_current_meminfo = std::make_unique<apple2_meminfo[]>(i); full_update = 1; } diff --git a/src/mame/machine/ns10crypt.cpp b/src/mame/machine/ns10crypt.cpp index b39dcd70948..e639108166c 100644 --- a/src/mame/machine/ns10crypt.cpp +++ b/src/mame/machine/ns10crypt.cpp @@ -172,7 +172,7 @@ UINT16 ns10_decrypter_device::decrypt(UINT16 cipherword) void ns10_decrypter_device::device_start() { _active = false; - _reducer = auto_alloc(machine(), gf2_reducer()); + _reducer = std::make_unique<gf2_reducer>(); } void ns10_decrypter_device::init(int iv) diff --git a/src/mame/machine/ns10crypt.h b/src/mame/machine/ns10crypt.h index 9be7f7d7252..163a4ac21c7 100644 --- a/src/mame/machine/ns10crypt.h +++ b/src/mame/machine/ns10crypt.h @@ -44,7 +44,7 @@ private: bool _active; const ns10_crypto_logic& _logic; static const int initSbox[16]; - const gf2_reducer *_reducer; + std::unique_ptr<const gf2_reducer>_reducer; void device_start() override; void init(int iv); diff --git a/src/mame/machine/smartmed.cpp b/src/mame/machine/smartmed.cpp index f8295a4110d..9ba88c447fe 100644 --- a/src/mame/machine/smartmed.cpp +++ b/src/mame/machine/smartmed.cpp @@ -119,7 +119,7 @@ void nand_device::device_start() m_accumulated_status = 0; m_mp_opcode = 0; m_mode_3065 = 0; - m_pagereg = auto_alloc_array(machine(), UINT8, m_page_total_size); + m_pagereg = std::make_unique<UINT8[]>(m_page_total_size); #ifdef SMARTMEDIA_IMAGE_SAVE m_image_format = 0; @@ -151,7 +151,7 @@ bool smartmedia_image_device::smartmedia_format_1() m_num_pages = get_UINT32BE(custom_header.num_pages); m_log2_pages_per_block = get_UINT32BE(custom_header.log2_pages_per_block); m_data_ptr = auto_alloc_array(machine(), UINT8, m_page_total_size*m_num_pages); - m_data_uid_ptr = auto_alloc_array(machine(), UINT8, 256 + 16); + m_data_uid_ptr = std::make_unique<UINT8[]>(256 + 16); m_mode = SM_M_INIT; m_pointer_mode = SM_PM_A; m_page_addr = 0; @@ -160,7 +160,7 @@ bool smartmedia_image_device::smartmedia_format_1() if (!is_readonly()) m_status |= 0x80; m_accumulated_status = 0; - m_pagereg = auto_alloc_array(machine(), UINT8, m_page_total_size); + m_pagereg = std::make_unique<UINT8[]>(m_page_total_size); memset( m_id, 0, sizeof( m_id)); m_id_len = 0; m_col_address_cycles = 1; @@ -178,7 +178,7 @@ bool smartmedia_image_device::smartmedia_format_1() m_id_len = 3; fread(m_id, m_id_len); fread(&m_mp_opcode, 1); - fread(m_data_uid_ptr, 256 + 16); + fread(m_data_uid_ptr.get(), 256 + 16); } fread(m_data_ptr, m_page_total_size*m_num_pages); @@ -246,7 +246,7 @@ bool smartmedia_image_device::smartmedia_format_2() } m_data_ptr = auto_alloc_array(machine(), UINT8, m_page_total_size*m_num_pages); - m_data_uid_ptr = auto_alloc_array(machine(), UINT8, 256 + 16); + m_data_uid_ptr = std::make_unique<UINT8[]>(256 + 16); m_mode = SM_M_INIT; m_pointer_mode = SM_PM_A; m_page_addr = 0; @@ -255,7 +255,7 @@ bool smartmedia_image_device::smartmedia_format_2() if (!is_readonly()) m_status |= 0x80; m_accumulated_status = 0; - m_pagereg = auto_alloc_array(machine(), UINT8, m_page_total_size); + m_pagereg = std::make_unique<UINT8[]>(m_page_total_size); m_id_len = 3; memcpy( m_id, custom_header.data1, m_id_len); m_mp_opcode = 0; @@ -265,10 +265,10 @@ bool smartmedia_image_device::smartmedia_format_2() for (i=0;i<8;i++) { - memcpy( m_data_uid_ptr + i * 32, custom_header.data2, 16); + memcpy( m_data_uid_ptr.get() + i * 32, custom_header.data2, 16); for (j=0;j<16;j++) m_data_uid_ptr[i*32+16+j] = custom_header.data2[j] ^ 0xFF; } - memcpy( m_data_uid_ptr + 256, custom_header.data3, 16); + memcpy( m_data_uid_ptr.get() + 256, custom_header.data3, 16); fread(m_data_ptr, m_page_total_size*m_num_pages); @@ -343,7 +343,7 @@ void smartmedia_image_device::call_unload() m_byte_addr = 0; m_status = 0xC0; m_accumulated_status = 0; - m_pagereg = auto_alloc_array(machine(), UINT8, m_page_total_size); + m_pagereg = std::make_unique<UINT8[]>(m_page_total_size); memset( m_id, 0, sizeof( m_id)); m_id_len = 0; m_mp_opcode = 0; @@ -440,7 +440,7 @@ void nand_device::command_w(UINT8 data) m_page_addr = 0; m_addr_load_ptr = 0; m_program_byte_count = 0; - memset(m_pagereg, 0xff, m_page_total_size); + memset(m_pagereg.get(), 0xff, m_page_total_size); break; case 0x10: // Page Program (2nd cycle) case 0x15: diff --git a/src/mame/machine/smartmed.h b/src/mame/machine/smartmed.h index 29268f2652e..a49ba0e8d1c 100644 --- a/src/mame/machine/smartmed.h +++ b/src/mame/machine/smartmed.h @@ -160,8 +160,8 @@ protected: // 0 means no card loaded int m_log2_pages_per_block; // log2 of number of pages per erase block (usually 4 or 5) - UINT8 *m_data_ptr; // FEEPROM data area - UINT8 *m_data_uid_ptr; + UINT8* m_data_ptr; // FEEPROM data area + std::unique_ptr<UINT8[]> m_data_uid_ptr; sm_mode_t m_mode; // current operation mode pointer_sm_mode_t m_pointer_mode; // pointer mode @@ -173,7 +173,7 @@ protected: int m_status; // current status int m_accumulated_status; // accumulated status - UINT8 *m_pagereg; // page register used by program command + std::unique_ptr<UINT8[]> m_pagereg; // page register used by program command UINT8 m_id[5]; // chip ID UINT8 m_mp_opcode; // multi-plane operation code diff --git a/src/mame/machine/subsino.cpp b/src/mame/machine/subsino.cpp index 37272d11c34..1389058756f 100644 --- a/src/mame/machine/subsino.cpp +++ b/src/mame/machine/subsino.cpp @@ -86,7 +86,7 @@ void dump_decrypted(running_machine& machine, UINT8* decrypt) void subsino_decrypt(running_machine& machine, void (*bitswaps)(UINT8 *decrypt, int i), const UINT8 *xors, int size) { int i; - UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x10000); + std::unique_ptr<UINT8[]> decrypt = std::make_unique<UINT8[]>(0x10000); UINT8* region = machine.root_device().memregion("maincpu")->base(); for (i=0;i<0x10000;i++) @@ -94,7 +94,7 @@ void subsino_decrypt(running_machine& machine, void (*bitswaps)(UINT8 *decrypt, if (i<size) { decrypt[i] = region[i]^xors[i&7]; - bitswaps(decrypt, i); + bitswaps(decrypt.get(), i); } else { @@ -102,5 +102,5 @@ void subsino_decrypt(running_machine& machine, void (*bitswaps)(UINT8 *decrypt, } } // dump_decrypted(machine, decrypt); - memcpy(region, decrypt, 0x10000); + memcpy(region, decrypt.get(), 0x10000); } diff --git a/src/mame/machine/xbox.cpp b/src/mame/machine/xbox.cpp index f584f62ce1d..4ee92fd1116 100644 --- a/src/mame/machine/xbox.cpp +++ b/src/mame/machine/xbox.cpp @@ -1427,7 +1427,7 @@ ADDRESS_MAP_END void xbox_base_state::machine_start() { - nvidia_nv2a = auto_alloc(machine(), nv2a_renderer(machine())); + nvidia_nv2a = std::make_unique<nv2a_renderer>(machine()); memset(pic16lc_buffer, 0, sizeof(pic16lc_buffer)); pic16lc_buffer[0] = 'B'; pic16lc_buffer[4] = 0; // A/V connector, 2=vga diff --git a/src/mame/video/gaelco3d.cpp b/src/mame/video/gaelco3d.cpp index 62b21c1b8e3..49164395510 100644 --- a/src/mame/video/gaelco3d.cpp +++ b/src/mame/video/gaelco3d.cpp @@ -68,14 +68,14 @@ gaelco3d_renderer::gaelco3d_renderer(gaelco3d_state &state) void gaelco3d_state::video_start() { - m_poly = auto_alloc(machine(), gaelco3d_renderer(*this)); + m_poly = std::make_unique<gaelco3d_renderer>(*this); - m_palette = auto_alloc_array(machine(), rgb_t, 32768); + m_palette = std::make_unique<rgb_t[]>(32768); m_polydata_buffer = std::make_unique<UINT32[]>(MAX_POLYDATA); /* save states */ - save_pointer(NAME(m_palette), 32768); + save_pointer(NAME(m_palette.get()), 32768); save_pointer(NAME(m_polydata_buffer.get()), MAX_POLYDATA); save_item(NAME(m_polydata_count)); save_item(NAME(m_lastscan)); @@ -208,7 +208,7 @@ void gaelco3d_renderer::render_noz_noperspective(INT32 scanline, const extent_t float voz_step = object.voz_dx * zbase; int zbufval = (int)(-object.z0 * zbase); offs_t endmask = m_texture_size - 1; - const rgb_t *palsource = m_state.m_palette + object.color; + const rgb_t *palsource = m_state.m_palette.get() + object.color; UINT32 tex = object.tex; UINT16 *dest = &m_screenbits.pix16(scanline); UINT16 *zbuf = &m_zbuffer.pix16(scanline); @@ -246,7 +246,7 @@ void gaelco3d_renderer::render_normal(INT32 scanline, const extent_t &extent, co float uoz_dx = object.uoz_dx; float voz_dx = object.voz_dx; offs_t endmask = m_texture_size - 1; - const rgb_t *palsource = m_state.m_palette + object.color; + const rgb_t *palsource = m_state.m_palette.get() + object.color; UINT32 tex = object.tex; float z0 = object.z0; UINT16 *dest = &m_screenbits.pix16(scanline); @@ -296,7 +296,7 @@ void gaelco3d_renderer::render_alphablend(INT32 scanline, const extent_t &extent float uoz_dx = object.uoz_dx; float voz_dx = object.voz_dx; offs_t endmask = m_texture_size - 1; - const rgb_t *palsource = m_state.m_palette + object.color; + const rgb_t *palsource = m_state.m_palette.get() + object.color; UINT32 tex = object.tex; float z0 = object.z0; UINT16 *dest = &m_screenbits.pix16(scanline); diff --git a/src/mame/video/galastrm.cpp b/src/mame/video/galastrm.cpp index 46bc722ab86..751fbb5d17a 100644 --- a/src/mame/video/galastrm.cpp +++ b/src/mame/video/galastrm.cpp @@ -21,7 +21,7 @@ void galastrm_state::video_start() { m_spritelist = auto_alloc_array(machine(), struct gs_tempsprite, 0x4000); - m_poly = auto_alloc(machine(), galastrm_renderer(*this)); + m_poly = std::make_unique<galastrm_renderer>(*this); m_screen->register_screen_bitmap(m_tmpbitmaps); m_screen->register_screen_bitmap(m_poly->screenbits()); diff --git a/src/mame/video/hng64.cpp b/src/mame/video/hng64.cpp index a85a820b308..a666474bb5e 100644 --- a/src/mame/video/hng64.cpp +++ b/src/mame/video/hng64.cpp @@ -1285,7 +1285,7 @@ void hng64_state::video_start() m_additive_tilemap_debug = 0; // Rasterizer creation - m_poly_renderer = auto_alloc(machine(), hng64_poly_renderer(*this)); + m_poly_renderer = std::make_unique<hng64_poly_renderer>(*this); // 3d information m_dl = std::make_unique<UINT16[]>(0x100); diff --git a/src/mame/video/kaneko_spr.cpp b/src/mame/video/kaneko_spr.cpp index d37d11bb672..87d5ed0b371 100644 --- a/src/mame/video/kaneko_spr.cpp +++ b/src/mame/video/kaneko_spr.cpp @@ -70,7 +70,7 @@ 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_first_sprite = std::make_unique<struct kan_tempsprite[]>(0x400); m_sprites_regs = make_unique_clear<UINT16[]>(0x20/2); m_screen->register_screen_bitmap(m_sprites_bitmap); @@ -358,7 +358,7 @@ void kaneko16_sprite_device::kaneko16_draw_sprites(_BitmapClass &bitmap, const r int max = (m_screen->width() > 0x100) ? (0x200<<6) : (0x100<<6); int i = 0; - struct kan_tempsprite *s = m_first_sprite; + struct kan_tempsprite *s = m_first_sprite.get(); /* These values are latched from the last sprite. */ int x = 0; @@ -451,7 +451,7 @@ void kaneko16_sprite_device::kaneko16_draw_sprites(_BitmapClass &bitmap, const r /* Let's finally draw the sprites we buffered, in reverse order (for pdrawgfx) */ - for (s--; s >= m_first_sprite; s--) + for (s--; s >= m_first_sprite.get(); s--) { int curr_pri = s->priority; diff --git a/src/mame/video/kaneko_spr.h b/src/mame/video/kaneko_spr.h index 1448a753265..44639a2351c 100644 --- a/src/mame/video/kaneko_spr.h +++ b/src/mame/video/kaneko_spr.h @@ -81,7 +81,7 @@ private: UINT16 m_sprite_flipy; std::unique_ptr<UINT16[]> m_sprites_regs; - struct kan_tempsprite *m_first_sprite; + std::unique_ptr<struct kan_tempsprite[]> m_first_sprite; int m_keep_sprites; bitmap_ind16 m_sprites_bitmap; diff --git a/src/mame/video/midvunit.cpp b/src/mame/video/midvunit.cpp index 489ae0d52ae..fdba2b581d1 100644 --- a/src/mame/video/midvunit.cpp +++ b/src/mame/video/midvunit.cpp @@ -70,7 +70,7 @@ void midvunit_state::video_start() { m_scanline_timer = timer_alloc(TIMER_SCANLINE); - m_poly = auto_alloc(machine(), midvunit_renderer(*this)); + m_poly = std::make_unique<midvunit_renderer>(*this); save_item(NAME(m_video_regs)); save_item(NAME(m_dma_data)); diff --git a/src/mame/video/midyunit.cpp b/src/mame/video/midyunit.cpp index cca4343fde3..38c40b88ebf 100644 --- a/src/mame/video/midyunit.cpp +++ b/src/mame/video/midyunit.cpp @@ -44,7 +44,7 @@ VIDEO_START_MEMBER(midyunit_state,common) /* allocate memory */ m_cmos_ram = std::make_unique<UINT16[]>((0x2000 * 4)/2); m_local_videoram = make_unique_clear<UINT16[]>(0x80000/2); - m_pen_map = auto_alloc_array(machine(), pen_t, 65536); + m_pen_map = std::make_unique<pen_t[]>(65536); machine().device<nvram_device>("nvram")->set_base(m_cmos_ram.get(), 0x2000 * 4); diff --git a/src/mame/video/neogeo_spr.cpp b/src/mame/video/neogeo_spr.cpp index 947090e7de7..7f075b28797 100644 --- a/src/mame/video/neogeo_spr.cpp +++ b/src/mame/video/neogeo_spr.cpp @@ -27,11 +27,11 @@ neosprite_base_device::neosprite_base_device(const machine_config &mconfig, cons void neosprite_base_device::device_start() { - m_videoram = auto_alloc_array(machine(), UINT16, 0x8000 + 0x800); - m_videoram_drawsource = m_videoram; + m_videoram = std::make_unique<UINT16[]>(0x8000 + 0x800); + m_videoram_drawsource = m_videoram.get(); /* clear allocated memory */ - memset(m_videoram, 0x00, (0x8000 + 0x800) * sizeof(UINT16)); + memset(m_videoram.get(), 0x00, (0x8000 + 0x800) * sizeof(UINT16)); create_sprite_line_timer(); create_auto_animation_timer(); @@ -48,7 +48,7 @@ void neosprite_base_device::device_start() m_auto_animation_frame_counter = 0; /* register for state saving */ - save_pointer(NAME(m_videoram), 0x8000 + 0x800); + save_pointer(NAME(m_videoram.get()), 0x8000 + 0x800); save_item(NAME(m_vram_offset)); save_item(NAME(m_vram_read_buffer)); save_item(NAME(m_vram_modulo)); @@ -772,16 +772,16 @@ void neosprite_midas_device::device_start() { neosprite_base_device::device_start(); - m_videoram_buffer = auto_alloc_array(machine(), UINT16, 0x8000 + 0x800); - m_videoram_drawsource = m_videoram_buffer; + m_videoram_buffer = std::make_unique<UINT16[]>(0x8000 + 0x800); + m_videoram_drawsource = m_videoram_buffer.get(); - memset(m_videoram_buffer, 0x00, (0x8000 + 0x800) * sizeof(UINT16)); + memset(m_videoram_buffer.get(), 0x00, (0x8000 + 0x800) * sizeof(UINT16)); } void neosprite_midas_device::buffer_vram() { - memcpy(m_videoram_buffer, m_videoram, (0x8000 + 0x800) * sizeof(UINT16)); + memcpy(m_videoram_buffer.get(), m_videoram.get(), (0x8000 + 0x800) * sizeof(UINT16)); } inline void neosprite_midas_device::draw_fixed_layer_2pixels(UINT32*&pixel_addr, int offset, UINT8* gfx_base, const pen_t* char_pens) diff --git a/src/mame/video/neogeo_spr.h b/src/mame/video/neogeo_spr.h index b1f08bfd8e4..6c2f525544f 100644 --- a/src/mame/video/neogeo_spr.h +++ b/src/mame/video/neogeo_spr.h @@ -51,7 +51,7 @@ public: void set_screen(screen_device* screen); void set_pens(const pen_t* pens); - UINT16 *m_videoram; + std::unique_ptr<UINT16[]> m_videoram; UINT16 *m_videoram_drawsource; UINT16 m_vram_offset; @@ -133,7 +133,7 @@ public: virtual void draw_pixel(int romaddr, UINT32* dst, const pen_t *line_pens) override; - UINT16* m_videoram_buffer; + std::unique_ptr<UINT16[]> m_videoram_buffer; void buffer_vram(); virtual void draw_fixed_layer_2pixels(UINT32*&pixel_addr, int offset, UINT8* gfx_base, const pen_t* char_pens) override; virtual void set_sprite_region(UINT8* region_sprites, UINT32 region_sprites_size) override; diff --git a/src/mame/video/ppu2c0x.cpp b/src/mame/video/ppu2c0x.cpp index 19c0143ffd1..0c15efb3c70 100644 --- a/src/mame/video/ppu2c0x.cpp +++ b/src/mame/video/ppu2c0x.cpp @@ -224,8 +224,8 @@ void ppu2c0x_device::device_start() /* allocate a screen bitmap, videomem and spriteram, a dirtychar array and the monochromatic colortable */ m_bitmap = std::make_unique<bitmap_ind16>(VISIBLE_SCREEN_WIDTH, VISIBLE_SCREEN_HEIGHT); m_spriteram = make_unique_clear<UINT8[]>(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)); + m_colortable = std::make_unique<pen_t[]>(ARRAY_LENGTH(default_colortable)); + m_colortable_mono = std::make_unique<pen_t[]>(ARRAY_LENGTH(default_colortable_mono)); /* initialize the color tables */ for (int i = 0; i < ARRAY_LENGTH(default_colortable_mono); i++) @@ -257,8 +257,8 @@ void ppu2c0x_device::device_start() save_item(NAME(m_draw_phase)); save_item(NAME(m_tilecount)); 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_pointer(NAME(m_colortable.get()), ARRAY_LENGTH(default_colortable)); + save_pointer(NAME(m_colortable_mono.get()), ARRAY_LENGTH(default_colortable_mono)); save_item(NAME(*m_bitmap)); } @@ -571,12 +571,12 @@ void ppu2c0x_device::draw_background( UINT8 *line_priority ) if (m_regs[PPU_CONTROL1] & PPU_CONTROL1_DISPLAY_MONO) { color_mask = 0xf0; - color_table = m_colortable_mono; + color_table = m_colortable_mono.get(); } else { color_mask = 0xff; - color_table = m_colortable; + color_table = m_colortable.get(); } /* cache the background pen */ diff --git a/src/mame/video/ppu2c0x.h b/src/mame/video/ppu2c0x.h index 09097b720a4..8a21d51f0b8 100644 --- a/src/mame/video/ppu2c0x.h +++ b/src/mame/video/ppu2c0x.h @@ -190,8 +190,8 @@ public: std::unique_ptr<bitmap_ind16> m_bitmap; /* target bitmap */ std::unique_ptr<UINT8[]> 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 */ + std::unique_ptr<pen_t[]> m_colortable; /* color table modified at run time */ + std::unique_ptr<pen_t[]> m_colortable_mono; /* monochromatic color table modified at run time */ int m_scanline; /* scanline count */ ppu2c0x_scanline_delegate m_scanline_callback_proc; /* optional scanline callback */ ppu2c0x_hblank_delegate m_hblank_callback_proc; /* optional hblank callback */ diff --git a/src/mame/video/taito_f2.cpp b/src/mame/video/taito_f2.cpp index 7818f7a4d73..85aa44d8839 100644 --- a/src/mame/video/taito_f2.cpp +++ b/src/mame/video/taito_f2.cpp @@ -36,7 +36,7 @@ void taitof2_state::taitof2_core_vh_start (int sprite_type, int hide, int flip_h m_spriteram_delayed = make_unique_clear<UINT16[]>(m_spriteram.bytes() / 2); m_spriteram_buffered = make_unique_clear<UINT16[]>(m_spriteram.bytes() / 2); - m_spritelist = auto_alloc_array_clear(machine(), struct f2_tempsprite, 0x400); + m_spritelist = make_unique_clear<struct f2_tempsprite[]>(0x400); for (i = 0; i < 8; i ++) { @@ -487,7 +487,7 @@ void taitof2_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, c /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list while processing sprite ram and then draw them all at the end */ - struct f2_tempsprite *sprite_ptr = m_spritelist; + struct f2_tempsprite *sprite_ptr = m_spritelist.get(); /* must remember enable status from last frame because driftout fails to reactivate them from a certain point onwards. */ @@ -775,7 +775,7 @@ void taitof2_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, c /* this happens only if primsks != NULL */ - while (sprite_ptr != m_spritelist) + while (sprite_ptr != m_spritelist.get()) { sprite_ptr--; diff --git a/src/mame/video/tc0780fpa.cpp b/src/mame/video/tc0780fpa.cpp index 5de33f613f4..f8bca1a8d84 100644 --- a/src/mame/video/tc0780fpa.cpp +++ b/src/mame/video/tc0780fpa.cpp @@ -416,7 +416,7 @@ void tc0780fpa_device::device_start() m_texture = std::make_unique<UINT8[]>(0x400000); m_poly_fifo = std::make_unique<UINT16[]>(POLY_FIFO_SIZE); - m_renderer = auto_alloc(machine(), tc0780fpa_renderer(*this, *m_screen, m_texture.get())); + m_renderer = std::make_unique<tc0780fpa_renderer>(*this, *m_screen, m_texture.get()); save_pointer(NAME(m_texture.get()), 0x400000); save_pointer(NAME(m_poly_fifo.get()), POLY_FIFO_SIZE); diff --git a/src/mame/video/tc0780fpa.h b/src/mame/video/tc0780fpa.h index 21dec1edd54..41a5fb2a21a 100644 --- a/src/mame/video/tc0780fpa.h +++ b/src/mame/video/tc0780fpa.h @@ -69,7 +69,7 @@ private: std::unique_ptr<UINT16[]> m_poly_fifo; int m_poly_fifo_ptr; - tc0780fpa_renderer *m_renderer; + std::unique_ptr<tc0780fpa_renderer> m_renderer; UINT16 m_tex_address; UINT16 m_tex_offset; diff --git a/src/mame/video/tiamc1.cpp b/src/mame/video/tiamc1.cpp index fc729293b15..8bdf45ff7e3 100644 --- a/src/mame/video/tiamc1.cpp +++ b/src/mame/video/tiamc1.cpp @@ -95,7 +95,7 @@ PALETTE_INIT_MEMBER(tiamc1_state, tiamc1) int r, g, b, ir, ig, ib; float tcol; - m_palette_ptr = auto_alloc_array(machine(), rgb_t, 256); + m_palette_ptr = std::make_unique<rgb_t[]>(256); for (col = 0; col < 256; col++) { ir = (col >> 3) & 7; diff --git a/src/mame/video/williams.cpp b/src/mame/video/williams.cpp index 0f4a01d3688..1cdd84fd823 100644 --- a/src/mame/video/williams.cpp +++ b/src/mame/video/williams.cpp @@ -276,7 +276,7 @@ void williams_state::create_palette_lookup() 2, resistances_b, weights_b, 0, 0); /* build a palette lookup */ - m_palette_lookup = auto_alloc_array(machine(), rgb_t, 256); + m_palette_lookup = std::make_unique<rgb_t[]>(256); for (i = 0; i < 256; i++) { int r = combine_3_weights(weights_r, BIT(i,0), BIT(i,1), BIT(i,2)); |