From 33c104d41892f668a67e8943fbc84ff28a7fe5d1 Mon Sep 17 00:00:00 2001 From: adelikat Date: Fri, 31 Jan 2014 21:23:46 +0000 Subject: [PATCH] NES Nametable Viewer - Floating Window and Always on Top, and refactor --- BizHawk.Client.Common/config/Config.cs | 6 +- .../tools/NES/NESNameTableViewer.Designer.cs | 954 +++++++++--------- .../tools/NES/NESNameTableViewer.cs | 416 ++++---- 3 files changed, 730 insertions(+), 646 deletions(-) diff --git a/BizHawk.Client.Common/config/Config.cs b/BizHawk.Client.Common/config/Config.cs index 73898b4ede..aad55b09d3 100644 --- a/BizHawk.Client.Common/config/Config.cs +++ b/BizHawk.Client.Common/config/Config.cs @@ -358,11 +358,9 @@ namespace BizHawk.Client.Common public int NESDebuggerWidth = -1; public int NESDebuggerHeight = -1; - // NESNameTableViewer Settings + // NES NameTableViewer Settings + public ToolDialogSettings NesNameTableSettings = new ToolDialogSettings(); public bool AutoLoadNESNameTable = false; - public bool NESNameTableSaveWindowPosition = true; - public int NESNameTableWndx = -1; - public int NESNameTableWndy = -1; public int NESNameTableRefreshRate = 4; // gb gpu view settings diff --git a/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.Designer.cs b/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.Designer.cs index c8d09746c7..ba30821d73 100644 --- a/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.Designer.cs @@ -28,467 +28,478 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.NameTableView = new BizHawk.Client.EmuHawk.NameTableViewer(); - this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.screenshotAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveImageClipboardToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.refreshImageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.menuStrip1 = new MenuStripEx(); - this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.screenshotToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.screenshotToClipboardToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.autoloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.txtScanline = new System.Windows.Forms.TextBox(); - this.rbNametableNW = new System.Windows.Forms.RadioButton(); - this.rbNametableNE = new System.Windows.Forms.RadioButton(); - this.rbNametableSW = new System.Windows.Forms.RadioButton(); - this.rbNametableSE = new System.Windows.Forms.RadioButton(); - this.rbNametableAll = new System.Windows.Forms.RadioButton(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.groupBox3 = new System.Windows.Forms.GroupBox(); - this.groupBox4 = new System.Windows.Forms.GroupBox(); - this.PaletteLabel = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.TableLabel = new System.Windows.Forms.Label(); - this.label4 = 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.groupBox5 = new System.Windows.Forms.GroupBox(); - this.label7 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.RefreshRate = new System.Windows.Forms.TrackBar(); - this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.groupBox1.SuspendLayout(); - this.contextMenuStrip1.SuspendLayout(); - this.menuStrip1.SuspendLayout(); - this.groupBox2.SuspendLayout(); - this.groupBox3.SuspendLayout(); - this.groupBox4.SuspendLayout(); - this.groupBox5.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.RefreshRate)).BeginInit(); - this.SuspendLayout(); - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.NameTableView); - this.groupBox1.Location = new System.Drawing.Point(12, 36); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(545, 513); - this.groupBox1.TabIndex = 0; - this.groupBox1.TabStop = false; - // - // NameTableView - // - this.NameTableView.BackColor = System.Drawing.Color.Transparent; - this.NameTableView.ContextMenuStrip = this.contextMenuStrip1; - this.NameTableView.Location = new System.Drawing.Point(17, 19); - this.NameTableView.Name = "NameTableView"; - this.NameTableView.Size = new System.Drawing.Size(512, 480); - this.NameTableView.TabIndex = 0; - this.NameTableView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.NESNameTableViewer_KeyDown); - this.NameTableView.MouseLeave += new System.EventHandler(this.NameTableView_MouseLeave); - this.NameTableView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.NameTableView_MouseMove); - // - // contextMenuStrip1 - // - this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.screenshotAsToolStripMenuItem, - this.saveImageClipboardToolStripMenuItem, - this.refreshImageToolStripMenuItem}); - this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(248, 70); - // - // screenshotAsToolStripMenuItem - // - this.screenshotAsToolStripMenuItem.Name = "screenshotAsToolStripMenuItem"; - this.screenshotAsToolStripMenuItem.Size = new System.Drawing.Size(247, 22); - this.screenshotAsToolStripMenuItem.Text = "&Save Image..."; - this.screenshotAsToolStripMenuItem.Click += new System.EventHandler(this.screenshotAsToolStripMenuItem_Click); - // - // saveImageClipboardToolStripMenuItem - // - this.saveImageClipboardToolStripMenuItem.Name = "saveImageClipboardToolStripMenuItem"; - this.saveImageClipboardToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+C"; - this.saveImageClipboardToolStripMenuItem.Size = new System.Drawing.Size(247, 22); - this.saveImageClipboardToolStripMenuItem.Text = "&Copy Image to clipboard"; - this.saveImageClipboardToolStripMenuItem.Click += new System.EventHandler(this.saveImageClipboardToolStripMenuItem_Click); - // - // refreshImageToolStripMenuItem - // - this.refreshImageToolStripMenuItem.Name = "refreshImageToolStripMenuItem"; - this.refreshImageToolStripMenuItem.Size = new System.Drawing.Size(247, 22); - this.refreshImageToolStripMenuItem.Text = "&Refresh Image"; - this.refreshImageToolStripMenuItem.Click += new System.EventHandler(this.refreshImageToolStripMenuItem_Click); - // - // menuStrip1 - // - this.menuStrip1.ClickThrough = true; - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.fileToolStripMenuItem, - this.optionsToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(0, 0); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(679, 24); - this.menuStrip1.TabIndex = 1; - this.menuStrip1.Text = "menuStrip1"; - // - // fileToolStripMenuItem - // - this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.screenshotToolStripMenuItem, - this.screenshotToClipboardToolStripMenuItem, + this.components = new System.ComponentModel.Container(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.NameTableView = new BizHawk.Client.EmuHawk.NameTableViewer(); + this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.ScreenshotAsContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.SaveImageClipboardMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.RefreshImageContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.menuStrip1 = new MenuStripEx(); + this.FileSubMenu = new System.Windows.Forms.ToolStripMenuItem(); + this.ScreenshotMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.ScreenshotToClipboardMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.OptionsSubMenu = new System.Windows.Forms.ToolStripMenuItem(); + this.AutoloadMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.SaveWindowPositionMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.AlwaysOnTopMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.FloatingWindowMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.txtScanline = new System.Windows.Forms.TextBox(); + this.rbNametableNW = new System.Windows.Forms.RadioButton(); + this.rbNametableNE = new System.Windows.Forms.RadioButton(); + this.rbNametableSW = new System.Windows.Forms.RadioButton(); + this.rbNametableSE = new System.Windows.Forms.RadioButton(); + this.rbNametableAll = new System.Windows.Forms.RadioButton(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.PaletteLabel = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.TableLabel = new System.Windows.Forms.Label(); + this.label4 = 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.groupBox5 = new System.Windows.Forms.GroupBox(); + this.label7 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.RefreshRate = new System.Windows.Forms.TrackBar(); + this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.groupBox1.SuspendLayout(); + this.contextMenuStrip1.SuspendLayout(); + this.menuStrip1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.groupBox4.SuspendLayout(); + this.groupBox5.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.RefreshRate)).BeginInit(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.NameTableView); + this.groupBox1.Location = new System.Drawing.Point(12, 36); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(545, 513); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + // + // NameTableView + // + this.NameTableView.BackColor = System.Drawing.Color.Transparent; + this.NameTableView.ContextMenuStrip = this.contextMenuStrip1; + this.NameTableView.Location = new System.Drawing.Point(17, 19); + this.NameTableView.Name = "NameTableView"; + this.NameTableView.Size = new System.Drawing.Size(512, 480); + this.NameTableView.TabIndex = 0; + this.NameTableView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.NesNameTableViewer_KeyDown); + this.NameTableView.MouseLeave += new System.EventHandler(this.NameTableView_MouseLeave); + this.NameTableView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.NameTableView_MouseMove); + // + // contextMenuStrip1 + // + this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.ScreenshotAsContextMenuItem, + this.SaveImageClipboardMenuItem, + this.RefreshImageContextMenuItem}); + this.contextMenuStrip1.Name = "contextMenuStrip1"; + this.contextMenuStrip1.Size = new System.Drawing.Size(248, 92); + // + // ScreenshotAsContextMenuItem + // + this.ScreenshotAsContextMenuItem.Name = "ScreenshotAsContextMenuItem"; + this.ScreenshotAsContextMenuItem.Size = new System.Drawing.Size(247, 22); + this.ScreenshotAsContextMenuItem.Text = "&Save Image..."; + this.ScreenshotAsContextMenuItem.Click += new System.EventHandler(this.ScreenshotMenuItem_Click); + // + // SaveImageClipboardMenuItem + // + this.SaveImageClipboardMenuItem.Name = "SaveImageClipboardMenuItem"; + this.SaveImageClipboardMenuItem.ShortcutKeyDisplayString = "Ctrl+C"; + this.SaveImageClipboardMenuItem.Size = new System.Drawing.Size(247, 22); + this.SaveImageClipboardMenuItem.Text = "&Copy Image to clipboard"; + this.SaveImageClipboardMenuItem.Click += new System.EventHandler(this.ScreenshotToClipboardMenuItem_Click); + // + // RefreshImageContextMenuItem + // + this.RefreshImageContextMenuItem.Name = "RefreshImageContextMenuItem"; + this.RefreshImageContextMenuItem.Size = new System.Drawing.Size(247, 22); + this.RefreshImageContextMenuItem.Text = "&Refresh Image"; + this.RefreshImageContextMenuItem.Click += new System.EventHandler(this.RefreshImageContextMenuItem_Click); + // + // menuStrip1 + // + this.menuStrip1.ClickThrough = true; + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.FileSubMenu, + this.OptionsSubMenu}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(679, 24); + this.menuStrip1.TabIndex = 1; + this.menuStrip1.Text = "menuStrip1"; + // + // FileSubMenu + // + this.FileSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.ScreenshotMenuItem, + this.ScreenshotToClipboardMenuItem, this.toolStripSeparator2, - this.exitToolStripMenuItem}); - this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); - this.fileToolStripMenuItem.Text = "&File"; - // - // screenshotToolStripMenuItem - // - this.screenshotToolStripMenuItem.Name = "screenshotToolStripMenuItem"; - this.screenshotToolStripMenuItem.Size = new System.Drawing.Size(243, 22); - this.screenshotToolStripMenuItem.Text = "Save Screenshot &As..."; - this.screenshotToolStripMenuItem.Click += new System.EventHandler(this.screenshotToolStripMenuItem_Click); - // - // screenshotToClipboardToolStripMenuItem - // - this.screenshotToClipboardToolStripMenuItem.Name = "screenshotToClipboardToolStripMenuItem"; - this.screenshotToClipboardToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+C"; - this.screenshotToClipboardToolStripMenuItem.Size = new System.Drawing.Size(243, 22); - this.screenshotToClipboardToolStripMenuItem.Text = "Screenshot to &Clipboard"; - this.screenshotToClipboardToolStripMenuItem.Click += new System.EventHandler(this.screenshotToClipboardToolStripMenuItem_Click); - // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(240, 6); - // - // exitToolStripMenuItem - // - this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4))); - this.exitToolStripMenuItem.Size = new System.Drawing.Size(243, 22); - this.exitToolStripMenuItem.Text = "E&xit"; - this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); - // - // optionsToolStripMenuItem - // - this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.autoloadToolStripMenuItem, - this.saveWindowPositionToolStripMenuItem, - this.toolStripSeparator1}); - this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; - this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20); - this.optionsToolStripMenuItem.Text = "&Options"; - this.optionsToolStripMenuItem.DropDownOpened += new System.EventHandler(this.optionsToolStripMenuItem_DropDownOpened); - // - // autoloadToolStripMenuItem - // - this.autoloadToolStripMenuItem.Name = "autoloadToolStripMenuItem"; - this.autoloadToolStripMenuItem.Size = new System.Drawing.Size(191, 22); - this.autoloadToolStripMenuItem.Text = "Autoload"; - this.autoloadToolStripMenuItem.Click += new System.EventHandler(this.autoloadToolStripMenuItem_Click); - // - // saveWindowPositionToolStripMenuItem - // - this.saveWindowPositionToolStripMenuItem.Name = "saveWindowPositionToolStripMenuItem"; - this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(191, 22); - this.saveWindowPositionToolStripMenuItem.Text = "Save Window Position"; - this.saveWindowPositionToolStripMenuItem.Click += new System.EventHandler(this.saveWindowPositionToolStripMenuItem_Click); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(188, 6); - // - // txtScanline - // - this.txtScanline.Location = new System.Drawing.Point(4, 19); - this.txtScanline.Name = "txtScanline"; - this.txtScanline.Size = new System.Drawing.Size(60, 20); - this.txtScanline.TabIndex = 2; - this.txtScanline.Text = "0"; - this.txtScanline.TextChanged += new System.EventHandler(this.txtScanline_TextChanged); - // - // rbNametableNW - // - this.rbNametableNW.AutoSize = true; - this.rbNametableNW.Location = new System.Drawing.Point(6, 19); - this.rbNametableNW.Name = "rbNametableNW"; - this.rbNametableNW.Size = new System.Drawing.Size(14, 13); - this.rbNametableNW.TabIndex = 4; - this.toolTip1.SetToolTip(this.rbNametableNW, "0x2000"); - this.rbNametableNW.UseVisualStyleBackColor = true; - this.rbNametableNW.CheckedChanged += new System.EventHandler(this.rbNametable_CheckedChanged); - // - // rbNametableNE - // - this.rbNametableNE.AutoSize = true; - this.rbNametableNE.Location = new System.Drawing.Point(56, 19); - this.rbNametableNE.Name = "rbNametableNE"; - this.rbNametableNE.Size = new System.Drawing.Size(14, 13); - this.rbNametableNE.TabIndex = 5; - this.toolTip1.SetToolTip(this.rbNametableNE, "0x2400"); - this.rbNametableNE.UseVisualStyleBackColor = true; - this.rbNametableNE.CheckedChanged += new System.EventHandler(this.rbNametable_CheckedChanged); - // - // rbNametableSW - // - this.rbNametableSW.AutoSize = true; - this.rbNametableSW.Location = new System.Drawing.Point(6, 57); - this.rbNametableSW.Name = "rbNametableSW"; - this.rbNametableSW.Size = new System.Drawing.Size(14, 13); - this.rbNametableSW.TabIndex = 6; - this.toolTip1.SetToolTip(this.rbNametableSW, "0x2800"); - this.rbNametableSW.UseVisualStyleBackColor = true; - this.rbNametableSW.CheckedChanged += new System.EventHandler(this.rbNametable_CheckedChanged); - // - // rbNametableSE - // - this.rbNametableSE.AutoSize = true; - this.rbNametableSE.Location = new System.Drawing.Point(56, 57); - this.rbNametableSE.Name = "rbNametableSE"; - this.rbNametableSE.Size = new System.Drawing.Size(14, 13); - this.rbNametableSE.TabIndex = 7; - this.toolTip1.SetToolTip(this.rbNametableSE, "0x2C00"); - this.rbNametableSE.UseVisualStyleBackColor = true; - this.rbNametableSE.CheckedChanged += new System.EventHandler(this.rbNametable_CheckedChanged); - // - // rbNametableAll - // - this.rbNametableAll.AutoSize = true; - this.rbNametableAll.Checked = true; - this.rbNametableAll.Location = new System.Drawing.Point(31, 38); - this.rbNametableAll.Name = "rbNametableAll"; - this.rbNametableAll.Size = new System.Drawing.Size(14, 13); - this.rbNametableAll.TabIndex = 9; - this.rbNametableAll.TabStop = true; - this.toolTip1.SetToolTip(this.rbNametableAll, "All"); - this.rbNametableAll.UseVisualStyleBackColor = true; - this.rbNametableAll.CheckedChanged += new System.EventHandler(this.rbNametable_CheckedChanged); - // - // groupBox2 - // - this.groupBox2.Controls.Add(this.rbNametableNW); - this.groupBox2.Controls.Add(this.rbNametableNE); - this.groupBox2.Controls.Add(this.rbNametableAll); - this.groupBox2.Controls.Add(this.rbNametableSW); - this.groupBox2.Controls.Add(this.rbNametableSE); - this.groupBox2.Location = new System.Drawing.Point(563, 94); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(76, 79); - this.groupBox2.TabIndex = 11; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "Nametable"; - // - // groupBox3 - // - this.groupBox3.Controls.Add(this.txtScanline); - this.groupBox3.Location = new System.Drawing.Point(563, 36); - this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(76, 52); - this.groupBox3.TabIndex = 12; - this.groupBox3.TabStop = false; - this.groupBox3.Text = "Scanline"; - // - // 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); - this.groupBox4.Controls.Add(this.label3); - this.groupBox4.Controls.Add(this.label2); - 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, 128); - this.groupBox4.TabIndex = 13; - this.groupBox4.TabStop = false; - this.groupBox4.Text = "Properties"; - // - // 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 = " "; - // - // 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:"; - // - // 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 = " "; - // - // 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:"; - // - // PPUAddressLabel - // - this.PPUAddressLabel.AutoSize = true; - this.PPUAddressLabel.Location = new System.Drawing.Point(64, 60); - this.PPUAddressLabel.Name = "PPUAddressLabel"; - this.PPUAddressLabel.Size = new System.Drawing.Size(22, 13); - 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:"; - // - // groupBox5 - // - this.groupBox5.Controls.Add(this.label7); - this.groupBox5.Controls.Add(this.label6); - this.groupBox5.Controls.Add(this.RefreshRate); - this.groupBox5.Location = new System.Drawing.Point(563, 313); - this.groupBox5.Name = "groupBox5"; - this.groupBox5.Size = new System.Drawing.Size(108, 236); - this.groupBox5.TabIndex = 14; - this.groupBox5.TabStop = false; - this.groupBox5.Text = "Refresh"; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(7, 186); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(31, 13); - this.label7.TabIndex = 2; - this.label7.Text = "More"; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(7, 32); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(29, 13); - this.label6.TabIndex = 1; - this.label6.Text = "Less"; - // - // RefreshRate - // - this.RefreshRate.LargeChange = 2; - this.RefreshRate.Location = new System.Drawing.Point(9, 47); - this.RefreshRate.Maximum = 8; - this.RefreshRate.Minimum = 1; - this.RefreshRate.Name = "RefreshRate"; - this.RefreshRate.Orientation = System.Windows.Forms.Orientation.Vertical; - this.RefreshRate.Size = new System.Drawing.Size(45, 136); - this.RefreshRate.TabIndex = 0; - this.RefreshRate.TickFrequency = 4; - this.RefreshRate.Value = 1; - // - // NESNameTableViewer - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(679, 561); - this.Controls.Add(this.groupBox5); - this.Controls.Add(this.groupBox4); - this.Controls.Add(this.groupBox3); - this.Controls.Add(this.groupBox2); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.menuStrip1); - this.MainMenuStrip = this.menuStrip1; - this.MinimumSize = new System.Drawing.Size(687, 588); - this.Name = "NESNameTableViewer"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "NES Nametable Viewer"; - this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.NESNameTableViewer_FormClosed); - this.Load += new System.EventHandler(this.NESNameTableViewer_Load); - this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.NESNameTableViewer_KeyDown); - this.groupBox1.ResumeLayout(false); - this.contextMenuStrip1.ResumeLayout(false); - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); - this.groupBox2.ResumeLayout(false); - this.groupBox2.PerformLayout(); - this.groupBox3.ResumeLayout(false); - this.groupBox3.PerformLayout(); - this.groupBox4.ResumeLayout(false); - this.groupBox4.PerformLayout(); - this.groupBox5.ResumeLayout(false); - this.groupBox5.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.RefreshRate)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); + this.ExitMenuItem}); + this.FileSubMenu.Name = "FileSubMenu"; + this.FileSubMenu.Size = new System.Drawing.Size(37, 20); + this.FileSubMenu.Text = "&File"; + // + // ScreenshotMenuItem + // + this.ScreenshotMenuItem.Name = "ScreenshotMenuItem"; + this.ScreenshotMenuItem.Size = new System.Drawing.Size(243, 22); + this.ScreenshotMenuItem.Text = "Save Screenshot &As..."; + this.ScreenshotMenuItem.Click += new System.EventHandler(this.ScreenshotMenuItem_Click); + // + // ScreenshotToClipboardMenuItem + // + this.ScreenshotToClipboardMenuItem.Name = "ScreenshotToClipboardMenuItem"; + this.ScreenshotToClipboardMenuItem.ShortcutKeyDisplayString = "Ctrl+C"; + this.ScreenshotToClipboardMenuItem.Size = new System.Drawing.Size(243, 22); + this.ScreenshotToClipboardMenuItem.Text = "Screenshot to &Clipboard"; + this.ScreenshotToClipboardMenuItem.Click += new System.EventHandler(this.ScreenshotToClipboardMenuItem_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(240, 6); + // + // ExitMenuItem + // + this.ExitMenuItem.Name = "ExitMenuItem"; + this.ExitMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4))); + this.ExitMenuItem.Size = new System.Drawing.Size(243, 22); + this.ExitMenuItem.Text = "E&xit"; + this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click); + // + // OptionsSubMenu + // + this.OptionsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.AutoloadMenuItem, + this.SaveWindowPositionMenuItem, + this.AlwaysOnTopMenuItem, + this.FloatingWindowMenuItem}); + this.OptionsSubMenu.Name = "OptionsSubMenu"; + this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20); + this.OptionsSubMenu.Text = "&Options"; + this.OptionsSubMenu.DropDownOpened += new System.EventHandler(this.OptionsSubMenu_DropDownOpened); + // + // AutoloadMenuItem + // + this.AutoloadMenuItem.Name = "AutoloadMenuItem"; + this.AutoloadMenuItem.Size = new System.Drawing.Size(191, 22); + this.AutoloadMenuItem.Text = "Autoload"; + this.AutoloadMenuItem.Click += new System.EventHandler(this.AutoloadMenuItem_Click); + // + // SaveWindowPositionMenuItem + // + this.SaveWindowPositionMenuItem.Name = "SaveWindowPositionMenuItem"; + this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(191, 22); + this.SaveWindowPositionMenuItem.Text = "Save Window Position"; + this.SaveWindowPositionMenuItem.Click += new System.EventHandler(this.SaveWindowPositionMenuItem_Click); + // + // AlwaysOnTopMenuItem + // + this.AlwaysOnTopMenuItem.Name = "AlwaysOnTopMenuItem"; + this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(191, 22); + this.AlwaysOnTopMenuItem.Text = "Always On Top"; + this.AlwaysOnTopMenuItem.Click += new System.EventHandler(this.AlwaysOnTopMenuItem_Click); + // + // FloatingWindowMenuItem + // + this.FloatingWindowMenuItem.Name = "FloatingWindowMenuItem"; + this.FloatingWindowMenuItem.Size = new System.Drawing.Size(191, 22); + this.FloatingWindowMenuItem.Text = "Floating Window"; + this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click); + // + // txtScanline + // + this.txtScanline.Location = new System.Drawing.Point(4, 19); + this.txtScanline.Name = "txtScanline"; + this.txtScanline.Size = new System.Drawing.Size(60, 20); + this.txtScanline.TabIndex = 2; + this.txtScanline.Text = "0"; + this.txtScanline.TextChanged += new System.EventHandler(this.ScanlineTextbox_TextChanged); + // + // rbNametableNW + // + this.rbNametableNW.AutoSize = true; + this.rbNametableNW.Location = new System.Drawing.Point(6, 19); + this.rbNametableNW.Name = "rbNametableNW"; + this.rbNametableNW.Size = new System.Drawing.Size(14, 13); + this.rbNametableNW.TabIndex = 4; + this.toolTip1.SetToolTip(this.rbNametableNW, "0x2000"); + this.rbNametableNW.UseVisualStyleBackColor = true; + this.rbNametableNW.CheckedChanged += new System.EventHandler(this.NametableRadio_CheckedChanged); + // + // rbNametableNE + // + this.rbNametableNE.AutoSize = true; + this.rbNametableNE.Location = new System.Drawing.Point(56, 19); + this.rbNametableNE.Name = "rbNametableNE"; + this.rbNametableNE.Size = new System.Drawing.Size(14, 13); + this.rbNametableNE.TabIndex = 5; + this.toolTip1.SetToolTip(this.rbNametableNE, "0x2400"); + this.rbNametableNE.UseVisualStyleBackColor = true; + this.rbNametableNE.CheckedChanged += new System.EventHandler(this.NametableRadio_CheckedChanged); + // + // rbNametableSW + // + this.rbNametableSW.AutoSize = true; + this.rbNametableSW.Location = new System.Drawing.Point(6, 57); + this.rbNametableSW.Name = "rbNametableSW"; + this.rbNametableSW.Size = new System.Drawing.Size(14, 13); + this.rbNametableSW.TabIndex = 6; + this.toolTip1.SetToolTip(this.rbNametableSW, "0x2800"); + this.rbNametableSW.UseVisualStyleBackColor = true; + this.rbNametableSW.CheckedChanged += new System.EventHandler(this.NametableRadio_CheckedChanged); + // + // rbNametableSE + // + this.rbNametableSE.AutoSize = true; + this.rbNametableSE.Location = new System.Drawing.Point(56, 57); + this.rbNametableSE.Name = "rbNametableSE"; + this.rbNametableSE.Size = new System.Drawing.Size(14, 13); + this.rbNametableSE.TabIndex = 7; + this.toolTip1.SetToolTip(this.rbNametableSE, "0x2C00"); + this.rbNametableSE.UseVisualStyleBackColor = true; + this.rbNametableSE.CheckedChanged += new System.EventHandler(this.NametableRadio_CheckedChanged); + // + // rbNametableAll + // + this.rbNametableAll.AutoSize = true; + this.rbNametableAll.Checked = true; + this.rbNametableAll.Location = new System.Drawing.Point(31, 38); + this.rbNametableAll.Name = "rbNametableAll"; + this.rbNametableAll.Size = new System.Drawing.Size(14, 13); + this.rbNametableAll.TabIndex = 9; + this.rbNametableAll.TabStop = true; + this.toolTip1.SetToolTip(this.rbNametableAll, "All"); + this.rbNametableAll.UseVisualStyleBackColor = true; + this.rbNametableAll.CheckedChanged += new System.EventHandler(this.NametableRadio_CheckedChanged); + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.rbNametableNW); + this.groupBox2.Controls.Add(this.rbNametableNE); + this.groupBox2.Controls.Add(this.rbNametableAll); + this.groupBox2.Controls.Add(this.rbNametableSW); + this.groupBox2.Controls.Add(this.rbNametableSE); + this.groupBox2.Location = new System.Drawing.Point(563, 94); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(76, 79); + this.groupBox2.TabIndex = 11; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Nametable"; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.txtScanline); + this.groupBox3.Location = new System.Drawing.Point(563, 36); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(76, 52); + this.groupBox3.TabIndex = 12; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Scanline"; + // + // 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); + this.groupBox4.Controls.Add(this.label3); + this.groupBox4.Controls.Add(this.label2); + 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, 128); + this.groupBox4.TabIndex = 13; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "Properties"; + // + // 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 = " "; + // + // 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:"; + // + // 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 = " "; + // + // 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:"; + // + // PPUAddressLabel + // + this.PPUAddressLabel.AutoSize = true; + this.PPUAddressLabel.Location = new System.Drawing.Point(64, 60); + this.PPUAddressLabel.Name = "PPUAddressLabel"; + this.PPUAddressLabel.Size = new System.Drawing.Size(22, 13); + 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:"; + // + // groupBox5 + // + this.groupBox5.Controls.Add(this.label7); + this.groupBox5.Controls.Add(this.label6); + this.groupBox5.Controls.Add(this.RefreshRate); + this.groupBox5.Location = new System.Drawing.Point(563, 313); + this.groupBox5.Name = "groupBox5"; + this.groupBox5.Size = new System.Drawing.Size(108, 236); + this.groupBox5.TabIndex = 14; + this.groupBox5.TabStop = false; + this.groupBox5.Text = "Refresh"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(7, 186); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(31, 13); + this.label7.TabIndex = 2; + this.label7.Text = "More"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(7, 32); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(29, 13); + this.label6.TabIndex = 1; + this.label6.Text = "Less"; + // + // RefreshRate + // + this.RefreshRate.LargeChange = 2; + this.RefreshRate.Location = new System.Drawing.Point(9, 47); + this.RefreshRate.Maximum = 8; + this.RefreshRate.Minimum = 1; + this.RefreshRate.Name = "RefreshRate"; + this.RefreshRate.Orientation = System.Windows.Forms.Orientation.Vertical; + this.RefreshRate.Size = new System.Drawing.Size(45, 136); + this.RefreshRate.TabIndex = 0; + this.RefreshRate.TickFrequency = 4; + this.RefreshRate.Value = 1; + // + // NESNameTableViewer + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(679, 561); + this.Controls.Add(this.groupBox5); + this.Controls.Add(this.groupBox4); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; + this.MinimumSize = new System.Drawing.Size(687, 588); + this.Name = "NESNameTableViewer"; + this.ShowIcon = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "NES Nametable Viewer"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.NESNameTableViewer_FormClosed); + this.Load += new System.EventHandler(this.NESNameTableViewer_Load); + this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.NesNameTableViewer_KeyDown); + this.groupBox1.ResumeLayout(false); + this.contextMenuStrip1.ResumeLayout(false); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + this.groupBox4.ResumeLayout(false); + this.groupBox4.PerformLayout(); + this.groupBox5.ResumeLayout(false); + this.groupBox5.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.RefreshRate)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); } @@ -497,10 +508,9 @@ private System.Windows.Forms.GroupBox groupBox1; private NameTableViewer NameTableView; private MenuStripEx menuStrip1; - private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem autoloadToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem saveWindowPositionToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem OptionsSubMenu; + private System.Windows.Forms.ToolStripMenuItem AutoloadMenuItem; + private System.Windows.Forms.ToolStripMenuItem SaveWindowPositionMenuItem; private System.Windows.Forms.TextBox txtScanline; private System.Windows.Forms.RadioButton rbNametableNW; private System.Windows.Forms.RadioButton rbNametableNE; @@ -524,15 +534,17 @@ private System.Windows.Forms.Label label6; private System.Windows.Forms.TrackBar RefreshRate; private System.Windows.Forms.Label label7; - private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem screenshotToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem FileSubMenu; + private System.Windows.Forms.ToolStripMenuItem ScreenshotMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; - private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem ExitMenuItem; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; - private System.Windows.Forms.ToolStripMenuItem screenshotAsToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem refreshImageToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem saveImageClipboardToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem screenshotToClipboardToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem ScreenshotAsContextMenuItem; + private System.Windows.Forms.ToolStripMenuItem RefreshImageContextMenuItem; + private System.Windows.Forms.ToolStripMenuItem SaveImageClipboardMenuItem; + private System.Windows.Forms.ToolStripMenuItem ScreenshotToClipboardMenuItem; private System.Windows.Forms.ToolTip toolTip1; + private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem; + private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem; } } \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs b/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs index ad82d38f16..76637d6730 100644 --- a/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs +++ b/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs @@ -2,124 +2,49 @@ using System.Drawing; using System.Drawing.Imaging; using System.Windows.Forms; -using BizHawk.Emulation.Cores.Nintendo.NES; using BizHawk.Client.Common; +using BizHawk.Emulation.Cores.Nintendo.NES; namespace BizHawk.Client.EmuHawk { public partial class NESNameTableViewer : Form, IToolForm { - //TODO: - //Show Scroll Lines + UI Toggle - + // TODO: + // Show Scroll Lines + UI Toggle + private readonly NES.PPU.DebugCallback _callback = new NES.PPU.DebugCallback(); private NES _nes; - private readonly NES.PPU.DebugCallback Callback = new NES.PPU.DebugCallback(); - - public bool AskSave() { return true; } - public bool UpdateBefore { get { return true; } } public NESNameTableViewer() { InitializeComponent(); - Closing += (o, e) => SaveConfigSettings(); - Callback.Callback = () => Generate(); - } - - private void SaveConfigSettings() - { - Global.Config.NESNameTableWndx = Location.X; - Global.Config.NESNameTableWndy = Location.Y; - Global.Config.NESNameTableRefreshRate = RefreshRate.Value; - } - - unsafe void Generate(bool now = false) - { - if (!IsHandleCreated || IsDisposed) return; - if (_nes == null) return; - - if (now == false) - { - if (Global.Emulator.Frame % RefreshRate.Value != 0) return; - } - - BitmapData bmpdata = NameTableView.Nametables.LockBits(new Rectangle(0, 0, 512, 480), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); - - int* dptr = (int*)bmpdata.Scan0.ToPointer(); - int pitch = bmpdata.Stride / 4; - int pt_add = _nes.ppu.reg_2000.bg_pattern_hi ? 0x1000 : 0; - - //buffer all the data from the ppu, because it will be read multiple times and that is slow - byte[] p = new byte[0x3000]; - for (int x = 0; x < 0x3000; x++) - p[x] = _nes.ppu.ppubus_peek(x); - - byte[] palram = new byte[0x20]; - for (int x = 0; x < 0x20; x++) - palram[x] = _nes.ppu.PALRAM[x]; - - int ytable = 0, yline = 0; - for (int y = 0; y < 480; y++) - { - if (y == 240) + Closing += (o, e) => { - ytable += 2; - yline = 240; - } - for (int x = 0; x < 512; x++, dptr++) - { - int table = (x >> 8) + ytable; - int ntaddr = (table << 10); - int px = x & 255; - int py = 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 = p[ntbyte_ptr + 0x2000]; - - int at = p[atbyte_ptr + 0x2000]; - if ((ty & 2) != 0) at >>= 4; - if ((tx & 2) != 0) at >>= 2; - at &= 0x03; - at <<= 2; - - int bgpx = x & 7; - int bgpy = y & 7; - int pt_addr = (nt << 4) + bgpy + pt_add; - int pt_0 = p[pt_addr]; - int pt_1 = p[pt_addr + 8]; - int pixel = ((pt_0 >> (7 - bgpx)) & 1) | (((pt_1 >> (7 - bgpx)) & 1) << 1); - - //if the pixel is transparent, draw the backdrop color - //TODO - consider making this optional? nintendulator does it and fceux doesnt need to do it due to buggy palette logic which creates the same effect - if (pixel != 0) - pixel |= at; - - pixel = palram[pixel]; - int cvalue = _nes.LookupColor(pixel); - *dptr = cvalue; - } - dptr += pitch - 512; - } - - NameTableView.Nametables.UnlockBits(bmpdata); - NameTableView.Refresh(); + Global.Config.NesNameTableSettings.Wndx = Location.X; + Global.Config.NesNameTableSettings.Wndx = Location.Y; + Global.Config.NESNameTableRefreshRate = RefreshRate.Value; + }; + TopMost = Global.Config.NesNameTableSettings.TopMost; + _callback.Callback = () => Generate(); } - public void UpdateValues() + private void NESNameTableViewer_Load(object sender, EventArgs e) { - if (Global.Emulator is NES) + if (Global.Config.NesNameTableSettings.UseWindowPosition) { - NES.PPU ppu = (Global.Emulator as NES).ppu; - ppu.NTViewCallback = Callback; - } - else - { - Close(); + Location = Global.Config.NesNameTableSettings.WindowPosition; } + + _nes = Global.Emulator as NES; + RefreshRate.Value = Global.Config.NESNameTableRefreshRate; + Generate(true); } + #region Public API + + public bool AskSave() { return true; } + public bool UpdateBefore { get { return true; } } + public void Restart() { if (Global.Emulator is NES) @@ -133,61 +58,245 @@ namespace BizHawk.Client.EmuHawk } } - private void NESNameTableViewer_Load(object sender, EventArgs e) + public void UpdateValues() { - if (Global.Config.NESNameTableSaveWindowPosition && Global.Config.NESNameTableWndx >= 0 && Global.Config.NESNameTableWndy >= 0) - Location = new Point(Global.Config.NESNameTableWndx, Global.Config.NESNameTableWndy); - - _nes = Global.Emulator as NES; - RefreshRate.Value = Global.Config.NESNameTableRefreshRate; - Generate(true); + if (Global.Emulator is NES) + { + (Global.Emulator as NES).ppu.NTViewCallback = _callback; + } + else + { + Close(); + } } - private void exitToolStripMenuItem_Click(object sender, EventArgs e) + #endregion + + private unsafe void Generate(bool now = false) + { + if (!IsHandleCreated || IsDisposed) + { + return; + } + + if (_nes == null) + { + return; + } + + if (now == false && Global.Emulator.Frame % RefreshRate.Value != 0) + { + return; + } + + var bmpdata = NameTableView.Nametables.LockBits( + new Rectangle(0, 0, 512, 480), + ImageLockMode.WriteOnly, + PixelFormat.Format32bppArgb); + + var dptr = (int*)bmpdata.Scan0.ToPointer(); + var pitch = bmpdata.Stride / 4; + var pt_add = _nes.ppu.reg_2000.bg_pattern_hi ? 0x1000 : 0; + + // Buffer all the data from the ppu, because it will be read multiple times and that is slow + var ppuBuffer = new byte[0x3000]; + for (var i = 0; i < 0x3000; i++) + { + ppuBuffer[i] = _nes.ppu.ppubus_peek(i); + } + + var palram = new byte[0x20]; + for (var i = 0; i < 0x20; i++) + { + palram[i] = _nes.ppu.PALRAM[i]; + } + + int ytable = 0, yline = 0; + for (int y = 0; y < 480; y++) + { + if (y == 240) + { + ytable += 2; + yline = 240; + } + for (int x = 0; x < 512; x++, dptr++) + { + int table = (x >> 8) + ytable; + int ntaddr = table << 10; + int px = x & 255; + int py = 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 = ppuBuffer[ntbyte_ptr + 0x2000]; + + int at = ppuBuffer[atbyte_ptr + 0x2000]; + if ((ty & 2) != 0) + { + at >>= 4; + } + + if ((tx & 2) != 0) + { + at >>= 2; + } + + at &= 0x03; + at <<= 2; + + int bgpx = x & 7; + int bgpy = y & 7; + int pt_addr = (nt << 4) + bgpy + pt_add; + int pt_0 = ppuBuffer[pt_addr]; + int pt_1 = ppuBuffer[pt_addr + 8]; + int pixel = ((pt_0 >> (7 - bgpx)) & 1) | (((pt_1 >> (7 - bgpx)) & 1) << 1); + + // if the pixel is transparent, draw the backdrop color + // TODO - consider making this optional? nintendulator does it and fceux doesnt need to do it due to buggy palette logic which creates the same effect + if (pixel != 0) + { + pixel |= at; + } + + pixel = palram[pixel]; + *dptr = _nes.LookupColor(pixel); + } + + dptr += pitch - 512; + } + + NameTableView.Nametables.UnlockBits(bmpdata); + NameTableView.Refresh(); + } + + private void RefreshFloatingWindowControl() + { + Owner = Global.Config.NesNameTableSettings.FloatingWindow ? null : GlobalWin.MainForm; + } + + #region Events + + #region Menu and Context Menu + + private void ScreenshotMenuItem_Click(object sender, EventArgs e) + { + NameTableView.Screenshot(); + } + + private void ScreenshotToClipboardMenuItem_Click(object sender, EventArgs e) + { + NameTableView.ScreenshotToClipboard(); + } + + private void ExitMenuItem_Click(object sender, EventArgs e) { Close(); } - private void autoloadToolStripMenuItem_Click(object sender, EventArgs e) + private void OptionsSubMenu_DropDownOpened(object sender, EventArgs e) + { + AutoloadMenuItem.Checked = Global.Config.AutoLoadNESNameTable; + SaveWindowPositionMenuItem.Checked = Global.Config.NesNameTableSettings.SaveWindowPosition; + AlwaysOnTopMenuItem.Checked = Global.Config.NesNameTableSettings.TopMost; + FloatingWindowMenuItem.Checked = Global.Config.NesNameTableSettings.FloatingWindow; + } + + private void AutoloadMenuItem_Click(object sender, EventArgs e) { Global.Config.AutoLoadNESNameTable ^= true; } - private void saveWindowPositionToolStripMenuItem_Click(object sender, EventArgs e) + private void SaveWindowPositionMenuItem_Click(object sender, EventArgs e) { - Global.Config.NESNameTableSaveWindowPosition ^= true; + Global.Config.NesNameTableSettings.SaveWindowPosition ^= true; } - private void optionsToolStripMenuItem_DropDownOpened(object sender, EventArgs e) + private void AlwaysOnTopMenuItem_Click(object sender, EventArgs e) { - autoloadToolStripMenuItem.Checked = Global.Config.AutoLoadNESNameTable; - saveWindowPositionToolStripMenuItem.Checked = Global.Config.NESNameTableSaveWindowPosition; + Global.Config.NesNameTableSettings.TopMost ^= true; + TopMost = Global.Config.NesNameTableSettings.TopMost; } - private void txtScanline_TextChanged(object sender, EventArgs e) + private void FloatingWindowMenuItem_Click(object sender, EventArgs e) { - int temp; - if (int.TryParse(txtScanline.Text, out temp)) + Global.Config.NesNameTableSettings.FloatingWindow ^= true; + RefreshFloatingWindowControl(); + } + + private void RefreshImageContextMenuItem_Click(object sender, EventArgs e) + { + UpdateValues(); + NameTableView.Refresh(); + } + + #endregion + + #region Dialog and Controls + + private void NesNameTableViewer_KeyDown(object sender, KeyEventArgs e) + { + switch (e.KeyCode) { - Callback.Scanline = temp; + case Keys.C: + if (e.Modifiers == Keys.Control) + { + NameTableView.ScreenshotToClipboard(); + } + + break; } } + protected override void OnShown(EventArgs e) + { + RefreshFloatingWindowControl(); + base.OnShown(e); + } + private void NESNameTableViewer_FormClosed(object sender, FormClosedEventArgs e) { - if (_nes == null) return; - if (_nes.ppu.NTViewCallback == Callback) + if (_nes != null && _nes.ppu.NTViewCallback == _callback) + { _nes.ppu.NTViewCallback = null; + } } - - private void rbNametable_CheckedChanged(object sender, EventArgs e) + private void ScanlineTextbox_TextChanged(object sender, EventArgs e) { - if (rbNametableNW.Checked) NameTableView.Which = NameTableViewer.WhichNametable.NT_2000; - if (rbNametableNE.Checked) NameTableView.Which = NameTableViewer.WhichNametable.NT_2400; - if (rbNametableSW.Checked) NameTableView.Which = NameTableViewer.WhichNametable.NT_2800; - if (rbNametableSE.Checked) NameTableView.Which = NameTableViewer.WhichNametable.NT_2C00; - if (rbNametableAll.Checked) NameTableView.Which = NameTableViewer.WhichNametable.NT_ALL; + int temp; + if (int.TryParse(txtScanline.Text, out temp)) + { + _callback.Scanline = temp; + } + } + + private void NametableRadio_CheckedChanged(object sender, EventArgs e) + { + if (rbNametableNW.Checked) + { + NameTableView.Which = NameTableViewer.WhichNametable.NT_2000; + } + + if (rbNametableNE.Checked) + { + NameTableView.Which = NameTableViewer.WhichNametable.NT_2400; + } + + if (rbNametableSW.Checked) + { + NameTableView.Which = NameTableViewer.WhichNametable.NT_2800; + } + + if (rbNametableSE.Checked) + { + NameTableView.Which = NameTableViewer.WhichNametable.NT_2C00; + } + + if (rbNametableAll.Checked) + { + NameTableView.Which = NameTableViewer.WhichNametable.NT_ALL; + } } private void NameTableView_MouseMove(object sender, MouseEventArgs e) @@ -221,12 +330,12 @@ namespace BizHawk.Client.EmuHawk TileX = e.X / 16; TileY = e.Y / 16; } - - XYLabel.Text = TileX.ToString() + " : " + TileY.ToString(); + + XYLabel.Text = TileX + " : " + TileY; int PPUAddress = 0x2000 + (NameTable * 0x400) + ((TileY % 30) * 32) + (TileX % 32); - PPUAddressLabel.Text = String.Format("{0:X4}", PPUAddress); + PPUAddressLabel.Text = string.Format("{0:X4}", PPUAddress); int TileID = _nes.ppu.ppubus_read(PPUAddress, true); - TileIDLabel.Text = String.Format("{0:X2}", TileID); + TileIDLabel.Text = string.Format("{0:X2}", TileID); TableLabel.Text = NameTable.ToString(); int ytable = 0, yline = 0; @@ -251,50 +360,15 @@ namespace BizHawk.Client.EmuHawk private void NameTableView_MouseLeave(object sender, EventArgs e) { - XYLabel.Text = ""; - PPUAddressLabel.Text = ""; - TileIDLabel.Text = ""; - TableLabel.Text = ""; - PaletteLabel.Text = ""; + XYLabel.Text = string.Empty; + PPUAddressLabel.Text = string.Empty; + TileIDLabel.Text = string.Empty; + TableLabel.Text = string.Empty; + PaletteLabel.Text = string.Empty; } - private void screenshotToolStripMenuItem_Click(object sender, EventArgs e) - { - NameTableView.Screenshot(); - } + #endregion - private void screenshotAsToolStripMenuItem_Click(object sender, EventArgs e) - { - NameTableView.Screenshot(); - } - - private void refreshImageToolStripMenuItem_Click(object sender, EventArgs e) - { - UpdateValues(); - NameTableView.Refresh(); - } - - private void saveImageClipboardToolStripMenuItem_Click(object sender, EventArgs e) - { - NameTableView.ScreenshotToClipboard(); - } - - private void NESNameTableViewer_KeyDown(object sender, KeyEventArgs e) - { - switch (e.KeyCode) - { - case Keys.C: - if (e.Modifiers == Keys.Control) - { - NameTableView.ScreenshotToClipboard(); - } - break; - } - } - - private void screenshotToClipboardToolStripMenuItem_Click(object sender, EventArgs e) - { - NameTableView.ScreenshotToClipboard(); - } + #endregion } }