video/ppu2c0x.cpp: Improved behavior of OAM writes during PPU rendering. (#10678)

Noticeably improves high hopes demo.
This commit is contained in:
0kmg 2022-12-13 10:46:37 -08:00 committed by GitHub
parent c0412d9ca3
commit 25067c5654
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 12 deletions

View File

@ -114,8 +114,7 @@ ppu2c0x_device::ppu2c0x_device(const machine_config& mconfig, device_type type,
m_buffered_data(0),
m_sprite_page(0),
m_scan_scale(1), // set the scan scale (this is for dual monitor vertical setups)
m_draw_phase(0),
m_use_sprite_write_limitation(true)
m_draw_phase(0)
{
for (auto& elem : m_regs)
elem = 0;
@ -1284,12 +1283,13 @@ void ppu2c0x_device::write(offs_t offset, uint8_t data)
break;
case PPU_SPRITE_DATA: /* 4 */
// If the PPU is currently rendering the screen, 0xff is written instead of the desired data.
if (m_use_sprite_write_limitation)
if (m_scanline <= BOTTOM_VISIBLE_SCANLINE)
data = 0xff;
m_spriteram[m_regs[PPU_SPRITE_ADDRESS]] = data;
m_regs[PPU_SPRITE_ADDRESS] = (m_regs[PPU_SPRITE_ADDRESS] + 1) & 0xff;
// writes to sprite data during rendering do not modify memory
// TODO: however writes during rendering do perform a glitchy increment to the address
if (m_scanline > BOTTOM_VISIBLE_SCANLINE || !(m_regs[PPU_CONTROL1] & (PPU_CONTROL1_BACKGROUND | PPU_CONTROL1_SPRITES)))
{
m_spriteram[m_regs[PPU_SPRITE_ADDRESS]] = data;
m_regs[PPU_SPRITE_ADDRESS] = (m_regs[PPU_SPRITE_ADDRESS] + 1) & 0xff;
}
break;
case PPU_SCROLL: /* 5 */

View File

@ -127,8 +127,6 @@ public:
// void update_screen(bitmap_t &bitmap, const rectangle &cliprect);
// some bootleg / clone hardware appears to ignore this
void use_sprite_write_limitation_disable() { m_use_sprite_write_limitation = false; }
uint16_t get_vram_dest();
void set_vram_dest(uint16_t dest);
@ -244,8 +242,6 @@ private:
emu_timer *m_hblank_timer; /* hblank period at end of each scanline */
emu_timer *m_nmi_timer; /* NMI timer */
emu_timer *m_scanline_timer; /* scanline timer */
bool m_use_sprite_write_limitation;
};
class ppu2c0x_rgb_device : public ppu2c0x_device {