seibucop.cpp: disable sprite DMA dest increment for SD Gundam if X positions are outside expected ranges, fix sprite clipping [Angelo Salese]

This commit is contained in:
Angelo Salese 2019-07-29 00:13:23 +02:00
parent eaec3c0e87
commit acbc95ebb5
3 changed files with 10 additions and 4 deletions

View File

@ -1275,15 +1275,17 @@ WRITE16_MEMBER( raiden2cop_device::cop_sprite_dma_src_lo_w)
m_cop_sprite_dma_src = (m_cop_sprite_dma_src&0xffff0000)|(data&0xffff);
}
// guess
WRITE16_MEMBER(raiden2cop_device::cop_sprite_dma_inc_w)
{
if (data)
printf("Warning: COP RAM 0x410 used with %04x\n", data);
else
{
/* guess */
cop_regs[4] += 8;
// Don't increment if the sprite DMA is out of bounds
// (A3 doesn't get updated if it happens, cfr. code at $1e56)
// TODO: hardwired for SD Gundam, must be user controllable somehow.
if (m_sprite_dma_x_clip >= -160 && m_sprite_dma_x_clip < 320)
cop_regs[4] += 8;
m_cop_sprite_dma_src += 6;
m_cop_sprite_dma_size--;

View File

@ -187,6 +187,7 @@ public:
int m_cop_sprite_dma_abs_x,m_cop_sprite_dma_abs_y;
int m_sprite_dma_rel_x, m_sprite_dma_rel_y;
int m_sprite_dma_x_clip;
DECLARE_WRITE16_MEMBER(cop_sprite_dma_abs_y_w);
DECLARE_WRITE16_MEMBER(cop_sprite_dma_abs_x_w);

View File

@ -582,7 +582,10 @@ void raiden2cop_device::LEGACY_execute_c480(int offset, uint16_t data)
sprite_pri |= 0x8000;
m_host_space->write_word(cop_regs[4] + offs + 2, sprite_pri);
}
m_host_space->write_word(cop_regs[4] + offs + 4, sprite_x);
// save into internal clip register, cfr. increment DMA register $410
m_sprite_dma_x_clip = sprite_x;
m_host_space->write_word(cop_regs[4] + offs + 4, m_sprite_dma_x_clip);
m_host_space->write_word(cop_regs[4] + offs + 6, sprite_y);
}