diff options
author | 2019-07-02 20:51:24 -0300 | |
---|---|---|
committer | 2019-07-02 20:51:24 -0300 | |
commit | 2a664c1f23140acc85e2e837da32dabe404f32f3 (patch) | |
tree | e09337d13bd1fe3ca36ac8b0cf673d78b86ea570 /src/devices/video/ppu2c0x.cpp | |
parent | b1dff791ed66f114f3b8d63c156d8f16f06c0f0c (diff) |
nes, sms: Fix light gun regression
Diffstat (limited to 'src/devices/video/ppu2c0x.cpp')
-rw-r--r-- | src/devices/video/ppu2c0x.cpp | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/src/devices/video/ppu2c0x.cpp b/src/devices/video/ppu2c0x.cpp index f97c91d381b..c4ac3898b4d 100644 --- a/src/devices/video/ppu2c0x.cpp +++ b/src/devices/video/ppu2c0x.cpp @@ -979,10 +979,13 @@ void ppu2c0x_device::update_scanline() /* Render this scanline if appropriate */ if (m_regs[PPU_CONTROL1] & (PPU_CONTROL1_BACKGROUND | PPU_CONTROL1_SPRITES)) { - /* If background or sprites are enabled, copy the ppu address latch */ - /* Copy only the scroll x-coarse and the x-overflow bit */ - m_refresh_data &= ~0x041f; - m_refresh_data |= (m_refresh_latch & 0x041f); + if (m_scanline_timer->remaining() == attotime::zero) + { + /* If background or sprites are enabled, copy the ppu address latch */ + /* Copy only the scroll x-coarse and the x-overflow bit */ + m_refresh_data &= ~0x041f; + m_refresh_data |= (m_refresh_latch & 0x041f); + } // logerror("updating refresh_data: %04x (scanline: %d)\n", m_refresh_data, m_scanline); render_scanline(); @@ -1014,23 +1017,26 @@ void ppu2c0x_device::update_scanline() bitmap.pix32(m_scanline, i) = back_pen; } - /* increment the fine y-scroll */ - m_refresh_data += 0x1000; - - /* if it's rolled, increment the coarse y-scroll */ - if (m_refresh_data & 0x8000) + if (m_scanline_timer->remaining() == attotime::zero) { - uint16_t tmp; - tmp = (m_refresh_data & 0x03e0) + 0x20; - m_refresh_data &= 0x7c1f; + /* increment the fine y-scroll */ + m_refresh_data += 0x1000; - /* handle bizarro scrolling rollover at the 30th (not 32nd) vertical tile */ - if (tmp == 0x03c0) - m_refresh_data ^= 0x0800; - else - m_refresh_data |= (tmp & 0x03e0); + /* if it's rolled, increment the coarse y-scroll */ + if (m_refresh_data & 0x8000) + { + uint16_t tmp; + tmp = (m_refresh_data & 0x03e0) + 0x20; + m_refresh_data &= 0x7c1f; -// logerror("updating refresh_data: %04x\n", m_refresh_data); + /* handle bizarro scrolling rollover at the 30th (not 32nd) vertical tile */ + if (tmp == 0x03c0) + m_refresh_data ^= 0x0800; + else + m_refresh_data |= (tmp & 0x03e0); + + //logerror("updating refresh_data: %04x\n", m_refresh_data); + } } } @@ -1331,13 +1337,18 @@ void ppu2c0x_device::spriteram_dma( address_space &space, const uint8_t page ) * *************************************/ -void ppu2c0x_device::render(bitmap_rgb32 &bitmap, int flipx, int flipy, int sx, int sy) +void ppu2c0x_device::render(bitmap_rgb32 &bitmap, int flipx, int flipy, int sx, int sy, const rectangle &cliprect) { - copybitmap(bitmap, *m_bitmap, flipx, flipy, sx, sy, bitmap.cliprect()); + if (m_scanline_timer->remaining() != attotime::zero) + { + // Partial line update, need to render first (especially for light gun emulation). + update_scanline(); + } + copybitmap(bitmap, *m_bitmap, flipx, flipy, sx, sy, cliprect); } uint32_t ppu2c0x_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - render(bitmap, 0, 0, 0, 0); + render(bitmap, 0, 0, 0, 0, cliprect); return 0; } |