bsnes-emu / bsnes

bsnes is a Super Nintendo (SNES) emulator focused on performance, features, and ease of use.
Other
1.68k stars 156 forks source link

Fix color blending math in fast PPU #79

Open ghost opened 3 years ago

ghost commented 3 years ago

Presuming https://github.com/bsnes-emu/bsnes/pull/78 gets merged, there will be four hacks left that aren't directly related to intentional accuracy sacrifices for speed. Two in particular look like low hanging fruit:

https://github.com/bsnes-emu/bsnes/blob/master/bsnes/target-bsnes/program/hacks.cpp#L25

//the dialogue text is blurry due to an issue in the scanline-based renderer's color math support
if(title == "マーヴェラス") fastPPU = false;
//stage 2 uses pseudo-hires in a way that's not compatible with the scanline-based renderer
if(title == "SFC クレヨンシンチャン") fastPPU = false;

These work correctly with the pixel-based PPU. I can't make sense of how to port the fixes from it to the scanline-based PPU, but I'm making an issue report in the hopes someone else can.

The color blending code for the pixel-based PPU is here: https://github.com/bsnes-emu/bsnes/blob/master/bsnes/sfc/ppu/screen.cpp#L32

The color blending code for the scanline-based PPU is here: https://github.com/bsnes-emu/bsnes/blob/master/bsnes/sfc/ppu-fast/line.cpp#L106

Also worth noting is this issue affects higan-emu's ppu-performance, only there's no hacks in place with it: https://github.com/higan-emu/higan/blob/master/higan/sfc/ppu-performance/dac.cpp#L33

A fix for this would improve both emulators.

Max833 commented 3 years ago

More Context: https://archive.is/cWlTv

But yeah unfortunately this one's a known issue. It's also the cause of that one game with the fog level I had to disable the fast PPU on: a while back AWJ helped enhance the accuracy PPU to have more accurate color blending, but the accuracy PPU is so incredibly different in structure that I was never able to port the color blending modifications back to the fast PPU. I'm not sure if we should disable the fast PPU for this one ... it will make Marvelous a lot more demanding, and it's actually a pretty decent game. The text isn't illegible, just ... worse. Unfortunately I really don't know how to fix it though. I'd need some help with porting over the accuracy PPU color blending logic.

So yeah... maybe someone like @awjackson is capable doing this. But it looks like the fast PPU does handle this completly different.

Related: https://github.com/bsnes-emu/bsnes/issues/212