mirror of
https://github.com/holub/mame
synced 2025-04-20 15:32:45 +03:00
Merge pull request #5621 from cam900/deco_mlc_bgblend
deco_mlc.cpp : Re-enable background color blending, Misc updates
This commit is contained in:
commit
4f8928432a
@ -176,7 +176,7 @@ WRITE32_MEMBER(deco_mlc_state::eeprom_w)
|
||||
{
|
||||
const u8 ebyte = (data >> 8) & 0xff;
|
||||
// if (ebyte & 0x80)
|
||||
// {
|
||||
// {
|
||||
m_eeprom->clk_write((ebyte & 0x2) ? ASSERT_LINE : CLEAR_LINE);
|
||||
m_eeprom->di_write(ebyte & 0x1);
|
||||
m_eeprom->cs_write((ebyte & 0x4) ? ASSERT_LINE : CLEAR_LINE);
|
||||
@ -232,11 +232,11 @@ WRITE32_MEMBER(deco_mlc_state::irq_ram_w)
|
||||
m_maincpu->set_input_line(m_irqLevel, CLEAR_LINE);
|
||||
return;
|
||||
case 0x14: /* Prepare scanline interrupt */
|
||||
if(m_irq_ram[0x14/4] == -1) // TODO: likely to be anything that doesn't fit into the screen v-pos range.
|
||||
if(m_irq_ram[0x14 / 4] == -1) // TODO: likely to be anything that doesn't fit into the screen v-pos range.
|
||||
m_raster_irq_timer->adjust(attotime::never);
|
||||
else
|
||||
m_raster_irq_timer->adjust(m_screen->time_until_pos(m_irq_ram[0x14/4]));
|
||||
//logerror("prepare scanline to fire at %d (currently on %d)\n", m_irq_ram[0x14/4], m_screen->vpos());
|
||||
m_raster_irq_timer->adjust(m_screen->time_until_pos(m_irq_ram[0x14 / 4]));
|
||||
//logerror("prepare scanline to fire at %d (currently on %d)\n", m_irq_ram[0x14 / 4], m_screen->vpos());
|
||||
return;
|
||||
|
||||
default:
|
||||
@ -922,12 +922,13 @@ void deco_mlc_state::descramble_sound( )
|
||||
|
||||
for (u32 x = 0; x < length; x++)
|
||||
{
|
||||
u32 addr = bitswap<24> (x,23,22,21,0, 20,
|
||||
19,18,17,16,
|
||||
15,14,13,12,
|
||||
11,10,9, 8,
|
||||
7, 6, 5, 4,
|
||||
3, 2, 1 );
|
||||
const u32 addr = bitswap<24>(x,
|
||||
23,22,21,0, 20,
|
||||
19,18,17,16,
|
||||
15,14,13,12,
|
||||
11,10,9, 8,
|
||||
7, 6, 5, 4,
|
||||
3, 2, 1 );
|
||||
|
||||
buf[addr] = rom[x];
|
||||
}
|
||||
@ -937,8 +938,8 @@ void deco_mlc_state::descramble_sound( )
|
||||
|
||||
READ32_MEMBER(deco_mlc_state::avengrgs_speedup_r)
|
||||
{
|
||||
u32 a = m_mainram[0x89a0/4];
|
||||
u32 p = m_maincpu->pc();
|
||||
const u32 a = m_mainram[0x89a0 / 4];
|
||||
const u32 p = m_maincpu->pc();
|
||||
|
||||
if ((p == 0x3234 || p == 0x32dc) && (a & 1)) m_maincpu->spin_until_interrupt();
|
||||
|
||||
@ -955,7 +956,7 @@ void deco_mlc_state::init_avengrgs()
|
||||
dynamic_cast<sh2_device *>(m_maincpu.target())->sh2drc_add_pcflush(0x32dc);
|
||||
|
||||
dynamic_cast<sh2_device *>(m_maincpu.target())->sh2drc_add_fastram(0x0100000, 0x01088ff, 0, &m_mainram[0]);
|
||||
dynamic_cast<sh2_device *>(m_maincpu.target())->sh2drc_add_fastram(0x0108a00, 0x011ffff, 0, &m_mainram[0x8a00/4]);
|
||||
dynamic_cast<sh2_device *>(m_maincpu.target())->sh2drc_add_fastram(0x0108a00, 0x011ffff, 0, &m_mainram[0x8a00 / 4]);
|
||||
dynamic_cast<sh2_device *>(m_maincpu.target())->sh2drc_add_fastram(0x0200080, 0x02000ff, 0, &m_clip_ram[0]);
|
||||
dynamic_cast<sh2_device *>(m_maincpu.target())->sh2drc_add_fastram(0x0280000, 0x029ffff, 0, &m_vram[0]);
|
||||
|
||||
|
@ -29,13 +29,13 @@ void deco_mlc_state::video_start()
|
||||
}
|
||||
|
||||
// temp_bitmap = std::make_unique<bitmap_rgb32>(512, 512);
|
||||
m_buffered_spriteram = std::make_unique<u16[]>(0x3000/4);
|
||||
m_spriteram_spare = std::make_unique<u16[]>(0x3000/4);
|
||||
m_spriteram = std::make_unique<u16[]>(0x3000/4);
|
||||
m_buffered_spriteram = std::make_unique<u16[]>(0x3000 / 4);
|
||||
m_spriteram_spare = std::make_unique<u16[]>(0x3000 / 4);
|
||||
m_spriteram = std::make_unique<u16[]>(0x3000 / 4);
|
||||
|
||||
save_pointer(NAME(m_spriteram), 0x3000/4);
|
||||
save_pointer(NAME(m_spriteram_spare), 0x3000/4);
|
||||
save_pointer(NAME(m_buffered_spriteram), 0x3000/4);
|
||||
save_pointer(NAME(m_spriteram), 0x3000 / 4);
|
||||
save_pointer(NAME(m_spriteram_spare), 0x3000 / 4);
|
||||
save_pointer(NAME(m_buffered_spriteram), 0x3000 / 4);
|
||||
}
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ void deco_mlc_state::drawgfxzoomline(u32* dest, u8* pri,const rectangle &clip,gf
|
||||
int scalex, int srcline, int shadowMode )
|
||||
{
|
||||
if (!scalex) return;
|
||||
const u32 alphaMode = m_irq_ram[0x04/4] & 0xc0;
|
||||
const u32 alphaMode = m_irq_ram[0x04 / 4] & 0xc0;
|
||||
|
||||
/*
|
||||
scalex and scaley are 16.16 fixed point numbers
|
||||
@ -80,9 +80,9 @@ void deco_mlc_state::drawgfxzoomline(u32* dest, u8* pri,const rectangle &clip,gf
|
||||
|
||||
if (sx < clip.left())
|
||||
{ /* clip left */
|
||||
int pixels = clip.left()-sx;
|
||||
int pixels = clip.left() - sx;
|
||||
sx += pixels;
|
||||
x_index_base += pixels*dx;
|
||||
x_index_base += pixels * dx;
|
||||
}
|
||||
/* NS 980211 - fixed incorrect clipping */
|
||||
if (ex > clip.right() + 1)
|
||||
@ -98,107 +98,42 @@ void deco_mlc_state::drawgfxzoomline(u32* dest, u8* pri,const rectangle &clip,gf
|
||||
const u8 *code_base2 = gfx->get_data(code2 % gfx->elements());
|
||||
const u8 *source1 = code_base1 + (srcline) * gfx->rowbytes();
|
||||
const u8 *source2 = code_base2 + (srcline) * gfx->rowbytes();
|
||||
/* no alpha */
|
||||
if (!shadowMode)
|
||||
{
|
||||
if (alphaMode & 0xc0)
|
||||
// alphaMode & 0xc0 = 0xc0 : Shadow, 0 : Alpha or Pre-shadowed, Other bits unknown
|
||||
if (shadowMode && (alphaMode & 0xc0))
|
||||
{ /* TODO : 8bpp and shadow can use simultaneously? */
|
||||
int x, x_index = x_index_base;
|
||||
for (x = sx; x < ex; x++)
|
||||
{
|
||||
int x, x_index = x_index_base;
|
||||
for (x = sx; x < ex; x++)
|
||||
if (!(pri[x] & 0x80))
|
||||
{
|
||||
if (!(pri[x] & 0x80))
|
||||
{
|
||||
int c = source1[x_index >> 16];
|
||||
if (use8bpp)
|
||||
c = (c << 4) | source2[x_index >> 16];
|
||||
int c = source1[x_index >> 16];
|
||||
if (use8bpp)
|
||||
c = (c << 4) | source2[x_index >> 16];
|
||||
|
||||
if (c != transparent_color)
|
||||
{
|
||||
u32 col = pal[c];
|
||||
if ((pri[x] & 0x3) && ((pri[x] & 0x3) != 0x3))
|
||||
{
|
||||
const u8 a = (col >> 24) & 0xff;
|
||||
const u8 r = (col >> 16) & 0xff;
|
||||
const u8 g = (col >> 8) & 0xff;
|
||||
const u8 b = (col >> 0) & 0xff;
|
||||
if (pri[x] & 1) // shadow
|
||||
{
|
||||
col = rgb_t(a, r >> 1, g >> 1, b >> 1);
|
||||
}
|
||||
else if (pri[x] & 2) // hilight
|
||||
{
|
||||
col = rgb_t(a, 0x80 | (r >> 1), 0x80 | (g >> 1), 0x80 | (b >> 1));
|
||||
}
|
||||
}
|
||||
dest[x] = col;
|
||||
pri[x] |= 0x80; // Mark it drawn
|
||||
}
|
||||
}
|
||||
|
||||
x_index += dx;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int x, x_index = x_index_base;
|
||||
for (x = sx; x < ex; x++)
|
||||
{
|
||||
if (!(pri[x] & 0x80))
|
||||
{
|
||||
int c = source1[x_index >> 16];
|
||||
if (use8bpp)
|
||||
c = (c << 4) | source2[x_index >> 16];
|
||||
|
||||
if (c != transparent_color)
|
||||
{
|
||||
dest[x] = pal[c];
|
||||
pri[x] |= 0x80; // Mark it drawn
|
||||
}
|
||||
}
|
||||
|
||||
x_index += dx;
|
||||
if (c != transparent_color)
|
||||
pri[x] |= shadowMode; // Mark it shadow / hilighted
|
||||
}
|
||||
x_index += dx;
|
||||
}
|
||||
}
|
||||
// alphaMode & 0xc0 = 0xc0 : Shadow, 0 : Alpha or Pre-shadowed, Other bits unknown
|
||||
else
|
||||
{
|
||||
if (alphaMode & 0xc0)
|
||||
{ /* TODO : 8bpp and shadow can use simultaneously? */
|
||||
int x, x_index = x_index_base;
|
||||
for (x = sx; x < ex; x++)
|
||||
{
|
||||
if (!(pri[x] & 0x80))
|
||||
{
|
||||
int c = source1[x_index >> 16];
|
||||
if (use8bpp)
|
||||
c = (c << 4) | source2[x_index >> 16];
|
||||
|
||||
if (c != transparent_color)
|
||||
pri[x] |= shadowMode; // Mark it shadow / hilighted
|
||||
}
|
||||
x_index += dx;
|
||||
}
|
||||
}
|
||||
else
|
||||
int x, x_index = x_index_base;
|
||||
for (x = sx; x < ex; x++)
|
||||
{
|
||||
int x, x_index = x_index_base;
|
||||
for (x = sx; x < ex; x++)
|
||||
if (!(pri[x] & 0x80))
|
||||
{
|
||||
if (!(pri[x] & 0x80))
|
||||
{
|
||||
int c = source1[x_index >> 16];
|
||||
if (use8bpp)
|
||||
c = (c << 4) | source2[x_index >> 16];
|
||||
int c = source1[x_index >> 16];
|
||||
if (use8bpp)
|
||||
c = (c << 4) | source2[x_index >> 16];
|
||||
|
||||
if (c != transparent_color)
|
||||
{
|
||||
dest[x] = (shadowMode == 3) ? pal[c] : alpha_blend_r32(pal[c], shadowMode & 2 ? ~0 : 0, 0x80);
|
||||
pri[x] |= 0x80; // Mark it drawn
|
||||
}
|
||||
if (c != transparent_color)
|
||||
{
|
||||
dest[x] = pal[c];
|
||||
pri[x] |= 0x80 | shadowMode; // Mark it drawn
|
||||
}
|
||||
x_index += dx;
|
||||
}
|
||||
x_index += dx;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -224,7 +159,7 @@ void deco_mlc_state::draw_sprites(const rectangle &cliprect, int scanline, u32*
|
||||
|
||||
//printf("%d - (%08x %08x %08x) (%08x %08x %08x) (%08x %08x %08x)\n", scanline, m_irq_ram[6], m_irq_ram[7], m_irq_ram[8], m_irq_ram[9], m_irq_ram[10], m_irq_ram[11] , m_irq_ram[12] , m_irq_ram[13] , m_irq_ram[14]);
|
||||
|
||||
for (int offs = 0; offs < (0x3000/4); offs += 8)
|
||||
for (int offs = 0; offs < (0x3000 / 4); offs += 8)
|
||||
{
|
||||
if ((spriteram[offs + 0] & 0x8000) == 0)
|
||||
continue;
|
||||
@ -601,7 +536,7 @@ WRITE_LINE_MEMBER(deco_mlc_state::screen_vblank_mlc)
|
||||
lookup table. Without buffering incorrect one frame glitches are seen
|
||||
in several places, especially in Hoops.
|
||||
*/
|
||||
std::copy(&m_spriteram[0], &m_spriteram[0x3000/4], &m_buffered_spriteram[0]);
|
||||
std::copy(&m_spriteram[0], &m_spriteram[0x3000 / 4], &m_buffered_spriteram[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -625,6 +560,20 @@ u32 deco_mlc_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c
|
||||
printf("\n");
|
||||
*/
|
||||
draw_sprites(cliprect, i, dest, pri);
|
||||
for (int x = cliprect.left(); x <= cliprect.right(); x++)
|
||||
{
|
||||
u32 col = dest[x];
|
||||
const u8 shadow_flag = pri[x] & 3;
|
||||
if ((shadow_flag & 3) && (shadow_flag != 3))
|
||||
{
|
||||
if (shadow_flag & 1) // shadow
|
||||
col = (col & 0xff000000) | ((col & 0xfefefe) >> 1);
|
||||
else if (shadow_flag & 2) // hilight
|
||||
col = (col & 0xff000000) | ((col & 0xfefefe) >> 1) | 0x808080;
|
||||
|
||||
dest[x] = col;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user