NES NT Viewer - show some more info on mouse over
This commit is contained in:
parent
f210e21b1e
commit
1bb58fc026
|
@ -44,12 +44,16 @@
|
|||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox4 = new System.Windows.Forms.GroupBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.TileIDLabel = new System.Windows.Forms.Label();
|
||||
this.XYLabel = new System.Windows.Forms.Label();
|
||||
this.PPUAddressLabel = new System.Windows.Forms.Label();
|
||||
this.XYLabel = new System.Windows.Forms.Label();
|
||||
this.TileIDLabel = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.TableLabel = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.PaletteLabel = new System.Windows.Forms.Label();
|
||||
this.NameTableView = new BizHawk.MultiClient.NameTableViewer();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
|
@ -203,6 +207,10 @@
|
|||
//
|
||||
// groupBox4
|
||||
//
|
||||
this.groupBox4.Controls.Add(this.PaletteLabel);
|
||||
this.groupBox4.Controls.Add(this.label5);
|
||||
this.groupBox4.Controls.Add(this.TableLabel);
|
||||
this.groupBox4.Controls.Add(this.label4);
|
||||
this.groupBox4.Controls.Add(this.PPUAddressLabel);
|
||||
this.groupBox4.Controls.Add(this.XYLabel);
|
||||
this.groupBox4.Controls.Add(this.TileIDLabel);
|
||||
|
@ -211,56 +219,11 @@
|
|||
this.groupBox4.Controls.Add(this.label1);
|
||||
this.groupBox4.Location = new System.Drawing.Point(563, 179);
|
||||
this.groupBox4.Name = "groupBox4";
|
||||
this.groupBox4.Size = new System.Drawing.Size(108, 100);
|
||||
this.groupBox4.Size = new System.Drawing.Size(108, 128);
|
||||
this.groupBox4.TabIndex = 13;
|
||||
this.groupBox4.TabStop = false;
|
||||
this.groupBox4.Text = "Properties";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(6, 26);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(41, 13);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Tile ID:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(6, 43);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(35, 13);
|
||||
this.label2.TabIndex = 1;
|
||||
this.label2.Text = "X / Y:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(6, 60);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(57, 13);
|
||||
this.label3.TabIndex = 2;
|
||||
this.label3.Text = "PPU Addr:";
|
||||
//
|
||||
// TileIDLabel
|
||||
//
|
||||
this.TileIDLabel.AutoSize = true;
|
||||
this.TileIDLabel.Location = new System.Drawing.Point(64, 26);
|
||||
this.TileIDLabel.Name = "TileIDLabel";
|
||||
this.TileIDLabel.Size = new System.Drawing.Size(22, 13);
|
||||
this.TileIDLabel.TabIndex = 3;
|
||||
this.TileIDLabel.Text = " ";
|
||||
//
|
||||
// XYLabel
|
||||
//
|
||||
this.XYLabel.AutoSize = true;
|
||||
this.XYLabel.Location = new System.Drawing.Point(64, 43);
|
||||
this.XYLabel.Name = "XYLabel";
|
||||
this.XYLabel.Size = new System.Drawing.Size(22, 13);
|
||||
this.XYLabel.TabIndex = 4;
|
||||
this.XYLabel.Text = " ";
|
||||
//
|
||||
// PPUAddressLabel
|
||||
//
|
||||
this.PPUAddressLabel.AutoSize = true;
|
||||
|
@ -270,9 +233,90 @@
|
|||
this.PPUAddressLabel.TabIndex = 5;
|
||||
this.PPUAddressLabel.Text = " ";
|
||||
//
|
||||
// XYLabel
|
||||
//
|
||||
this.XYLabel.AutoSize = true;
|
||||
this.XYLabel.Location = new System.Drawing.Point(64, 43);
|
||||
this.XYLabel.Name = "XYLabel";
|
||||
this.XYLabel.Size = new System.Drawing.Size(22, 13);
|
||||
this.XYLabel.TabIndex = 4;
|
||||
this.XYLabel.Text = " ";
|
||||
//
|
||||
// TileIDLabel
|
||||
//
|
||||
this.TileIDLabel.AutoSize = true;
|
||||
this.TileIDLabel.Location = new System.Drawing.Point(64, 26);
|
||||
this.TileIDLabel.Name = "TileIDLabel";
|
||||
this.TileIDLabel.Size = new System.Drawing.Size(22, 13);
|
||||
this.TileIDLabel.TabIndex = 3;
|
||||
this.TileIDLabel.Text = " ";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(6, 60);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(57, 13);
|
||||
this.label3.TabIndex = 2;
|
||||
this.label3.Text = "PPU Addr:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(6, 43);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(35, 13);
|
||||
this.label2.TabIndex = 1;
|
||||
this.label2.Text = "X / Y:";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(6, 26);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(41, 13);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Tile ID:";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(6, 78);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(37, 13);
|
||||
this.label4.TabIndex = 6;
|
||||
this.label4.Text = "Table:";
|
||||
//
|
||||
// TableLabel
|
||||
//
|
||||
this.TableLabel.AutoSize = true;
|
||||
this.TableLabel.Location = new System.Drawing.Point(64, 78);
|
||||
this.TableLabel.Name = "TableLabel";
|
||||
this.TableLabel.Size = new System.Drawing.Size(22, 13);
|
||||
this.TableLabel.TabIndex = 7;
|
||||
this.TableLabel.Text = " ";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(6, 96);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(43, 13);
|
||||
this.label5.TabIndex = 8;
|
||||
this.label5.Text = "Palette:";
|
||||
//
|
||||
// PaletteLabel
|
||||
//
|
||||
this.PaletteLabel.AutoSize = true;
|
||||
this.PaletteLabel.Location = new System.Drawing.Point(64, 96);
|
||||
this.PaletteLabel.Name = "PaletteLabel";
|
||||
this.PaletteLabel.Size = new System.Drawing.Size(22, 13);
|
||||
this.PaletteLabel.TabIndex = 9;
|
||||
this.PaletteLabel.Text = " ";
|
||||
//
|
||||
// NameTableView
|
||||
//
|
||||
this.NameTableView.BackColor = System.Drawing.Color.Black;
|
||||
this.NameTableView.BackColor = System.Drawing.Color.Transparent;
|
||||
this.NameTableView.Location = new System.Drawing.Point(17, 19);
|
||||
this.NameTableView.Name = "NameTableView";
|
||||
this.NameTableView.Size = new System.Drawing.Size(512, 480);
|
||||
|
@ -335,5 +379,9 @@
|
|||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label TableLabel;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.Label PaletteLabel;
|
||||
}
|
||||
}
|
|
@ -207,6 +207,30 @@ namespace BizHawk.MultiClient
|
|||
PPUAddressLabel.Text = String.Format("{0:X4}", PPUAddress);
|
||||
int TileID = Nes.ppu.ppubus_read(PPUAddress, true);
|
||||
TileIDLabel.Text = String.Format("{0:X2}", TileID);
|
||||
TableLabel.Text = NameTable.ToString();
|
||||
|
||||
int ytable = 0, yline = 0;
|
||||
if (e.Y >= 240)
|
||||
{
|
||||
ytable += 2;
|
||||
yline = 240;
|
||||
}
|
||||
int pt_add = Nes.ppu.reg_2000.bg_pattern_hi ? 0x1000 : 0;
|
||||
int table = (e.X >> 8) + ytable;
|
||||
int ntaddr = (table << 10);
|
||||
int px = e.X & 255;
|
||||
int py = e.Y - yline;
|
||||
int tx = px >> 3;
|
||||
int ty = py >> 3;
|
||||
int ntbyte_ptr = ntaddr + (ty * 32) + tx;
|
||||
int atbyte_ptr = ntaddr + 0x3C0 + ((ty >> 2) << 3) + (tx >> 2);
|
||||
int nt = Nes.ppu.ppubus_peek(ntbyte_ptr + 0x2000);
|
||||
|
||||
int at = Nes.ppu.ppubus_peek(atbyte_ptr + 0x2000);
|
||||
if ((ty & 2) != 0) at >>= 4;
|
||||
if ((tx & 2) != 0) at >>= 2;
|
||||
at &= 0x03;
|
||||
PaletteLabel.Text = at.ToString();
|
||||
}
|
||||
|
||||
private void NameTableView_MouseLeave(object sender, EventArgs e)
|
||||
|
@ -214,6 +238,8 @@ namespace BizHawk.MultiClient
|
|||
XYLabel.Text = "";
|
||||
PPUAddressLabel.Text = "";
|
||||
TileIDLabel.Text = "";
|
||||
TableLabel.Text = "";
|
||||
PaletteLabel.Text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,8 +20,9 @@ namespace BizHawk.MultiClient
|
|||
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
SetStyle(ControlStyles.UserPaint, true);
|
||||
SetStyle(ControlStyles.DoubleBuffer, true);
|
||||
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
this.Size = new Size(256, 224);
|
||||
this.BackColor = Color.White;
|
||||
this.BackColor = Color.Transparent;
|
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.NameTableViewer_Paint);
|
||||
}
|
||||
|
||||
|
@ -66,7 +67,34 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void NameTableViewer_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
Display(e.Graphics);
|
||||
e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
e.Graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;
|
||||
switch (Which)
|
||||
{
|
||||
case WhichNametable.NT_ALL:
|
||||
e.Graphics.DrawImageUnscaled(nametables, 1, 1);
|
||||
break;
|
||||
case WhichNametable.NT_2000:
|
||||
e.Graphics.DrawImage(nametables, new Rectangle(0, 0, 512, 480), 0, 0, 256, 240, GraphicsUnit.Pixel);
|
||||
break;
|
||||
case WhichNametable.NT_2400:
|
||||
e.Graphics.DrawImage(nametables, new Rectangle(0, 0, 512, 480), 256, 0, 256, 240, GraphicsUnit.Pixel);
|
||||
break;
|
||||
case WhichNametable.NT_2800:
|
||||
e.Graphics.DrawImage(nametables, new Rectangle(0, 0, 512, 480), 0, 240, 256, 240, GraphicsUnit.Pixel);
|
||||
break;
|
||||
case WhichNametable.NT_2C00:
|
||||
e.Graphics.DrawImage(nametables, new Rectangle(0, 0, 512, 480), 256, 240, 256, 240, GraphicsUnit.Pixel);
|
||||
break;
|
||||
|
||||
//adelikat: Meh, just in case we might want these, someone requested it but I can't remember the justification so I didn't do the UI part
|
||||
case WhichNametable.TOPS:
|
||||
e.Graphics.DrawImage(nametables, new Rectangle(0, 0, 512, 240), 0, 0, 512, 240, GraphicsUnit.Pixel);
|
||||
break;
|
||||
case WhichNametable.BOTTOMS:
|
||||
e.Graphics.DrawImage(nametables, new Rectangle(0, 240, 512, 240), 0, 240, 512, 240, GraphicsUnit.Pixel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue