NES - implement Clip Left & Right sides option
This commit is contained in:
parent
721a514d26
commit
35d0ad1b31
|
@ -133,6 +133,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
{
|
||||
public int top = 8;
|
||||
public int bottom = 231;
|
||||
public int left = 0;
|
||||
public int right = 256;
|
||||
|
||||
NES emu;
|
||||
public MyVideoProvider(NES emu)
|
||||
|
@ -145,31 +147,46 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
{
|
||||
int backdrop = emu.CoreInputComm.NES_BackdropColor;
|
||||
bool useBackdrop = (backdrop & 0xFF000000) != 0;
|
||||
|
||||
//TODO - we could recalculate this on the fly (and invalidate/recalculate it when the palette is changed)
|
||||
for (int x = 0; x < 256; x++)
|
||||
int width = right - left;
|
||||
for (int x = left; x < right; x++)
|
||||
{
|
||||
for (int y = top; y < bottom; y++)
|
||||
{
|
||||
short pixel = emu.ppu.xbuf[(y*256) + x];
|
||||
if ((pixel & 0x8000) != 0 && useBackdrop)
|
||||
{
|
||||
pixels[((y-top)*256) + x] = backdrop;
|
||||
pixels[((y-top)*width) + (x - left)] = backdrop;
|
||||
}
|
||||
else pixels[((y-top)*256) + x] = emu.palette_compiled[pixel & 0x7FFF];
|
||||
else pixels[((y-top)*width) + (x - left)] = emu.palette_compiled[pixel & 0x7FFF];
|
||||
}
|
||||
}
|
||||
return pixels;
|
||||
}
|
||||
public int BufferWidth { get { return 256; } }
|
||||
public int BufferWidth { get { return right - left; } }
|
||||
public int BufferHeight { get { return bottom - top; } }
|
||||
public int BackgroundColor { get { return 0; } }
|
||||
public int Top { get { return top; } set { top = value; } }
|
||||
public int Bottom { get { return bottom; } set { bottom = value; } }
|
||||
}
|
||||
|
||||
public int FirstDrawLine { get { return videoProvider.top; } set { videoProvider.top = value; } }
|
||||
public int LastDrawLine { get { return videoProvider.bottom; } set { videoProvider.bottom = value; } }
|
||||
|
||||
public void SetClipLeftAndRight(bool clip)
|
||||
{
|
||||
if (clip)
|
||||
{
|
||||
videoProvider.left = 8;
|
||||
videoProvider.right = 248;
|
||||
}
|
||||
else
|
||||
{
|
||||
videoProvider.left = 0;
|
||||
videoProvider.right = 256;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MyVideoProvider videoProvider;
|
||||
public IVideoProvider VideoProvider { get { return videoProvider; } }
|
||||
public ISoundProvider SoundProvider { get { return apu; } }
|
||||
|
|
|
@ -1029,6 +1029,7 @@ namespace BizHawk.MultiClient
|
|||
NES nes = new NES(game, rom.FileData);
|
||||
nes.FirstDrawLine = Global.Config.NESTopLine;
|
||||
nes.LastDrawLine = Global.Config.NESBottomLine;
|
||||
nes.SetClipLeftAndRight(Global.Config.NESClipLeftAndRight);
|
||||
Global.Game.Status = nes.RomStatus;
|
||||
nextEmulator = nes;
|
||||
if (Global.Config.NESAutoLoadPalette && Global.Config.NESPaletteFile.Length > 0 &&
|
||||
|
|
|
@ -220,7 +220,6 @@
|
|||
// ClipLeftAndRightCheckBox
|
||||
//
|
||||
this.ClipLeftAndRightCheckBox.AutoSize = true;
|
||||
this.ClipLeftAndRightCheckBox.Enabled = false;
|
||||
this.ClipLeftAndRightCheckBox.Location = new System.Drawing.Point(143, 47);
|
||||
this.ClipLeftAndRightCheckBox.Name = "ClipLeftAndRightCheckBox";
|
||||
this.ClipLeftAndRightCheckBox.Size = new System.Drawing.Size(186, 17);
|
||||
|
|
|
@ -93,6 +93,7 @@ namespace BizHawk.MultiClient
|
|||
nes.LastDrawLine = (int)LastLineNumeric.Value;
|
||||
Global.Config.NESAllowMoreThanEightSprites = AllowMoreSprites.Checked;
|
||||
Global.Config.NESClipLeftAndRight = ClipLeftAndRightCheckBox.Checked;
|
||||
nes.SetClipLeftAndRight(ClipLeftAndRightCheckBox.Checked);
|
||||
Global.Config.NESAutoLoadPalette = AutoLoadPalette.Checked;
|
||||
Global.Config.NESDispSprites = DispSprites.Checked;
|
||||
Global.Config.NESDispBackground = DispBackground.Checked;
|
||||
|
|
Loading…
Reference in New Issue