[NES] make pattern view run at a reasonable speed
This commit is contained in:
parent
e015be999a
commit
44619d747c
|
@ -62,7 +62,7 @@ namespace BizHawk.MultiClient
|
|||
return (byte)(((value >> (7 - bit)) & 1));
|
||||
}
|
||||
|
||||
public void UpdateValues()
|
||||
public unsafe void UpdateValues()
|
||||
{
|
||||
if (!(Global.Emulator is NES)) return;
|
||||
if (!this.IsHandleCreated || this.IsDisposed) return;
|
||||
|
@ -76,6 +76,8 @@ namespace BizHawk.MultiClient
|
|||
PaletteView.Refresh();
|
||||
|
||||
//Pattern Viewer
|
||||
System.Drawing.Imaging.BitmapData bmpdata = PatternView.pattern.LockBits(new Rectangle(new Point(0, 0), PatternView.pattern.Size), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
int* framebuf = (int*)bmpdata.Scan0.ToPointer();
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
for (int j = 0; j < 16; j++)
|
||||
|
@ -97,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 + (0 * 4)]; //TODO: 0 = user selection 0-7
|
||||
value2 += Nes.ppu.PALRAM[value2 + (0 * 4)]; //TODO: 0 = user selection 0-7
|
||||
|
||||
int cvalue = Nes.ConvertColor(value);
|
||||
int cvalue2 = Nes.ConvertColor(value2);
|
||||
|
@ -109,12 +111,14 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
Color color = Color.FromArgb(cvalue);
|
||||
Color color2 = Color.FromArgb(cvalue2);
|
||||
PatternView.pattern.SetPixel(x + (j*8), y + (i*8), color);
|
||||
PatternView.pattern.SetPixel(128 + x + (j * 8), y + (i * 8), color2);
|
||||
int adr = (x + (j * 8)) + (y + (i * 8)) * (bmpdata.Stride / 4);
|
||||
framebuf[adr] = color.ToArgb();
|
||||
framebuf[adr + 128] = color2.ToArgb();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
PatternView.pattern.UnlockBits(bmpdata);
|
||||
PatternView.Refresh();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue