minimal deemph palette emulation

This commit is contained in:
zeromus 2011-02-27 10:55:38 +00:00
parent 4e85d82f14
commit 7367e8b542
3 changed files with 17 additions and 4 deletions

View File

@ -117,10 +117,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
for (int i = 0; i < 256; i++)
{
byte db = ReadMemory((ushort)addr);
if (i == 1 && db != 0)
{
int zzz = 9;
}
WriteMemory(0x2004, db);
addr++;
}
@ -180,6 +176,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
int r = emu.palette[pixel, 0];
int g = emu.palette[pixel, 1];
int b = emu.palette[pixel, 2];
Palettes.ApplyDeemphasis(ref r, ref g, ref b, deemph);
pixels[i] = (r<<16)|(g<<8)|b;
i++;
}

View File

@ -71,6 +71,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
byte pad;
}
//TODO - check flashing sirens in werewolf
int PaletteAdjustPixel(int pixel)
{
//tack on the deemph bits

View File

@ -12,6 +12,21 @@ namespace BizHawk.Emulation.Consoles.Nintendo
{
static class Palettes
{
static float[] rtmul = { 1.239f, 0.794f, 1.019f, 0.905f, 1.023f, 0.741f, 0.75f };
static float[] gtmul = { 0.915f, 1.086f, 0.98f, 1.026f, 0.908f, 0.987f, 0.75f };
static float[] btmul = { 0.743f, 0.882f, 0.653f, 1.277f, 0.979f, 0.101f, 0.75f };
public static void ApplyDeemphasis(ref int r, ref int g, ref int b, int deemph_bits)
{
if (deemph_bits == 0) return;
int d = deemph_bits-1;
r = (int)(r * rtmul[d]);
g = (int)(g * gtmul[d]);
b = (int)(b * btmul[d]);
if (r > 0xFF) r = 0xFF;
if (g > 0xFF) g = 0xFF;
if (b > 0xFF) b = 0xFF;
}
public static int[,] FCEUX_Standard = new int[,]
{
{ 0x1D<<2, 0x1D<<2, 0x1D<<2 }, /* Value 0 */