NES - PPU Viewer - more small speed optimizations
This commit is contained in:
parent
e2469328ae
commit
a5e369b872
|
@ -87,20 +87,28 @@ namespace BizHawk.MultiClient
|
||||||
if (Global.Emulator.Frame % RefreshRate.Value == 0 || now)
|
if (Global.Emulator.Frame % RefreshRate.Value == 0 || now)
|
||||||
{
|
{
|
||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
for (int x = 0; x < 0x2000; x++)
|
|
||||||
{
|
|
||||||
PPUBusprev[x] = PPUBus[x];
|
|
||||||
PPUBus[x] = Nes.ppu.ppubus_peek(x);
|
|
||||||
if (PPUBus[x] != PPUBusprev[x])
|
|
||||||
Changed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int x = 0; x < 0x20; x++)
|
for (int x = 0; x < 0x20; x++)
|
||||||
{
|
{
|
||||||
PALRAMprev[x] = PALRAM[x];
|
PALRAMprev[x] = PALRAM[x];
|
||||||
PALRAM[x] = Nes.ppu.PALRAM[x];
|
PALRAM[x] = Nes.ppu.PALRAM[x];
|
||||||
if (PALRAM[x] != PALRAMprev[x])
|
if (PALRAM[x] != PALRAMprev[x])
|
||||||
|
{
|
||||||
Changed = true;
|
Changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Changed)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < 0x2000; x++)
|
||||||
|
{
|
||||||
|
PPUBusprev[x] = PPUBus[x];
|
||||||
|
PPUBus[x] = Nes.ppu.ppubus_peek(x);
|
||||||
|
if (PPUBus[x] != PPUBusprev[x])
|
||||||
|
{
|
||||||
|
Changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int b0 = 0;
|
int b0 = 0;
|
||||||
|
@ -120,9 +128,9 @@ namespace BizHawk.MultiClient
|
||||||
PaletteView.spritePalettes[x].Value = Nes.LookupColor(Nes.ppu.PALRAM[PaletteView.spritePalettes[x].Address]);
|
PaletteView.spritePalettes[x].Value = Nes.LookupColor(Nes.ppu.PALRAM[PaletteView.spritePalettes[x].Address]);
|
||||||
}
|
}
|
||||||
if (PaletteView.HasChanged())
|
if (PaletteView.HasChanged())
|
||||||
|
{
|
||||||
PaletteView.Refresh();
|
PaletteView.Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
System.Drawing.Imaging.BitmapData bmpdata = PatternView.pattern.LockBits(new Rectangle(new Point(0, 0), PatternView.pattern.Size), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
System.Drawing.Imaging.BitmapData bmpdata = PatternView.pattern.LockBits(new Rectangle(new Point(0, 0), PatternView.pattern.Size), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||||
int* framebuf = (int*)bmpdata.Scan0.ToPointer();
|
int* framebuf = (int*)bmpdata.Scan0.ToPointer();
|
||||||
|
@ -141,8 +149,9 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
for (int y = 0; y < 8; y++)
|
for (int y = 0; y < 8; y++)
|
||||||
{
|
{
|
||||||
b0 = GetBit((z << 12) + (i << 8) + (j << 4) + y , x);
|
int address = (z << 12) + (i << 8) + (j << 4) + y;
|
||||||
b1 = GetBit((z << 12) + (i << 8) + (j << 4) + y + 8, x);
|
b0 = (byte)(((PPUBus[address] >> (7 - x)) & 1));
|
||||||
|
b1 = (byte)(((PPUBus[address + 8] >> (7 - x)) & 1));
|
||||||
|
|
||||||
value = (byte)(b0 + (b1 << 1));
|
value = (byte)(b0 + (b1 << 1));
|
||||||
cvalue = Nes.LookupColor(Nes.ppu.PALRAM[value + (pal << 2)]);
|
cvalue = Nes.LookupColor(Nes.ppu.PALRAM[value + (pal << 2)]);
|
||||||
|
@ -193,8 +202,9 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
for (int y = 0; y < 8; y++)
|
for (int y = 0; y < 8; y++)
|
||||||
{
|
{
|
||||||
b0 = GetBit(PatAddr + y + 0 * 8, x);
|
int address = PatAddr + y;
|
||||||
b1 = GetBit(PatAddr + y + 1 * 8, x);
|
b0 = (byte)(((PPUBus[address] >> (7 - x)) & 1));
|
||||||
|
b1 = (byte)(((PPUBus[address + 8] >> (7 - x)) & 1));
|
||||||
value = (byte)(b0 + (b1 << 1));
|
value = (byte)(b0 + (b1 << 1));
|
||||||
cvalue = Nes.LookupColor(Nes.ppu.PALRAM[16 + value + (Palette << 2)]);
|
cvalue = Nes.LookupColor(Nes.ppu.PALRAM[16 + value + (Palette << 2)]);
|
||||||
|
|
||||||
|
@ -206,8 +216,9 @@ namespace BizHawk.MultiClient
|
||||||
PatAddr += 0x10;
|
PatAddr += 0x10;
|
||||||
for (int y = 0; y < 8; y++)
|
for (int y = 0; y < 8; y++)
|
||||||
{
|
{
|
||||||
b0 = GetBit(PatAddr + y, x);
|
int address = PatAddr + y;
|
||||||
b1 = GetBit(PatAddr + y + 8, x);
|
b0 = (byte)(((PPUBus[address] >> (7 - x)) & 1));
|
||||||
|
b1 = (byte)(((PPUBus[address + 8] >> (7 - x)) & 1));
|
||||||
value = (byte)(b0 + (b1 << 1));
|
value = (byte)(b0 + (b1 << 1));
|
||||||
cvalue = Nes.LookupColor(Nes.ppu.PALRAM[16 + value + (Palette << 2)]);
|
cvalue = Nes.LookupColor(Nes.ppu.PALRAM[16 + value + (Palette << 2)]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue