neshawk: fix bottom-left-corner in dw4. I tried to fix this in the least blecky way possible, but it wasnt the smallest possible change. Smallest possible change would be simply to add a PPUOFF check around the wacky code.

This commit is contained in:
zeromus 2015-09-06 12:02:22 -05:00
parent 3fccda33fd
commit 1ced59c21e
1 changed files with 16 additions and 21 deletions

View File

@ -188,7 +188,22 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
int bgpx = bgpos & 7;
int bgtile = bgpos >> 3;
int pixel = 0, pixelcolor;
int pixel = 0, pixelcolor = PALRAM[pixel];
//according to qeed's doc, use palette 0 or $2006's value if it is & 0x3Fxx
//at one point I commented this out to fix bottom-left garbage in DW4. but it's needed for full_nes_palette.
//solution is to only run when PPU is actually OFF (left-suppression doesnt count)
if (!reg_2001.show_bg && !reg_2001.show_obj)
{
// if there's anything wrong with how we're doing this, someone please chime in
int addr = ppur.get_2007access();
if ((addr & 0x3F00) == 0x3F00)
{
pixel = addr & 0x1F;
}
pixelcolor = PALRAM[pixel];
pixelcolor |= 0x8000; //whats this? i think its a flag to indicate a hidden background to be used by the canvas filling logic later
}
//generate the BG data
if (renderbgnow)
@ -201,26 +216,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
pixel |= bgdata[bgtile].at;
pixelcolor = PALRAM[pixel];
}
else
{
if (!renderspritenow)
{
//according to qeed's doc, use palette 0 or $2006's value if it is & 0x3Fxx
//EDIT - this requires corect emulation of PPU OFF state, and seems only to apply when the PPU is OFF
// not sure why this was off, but having it on fixes full_nes_palette, and it's a behavior that's been
// verified on the decapped PPU
// if there's anything wrong with how we're doing this, someone please chime in
int addr = ppur.get_2007access();
if ((addr & 0x3F00) == 0x3F00)
{
// System.Console.WriteLine("{0:X4}", addr);
pixel = addr & 0x1F;
}
}
pixelcolor = PALRAM[pixel];
pixelcolor |= 0x8000; //whats this? i think its a flag to indicate a hidden background to be used by the canvas filling logic later
}
if (!nes.Settings.DispBackground)
pixelcolor = 0x8000; //whats this? i think its a flag to indicate a hidden background to be used by the canvas filling logic later