NESPPU - at a refresh rate slider. I was hoping to not resort to such a hack but it REALLY helps, and most case uses don't need full refresh accuracy, and on those occasions, it is a simple use of the slider.
This commit is contained in:
parent
f2e6babd71
commit
4048863a30
|
@ -244,6 +244,7 @@
|
|||
public bool NESPPUSaveWindowPosition = true;
|
||||
public int NESPPUWndx = -1;
|
||||
public int NESPPUWndy = -1;
|
||||
public int NESPPURefreshRate = 4;
|
||||
|
||||
// NESDebuger Settings
|
||||
public bool AutoLoadNESDebugger = false;
|
||||
|
|
|
@ -34,6 +34,12 @@
|
|||
this.Table0PaletteLabel = new System.Windows.Forms.Label();
|
||||
this.PalettesGroup = new System.Windows.Forms.GroupBox();
|
||||
this.DetailsBox = new System.Windows.Forms.GroupBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.Value5Label = new System.Windows.Forms.Label();
|
||||
this.Value4Label = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.ZoomBox = new System.Windows.Forms.PictureBox();
|
||||
this.Value3Label = new System.Windows.Forms.Label();
|
||||
this.Value2Label = new System.Windows.Forms.Label();
|
||||
this.ValueLabel = new System.Windows.Forms.Label();
|
||||
this.AddressLabel = new System.Windows.Forms.Label();
|
||||
|
@ -63,22 +69,22 @@
|
|||
this.SpriteViewerBox = new System.Windows.Forms.GroupBox();
|
||||
this.txtScanline = new System.Windows.Forms.TextBox();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.Value3Label = new System.Windows.Forms.Label();
|
||||
this.ZoomBox = new System.Windows.Forms.PictureBox();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.RefreshRate = new System.Windows.Forms.TrackBar();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.SpriteView = new BizHawk.MultiClient.SpriteViewer();
|
||||
this.PaletteView = new BizHawk.MultiClient.PaletteViewer();
|
||||
this.PatternView = new BizHawk.MultiClient.PatternViewer();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.Value4Label = new System.Windows.Forms.Label();
|
||||
this.Value5Label = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.PatternGroup.SuspendLayout();
|
||||
this.PalettesGroup.SuspendLayout();
|
||||
this.DetailsBox.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ZoomBox)).BeginInit();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
this.SpriteViewerBox.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ZoomBox)).BeginInit();
|
||||
this.groupBox2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.RefreshRate)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// PatternGroup
|
||||
|
@ -139,6 +145,59 @@
|
|||
this.DetailsBox.TabStop = false;
|
||||
this.DetailsBox.Text = "Details";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(6, 31);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(163, 13);
|
||||
this.label2.TabIndex = 10;
|
||||
this.label2.Text = "Right-click to remember selection";
|
||||
//
|
||||
// Value5Label
|
||||
//
|
||||
this.Value5Label.AutoSize = true;
|
||||
this.Value5Label.Location = new System.Drawing.Point(176, 148);
|
||||
this.Value5Label.Name = "Value5Label";
|
||||
this.Value5Label.Size = new System.Drawing.Size(43, 13);
|
||||
this.Value5Label.TabIndex = 9;
|
||||
this.Value5Label.Text = "Value 5";
|
||||
//
|
||||
// Value4Label
|
||||
//
|
||||
this.Value4Label.AutoSize = true;
|
||||
this.Value4Label.Location = new System.Drawing.Point(176, 120);
|
||||
this.Value4Label.Name = "Value4Label";
|
||||
this.Value4Label.Size = new System.Drawing.Size(43, 13);
|
||||
this.Value4Label.TabIndex = 8;
|
||||
this.Value4Label.Text = "Value 4";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(6, 16);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(152, 13);
|
||||
this.label1.TabIndex = 7;
|
||||
this.label1.Text = "Hover over item to view details";
|
||||
//
|
||||
// ZoomBox
|
||||
//
|
||||
this.ZoomBox.Location = new System.Drawing.Point(196, 16);
|
||||
this.ZoomBox.Name = "ZoomBox";
|
||||
this.ZoomBox.Size = new System.Drawing.Size(64, 64);
|
||||
this.ZoomBox.TabIndex = 6;
|
||||
this.ZoomBox.TabStop = false;
|
||||
//
|
||||
// Value3Label
|
||||
//
|
||||
this.Value3Label.AutoSize = true;
|
||||
this.Value3Label.Location = new System.Drawing.Point(176, 92);
|
||||
this.Value3Label.Name = "Value3Label";
|
||||
this.Value3Label.Size = new System.Drawing.Size(43, 13);
|
||||
this.Value3Label.TabIndex = 5;
|
||||
this.Value3Label.Text = "Value 3";
|
||||
//
|
||||
// Value2Label
|
||||
//
|
||||
this.Value2Label.AutoSize = true;
|
||||
|
@ -389,22 +448,48 @@
|
|||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Scanline";
|
||||
//
|
||||
// Value3Label
|
||||
// groupBox2
|
||||
//
|
||||
this.Value3Label.AutoSize = true;
|
||||
this.Value3Label.Location = new System.Drawing.Point(176, 92);
|
||||
this.Value3Label.Name = "Value3Label";
|
||||
this.Value3Label.Size = new System.Drawing.Size(43, 13);
|
||||
this.Value3Label.TabIndex = 5;
|
||||
this.Value3Label.Text = "Value 3";
|
||||
this.groupBox2.Controls.Add(this.label4);
|
||||
this.groupBox2.Controls.Add(this.label3);
|
||||
this.groupBox2.Controls.Add(this.RefreshRate);
|
||||
this.groupBox2.Location = new System.Drawing.Point(93, 37);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(191, 52);
|
||||
this.groupBox2.TabIndex = 9;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Refresh";
|
||||
//
|
||||
// ZoomBox
|
||||
// RefreshRate
|
||||
//
|
||||
this.ZoomBox.Location = new System.Drawing.Point(196, 16);
|
||||
this.ZoomBox.Name = "ZoomBox";
|
||||
this.ZoomBox.Size = new System.Drawing.Size(64, 64);
|
||||
this.ZoomBox.TabIndex = 6;
|
||||
this.ZoomBox.TabStop = false;
|
||||
this.RefreshRate.AutoSize = false;
|
||||
this.RefreshRate.LargeChange = 2;
|
||||
this.RefreshRate.Location = new System.Drawing.Point(39, 15);
|
||||
this.RefreshRate.Maximum = 8;
|
||||
this.RefreshRate.Minimum = 1;
|
||||
this.RefreshRate.Name = "RefreshRate";
|
||||
this.RefreshRate.Size = new System.Drawing.Size(104, 31);
|
||||
this.RefreshRate.TabIndex = 0;
|
||||
this.RefreshRate.TickFrequency = 8;
|
||||
this.RefreshRate.Value = 1;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(6, 19);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(31, 13);
|
||||
this.label3.TabIndex = 10;
|
||||
this.label3.Text = "More";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(140, 20);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(29, 13);
|
||||
this.label4.TabIndex = 11;
|
||||
this.label4.Text = "Less";
|
||||
//
|
||||
// SpriteView
|
||||
//
|
||||
|
@ -442,47 +527,12 @@
|
|||
this.PatternView.MouseLeave += new System.EventHandler(this.PatternView_MouseLeave);
|
||||
this.PatternView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PatternView_MouseMove);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(6, 16);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(152, 13);
|
||||
this.label1.TabIndex = 7;
|
||||
this.label1.Text = "Hover over item to view details";
|
||||
//
|
||||
// Value4Label
|
||||
//
|
||||
this.Value4Label.AutoSize = true;
|
||||
this.Value4Label.Location = new System.Drawing.Point(176, 120);
|
||||
this.Value4Label.Name = "Value4Label";
|
||||
this.Value4Label.Size = new System.Drawing.Size(43, 13);
|
||||
this.Value4Label.TabIndex = 8;
|
||||
this.Value4Label.Text = "Value 4";
|
||||
//
|
||||
// Value5Label
|
||||
//
|
||||
this.Value5Label.AutoSize = true;
|
||||
this.Value5Label.Location = new System.Drawing.Point(176, 148);
|
||||
this.Value5Label.Name = "Value5Label";
|
||||
this.Value5Label.Size = new System.Drawing.Size(43, 13);
|
||||
this.Value5Label.TabIndex = 9;
|
||||
this.Value5Label.Text = "Value 5";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(6, 31);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(163, 13);
|
||||
this.label2.TabIndex = 10;
|
||||
this.label2.Text = "Right-click to remember selection";
|
||||
//
|
||||
// NESPPU
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(574, 348);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.SpriteViewerBox);
|
||||
this.Controls.Add(this.toolStrip1);
|
||||
|
@ -501,12 +551,15 @@
|
|||
this.PalettesGroup.ResumeLayout(false);
|
||||
this.DetailsBox.ResumeLayout(false);
|
||||
this.DetailsBox.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ZoomBox)).EndInit();
|
||||
this.toolStrip1.ResumeLayout(false);
|
||||
this.toolStrip1.PerformLayout();
|
||||
this.SpriteViewerBox.ResumeLayout(false);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ZoomBox)).EndInit();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.RefreshRate)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
@ -557,5 +610,9 @@
|
|||
private System.Windows.Forms.Label Value4Label;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.TrackBar RefreshRate;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label3;
|
||||
}
|
||||
}
|
|
@ -40,6 +40,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
Global.Config.NESPPUWndx = this.Location.X;
|
||||
Global.Config.NESPPUWndy = this.Location.Y;
|
||||
Global.Config.NESPPURefreshRate = RefreshRate.Value;
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
|
@ -68,6 +69,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
if (!this.IsHandleCreated || this.IsDisposed) return;
|
||||
|
||||
|
||||
//Pattern Viewer
|
||||
for (int x = 0; x < 16; x++)
|
||||
{
|
||||
|
@ -79,85 +81,88 @@ namespace BizHawk.MultiClient
|
|||
if (PaletteView.HasChanged())
|
||||
PaletteView.Refresh();
|
||||
|
||||
//Pattern Viewer
|
||||
int b0 = 0;
|
||||
int b1 = 0;
|
||||
byte value;
|
||||
int cvalue;
|
||||
int pal;
|
||||
|
||||
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 z = 0; z < 2; z++)
|
||||
if (Global.Emulator.Frame % RefreshRate.Value == 0)
|
||||
{
|
||||
if (z == 0)
|
||||
pal = PatternView.Pal0;
|
||||
else
|
||||
pal = PatternView.Pal1;
|
||||
//Pattern Viewer
|
||||
int b0 = 0;
|
||||
int b1 = 0;
|
||||
byte value;
|
||||
int cvalue;
|
||||
int pal;
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
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 z = 0; z < 2; z++)
|
||||
{
|
||||
for (int j = 0; j < 16; j++)
|
||||
if (z == 0)
|
||||
pal = PatternView.Pal0;
|
||||
else
|
||||
pal = PatternView.Pal1;
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
for (int x = 0; x < 8; x++)
|
||||
for (int j = 0; j < 16; j++)
|
||||
{
|
||||
for (int y = 0; y < 8; y++)
|
||||
for (int x = 0; x < 8; x++)
|
||||
{
|
||||
b0 = GetBit((z * 0x1000) + (i * 256) + (j * 16) + y + 0 * 8, x);
|
||||
b1 = GetBit((z * 0x1000) + (i * 256) + (j * 16) + y + 1 * 8, x);
|
||||
for (int y = 0; y < 8; y++)
|
||||
{
|
||||
b0 = GetBit((z * 0x1000) + (i * 256) + (j * 16) + y + 0 * 8, x);
|
||||
b1 = GetBit((z * 0x1000) + (i * 256) + (j * 16) + y + 1 * 8, x);
|
||||
|
||||
value = (byte)(b0 + (b1 << 1));
|
||||
value = (byte)(b0 + (b1 << 1));
|
||||
|
||||
cvalue = Nes.LookupColor(Nes.ppu.PALRAM[value + (pal * 4)]);
|
||||
cvalue = Nes.LookupColor(Nes.ppu.PALRAM[value + (pal * 4)]);
|
||||
|
||||
Color color = Color.FromArgb(cvalue);
|
||||
Color color = Color.FromArgb(cvalue);
|
||||
|
||||
int adr = (x + (j * 8)) + (y + (i * 8)) * (bmpdata.Stride / 4);
|
||||
framebuf[adr + (z * 128)] = color.ToArgb();
|
||||
int adr = (x + (j * 8)) + (y + (i * 8)) * (bmpdata.Stride / 4);
|
||||
framebuf[adr + (z * 128)] = color.ToArgb();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
PatternView.pattern.UnlockBits(bmpdata);
|
||||
PatternView.Refresh();
|
||||
PatternView.pattern.UnlockBits(bmpdata);
|
||||
PatternView.Refresh();
|
||||
|
||||
System.Drawing.Imaging.BitmapData bmpdata2 = SpriteView.sprites.LockBits(new Rectangle(new Point(0, 0), SpriteView.sprites.Size), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
int* framebuf2 = (int*)bmpdata2.Scan0.ToPointer();
|
||||
int Addr, SpriteNum, TileNum, PatAddr, Attr;
|
||||
|
||||
System.Drawing.Imaging.BitmapData bmpdata2 = SpriteView.sprites.LockBits(new Rectangle(new Point(0, 0), SpriteView.sprites.Size), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
int* framebuf2 = (int*)bmpdata2.Scan0.ToPointer();
|
||||
int Addr, SpriteNum, TileNum, PatAddr, Attr;
|
||||
|
||||
//Sprite Viewer
|
||||
for (int n = 0; n < 4; n++)
|
||||
{
|
||||
for (int r = 0; r < 16; r++)
|
||||
//Sprite Viewer
|
||||
for (int n = 0; n < 4; n++)
|
||||
{
|
||||
Addr = 0x23C1 + (n * 0x400) + (r + 4); //TODO: NEEDZ ADDRESS!
|
||||
SpriteNum = (n << 4) | r;
|
||||
TileNum = Nes.ppu.ppubus_read(Addr, true);
|
||||
PatAddr = (TileNum * 0x10) + (n > 1 ? 0x1000 : 0);
|
||||
Attr = 0; //TODO
|
||||
|
||||
//TODO: 8x16 viewing
|
||||
for (int x = 0; x < 8; x++)
|
||||
for (int r = 0; r < 16; r++)
|
||||
{
|
||||
for (int y = 0; y < 8; y++)
|
||||
Addr = 0x23C1 + (n * 0x400) + (r + 4); //TODO: NEEDZ ADDRESS!
|
||||
SpriteNum = (n << 4) | r;
|
||||
TileNum = Nes.ppu.ppubus_read(Addr, true);
|
||||
PatAddr = (TileNum * 0x10) + (n > 1 ? 0x1000 : 0);
|
||||
Attr = 0; //TODO
|
||||
|
||||
//TODO: 8x16 viewing
|
||||
for (int x = 0; x < 8; x++)
|
||||
{
|
||||
b0 = GetBit(PatAddr + y + 0 * 8, x);
|
||||
b1 = GetBit(PatAddr + y + 1 * 8, x);
|
||||
value = (byte)(b0 + (b1 << 1));
|
||||
cvalue = Nes.LookupColor(Nes.ppu.PALRAM[value + (PatternView.Pal0 * 4)]);
|
||||
Color color = Color.FromArgb(cvalue);
|
||||
for (int y = 0; y < 8; y++)
|
||||
{
|
||||
b0 = GetBit(PatAddr + y + 0 * 8, x);
|
||||
b1 = GetBit(PatAddr + y + 1 * 8, x);
|
||||
value = (byte)(b0 + (b1 << 1));
|
||||
cvalue = Nes.LookupColor(Nes.ppu.PALRAM[value + (PatternView.Pal0 * 4)]);
|
||||
Color color = Color.FromArgb(cvalue);
|
||||
|
||||
int adr = (x + (r * 8 * 2)) + (y + (n * 8 * 3)) * (bmpdata2.Stride / 4);
|
||||
framebuf2[adr] = color.ToArgb();
|
||||
int adr = (x + (r * 8 * 2)) + (y + (n * 8 * 3)) * (bmpdata2.Stride / 4);
|
||||
framebuf2[adr] = color.ToArgb();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
SpriteView.sprites.UnlockBits(bmpdata2);
|
||||
SpriteView.Refresh();
|
||||
}
|
||||
SpriteView.sprites.UnlockBits(bmpdata2);
|
||||
SpriteView.Refresh();
|
||||
}
|
||||
|
||||
public unsafe void UpdateValues()
|
||||
|
@ -172,6 +177,7 @@ namespace BizHawk.MultiClient
|
|||
LoadConfigSettings();
|
||||
Nes = Global.Emulator as NES;
|
||||
ClearDetails();
|
||||
RefreshRate.Value = Global.Config.NESPPURefreshRate;
|
||||
}
|
||||
|
||||
private void ClearDetails()
|
||||
|
|
Loading…
Reference in New Issue