diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs index 8216d2501d..d53630208f 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs @@ -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++; } diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/PPU.run.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/PPU.run.cs index 064aa1e917..beb2c4e1bf 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/PPU.run.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/PPU.run.cs @@ -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 diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Palettes.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Palettes.cs index c5ba6ed75c..e571aaf7b2 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Palettes.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Palettes.cs @@ -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 */