[NES] separate color conversion logic for use in tools
This commit is contained in:
parent
791f2bcc2f
commit
fe51441596
|
@ -132,6 +132,17 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
cpu.PendingCycles -= 512;
|
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)
|
public byte ReadMemory(ushort addr)
|
||||||
{
|
{
|
||||||
if (addr < 0x0800) return ram[addr];
|
if (addr < 0x0800) return ram[addr];
|
||||||
|
|
|
@ -56,13 +56,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
for (int x = 0; x < 256; x++)
|
for (int x = 0; x < 256; x++)
|
||||||
{
|
{
|
||||||
int pixel = emu.ppu.xbuf[i];
|
int pixel = emu.ppu.xbuf[i];
|
||||||
int deemph = pixel >> 8;
|
pixels[i] = emu.ConvertColor(pixel);
|
||||||
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;
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return pixels;
|
return pixels;
|
||||||
|
|
Loading…
Reference in New Issue