From e44b18dd7962d9ff261b93cdf9d41a4a017d9a93 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Sun, 13 Mar 2011 01:43:49 +0000 Subject: [PATCH] NES PPU - clicking the pattern view toggles through the 8 palette choices --- .../BizHawk.MultiClient.csproj | 4 + BizHawk.MultiClient/NEStools/NESPPU.cs | 4 +- BizHawk.MultiClient/NEStools/PatternViewer.cs | 19 +++ .../NEStools/PatternViewer.resx | 123 ++++++++++++++++++ 4 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 BizHawk.MultiClient/NEStools/PatternViewer.resx diff --git a/BizHawk.MultiClient/BizHawk.MultiClient.csproj b/BizHawk.MultiClient/BizHawk.MultiClient.csproj index 182ffc95b6..d8969c961b 100644 --- a/BizHawk.MultiClient/BizHawk.MultiClient.csproj +++ b/BizHawk.MultiClient/BizHawk.MultiClient.csproj @@ -292,6 +292,10 @@ NESPPU.cs Designer + + PatternViewer.cs + Designer + PlayMovie.cs Designer diff --git a/BizHawk.MultiClient/NEStools/NESPPU.cs b/BizHawk.MultiClient/NEStools/NESPPU.cs index 0010e24082..c0363764b9 100644 --- a/BizHawk.MultiClient/NEStools/NESPPU.cs +++ b/BizHawk.MultiClient/NEStools/NESPPU.cs @@ -99,8 +99,8 @@ namespace BizHawk.MultiClient byte value = (byte)(b0 + (b1 * 2)); byte value2 = (byte)(b2 + (b3 * 2)); - value += Nes.ppu.PALRAM[value + (0 * 4)]; //TODO: 0 = user selection 0-7 - value2 += Nes.ppu.PALRAM[value2 + (0 * 4)]; //TODO: 0 = user selection 0-7 + value += Nes.ppu.PALRAM[value + (PatternView.Pal0 * 4)]; //TODO: 0 = user selection 0-7 + value2 += Nes.ppu.PALRAM[value2 + (PatternView.Pal1 * 4)]; //TODO: 0 = user selection 0-7 int cvalue = Nes.ConvertColor(value); int cvalue2 = Nes.ConvertColor(value2); diff --git a/BizHawk.MultiClient/NEStools/PatternViewer.cs b/BizHawk.MultiClient/NEStools/PatternViewer.cs index 32e2c5951a..ae3bd230de 100644 --- a/BizHawk.MultiClient/NEStools/PatternViewer.cs +++ b/BizHawk.MultiClient/NEStools/PatternViewer.cs @@ -12,6 +12,8 @@ namespace BizHawk.MultiClient { Size pSize; public Bitmap pattern; + public int Pal0 = 0; //0-7 Palette choice + public int Pal1 = 0; public PatternViewer() { @@ -25,6 +27,8 @@ namespace BizHawk.MultiClient this.Paint += new System.Windows.Forms.PaintEventHandler(this.PatternViewer_Paint); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.PatternViewer_KeyDown); + this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PatternViewer_Click); + for (int x = 0; x < pattern.Size.Width; x++) { for (int y = 0; y < pattern.Size.Height; y++) @@ -48,5 +52,20 @@ namespace BizHawk.MultiClient { Display(e.Graphics); } + + private void PatternViewer_Click(object sender, MouseEventArgs e) + { + if (e.X < (this.Size.Width / 2)) + { + Pal0++; + if (Pal0 > 7) Pal0 = 0; + } + else + { + Pal1++; + if (Pal1 > 7) Pal1 = 0; + } + this.Refresh(); + } } } diff --git a/BizHawk.MultiClient/NEStools/PatternViewer.resx b/BizHawk.MultiClient/NEStools/PatternViewer.resx new file mode 100644 index 0000000000..3276f5c015 --- /dev/null +++ b/BizHawk.MultiClient/NEStools/PatternViewer.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + \ No newline at end of file