some manual changes to unique_ptr (nw)

This commit is contained in:
Miodrag Milanovic 2015-12-25 11:15:13 +01:00
parent 151a0adf54
commit 44ac295160
16 changed files with 43 additions and 44 deletions

View File

@ -78,7 +78,7 @@ public:
int m_tc0610_1_addr;
UINT32 m_mem[2];
INT16 m_tc0610_ctrl_reg[2][8];
struct gs_tempsprite *m_spritelist;
std::unique_ptr<gs_tempsprite[]> m_spritelist;
struct gs_tempsprite *m_sprite_ptr_pre;
bitmap_ind16 m_tmpbitmaps;
std::unique_ptr<galastrm_renderer> m_poly;

View File

@ -43,7 +43,7 @@ public:
UINT16 m_coin_word;
UINT16 m_frame_counter;
UINT16 m_port_sel;
struct gfx_tempsprite *m_spritelist;
std::unique_ptr<gfx_tempsprite[]> m_spritelist;
UINT16 m_rotate_ctrl[8];
rectangle m_hack_cliprect;

View File

@ -44,7 +44,7 @@ public:
bool m_coin_lockout;
UINT16 m_coin_word;
struct gb_tempsprite *m_spritelist;
std::unique_ptr<gb_tempsprite[]> m_spritelist;
UINT32 m_mem[2];
DECLARE_WRITE32_MEMBER(gunbustr_input_w);

View File

@ -25,6 +25,7 @@ public:
required_device<k055673_device> m_k055673;
required_shared_ptr<UINT16> m_gx_workram;
optional_shared_ptr<UINT16> m_spriteram;
std::unique_ptr<UINT8[]> m_decoded;
UINT8 m_mw_irq_control;
int m_cur_sound_region;

View File

@ -56,7 +56,7 @@ public:
required_shared_ptr<UINT16> m_spriteram;
/* video-related */
struct othunder_tempsprite *m_spritelist;
std::unique_ptr<othunder_tempsprite[]> m_spritelist;
/* misc */
int m_vblank_irq;

View File

@ -34,7 +34,7 @@ public:
required_shared_ptr<UINT32> m_spriteram;
required_shared_ptr<UINT32> m_shared_ram;
struct schs_tempsprite *m_spritelist;
std::unique_ptr<schs_tempsprite[]> m_spritelist;
UINT32 m_mem[2];
DECLARE_READ16_MEMBER(shared_ram_r);

View File

@ -45,6 +45,8 @@ public:
INT32 m_bg2_scroll_y;
bitmap_ind16 m_temp_bitmap;
std::unique_ptr<UINT16[]> m_sprite_ram_buffered;
std::unique_ptr<UINT8[]> m_decoded_16;
std::unique_ptr<UINT8[]> m_decoded_32;
int m_is_mask_spr[1024/16];
DECLARE_READ8_MEMBER(m68k_shared_r);
DECLARE_WRITE8_MEMBER(m68k_shared_w);

View File

@ -45,7 +45,7 @@ public:
UINT16 m_coin_word;
UINT16 m_port_sel;
int m_frame_counter;
struct uf_tempsprite *m_spritelist;
std::unique_ptr<uf_tempsprite[]> m_spritelist;
UINT16 m_rotate_ctrl[8];
UINT8 m_dislayer[6];
required_shared_ptr<UINT32> m_spriteram;

View File

@ -19,7 +19,7 @@ galastrm_renderer::galastrm_renderer(galastrm_state& state)
void galastrm_state::video_start()
{
m_spritelist = auto_alloc_array(machine(), struct gs_tempsprite, 0x4000);
m_spritelist = std::make_unique<gs_tempsprite[]>(0x4000);
m_poly = std::make_unique<galastrm_renderer>(*this);
@ -87,7 +87,7 @@ void galastrm_state::draw_sprites_pre(int x_offs, int y_offs)
/* 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 */
m_sprite_ptr_pre = m_spritelist;
m_sprite_ptr_pre = m_spritelist.get();
for (offs = (m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
{
@ -184,7 +184,7 @@ void galastrm_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c
{
struct gs_tempsprite *sprite_ptr = m_sprite_ptr_pre;
while (sprite_ptr != m_spritelist)
while (sprite_ptr != m_spritelist.get())
{
sprite_ptr--;

View File

@ -7,7 +7,7 @@
void groundfx_state::video_start()
{
m_spritelist = auto_alloc_array(machine(), struct gfx_tempsprite, 0x4000);
m_spritelist = std::make_unique<gfx_tempsprite[]>(0x4000);
/* Hack */
m_hack_cliprect.set(69, 250, 24 + 5, 24 + 44);
@ -74,7 +74,7 @@ void groundfx_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,co
/* 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 gfx_tempsprite *sprite_ptr = m_spritelist;
struct gfx_tempsprite *sprite_ptr = m_spritelist.get();
for (offs = (m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
{
@ -170,7 +170,7 @@ void groundfx_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,co
}
/* this happens only if primsks != NULL */
while (sprite_ptr != m_spritelist)
while (sprite_ptr != m_spritelist.get())
{
const rectangle *clipper;

View File

@ -7,7 +7,7 @@
void gunbustr_state::video_start()
{
m_spritelist = auto_alloc_array(machine(), struct gb_tempsprite, 0x4000);
m_spritelist = std::make_unique<gb_tempsprite[]>(0x4000);
}
/************************************************************
@ -69,7 +69,7 @@ void gunbustr_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,co
/* 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 gb_tempsprite *sprite_ptr = m_spritelist;
struct gb_tempsprite *sprite_ptr = m_spritelist.get();
for (offs = (m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
{
@ -181,7 +181,7 @@ logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks);
}
/* this happens only if primsks != NULL */
while (sprite_ptr != m_spritelist)
while (sprite_ptr != m_spritelist.get())
{
sprite_ptr--;

View File

@ -19,12 +19,12 @@ void mystwarr_state::decode_tiles()
UINT8 *s = memregion("gfx1")->base();
int len = memregion("gfx1")->bytes();
UINT8 *pFinish = s+len-3;
UINT8 *d, *decoded;
UINT8 *d;
int gfxnum = m_k056832->get_gfx_num();
decoded = auto_alloc_array(machine(), UINT8, len);
d = decoded;
m_decoded = std::make_unique<UINT8[]>(len);
d = m_decoded.get();
// now convert the data into a drawable format so we can decode it
while (s < pFinish)
@ -52,7 +52,7 @@ void mystwarr_state::decode_tiles()
d += 5;
}
m_gfxdecode->gfx(gfxnum)->set_source(decoded);
m_gfxdecode->gfx(gfxnum)->set_source(m_decoded.get());
}

View File

@ -9,7 +9,7 @@ void othunder_state::video_start()
/* Up to $800/8 big sprites, requires 0x100 * sizeof(*spritelist)
Multiply this by 32 to give room for the number of small sprites,
which are what actually get put in the structure. */
m_spritelist = auto_alloc_array(machine(), struct othunder_tempsprite, 0x2000);
m_spritelist = std::make_unique<othunder_tempsprite[]>(0x2000);
}
@ -77,7 +77,7 @@ void othunder_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap,
/* 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 othunder_tempsprite *sprite_ptr = m_spritelist;
struct othunder_tempsprite *sprite_ptr = m_spritelist.get();
for (offs = (m_spriteram.bytes() / 2) - 4; offs >= 0; offs -= 4)
{
@ -180,7 +180,7 @@ logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks);
}
/* this happens only if primsks != NULL */
while (sprite_ptr != m_spritelist)
while (sprite_ptr != m_spritelist.get())
{
sprite_ptr--;

View File

@ -5,7 +5,7 @@
void superchs_state::video_start()
{
m_spritelist = auto_alloc_array(machine(), struct schs_tempsprite, 0x4000);
m_spritelist = std::make_unique<schs_tempsprite[]>(0x4000);
}
/************************************************************
@ -67,7 +67,7 @@ void superchs_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,co
/* 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 schs_tempsprite *sprite_ptr = m_spritelist;
struct schs_tempsprite *sprite_ptr = m_spritelist.get();
for (offs = (m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
{
@ -179,7 +179,7 @@ logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks);
}
/* this happens only if primsks != NULL */
while (sprite_ptr != m_spritelist)
while (sprite_ptr != m_spritelist.get())
{
sprite_ptr--;

View File

@ -283,29 +283,28 @@ void tceptor_state::decode_sprite16(const char * region)
UINT8 *src = memregion(region)->base();
int len = memregion(region)->bytes();
UINT8 *dst;
int i, y;
dst = auto_alloc_array(machine(), UINT8, len);
m_decoded_16 = std::make_unique<UINT8[]>(len);
for (i = 0; i < len / (4*4*16); i++)
for (y = 0; y < 16; y++)
{
memcpy(&dst[(i*4 + 0) * (2*16*16/8) + y * (2*16/8)],
memcpy(&m_decoded_16[(i*4 + 0) * (2*16*16/8) + y * (2*16/8)],
&src[i * (2*32*32/8) + y * (2*32/8)],
4);
memcpy(&dst[(i*4 + 1) * (2*16*16/8) + y * (2*16/8)],
memcpy(&m_decoded_16[(i*4 + 1) * (2*16*16/8) + y * (2*16/8)],
&src[i * (2*32*32/8) + y * (2*32/8) + (4*8/8)],
4);
memcpy(&dst[(i*4 + 2) * (2*16*16/8) + y * (2*16/8)],
memcpy(&m_decoded_16[(i*4 + 2) * (2*16*16/8) + y * (2*16/8)],
&src[i * (2*32*32/8) + y * (2*32/8) + (16*2*32/8)],
4);
memcpy(&dst[(i*4 + 3) * (2*16*16/8) + y * (2*16/8)],
memcpy(&m_decoded_16[(i*4 + 3) * (2*16*16/8) + y * (2*16/8)],
&src[i * (2*32*32/8) + y * (2*32/8) + (4*8/8) + (16*2*32/8)],
4);
}
decode_sprite(m_sprite16, &spr16_layout, dst);
decode_sprite(m_sprite16, &spr16_layout, m_decoded_16.get());
}
// fix sprite order
@ -336,12 +335,9 @@ void tceptor_state::decode_sprite32(const char * region)
int len = memregion(region)->bytes();
int total = spr32_layout.total;
int size = spr32_layout.charincrement / 8;
UINT8 *dst;
int i;
dst = auto_alloc_array(machine(), UINT8, len);
memset(dst, 0, len);
m_decoded_32 = make_unique_clear<UINT8[]>(len);
for (i = 0; i < total; i++)
{
@ -350,11 +346,11 @@ void tceptor_state::decode_sprite32(const char * region)
code = (i & 0x07f) | ((i & 0x180) << 1) | 0x80;
code &= ~((i & 0x200) >> 2);
memcpy(&dst[size * (i + 0)], &src[size * (code + 0)], size);
memcpy(&dst[size * (i + total)], &src[size * (code + total)], size);
memcpy(&m_decoded_32[size * (i + 0)], &src[size * (code + 0)], size);
memcpy(&m_decoded_32[size * (i + total)], &src[size * (code + total)], size);
}
decode_sprite(m_sprite32, &spr32_layout, dst);
decode_sprite(m_sprite32, &spr32_layout, m_decoded_32.get());
}
void tceptor_state::video_start()

View File

@ -11,7 +11,7 @@ void undrfire_state::video_start()
{
int i;
m_spritelist = auto_alloc_array(machine(), struct uf_tempsprite, 0x4000);
m_spritelist = std::make_unique<uf_tempsprite[]>(0x4000);
for (i = 0; i < 16384; i++) /* Fix later - some weird colours in places */
m_palette->set_pen_color(i, rgb_t(0,0,0));
@ -77,7 +77,7 @@ void undrfire_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,co
/* 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 uf_tempsprite *sprite_ptr = m_spritelist;
struct uf_tempsprite *sprite_ptr = m_spritelist.get();
for (offs = (m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
{
@ -192,7 +192,7 @@ logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks);
}
/* this happens only if primsks != NULL */
while (sprite_ptr != m_spritelist)
while (sprite_ptr != m_spritelist.get())
{
sprite_ptr--;
@ -222,7 +222,7 @@ void undrfire_state::draw_sprites_cbombers(screen_device &screen, bitmap_ind16 &
/* 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 uf_tempsprite *sprite_ptr = m_spritelist;
struct uf_tempsprite *sprite_ptr = m_spritelist.get();
for (offs = (m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
{
@ -326,7 +326,7 @@ void undrfire_state::draw_sprites_cbombers(screen_device &screen, bitmap_ind16 &
}
/* this happens only if primsks != NULL */
while (sprite_ptr != m_spritelist)
while (sprite_ptr != m_spritelist.get())
{
sprite_ptr--;