SourMesen / Mesen-S

Mesen-S is a cross-platform (Windows & Linux) SNES emulator built in C++ and C#
GNU General Public License v3.0
415 stars 100 forks source link

GB: Evel Knievel (GBC) has tile map errors on Level Select screen characters #170

Open redacted173 opened 4 years ago

redacted173 commented 4 years ago

In Evel Knievel (GBC) some BG tile map writes get dropped on the first scanline because the SGB mode never sets _isFirstFrame = false. Start New Game -> Select default Stage.

https://github.com/SourMesen/Mesen-S/blob/master/Core/GbPpu.cpp#L627

This game uses the OAM STAT IRQ and several other IRQs to perform work. The IRQ for the OAM STAT ends up pushing VRAM writes for the tile map updates to the moving BG text after the rendering mode of the PPU. But for scanline 0 the OAM STAT IRQ is missing since _isFirstFrame always evaluates to true. In this case they get dropped and the expanding/scrolling text gets corrupted.

Adding the assignment of _isFirstFrame = false to the block guarded by SGB is not a small change for the rendering pipe. I tried Pinball Fantasies to make sure it still works, but unsure if this exposes other issues.