NES - don't recalculated the framebuffer constantly, instead only do it once per frame. ~1fps speed up

This commit is contained in:
adelikat 2012-08-19 20:01:17 +00:00
parent 493cff72c4
commit 70929679d5
2 changed files with 9 additions and 3 deletions

View File

@ -71,6 +71,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
bool resetSignal;
public void FrameAdvance(bool render)
{
videoProvider.FillFrameBuffer();
lagged = true;
if (resetSignal)
{

View File

@ -121,7 +121,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
public int bottom = 231;
public int left = 0;
public int right = 255;
NES emu;
public MyVideoProvider(NES emu)
{
@ -130,6 +130,11 @@ namespace BizHawk.Emulation.Consoles.Nintendo
int[] pixels = new int[256 * 240];
public int[] GetVideoBuffer()
{
return pixels;
}
public void FillFrameBuffer()
{
int backdrop = emu.CoreInputComm.NES_BackdropColor;
bool useBackdrop = (backdrop & 0xFF000000) != 0;
@ -148,9 +153,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
else pixels[((y - top) * width) + (x - left)] = emu.palette_compiled[pixel & 0x7FFF];
}
}
return pixels;
}
public int VirtualWidth { get { return BufferWidth; } }
public int VirtualWidth { get { return BufferWidth; } }
public int BufferWidth { get { return right - left + 1; } }
public int BufferHeight { get { return bottom - top + 1; } }
public int BackgroundColor { get { return 0; } }