[NES] separate color conversion logic for use in tools

This commit is contained in:
zeromus 2011-03-08 19:05:52 +00:00
parent 791f2bcc2f
commit fe51441596
2 changed files with 12 additions and 7 deletions

View File

@ -132,6 +132,17 @@ namespace BizHawk.Emulation.Consoles.Nintendo
cpu.PendingCycles -= 512;
}
public int ConvertColor(int pixel)
{
int deemph = pixel >> 8;
int palentry = pixel & 0xFF;
int r = palette[palentry, 0];
int g = palette[palentry, 1];
int b = palette[palentry, 2];
Palettes.ApplyDeemphasis(ref r, ref g, ref b, deemph);
return (r << 16) | (g << 8) | b;
}
public byte ReadMemory(ushort addr)
{
if (addr < 0x0800) return ram[addr];

View File

@ -56,13 +56,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
for (int x = 0; x < 256; x++)
{
int pixel = emu.ppu.xbuf[i];
int deemph = pixel >> 8;
int palentry = pixel & 0xFF;
int r = emu.palette[palentry, 0];
int g = emu.palette[palentry, 1];
int b = emu.palette[palentry, 2];
Palettes.ApplyDeemphasis(ref r, ref g, ref b, deemph);
pixels[i] = (r<<16)|(g<<8)|b;
pixels[i] = emu.ConvertColor(pixel);
i++;
}
return pixels;