cps modernisation part 1

This commit is contained in:
Robbbert 2013-02-04 09:57:26 +00:00
parent d63986040f
commit db6b7972f7
3 changed files with 131 additions and 138 deletions

View File

@ -640,7 +640,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(cps_state::cps2_interrupt)
{
m_cps_b_regs[0x10/2] = 0;
m_maincpu->set_input_line(4, HOLD_LINE);
cps2_set_sprite_priorities(timer.machine());
cps2_set_sprite_priorities();
timer.machine().primary_screen->update_partial(param);
m_scancalls++;
// popmessage("IRQ4 scancounter = %04i", param);
@ -651,7 +651,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(cps_state::cps2_interrupt)
{
m_cps_b_regs[0x12 / 2] = 0;
m_maincpu->set_input_line(4, HOLD_LINE);
cps2_set_sprite_priorities(timer.machine());
cps2_set_sprite_priorities();
timer.machine().primary_screen->update_partial(param);
m_scancalls++;
// popmessage("IRQ4 scancounter = %04i", param);
@ -664,10 +664,10 @@ TIMER_DEVICE_CALLBACK_MEMBER(cps_state::cps2_interrupt)
m_maincpu->set_input_line(2, HOLD_LINE);
if(m_scancalls)
{
cps2_set_sprite_priorities(timer.machine());
cps2_set_sprite_priorities();
timer.machine().primary_screen->update_partial(256);
}
cps2_objram_latch(timer.machine());
cps2_objram_latch();
}
// popmessage("Raster calls = %i", m_scancalls);
}

View File

@ -258,6 +258,24 @@ public:
DECLARE_WRITE16_MEMBER(sf2mdta_layer_w);
UINT32 screen_update_fcrash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void cps1_get_video_base();
void cps1_gfx_decode();
void unshuffle(UINT64 *buf, int len);
void cps2_gfx_decode();
int gfxrom_bank_mapper(int type, int code);
void cps1_update_transmasks();
void cps1_build_palette(const UINT16* const palette_base);
void cps1_find_last_sprite();
void cps1_render_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void cps2_find_last_sprite();
void cps2_render_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int *primasks);
void cps1_render_stars(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void cps1_render_layer(bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int primask);
void cps1_render_high_layer(bitmap_ind16 &bitmap, const rectangle &cliprect, int layer);
void cps2_set_sprite_priorities();
void cps2_objram_latch();
UINT16 *cps2_objbase();
};
/*----------- defined in drivers/cps1.c -----------*/

View File

@ -1493,9 +1493,6 @@ CPS1 VIDEO RENDERER
#define CPS2_OBJ_YOFFS 0x0a /* Y offset (always 0x0010) */
static void cps1_build_palette(running_machine &machine, const UINT16* const palette_base);
MACHINE_RESET_MEMBER(cps_state,cps)
{
const char *gamename = machine().system().name;
@ -1581,7 +1578,7 @@ WRITE16_MEMBER(cps_state::cps1_cps_a_w)
fixes glitches in the ghouls intro, but it might happen at next vblank.
*/
if (offset == CPS1_PALETTE_BASE)
cps1_build_palette(machine(), cps1_base(machine(), CPS1_PALETTE_BASE, m_palette_align));
cps1_build_palette(cps1_base(machine(), CPS1_PALETTE_BASE, m_palette_align));
// pzloop2 write to register 24 on startup. This is probably just a bug.
if (offset == 0x24 / 2 && m_cps_version == 2)
@ -1702,18 +1699,11 @@ WRITE16_MEMBER(cps_state::cps1_cps_b_w)
INLINE int cps2_port( running_machine &machine, int offset )
void cps_state::cps1_gfx_decode()
{
cps_state *state = machine.driver_data<cps_state>();
return state->m_output[offset / 2];
}
static void cps1_gfx_decode( running_machine &machine )
{
int size = machine.root_device().memregion("gfx")->bytes();
int size = memregion("gfx")->bytes();
int i, j, gfxsize;
UINT8 *cps1_gfx = machine.root_device().memregion("gfx")->base();
UINT8 *cps1_gfx = memregion("gfx")->base();
gfxsize = size / 4;
@ -1741,7 +1731,7 @@ static void cps1_gfx_decode( running_machine &machine )
}
}
static void unshuffle( UINT64 *buf, int len )
void cps_state::unshuffle( UINT64 *buf, int len )
{
int i;
UINT64 t;
@ -1764,22 +1754,22 @@ static void unshuffle( UINT64 *buf, int len )
}
}
static void cps2_gfx_decode( running_machine &machine )
void cps_state::cps2_gfx_decode()
{
const int banksize = 0x200000;
int size = machine.root_device().memregion("gfx")->bytes();
int size = memregion("gfx")->bytes();
int i;
for (i = 0; i < size; i += banksize)
unshuffle((UINT64 *)(machine.root_device().memregion("gfx")->base() + i), banksize / 8);
unshuffle((UINT64 *)(memregion("gfx")->base() + i), banksize / 8);
cps1_gfx_decode(machine);
cps1_gfx_decode();
}
DRIVER_INIT_MEMBER(cps_state,cps1)
{
cps1_gfx_decode(machine());
cps1_gfx_decode();
m_scanline1 = 0;
m_scanline2 = 0;
@ -1793,7 +1783,7 @@ DRIVER_INIT_MEMBER(cps_state,cps1)
DRIVER_INIT_MEMBER(cps_state,cps2_video)
{
cps2_gfx_decode(machine());
cps2_gfx_decode();
m_scanline1 = 262;
m_scanline2 = 262;
@ -1914,10 +1904,9 @@ WRITE16_MEMBER(cps_state::cps1_gfxram_w)
static int gfxrom_bank_mapper( running_machine &machine, int type, int code )
int cps_state::gfxrom_bank_mapper( int type, int code )
{
cps_state *state = machine.driver_data<cps_state>();
const struct gfx_range *range = state->m_game_config->bank_mapper;
const struct gfx_range *range = m_game_config->bank_mapper;
int shift = 0;
assert(range);
@ -1942,9 +1931,9 @@ static int gfxrom_bank_mapper( running_machine &machine, int type, int code )
int i;
for (i = 0; i < range->bank; ++i)
base += state->m_game_config->bank_sizes[i];
base += m_game_config->bank_sizes[i];
return (base + (code & (state->m_game_config->bank_sizes[range->bank] - 1))) >> shift;
return (base + (code & (m_game_config->bank_sizes[range->bank] - 1))) >> shift;
}
}
@ -1989,7 +1978,7 @@ TILE_GET_INFO_MEMBER(cps_state::get_tile0_info)
int attr = m_scroll1[2 * tile_index + 1];
int gfxset;
code = gfxrom_bank_mapper(machine(), GFXTYPE_SCROLL1, code);
code = gfxrom_bank_mapper(GFXTYPE_SCROLL1, code);
/* allows us to reproduce a problem seen with a ffight board where USA and Japanese
roms have been mixed to be reproduced (ffightub) -- it looks like each column
@ -2014,7 +2003,7 @@ TILE_GET_INFO_MEMBER(cps_state::get_tile1_info)
int code = m_scroll2[2 * tile_index];
int attr = m_scroll2[2 * tile_index + 1];
code = gfxrom_bank_mapper(machine(), GFXTYPE_SCROLL2, code);
code = gfxrom_bank_mapper(GFXTYPE_SCROLL2, code);
SET_TILE_INFO_MEMBER(
2,
@ -2033,7 +2022,7 @@ TILE_GET_INFO_MEMBER(cps_state::get_tile2_info)
int code = m_scroll3[2 * tile_index] & 0x3fff;
int attr = m_scroll3[2 * tile_index + 1];
code = gfxrom_bank_mapper(machine(), GFXTYPE_SCROLL3, code);
code = gfxrom_bank_mapper(GFXTYPE_SCROLL3, code);
SET_TILE_INFO_MEMBER(
3,
@ -2050,9 +2039,8 @@ TILE_GET_INFO_MEMBER(cps_state::get_tile2_info)
static void cps1_update_transmasks( running_machine &machine )
void cps_state::cps1_update_transmasks()
{
cps_state *state = machine.driver_data<cps_state>();
int i;
for (i = 0; i < 4; i++)
@ -2060,14 +2048,14 @@ static void cps1_update_transmasks( running_machine &machine )
int mask;
/* Get transparency registers */
if (state->m_game_config->priority[i] != -1)
mask = state->m_cps_b_regs[state->m_game_config->priority[i] / 2] ^ 0xffff;
if (m_game_config->priority[i] != -1)
mask = m_cps_b_regs[m_game_config->priority[i] / 2] ^ 0xffff;
else
mask = 0xffff; /* completely transparent if priority masks not defined (qad) */
state->m_bg_tilemap[0]->set_transmask(i, mask, 0x8000);
state->m_bg_tilemap[1]->set_transmask(i, mask, 0x8000);
state->m_bg_tilemap[2]->set_transmask(i, mask, 0x8000);
m_bg_tilemap[0]->set_transmask(i, mask, 0x8000);
m_bg_tilemap[1]->set_transmask(i, mask, 0x8000);
m_bg_tilemap[2]->set_transmask(i, mask, 0x8000);
}
}
@ -2095,7 +2083,7 @@ VIDEO_START_MEMBER(cps_state,cps)
memset(m_empty_tile, 0x0f, sizeof(m_empty_tile));
/* front masks will change at runtime to handle sprite occluding */
cps1_update_transmasks(machine());
cps1_update_transmasks();
for (i = 0; i < cps1_palette_entries * 16; i++)
palette_set_color(machine(), i, MAKE_RGB(0,0,0));
@ -2188,12 +2176,11 @@ VIDEO_START_MEMBER(cps_state,cps2)
***************************************************************************/
static void cps1_build_palette( running_machine &machine, const UINT16* const palette_base )
void cps_state::cps1_build_palette( const UINT16* const palette_base )
{
cps_state *state = machine.driver_data<cps_state>();
int offset, page;
const UINT16 *palette_ram = palette_base;
int ctrl = state->m_cps_b_regs[state->m_game_config->palette_control/2];
int ctrl = m_cps_b_regs[m_game_config->palette_control/2];
/*
The palette is copied only for pages that are enabled in the ctrl
@ -2218,7 +2205,7 @@ static void cps1_build_palette( running_machine &machine, const UINT16* const pa
g = ((palette >> 4) & 0x0f) * 0x11 * bright / 0x2d;
b = ((palette >> 0) & 0x0f) * 0x11 * bright / 0x2d;
palette_set_color (machine, 0x200 * page + offset, MAKE_RGB(r, g, b));
palette_set_color (machine(), 0x200 * page + offset, MAKE_RGB(r, g, b));
}
}
else
@ -2266,58 +2253,56 @@ static void cps1_build_palette( running_machine &machine, const UINT16* const pa
***************************************************************************/
static void cps1_find_last_sprite( running_machine &machine ) /* Find the offset of last sprite */
void cps_state::cps1_find_last_sprite() /* Find the offset of last sprite */
{
cps_state *state = machine.driver_data<cps_state>();
int offset = 0;
/* Locate the end of table marker */
while (offset < state->m_obj_size / 2)
while (offset < m_obj_size / 2)
{
int colour = state->m_buffered_obj[offset + 3];
int colour = m_buffered_obj[offset + 3];
if ((colour & 0xff00) == 0xff00)
{
/* Marker found. This is the last sprite. */
state->m_last_sprite_offset = offset - 4;
m_last_sprite_offset = offset - 4;
return;
}
offset += 4;
}
/* Sprites must use full sprite RAM */
state->m_last_sprite_offset = state->m_obj_size / 2 - 4;
m_last_sprite_offset = m_obj_size / 2 - 4;
}
static void cps1_render_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
void cps_state::cps1_render_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
cps_state *state = machine.driver_data<cps_state>();
#define DRAWSPRITE(CODE,COLOR,FLIPX,FLIPY,SX,SY) \
{ \
if (state->flip_screen()) \
if (flip_screen()) \
pdrawgfx_transpen(bitmap,\
cliprect,machine.gfx[2], \
cliprect,machine().gfx[2], \
CODE, \
COLOR, \
!(FLIPX),!(FLIPY), \
511-16-(SX),255-16-(SY), machine.priority_bitmap,0x02,15); \
511-16-(SX),255-16-(SY), machine().priority_bitmap,0x02,15); \
else \
pdrawgfx_transpen(bitmap,\
cliprect,machine.gfx[2], \
cliprect,machine().gfx[2], \
CODE, \
COLOR, \
FLIPX,FLIPY, \
SX,SY, machine.priority_bitmap,0x02,15); \
SX,SY, machine().priority_bitmap,0x02,15); \
}
int i, baseadd;
UINT16 *base = state->m_buffered_obj;
UINT16 *base = m_buffered_obj;
/* some sf2 hacks draw the sprites in reverse order */
if (state->m_game_config->bootleg_kludge == 1)
if (m_game_config->bootleg_kludge == 1)
{
base += state->m_last_sprite_offset;
base += m_last_sprite_offset;
baseadd = -4;
}
else
@ -2325,7 +2310,7 @@ static void cps1_render_sprites( running_machine &machine, bitmap_ind16 &bitmap,
baseadd = 4;
}
for (i = state->m_last_sprite_offset; i >= 0; i -= 4)
for (i = m_last_sprite_offset; i >= 0; i -= 4)
{
int x = *(base + 0);
int y = *(base + 1);
@ -2336,7 +2321,7 @@ static void cps1_render_sprites( running_machine &machine, bitmap_ind16 &bitmap,
// x -= 0x20;
// y += 0x20;
code = gfxrom_bank_mapper(machine, GFXTYPE_SPRITES, code);
code = gfxrom_bank_mapper(GFXTYPE_SPRITES, code);
if (code != -1)
{
@ -2485,81 +2470,78 @@ WRITE16_MEMBER(cps_state::cps2_objram2_w)
COMBINE_DATA(&m_objram2[offset]);
}
static UINT16 *cps2_objbase( running_machine &machine )
UINT16 *cps_state::cps2_objbase()
{
cps_state *state = machine.driver_data<cps_state>();
int baseptr;
baseptr = 0x7000;
if (state->m_objram_bank & 1)
if (m_objram_bank & 1)
baseptr ^= 0x0080;
//popmessage("%04x %d", cps2_port(machine, CPS2_OBJ_BASE), state->m_objram_bank & 1);
if (baseptr == 0x7000)
return state->m_objram1;
return m_objram1;
else //if (baseptr == 0x7080)
return state->m_objram2;
return m_objram2;
}
static void cps2_find_last_sprite( running_machine &machine ) /* Find the offset of last sprite */
void cps_state::cps2_find_last_sprite() /* Find the offset of last sprite */
{
cps_state *state = machine.driver_data<cps_state>();
int offset = 0;
UINT16 *base = state->m_cps2_buffered_obj;
UINT16 *base = m_cps2_buffered_obj;
/* Locate the end of table marker */
while (offset < state->m_cps2_obj_size / 2)
while (offset < m_cps2_obj_size / 2)
{
if (base[offset + 1] >= 0x8000 || base[offset + 3] >= 0xff00)
{
/* Marker found. This is the last sprite. */
state->m_cps2_last_sprite_offset = offset - 4;
m_cps2_last_sprite_offset = offset - 4;
return;
}
offset += 4;
}
/* Sprites must use full sprite RAM */
state->m_cps2_last_sprite_offset = state->m_cps2_obj_size / 2 - 4;
m_cps2_last_sprite_offset = m_cps2_obj_size / 2 - 4;
}
static void cps2_render_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int *primasks )
void cps_state::cps2_render_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int *primasks )
{
cps_state *state = machine.driver_data<cps_state>();
#define DRAWSPRITE(CODE,COLOR,FLIPX,FLIPY,SX,SY) \
{ \
if (state->flip_screen()) \
if (flip_screen()) \
pdrawgfx_transpen(bitmap,\
cliprect,machine.gfx[2], \
cliprect,machine().gfx[2], \
CODE, \
COLOR, \
!(FLIPX),!(FLIPY), \
511-16-(SX),255-16-(SY), machine.priority_bitmap,primasks[priority],15); \
511-16-(SX),255-16-(SY), machine().priority_bitmap,primasks[priority],15); \
else \
pdrawgfx_transpen(bitmap,\
cliprect,machine.gfx[2], \
cliprect,machine().gfx[2], \
CODE, \
COLOR, \
FLIPX,FLIPY, \
SX,SY, machine.priority_bitmap,primasks[priority],15); \
SX,SY, machine().priority_bitmap,primasks[priority],15); \
}
int i;
UINT16 *base = state->m_cps2_buffered_obj;
int xoffs = 64 - cps2_port(machine, CPS2_OBJ_XOFFS);
int yoffs = 16 - cps2_port(machine, CPS2_OBJ_YOFFS);
UINT16 *base = m_cps2_buffered_obj;
int xoffs = 64 - m_output[CPS2_OBJ_XOFFS /2];
int yoffs = 16 - m_output[CPS2_OBJ_YOFFS /2];
#ifdef MAME_DEBUG
if (machine.input().code_pressed(KEYCODE_Z) && machine.input().code_pressed(KEYCODE_R))
if (machine().input().code_pressed(KEYCODE_Z) && machine().input().code_pressed(KEYCODE_R))
{
return;
}
#endif
for (i = state->m_cps2_last_sprite_offset; i >= 0; i -= 4)
for (i = m_cps2_last_sprite_offset; i >= 0; i -= 4)
{
int x = base[i + 0];
int y = base[i + 1];
@ -2570,8 +2552,8 @@ static void cps2_render_sprites( running_machine &machine, bitmap_ind16 &bitmap,
if (colour & 0x80)
{
x += cps2_port(machine, CPS2_OBJ_XOFFS); /* fix the offset of some games */
y += cps2_port(machine, CPS2_OBJ_YOFFS); /* like Marvel vs. Capcom ending credits */
x += m_output[CPS2_OBJ_XOFFS /2]; /* fix the offset of some games */
y += m_output[CPS2_OBJ_YOFFS /2]; /* like Marvel vs. Capcom ending credits */
}
if (colour & 0xff00)
@ -2674,13 +2656,12 @@ static void cps2_render_sprites( running_machine &machine, bitmap_ind16 &bitmap,
static void cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
void cps_state::cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
cps_state *state = screen.machine().driver_data<cps_state>();
int offs;
UINT8 *stars_rom = state->memregion("stars")->base();
UINT8 *stars_rom = memregion("stars")->base();
if (!stars_rom && (state->m_stars_enabled[0] || state->m_stars_enabled[1]))
if (!stars_rom && (m_stars_enabled[0] || m_stars_enabled[1]))
{
#ifdef MAME_DEBUG
// popmessage("stars enabled but no stars ROM");
@ -2688,18 +2669,18 @@ static void cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, cons
return;
}
if (state->m_stars_enabled[0])
if (m_stars_enabled[0])
{
for (offs = 0; offs < state->m_stars_rom_size / 2; offs++)
for (offs = 0; offs < m_stars_rom_size / 2; offs++)
{
int col = stars_rom[8 * offs + 4];
if (col != 0x0f)
{
int sx = (offs / 256) * 32;
int sy = (offs % 256);
sx = (sx - state->m_stars2x + (col & 0x1f)) & 0x1ff;
sy = (sy - state->m_stars2y) & 0xff;
if (state->flip_screen())
sx = (sx - m_stars2x + (col & 0x1f)) & 0x1ff;
sy = (sy - m_stars2y) & 0xff;
if (flip_screen())
{
sx = 511 - sx;
sy = 255 - sy;
@ -2713,18 +2694,18 @@ static void cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, cons
}
}
if (state->m_stars_enabled[1])
if (m_stars_enabled[1])
{
for (offs = 0; offs < state->m_stars_rom_size / 2; offs++)
for (offs = 0; offs < m_stars_rom_size / 2; offs++)
{
int col = stars_rom[8*offs];
if (col != 0x0f)
{
int sx = (offs / 256) * 32;
int sy = (offs % 256);
sx = (sx - state->m_stars1x + (col & 0x1f)) & 0x1ff;
sy = (sy - state->m_stars1y) & 0xff;
if (state->flip_screen())
sx = (sx - m_stars1x + (col & 0x1f)) & 0x1ff;
sy = (sy - m_stars1y) & 0xff;
if (flip_screen())
{
sx = 511 - sx;
sy = 255 - sy;
@ -2740,25 +2721,23 @@ static void cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, cons
}
static void cps1_render_layer( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int primask )
void cps_state::cps1_render_layer( bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int primask )
{
cps_state *state = machine.driver_data<cps_state>();
switch (layer)
{
case 0:
cps1_render_sprites(machine, bitmap, cliprect);
cps1_render_sprites(bitmap, cliprect);
break;
case 1:
case 2:
case 3:
state->m_bg_tilemap[layer - 1]->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, primask);
m_bg_tilemap[layer - 1]->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, primask);
break;
}
}
static void cps1_render_high_layer( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer )
void cps_state::cps1_render_high_layer( bitmap_ind16 &bitmap, const rectangle &cliprect, int layer )
{
cps_state *state = machine.driver_data<cps_state>();
bitmap_ind16 dummy_bitmap;
switch (layer)
{
@ -2768,7 +2747,7 @@ static void cps1_render_high_layer( running_machine &machine, bitmap_ind16 &bitm
case 1:
case 2:
case 3:
state->m_bg_tilemap[layer - 1]->draw(dummy_bitmap, cliprect, TILEMAP_DRAW_LAYER0, 1);
m_bg_tilemap[layer - 1]->draw(dummy_bitmap, cliprect, TILEMAP_DRAW_LAYER0, 1);
break;
}
}
@ -2793,14 +2772,12 @@ UINT32 cps_state::screen_update_cps1(screen_device &screen, bitmap_ind16 &bitmap
cps1_get_video_base();
/* Find the offset of the last sprite in the sprite table */
cps1_find_last_sprite(machine());
cps1_find_last_sprite();
if (m_cps_version == 2)
{
cps2_find_last_sprite(machine());
}
cps2_find_last_sprite();
cps1_update_transmasks(machine());
cps1_update_transmasks();
m_bg_tilemap[0]->set_scrollx(0, m_scroll1x);
m_bg_tilemap[0]->set_scrolly(0, m_scroll1y);
@ -2856,22 +2833,22 @@ UINT32 cps_state::screen_update_cps1(screen_device &screen, bitmap_ind16 &bitmap
if (m_cps_version == 1)
{
cps1_render_layer(machine(), bitmap, cliprect, l0, 0);
cps1_render_layer(bitmap, cliprect, l0, 0);
if (l1 == 0)
cps1_render_high_layer(machine(), bitmap, cliprect, l0); /* prepare mask for sprites */
cps1_render_high_layer(bitmap, cliprect, l0); /* prepare mask for sprites */
cps1_render_layer(machine(), bitmap, cliprect, l1, 0);
cps1_render_layer(bitmap, cliprect, l1, 0);
if (l2 == 0)
cps1_render_high_layer(machine(), bitmap, cliprect, l1); /* prepare mask for sprites */
cps1_render_high_layer(bitmap, cliprect, l1); /* prepare mask for sprites */
cps1_render_layer(machine(), bitmap, cliprect, l2, 0);
cps1_render_layer(bitmap, cliprect, l2, 0);
if (l3 == 0)
cps1_render_high_layer(machine(), bitmap, cliprect, l2); /* prepare mask for sprites */
cps1_render_high_layer(bitmap, cliprect, l2); /* prepare mask for sprites */
cps1_render_layer(machine(), bitmap, cliprect, l3, 0);
cps1_render_layer(bitmap, cliprect, l3, 0);
}
else
{
@ -2883,13 +2860,13 @@ UINT32 cps_state::screen_update_cps1(screen_device &screen, bitmap_ind16 &bitmap
l3pri = (m_pri_ctrl >> 4 * l3) & 0x0f;
#if 0
if ( (cps2_port(machine(), CPS2_OBJ_BASE) != 0x7080 && cps2_port(machine(), CPS2_OBJ_BASE) != 0x7000) ||
cps2_port(machine(), CPS2_OBJ_UK1) != 0x807d ||
(cps2_port(machine(), CPS2_OBJ_UK2) != 0x0000 && cps2_port(machine(), CPS2_OBJ_UK2) != 0x1101 && cps2_port(machine(), CPS2_OBJ_UK2) != 0x0001))
if ( (m_output[CPS2_OBJ_BASE /2] != 0x7080 && m_output[CPS2_OBJ_BASE /2] != 0x7000) ||
m_output[CPS2_OBJ_UK1 /2] != 0x807d ||
(m_output[CPS2_OBJ_UK2 /2] != 0x0000 && m_output[CPS2_OBJ_UK2 /2] != 0x1101 && m_output[CPS2_OBJ_UK2 /2] != 0x0001))
popmessage("base %04x uk1 %04x uk2 %04x",
cps2_port(machine(), CPS2_OBJ_BASE),
cps2_port(machine(), CPS2_OBJ_UK1),
cps2_port(machine(), CPS2_OBJ_UK2));
m_output[CPS2_OBJ_BASE /2],
m_output[CPS2_OBJ_UK1 /2],
m_output[CPS2_OBJ_UK2 /2]);
if (0 && machine().input().code_pressed(KEYCODE_Z))
popmessage("order: %d (%d) %d (%d) %d (%d) %d (%d)",l0,l0pri,l1,l1pri,l2,l2pri,l3,l3pri);
@ -2922,10 +2899,10 @@ if (0 && machine().input().code_pressed(KEYCODE_Z))
}
}
cps1_render_layer(machine(), bitmap, cliprect, l0, 1);
cps1_render_layer(machine(), bitmap, cliprect, l1, 2);
cps1_render_layer(machine(), bitmap, cliprect, l2, 4);
cps2_render_sprites(machine(), bitmap, cliprect, primasks);
cps1_render_layer(bitmap, cliprect, l0, 1);
cps1_render_layer(bitmap, cliprect, l1, 2);
cps1_render_layer(bitmap, cliprect, l2, 4);
cps2_render_sprites(bitmap, cliprect, primasks);
}
return 0;
@ -2947,15 +2924,13 @@ void cps_state::screen_eof_cps1(screen_device &screen, bool state)
}
}
void cps2_set_sprite_priorities( running_machine &machine )
void cps_state::cps2_set_sprite_priorities()
{
cps_state *state = machine.driver_data<cps_state>();
state->m_pri_ctrl = cps2_port(machine, CPS2_OBJ_PRI);
m_pri_ctrl = m_output[CPS2_OBJ_PRI /2];
}
void cps2_objram_latch( running_machine &machine )
void cps_state::cps2_objram_latch()
{
cps_state *state = machine.driver_data<cps_state>();
cps2_set_sprite_priorities(machine);
memcpy(state->m_cps2_buffered_obj, cps2_objbase(machine), state->m_cps2_obj_size);
cps2_set_sprite_priorities();
memcpy(m_cps2_buffered_obj, cps2_objbase(), m_cps2_obj_size);
}