jsgroth / jgenesis

Sega Genesis / Sega CD / SNES / Master System / Game Gear emulator
MIT License
41 stars 3 forks source link

NHL '94 (USA).sfc glitchy line on the title screen #68

Open benderscruffy opened 2 months ago

benderscruffy commented 2 months ago

on the title screen when the puck comes down the screen the glitchy line appears when then puck first comes out

jsgroth commented 2 months ago

This is caused by not correctly handling mid-scanline writes to the Mode 7 scroll/center/parameter registers, which appear to be latched at the start of the scanline slightly before rendering starts. This also affects Battle Clash (there's a glitchy ~5-10 pixels towards the bottom-left corner of the screen during gameplay).

jsgroth commented 2 months ago

It seems like different emulators handle this differently, and I'm currently not sure what the correct behavior is.

Mesen appears to latch the registers at start of rendering (around H=22). This avoids the glitchy lines in NHL '94 but causes a glitchy line in Battle Clash during gameplay, which was the reason I attempted to handle mid-scanline Mode 7 register writes in the first place (and clearly did so incorrectly). Maybe that glitchy line is there on actual hardware?

bsnes/ares with the performance PPU normally latches all registers partway through the scanline (around H=128) which avoids the glitchy line in Battle Clash, but it has game-specific overrides for games that do mid-scanline PPU register writes, including NHL '94 where it renders the line around H=8.

bsnes/ares with the accuracy PPU renders pixel-by-pixel without latching any registers which causes partially glitched lines in both NHL '94 and Battle Clash.

jsgroth commented 2 months ago

For now at least I've changed the behavior to match what I think Mesen is doing, where mid-scanline Mode 7 register writes don't take effect until the next line. This fixes the glitchy lines in NHL '94 but does cause a glitchy line in Battle Clash during gameplay, right where the screen switches from Mode 1 to Mode 7.