SMS: fix backdrop colors
This commit is contained in:
parent
9448e56f0a
commit
c636c01424
src/BizHawk.Emulation.Cores/Consoles/Sega/SMS
|
@ -309,28 +309,25 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
OverscanFrameBuffer = new int[OverscanFrameHeight * OverscanFrameWidth];
|
||||
}
|
||||
|
||||
// TODO: overscan color can change, this should be calculated per scanline, not done in bulk at the end
|
||||
int overscan_color = Palette[BackdropColor];
|
||||
|
||||
// Top overscan
|
||||
for (int y=0; y<overscanTop; y++)
|
||||
for (int x = 0; x < OverscanFrameWidth; x++)
|
||||
OverscanFrameBuffer[(y * OverscanFrameWidth) + x] = overscan_color;
|
||||
OverscanFrameBuffer[(y * OverscanFrameWidth) + x] = Backdrop_SL[0];
|
||||
|
||||
// Bottom overscan
|
||||
for (int y = overscanTop + 192; y < OverscanFrameHeight; y++)
|
||||
for (int x = 0; x < OverscanFrameWidth; x++)
|
||||
OverscanFrameBuffer[(y * OverscanFrameWidth) + x] = overscan_color;
|
||||
OverscanFrameBuffer[(y * OverscanFrameWidth) + x] = Backdrop_SL[FrameHeight-1];
|
||||
|
||||
// Left overscan
|
||||
for (int y = overscanTop; y < overscanTop + 192; y++)
|
||||
for (int x = 0; x < overscanLeft; x++)
|
||||
OverscanFrameBuffer[(y * OverscanFrameWidth) + x] = overscan_color;
|
||||
OverscanFrameBuffer[(y * OverscanFrameWidth) + x] = Backdrop_SL[y - overscanTop];
|
||||
|
||||
// Right overscan
|
||||
for (int y = overscanTop; y < overscanTop + 192; y++)
|
||||
for (int x = overscanLeft + 256; x < OverscanFrameWidth; x++)
|
||||
OverscanFrameBuffer[(y * OverscanFrameWidth) + x] = overscan_color;
|
||||
OverscanFrameBuffer[(y * OverscanFrameWidth) + x] = Backdrop_SL[y - overscanTop];
|
||||
|
||||
// Active display area
|
||||
for (int y = 0; y < 192; y++)
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
public int[] FrameBuffer = new int[256 * 192];
|
||||
public int[] GameGearFrameBuffer = new int[160 * 144];
|
||||
public int[] OverscanFrameBuffer = null;
|
||||
public int[] Backdrop_SL = new int[256];
|
||||
|
||||
public bool Mode1Bit => (Registers[1] & 16) > 0;
|
||||
public bool Mode2Bit => (Registers[0] & 2) > 0;
|
||||
|
@ -382,6 +383,11 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
|
||||
internal void RenderCurrentScanline(bool render)
|
||||
{
|
||||
if (ScanLine < FrameHeight)
|
||||
{
|
||||
Backdrop_SL[ScanLine] = Palette[(byte)(16 + (Registers[7] & 15))];
|
||||
}
|
||||
|
||||
// only mode 4 supports frameskip. deal with it
|
||||
if (TmsMode == 4)
|
||||
{
|
||||
|
@ -423,6 +429,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
ser.Sync(nameof(CRAM), ref CRAM, false);
|
||||
ser.Sync(nameof(VRAM), ref VRAM, false);
|
||||
ser.Sync(nameof(HCounter), ref HCounter);
|
||||
ser.Sync(nameof(Backdrop_SL), ref Backdrop_SL, false);
|
||||
ser.EndSection();
|
||||
|
||||
if (ser.IsReader)
|
||||
|
|
Loading…
Reference in New Issue