gen: fix render scroll plane size / window calculation bug. fixes gfx glitches in several games.

This commit is contained in:
beirich 2012-09-09 04:22:44 +00:00
parent 64419fa501
commit a4f8ecc2e0
1 changed files with 9 additions and 9 deletions

View File

@ -48,13 +48,13 @@ namespace BizHawk.Emulation.Consoles.Sega
FrameBuffer[(p*FrameWidth) + i] = Palette[(p*16) + i]; FrameBuffer[(p*FrameWidth) + i] = Palette[(p*16) + i];
} }
void RenderScrollAScanline(int xScroll, int yScroll, int nameTableBase, int startPixel, int endPixel) void RenderScrollAScanline(int xScroll, int yScroll, int nameTableBase, int startPixel, int endPixel, bool window)
{ {
const int lowPriority = 2; const int lowPriority = 2;
const int highPriority = 5; const int highPriority = 5;
int yTile = ((ScanLine + yScroll) / 8) % NameTableHeight; int yTile = ((ScanLine + yScroll) / 8) % NameTableHeight;
int nameTableWidth = NameTableWidth; int nameTableWidth = NameTableWidth;
if (nameTableBase == NameTableAddrWindow) if (window)
nameTableWidth = Display40Mode ? 64 : 32; nameTableWidth = Display40Mode ? 64 : 32;
// this is hellllla slow. but not optimizing until we implement & understand // this is hellllla slow. but not optimizing until we implement & understand
@ -161,24 +161,24 @@ namespace BizHawk.Emulation.Consoles.Sega
if (ScanLine >= startWindowScanline && ScanLine < endWindowScanline) // Window takes up whole scanline if (ScanLine >= startWindowScanline && ScanLine < endWindowScanline) // Window takes up whole scanline
{ {
RenderScrollAScanline(0, 0, NameTableAddrWindow, 0, FrameWidth); RenderScrollAScanline(0, 0, NameTableAddrWindow, 0, FrameWidth, true);
} }
else if (startWindowPixel != -1) // Window takes up partial scanline else if (startWindowPixel != -1) // Window takes up partial scanline
{ {
if (startWindowPixel == 0) // Window grows from left side if (startWindowPixel == 0) // Window grows from left side
{ {
RenderScrollAScanline(0, 0, NameTableAddrWindow, 0, endWindowPixel); RenderScrollAScanline(0, 0, NameTableAddrWindow, 0, endWindowPixel, true);
RenderScrollAScanline(hscroll, vscroll, NameTableAddrA, endWindowPixel, FrameWidth); RenderScrollAScanline(hscroll, vscroll, NameTableAddrA, endWindowPixel, FrameWidth, false);
} }
else // Window grows from right side else // Window grows from right side
{ {
RenderScrollAScanline(hscroll, vscroll, NameTableAddrA, 0, startWindowPixel); RenderScrollAScanline(hscroll, vscroll, NameTableAddrA, 0, startWindowPixel, false);
RenderScrollAScanline(0, 0, NameTableAddrWindow, startWindowPixel, FrameWidth); RenderScrollAScanline(0, 0, NameTableAddrWindow, startWindowPixel, FrameWidth, true);
} }
} }
else // No window else // No window this scanline
{ {
RenderScrollAScanline(hscroll, vscroll, NameTableAddrA, 0, FrameWidth); RenderScrollAScanline(hscroll, vscroll, NameTableAddrA, 0, FrameWidth, false);
} }
} }