NES Nametable Viewer - Floating Window and Always on Top, and refactor

This commit is contained in:
adelikat 2014-01-31 21:23:46 +00:00
parent 4aab2ea31d
commit 33c104d418
3 changed files with 730 additions and 646 deletions

View File

@ -358,11 +358,9 @@ namespace BizHawk.Client.Common
public int NESDebuggerWidth = -1; public int NESDebuggerWidth = -1;
public int NESDebuggerHeight = -1; public int NESDebuggerHeight = -1;
// NESNameTableViewer Settings // NES NameTableViewer Settings
public ToolDialogSettings NesNameTableSettings = new ToolDialogSettings();
public bool AutoLoadNESNameTable = false; public bool AutoLoadNESNameTable = false;
public bool NESNameTableSaveWindowPosition = true;
public int NESNameTableWndx = -1;
public int NESNameTableWndy = -1;
public int NESNameTableRefreshRate = 4; public int NESNameTableRefreshRate = 4;
// gb gpu view settings // gb gpu view settings

View File

@ -28,467 +28,478 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.NameTableView = new BizHawk.Client.EmuHawk.NameTableViewer(); this.NameTableView = new BizHawk.Client.EmuHawk.NameTableViewer();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.screenshotAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ScreenshotAsContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveImageClipboardToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SaveImageClipboardMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.refreshImageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.RefreshImageContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1 = new MenuStripEx(); this.menuStrip1 = new MenuStripEx();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.FileSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.screenshotToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ScreenshotMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.screenshotToClipboardToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ScreenshotToClipboardMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.OptionsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.autoloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.AutoloadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SaveWindowPositionMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.AlwaysOnTopMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.txtScanline = new System.Windows.Forms.TextBox(); this.FloatingWindowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.rbNametableNW = new System.Windows.Forms.RadioButton(); this.txtScanline = new System.Windows.Forms.TextBox();
this.rbNametableNE = new System.Windows.Forms.RadioButton(); this.rbNametableNW = new System.Windows.Forms.RadioButton();
this.rbNametableSW = new System.Windows.Forms.RadioButton(); this.rbNametableNE = new System.Windows.Forms.RadioButton();
this.rbNametableSE = new System.Windows.Forms.RadioButton(); this.rbNametableSW = new System.Windows.Forms.RadioButton();
this.rbNametableAll = new System.Windows.Forms.RadioButton(); this.rbNametableSE = new System.Windows.Forms.RadioButton();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.rbNametableAll = new System.Windows.Forms.RadioButton();
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox4 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.PaletteLabel = new System.Windows.Forms.Label(); this.groupBox4 = new System.Windows.Forms.GroupBox();
this.label5 = new System.Windows.Forms.Label(); this.PaletteLabel = new System.Windows.Forms.Label();
this.TableLabel = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label(); this.TableLabel = new System.Windows.Forms.Label();
this.PPUAddressLabel = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.XYLabel = new System.Windows.Forms.Label(); this.PPUAddressLabel = new System.Windows.Forms.Label();
this.TileIDLabel = new System.Windows.Forms.Label(); this.XYLabel = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label(); this.TileIDLabel = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox(); this.label1 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label(); this.groupBox5 = new System.Windows.Forms.GroupBox();
this.label6 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label();
this.RefreshRate = new System.Windows.Forms.TrackBar(); this.label6 = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.RefreshRate = new System.Windows.Forms.TrackBar();
this.groupBox1.SuspendLayout(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.contextMenuStrip1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.menuStrip1.SuspendLayout(); this.contextMenuStrip1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.groupBox3.SuspendLayout(); this.groupBox2.SuspendLayout();
this.groupBox4.SuspendLayout(); this.groupBox3.SuspendLayout();
this.groupBox5.SuspendLayout(); this.groupBox4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.RefreshRate)).BeginInit(); this.groupBox5.SuspendLayout();
this.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.RefreshRate)).BeginInit();
// this.SuspendLayout();
// groupBox1 //
// // groupBox1
this.groupBox1.Controls.Add(this.NameTableView); //
this.groupBox1.Location = new System.Drawing.Point(12, 36); this.groupBox1.Controls.Add(this.NameTableView);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Location = new System.Drawing.Point(12, 36);
this.groupBox1.Size = new System.Drawing.Size(545, 513); this.groupBox1.Name = "groupBox1";
this.groupBox1.TabIndex = 0; this.groupBox1.Size = new System.Drawing.Size(545, 513);
this.groupBox1.TabStop = false; this.groupBox1.TabIndex = 0;
// this.groupBox1.TabStop = false;
// NameTableView //
// // NameTableView
this.NameTableView.BackColor = System.Drawing.Color.Transparent; //
this.NameTableView.ContextMenuStrip = this.contextMenuStrip1; this.NameTableView.BackColor = System.Drawing.Color.Transparent;
this.NameTableView.Location = new System.Drawing.Point(17, 19); this.NameTableView.ContextMenuStrip = this.contextMenuStrip1;
this.NameTableView.Name = "NameTableView"; this.NameTableView.Location = new System.Drawing.Point(17, 19);
this.NameTableView.Size = new System.Drawing.Size(512, 480); this.NameTableView.Name = "NameTableView";
this.NameTableView.TabIndex = 0; this.NameTableView.Size = new System.Drawing.Size(512, 480);
this.NameTableView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.NESNameTableViewer_KeyDown); this.NameTableView.TabIndex = 0;
this.NameTableView.MouseLeave += new System.EventHandler(this.NameTableView_MouseLeave); this.NameTableView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.NesNameTableViewer_KeyDown);
this.NameTableView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.NameTableView_MouseMove); this.NameTableView.MouseLeave += new System.EventHandler(this.NameTableView_MouseLeave);
// this.NameTableView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.NameTableView_MouseMove);
// contextMenuStrip1 //
// // contextMenuStrip1
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { //
this.screenshotAsToolStripMenuItem, this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.saveImageClipboardToolStripMenuItem, this.ScreenshotAsContextMenuItem,
this.refreshImageToolStripMenuItem}); this.SaveImageClipboardMenuItem,
this.contextMenuStrip1.Name = "contextMenuStrip1"; this.RefreshImageContextMenuItem});
this.contextMenuStrip1.Size = new System.Drawing.Size(248, 70); this.contextMenuStrip1.Name = "contextMenuStrip1";
// this.contextMenuStrip1.Size = new System.Drawing.Size(248, 92);
// screenshotAsToolStripMenuItem //
// // ScreenshotAsContextMenuItem
this.screenshotAsToolStripMenuItem.Name = "screenshotAsToolStripMenuItem"; //
this.screenshotAsToolStripMenuItem.Size = new System.Drawing.Size(247, 22); this.ScreenshotAsContextMenuItem.Name = "ScreenshotAsContextMenuItem";
this.screenshotAsToolStripMenuItem.Text = "&Save Image..."; this.ScreenshotAsContextMenuItem.Size = new System.Drawing.Size(247, 22);
this.screenshotAsToolStripMenuItem.Click += new System.EventHandler(this.screenshotAsToolStripMenuItem_Click); this.ScreenshotAsContextMenuItem.Text = "&Save Image...";
// this.ScreenshotAsContextMenuItem.Click += new System.EventHandler(this.ScreenshotMenuItem_Click);
// saveImageClipboardToolStripMenuItem //
// // SaveImageClipboardMenuItem
this.saveImageClipboardToolStripMenuItem.Name = "saveImageClipboardToolStripMenuItem"; //
this.saveImageClipboardToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+C"; this.SaveImageClipboardMenuItem.Name = "SaveImageClipboardMenuItem";
this.saveImageClipboardToolStripMenuItem.Size = new System.Drawing.Size(247, 22); this.SaveImageClipboardMenuItem.ShortcutKeyDisplayString = "Ctrl+C";
this.saveImageClipboardToolStripMenuItem.Text = "&Copy Image to clipboard"; this.SaveImageClipboardMenuItem.Size = new System.Drawing.Size(247, 22);
this.saveImageClipboardToolStripMenuItem.Click += new System.EventHandler(this.saveImageClipboardToolStripMenuItem_Click); this.SaveImageClipboardMenuItem.Text = "&Copy Image to clipboard";
// this.SaveImageClipboardMenuItem.Click += new System.EventHandler(this.ScreenshotToClipboardMenuItem_Click);
// refreshImageToolStripMenuItem //
// // RefreshImageContextMenuItem
this.refreshImageToolStripMenuItem.Name = "refreshImageToolStripMenuItem"; //
this.refreshImageToolStripMenuItem.Size = new System.Drawing.Size(247, 22); this.RefreshImageContextMenuItem.Name = "RefreshImageContextMenuItem";
this.refreshImageToolStripMenuItem.Text = "&Refresh Image"; this.RefreshImageContextMenuItem.Size = new System.Drawing.Size(247, 22);
this.refreshImageToolStripMenuItem.Click += new System.EventHandler(this.refreshImageToolStripMenuItem_Click); this.RefreshImageContextMenuItem.Text = "&Refresh Image";
// this.RefreshImageContextMenuItem.Click += new System.EventHandler(this.RefreshImageContextMenuItem_Click);
// menuStrip1 //
// // menuStrip1
this.menuStrip1.ClickThrough = true; //
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.menuStrip1.ClickThrough = true;
this.fileToolStripMenuItem, this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.optionsToolStripMenuItem}); this.FileSubMenu,
this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.OptionsSubMenu});
this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Size = new System.Drawing.Size(679, 24); this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.TabIndex = 1; this.menuStrip1.Size = new System.Drawing.Size(679, 24);
this.menuStrip1.Text = "menuStrip1"; this.menuStrip1.TabIndex = 1;
// this.menuStrip1.Text = "menuStrip1";
// fileToolStripMenuItem //
// // FileSubMenu
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { //
this.screenshotToolStripMenuItem, this.FileSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.screenshotToClipboardToolStripMenuItem, this.ScreenshotMenuItem,
this.ScreenshotToClipboardMenuItem,
this.toolStripSeparator2, this.toolStripSeparator2,
this.exitToolStripMenuItem}); this.ExitMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.FileSubMenu.Name = "FileSubMenu";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); this.FileSubMenu.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "&File"; this.FileSubMenu.Text = "&File";
// //
// screenshotToolStripMenuItem // ScreenshotMenuItem
// //
this.screenshotToolStripMenuItem.Name = "screenshotToolStripMenuItem"; this.ScreenshotMenuItem.Name = "ScreenshotMenuItem";
this.screenshotToolStripMenuItem.Size = new System.Drawing.Size(243, 22); this.ScreenshotMenuItem.Size = new System.Drawing.Size(243, 22);
this.screenshotToolStripMenuItem.Text = "Save Screenshot &As..."; this.ScreenshotMenuItem.Text = "Save Screenshot &As...";
this.screenshotToolStripMenuItem.Click += new System.EventHandler(this.screenshotToolStripMenuItem_Click); this.ScreenshotMenuItem.Click += new System.EventHandler(this.ScreenshotMenuItem_Click);
// //
// screenshotToClipboardToolStripMenuItem // ScreenshotToClipboardMenuItem
// //
this.screenshotToClipboardToolStripMenuItem.Name = "screenshotToClipboardToolStripMenuItem"; this.ScreenshotToClipboardMenuItem.Name = "ScreenshotToClipboardMenuItem";
this.screenshotToClipboardToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+C"; this.ScreenshotToClipboardMenuItem.ShortcutKeyDisplayString = "Ctrl+C";
this.screenshotToClipboardToolStripMenuItem.Size = new System.Drawing.Size(243, 22); this.ScreenshotToClipboardMenuItem.Size = new System.Drawing.Size(243, 22);
this.screenshotToClipboardToolStripMenuItem.Text = "Screenshot to &Clipboard"; this.ScreenshotToClipboardMenuItem.Text = "Screenshot to &Clipboard";
this.screenshotToClipboardToolStripMenuItem.Click += new System.EventHandler(this.screenshotToClipboardToolStripMenuItem_Click); this.ScreenshotToClipboardMenuItem.Click += new System.EventHandler(this.ScreenshotToClipboardMenuItem_Click);
// //
// toolStripSeparator2 // toolStripSeparator2
// //
this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(240, 6); this.toolStripSeparator2.Size = new System.Drawing.Size(240, 6);
// //
// exitToolStripMenuItem // ExitMenuItem
// //
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.ExitMenuItem.Name = "ExitMenuItem";
this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4))); this.ExitMenuItem.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.ExitMenuItem.Size = new System.Drawing.Size(243, 22);
this.exitToolStripMenuItem.Text = "E&xit"; this.ExitMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click);
// //
// optionsToolStripMenuItem // OptionsSubMenu
// //
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.OptionsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.autoloadToolStripMenuItem, this.AutoloadMenuItem,
this.saveWindowPositionToolStripMenuItem, this.SaveWindowPositionMenuItem,
this.toolStripSeparator1}); this.AlwaysOnTopMenuItem,
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; this.FloatingWindowMenuItem});
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20); this.OptionsSubMenu.Name = "OptionsSubMenu";
this.optionsToolStripMenuItem.Text = "&Options"; this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20);
this.optionsToolStripMenuItem.DropDownOpened += new System.EventHandler(this.optionsToolStripMenuItem_DropDownOpened); this.OptionsSubMenu.Text = "&Options";
// this.OptionsSubMenu.DropDownOpened += new System.EventHandler(this.OptionsSubMenu_DropDownOpened);
// autoloadToolStripMenuItem //
// // AutoloadMenuItem
this.autoloadToolStripMenuItem.Name = "autoloadToolStripMenuItem"; //
this.autoloadToolStripMenuItem.Size = new System.Drawing.Size(191, 22); this.AutoloadMenuItem.Name = "AutoloadMenuItem";
this.autoloadToolStripMenuItem.Text = "Autoload"; this.AutoloadMenuItem.Size = new System.Drawing.Size(191, 22);
this.autoloadToolStripMenuItem.Click += new System.EventHandler(this.autoloadToolStripMenuItem_Click); this.AutoloadMenuItem.Text = "Autoload";
// this.AutoloadMenuItem.Click += new System.EventHandler(this.AutoloadMenuItem_Click);
// saveWindowPositionToolStripMenuItem //
// // SaveWindowPositionMenuItem
this.saveWindowPositionToolStripMenuItem.Name = "saveWindowPositionToolStripMenuItem"; //
this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(191, 22); this.SaveWindowPositionMenuItem.Name = "SaveWindowPositionMenuItem";
this.saveWindowPositionToolStripMenuItem.Text = "Save Window Position"; this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(191, 22);
this.saveWindowPositionToolStripMenuItem.Click += new System.EventHandler(this.saveWindowPositionToolStripMenuItem_Click); this.SaveWindowPositionMenuItem.Text = "Save Window Position";
// this.SaveWindowPositionMenuItem.Click += new System.EventHandler(this.SaveWindowPositionMenuItem_Click);
// toolStripSeparator1 //
// // AlwaysOnTopMenuItem
this.toolStripSeparator1.Name = "toolStripSeparator1"; //
this.toolStripSeparator1.Size = new System.Drawing.Size(188, 6); this.AlwaysOnTopMenuItem.Name = "AlwaysOnTopMenuItem";
// this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(191, 22);
// txtScanline this.AlwaysOnTopMenuItem.Text = "Always On Top";
// this.AlwaysOnTopMenuItem.Click += new System.EventHandler(this.AlwaysOnTopMenuItem_Click);
this.txtScanline.Location = new System.Drawing.Point(4, 19); //
this.txtScanline.Name = "txtScanline"; // FloatingWindowMenuItem
this.txtScanline.Size = new System.Drawing.Size(60, 20); //
this.txtScanline.TabIndex = 2; this.FloatingWindowMenuItem.Name = "FloatingWindowMenuItem";
this.txtScanline.Text = "0"; this.FloatingWindowMenuItem.Size = new System.Drawing.Size(191, 22);
this.txtScanline.TextChanged += new System.EventHandler(this.txtScanline_TextChanged); this.FloatingWindowMenuItem.Text = "Floating Window";
// this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click);
// rbNametableNW //
// // txtScanline
this.rbNametableNW.AutoSize = true; //
this.rbNametableNW.Location = new System.Drawing.Point(6, 19); this.txtScanline.Location = new System.Drawing.Point(4, 19);
this.rbNametableNW.Name = "rbNametableNW"; this.txtScanline.Name = "txtScanline";
this.rbNametableNW.Size = new System.Drawing.Size(14, 13); this.txtScanline.Size = new System.Drawing.Size(60, 20);
this.rbNametableNW.TabIndex = 4; this.txtScanline.TabIndex = 2;
this.toolTip1.SetToolTip(this.rbNametableNW, "0x2000"); this.txtScanline.Text = "0";
this.rbNametableNW.UseVisualStyleBackColor = true; this.txtScanline.TextChanged += new System.EventHandler(this.ScanlineTextbox_TextChanged);
this.rbNametableNW.CheckedChanged += new System.EventHandler(this.rbNametable_CheckedChanged); //
// // rbNametableNW
// rbNametableNE //
// this.rbNametableNW.AutoSize = true;
this.rbNametableNE.AutoSize = true; this.rbNametableNW.Location = new System.Drawing.Point(6, 19);
this.rbNametableNE.Location = new System.Drawing.Point(56, 19); this.rbNametableNW.Name = "rbNametableNW";
this.rbNametableNE.Name = "rbNametableNE"; this.rbNametableNW.Size = new System.Drawing.Size(14, 13);
this.rbNametableNE.Size = new System.Drawing.Size(14, 13); this.rbNametableNW.TabIndex = 4;
this.rbNametableNE.TabIndex = 5; this.toolTip1.SetToolTip(this.rbNametableNW, "0x2000");
this.toolTip1.SetToolTip(this.rbNametableNE, "0x2400"); this.rbNametableNW.UseVisualStyleBackColor = true;
this.rbNametableNE.UseVisualStyleBackColor = true; this.rbNametableNW.CheckedChanged += new System.EventHandler(this.NametableRadio_CheckedChanged);
this.rbNametableNE.CheckedChanged += new System.EventHandler(this.rbNametable_CheckedChanged); //
// // rbNametableNE
// rbNametableSW //
// this.rbNametableNE.AutoSize = true;
this.rbNametableSW.AutoSize = true; this.rbNametableNE.Location = new System.Drawing.Point(56, 19);
this.rbNametableSW.Location = new System.Drawing.Point(6, 57); this.rbNametableNE.Name = "rbNametableNE";
this.rbNametableSW.Name = "rbNametableSW"; this.rbNametableNE.Size = new System.Drawing.Size(14, 13);
this.rbNametableSW.Size = new System.Drawing.Size(14, 13); this.rbNametableNE.TabIndex = 5;
this.rbNametableSW.TabIndex = 6; this.toolTip1.SetToolTip(this.rbNametableNE, "0x2400");
this.toolTip1.SetToolTip(this.rbNametableSW, "0x2800"); this.rbNametableNE.UseVisualStyleBackColor = true;
this.rbNametableSW.UseVisualStyleBackColor = true; this.rbNametableNE.CheckedChanged += new System.EventHandler(this.NametableRadio_CheckedChanged);
this.rbNametableSW.CheckedChanged += new System.EventHandler(this.rbNametable_CheckedChanged); //
// // rbNametableSW
// rbNametableSE //
// this.rbNametableSW.AutoSize = true;
this.rbNametableSE.AutoSize = true; this.rbNametableSW.Location = new System.Drawing.Point(6, 57);
this.rbNametableSE.Location = new System.Drawing.Point(56, 57); this.rbNametableSW.Name = "rbNametableSW";
this.rbNametableSE.Name = "rbNametableSE"; this.rbNametableSW.Size = new System.Drawing.Size(14, 13);
this.rbNametableSE.Size = new System.Drawing.Size(14, 13); this.rbNametableSW.TabIndex = 6;
this.rbNametableSE.TabIndex = 7; this.toolTip1.SetToolTip(this.rbNametableSW, "0x2800");
this.toolTip1.SetToolTip(this.rbNametableSE, "0x2C00"); this.rbNametableSW.UseVisualStyleBackColor = true;
this.rbNametableSE.UseVisualStyleBackColor = true; this.rbNametableSW.CheckedChanged += new System.EventHandler(this.NametableRadio_CheckedChanged);
this.rbNametableSE.CheckedChanged += new System.EventHandler(this.rbNametable_CheckedChanged); //
// // rbNametableSE
// rbNametableAll //
// this.rbNametableSE.AutoSize = true;
this.rbNametableAll.AutoSize = true; this.rbNametableSE.Location = new System.Drawing.Point(56, 57);
this.rbNametableAll.Checked = true; this.rbNametableSE.Name = "rbNametableSE";
this.rbNametableAll.Location = new System.Drawing.Point(31, 38); this.rbNametableSE.Size = new System.Drawing.Size(14, 13);
this.rbNametableAll.Name = "rbNametableAll"; this.rbNametableSE.TabIndex = 7;
this.rbNametableAll.Size = new System.Drawing.Size(14, 13); this.toolTip1.SetToolTip(this.rbNametableSE, "0x2C00");
this.rbNametableAll.TabIndex = 9; this.rbNametableSE.UseVisualStyleBackColor = true;
this.rbNametableAll.TabStop = true; this.rbNametableSE.CheckedChanged += new System.EventHandler(this.NametableRadio_CheckedChanged);
this.toolTip1.SetToolTip(this.rbNametableAll, "All"); //
this.rbNametableAll.UseVisualStyleBackColor = true; // rbNametableAll
this.rbNametableAll.CheckedChanged += new System.EventHandler(this.rbNametable_CheckedChanged); //
// this.rbNametableAll.AutoSize = true;
// groupBox2 this.rbNametableAll.Checked = true;
// this.rbNametableAll.Location = new System.Drawing.Point(31, 38);
this.groupBox2.Controls.Add(this.rbNametableNW); this.rbNametableAll.Name = "rbNametableAll";
this.groupBox2.Controls.Add(this.rbNametableNE); this.rbNametableAll.Size = new System.Drawing.Size(14, 13);
this.groupBox2.Controls.Add(this.rbNametableAll); this.rbNametableAll.TabIndex = 9;
this.groupBox2.Controls.Add(this.rbNametableSW); this.rbNametableAll.TabStop = true;
this.groupBox2.Controls.Add(this.rbNametableSE); this.toolTip1.SetToolTip(this.rbNametableAll, "All");
this.groupBox2.Location = new System.Drawing.Point(563, 94); this.rbNametableAll.UseVisualStyleBackColor = true;
this.groupBox2.Name = "groupBox2"; this.rbNametableAll.CheckedChanged += new System.EventHandler(this.NametableRadio_CheckedChanged);
this.groupBox2.Size = new System.Drawing.Size(76, 79); //
this.groupBox2.TabIndex = 11; // groupBox2
this.groupBox2.TabStop = false; //
this.groupBox2.Text = "Nametable"; this.groupBox2.Controls.Add(this.rbNametableNW);
// this.groupBox2.Controls.Add(this.rbNametableNE);
// groupBox3 this.groupBox2.Controls.Add(this.rbNametableAll);
// this.groupBox2.Controls.Add(this.rbNametableSW);
this.groupBox3.Controls.Add(this.txtScanline); this.groupBox2.Controls.Add(this.rbNametableSE);
this.groupBox3.Location = new System.Drawing.Point(563, 36); this.groupBox2.Location = new System.Drawing.Point(563, 94);
this.groupBox3.Name = "groupBox3"; this.groupBox2.Name = "groupBox2";
this.groupBox3.Size = new System.Drawing.Size(76, 52); this.groupBox2.Size = new System.Drawing.Size(76, 79);
this.groupBox3.TabIndex = 12; this.groupBox2.TabIndex = 11;
this.groupBox3.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox3.Text = "Scanline"; this.groupBox2.Text = "Nametable";
// //
// groupBox4 // groupBox3
// //
this.groupBox4.Controls.Add(this.PaletteLabel); this.groupBox3.Controls.Add(this.txtScanline);
this.groupBox4.Controls.Add(this.label5); this.groupBox3.Location = new System.Drawing.Point(563, 36);
this.groupBox4.Controls.Add(this.TableLabel); this.groupBox3.Name = "groupBox3";
this.groupBox4.Controls.Add(this.label4); this.groupBox3.Size = new System.Drawing.Size(76, 52);
this.groupBox4.Controls.Add(this.PPUAddressLabel); this.groupBox3.TabIndex = 12;
this.groupBox4.Controls.Add(this.XYLabel); this.groupBox3.TabStop = false;
this.groupBox4.Controls.Add(this.TileIDLabel); this.groupBox3.Text = "Scanline";
this.groupBox4.Controls.Add(this.label3); //
this.groupBox4.Controls.Add(this.label2); // groupBox4
this.groupBox4.Controls.Add(this.label1); //
this.groupBox4.Location = new System.Drawing.Point(563, 179); this.groupBox4.Controls.Add(this.PaletteLabel);
this.groupBox4.Name = "groupBox4"; this.groupBox4.Controls.Add(this.label5);
this.groupBox4.Size = new System.Drawing.Size(108, 128); this.groupBox4.Controls.Add(this.TableLabel);
this.groupBox4.TabIndex = 13; this.groupBox4.Controls.Add(this.label4);
this.groupBox4.TabStop = false; this.groupBox4.Controls.Add(this.PPUAddressLabel);
this.groupBox4.Text = "Properties"; this.groupBox4.Controls.Add(this.XYLabel);
// this.groupBox4.Controls.Add(this.TileIDLabel);
// PaletteLabel this.groupBox4.Controls.Add(this.label3);
// this.groupBox4.Controls.Add(this.label2);
this.PaletteLabel.AutoSize = true; this.groupBox4.Controls.Add(this.label1);
this.PaletteLabel.Location = new System.Drawing.Point(64, 96); this.groupBox4.Location = new System.Drawing.Point(563, 179);
this.PaletteLabel.Name = "PaletteLabel"; this.groupBox4.Name = "groupBox4";
this.PaletteLabel.Size = new System.Drawing.Size(22, 13); this.groupBox4.Size = new System.Drawing.Size(108, 128);
this.PaletteLabel.TabIndex = 9; this.groupBox4.TabIndex = 13;
this.PaletteLabel.Text = " "; this.groupBox4.TabStop = false;
// this.groupBox4.Text = "Properties";
// label5 //
// // PaletteLabel
this.label5.AutoSize = true; //
this.label5.Location = new System.Drawing.Point(6, 96); this.PaletteLabel.AutoSize = true;
this.label5.Name = "label5"; this.PaletteLabel.Location = new System.Drawing.Point(64, 96);
this.label5.Size = new System.Drawing.Size(43, 13); this.PaletteLabel.Name = "PaletteLabel";
this.label5.TabIndex = 8; this.PaletteLabel.Size = new System.Drawing.Size(22, 13);
this.label5.Text = "Palette:"; this.PaletteLabel.TabIndex = 9;
// this.PaletteLabel.Text = " ";
// TableLabel //
// // label5
this.TableLabel.AutoSize = true; //
this.TableLabel.Location = new System.Drawing.Point(64, 78); this.label5.AutoSize = true;
this.TableLabel.Name = "TableLabel"; this.label5.Location = new System.Drawing.Point(6, 96);
this.TableLabel.Size = new System.Drawing.Size(22, 13); this.label5.Name = "label5";
this.TableLabel.TabIndex = 7; this.label5.Size = new System.Drawing.Size(43, 13);
this.TableLabel.Text = " "; this.label5.TabIndex = 8;
// this.label5.Text = "Palette:";
// label4 //
// // TableLabel
this.label4.AutoSize = true; //
this.label4.Location = new System.Drawing.Point(6, 78); this.TableLabel.AutoSize = true;
this.label4.Name = "label4"; this.TableLabel.Location = new System.Drawing.Point(64, 78);
this.label4.Size = new System.Drawing.Size(37, 13); this.TableLabel.Name = "TableLabel";
this.label4.TabIndex = 6; this.TableLabel.Size = new System.Drawing.Size(22, 13);
this.label4.Text = "Table:"; this.TableLabel.TabIndex = 7;
// this.TableLabel.Text = " ";
// PPUAddressLabel //
// // label4
this.PPUAddressLabel.AutoSize = true; //
this.PPUAddressLabel.Location = new System.Drawing.Point(64, 60); this.label4.AutoSize = true;
this.PPUAddressLabel.Name = "PPUAddressLabel"; this.label4.Location = new System.Drawing.Point(6, 78);
this.PPUAddressLabel.Size = new System.Drawing.Size(22, 13); this.label4.Name = "label4";
this.PPUAddressLabel.TabIndex = 5; this.label4.Size = new System.Drawing.Size(37, 13);
this.PPUAddressLabel.Text = " "; this.label4.TabIndex = 6;
// this.label4.Text = "Table:";
// XYLabel //
// // PPUAddressLabel
this.XYLabel.AutoSize = true; //
this.XYLabel.Location = new System.Drawing.Point(64, 43); this.PPUAddressLabel.AutoSize = true;
this.XYLabel.Name = "XYLabel"; this.PPUAddressLabel.Location = new System.Drawing.Point(64, 60);
this.XYLabel.Size = new System.Drawing.Size(22, 13); this.PPUAddressLabel.Name = "PPUAddressLabel";
this.XYLabel.TabIndex = 4; this.PPUAddressLabel.Size = new System.Drawing.Size(22, 13);
this.XYLabel.Text = " "; this.PPUAddressLabel.TabIndex = 5;
// this.PPUAddressLabel.Text = " ";
// TileIDLabel //
// // XYLabel
this.TileIDLabel.AutoSize = true; //
this.TileIDLabel.Location = new System.Drawing.Point(64, 26); this.XYLabel.AutoSize = true;
this.TileIDLabel.Name = "TileIDLabel"; this.XYLabel.Location = new System.Drawing.Point(64, 43);
this.TileIDLabel.Size = new System.Drawing.Size(22, 13); this.XYLabel.Name = "XYLabel";
this.TileIDLabel.TabIndex = 3; this.XYLabel.Size = new System.Drawing.Size(22, 13);
this.TileIDLabel.Text = " "; this.XYLabel.TabIndex = 4;
// this.XYLabel.Text = " ";
// label3 //
// // TileIDLabel
this.label3.AutoSize = true; //
this.label3.Location = new System.Drawing.Point(6, 60); this.TileIDLabel.AutoSize = true;
this.label3.Name = "label3"; this.TileIDLabel.Location = new System.Drawing.Point(64, 26);
this.label3.Size = new System.Drawing.Size(57, 13); this.TileIDLabel.Name = "TileIDLabel";
this.label3.TabIndex = 2; this.TileIDLabel.Size = new System.Drawing.Size(22, 13);
this.label3.Text = "PPU Addr:"; this.TileIDLabel.TabIndex = 3;
// this.TileIDLabel.Text = " ";
// label2 //
// // label3
this.label2.AutoSize = true; //
this.label2.Location = new System.Drawing.Point(6, 43); this.label3.AutoSize = true;
this.label2.Name = "label2"; this.label3.Location = new System.Drawing.Point(6, 60);
this.label2.Size = new System.Drawing.Size(35, 13); this.label3.Name = "label3";
this.label2.TabIndex = 1; this.label3.Size = new System.Drawing.Size(57, 13);
this.label2.Text = "X / Y:"; this.label3.TabIndex = 2;
// this.label3.Text = "PPU Addr:";
// label1 //
// // label2
this.label1.AutoSize = true; //
this.label1.Location = new System.Drawing.Point(6, 26); this.label2.AutoSize = true;
this.label1.Name = "label1"; this.label2.Location = new System.Drawing.Point(6, 43);
this.label1.Size = new System.Drawing.Size(41, 13); this.label2.Name = "label2";
this.label1.TabIndex = 0; this.label2.Size = new System.Drawing.Size(35, 13);
this.label1.Text = "Tile ID:"; this.label2.TabIndex = 1;
// this.label2.Text = "X / Y:";
// groupBox5 //
// // label1
this.groupBox5.Controls.Add(this.label7); //
this.groupBox5.Controls.Add(this.label6); this.label1.AutoSize = true;
this.groupBox5.Controls.Add(this.RefreshRate); this.label1.Location = new System.Drawing.Point(6, 26);
this.groupBox5.Location = new System.Drawing.Point(563, 313); this.label1.Name = "label1";
this.groupBox5.Name = "groupBox5"; this.label1.Size = new System.Drawing.Size(41, 13);
this.groupBox5.Size = new System.Drawing.Size(108, 236); this.label1.TabIndex = 0;
this.groupBox5.TabIndex = 14; this.label1.Text = "Tile ID:";
this.groupBox5.TabStop = false; //
this.groupBox5.Text = "Refresh"; // groupBox5
// //
// label7 this.groupBox5.Controls.Add(this.label7);
// this.groupBox5.Controls.Add(this.label6);
this.label7.AutoSize = true; this.groupBox5.Controls.Add(this.RefreshRate);
this.label7.Location = new System.Drawing.Point(7, 186); this.groupBox5.Location = new System.Drawing.Point(563, 313);
this.label7.Name = "label7"; this.groupBox5.Name = "groupBox5";
this.label7.Size = new System.Drawing.Size(31, 13); this.groupBox5.Size = new System.Drawing.Size(108, 236);
this.label7.TabIndex = 2; this.groupBox5.TabIndex = 14;
this.label7.Text = "More"; this.groupBox5.TabStop = false;
// this.groupBox5.Text = "Refresh";
// label6 //
// // label7
this.label6.AutoSize = true; //
this.label6.Location = new System.Drawing.Point(7, 32); this.label7.AutoSize = true;
this.label6.Name = "label6"; this.label7.Location = new System.Drawing.Point(7, 186);
this.label6.Size = new System.Drawing.Size(29, 13); this.label7.Name = "label7";
this.label6.TabIndex = 1; this.label7.Size = new System.Drawing.Size(31, 13);
this.label6.Text = "Less"; this.label7.TabIndex = 2;
// this.label7.Text = "More";
// RefreshRate //
// // label6
this.RefreshRate.LargeChange = 2; //
this.RefreshRate.Location = new System.Drawing.Point(9, 47); this.label6.AutoSize = true;
this.RefreshRate.Maximum = 8; this.label6.Location = new System.Drawing.Point(7, 32);
this.RefreshRate.Minimum = 1; this.label6.Name = "label6";
this.RefreshRate.Name = "RefreshRate"; this.label6.Size = new System.Drawing.Size(29, 13);
this.RefreshRate.Orientation = System.Windows.Forms.Orientation.Vertical; this.label6.TabIndex = 1;
this.RefreshRate.Size = new System.Drawing.Size(45, 136); this.label6.Text = "Less";
this.RefreshRate.TabIndex = 0; //
this.RefreshRate.TickFrequency = 4; // RefreshRate
this.RefreshRate.Value = 1; //
// this.RefreshRate.LargeChange = 2;
// NESNameTableViewer this.RefreshRate.Location = new System.Drawing.Point(9, 47);
// this.RefreshRate.Maximum = 8;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.RefreshRate.Minimum = 1;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.RefreshRate.Name = "RefreshRate";
this.ClientSize = new System.Drawing.Size(679, 561); this.RefreshRate.Orientation = System.Windows.Forms.Orientation.Vertical;
this.Controls.Add(this.groupBox5); this.RefreshRate.Size = new System.Drawing.Size(45, 136);
this.Controls.Add(this.groupBox4); this.RefreshRate.TabIndex = 0;
this.Controls.Add(this.groupBox3); this.RefreshRate.TickFrequency = 4;
this.Controls.Add(this.groupBox2); this.RefreshRate.Value = 1;
this.Controls.Add(this.groupBox1); //
this.Controls.Add(this.menuStrip1); // NESNameTableViewer
this.MainMenuStrip = this.menuStrip1; //
this.MinimumSize = new System.Drawing.Size(687, 588); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.Name = "NESNameTableViewer"; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ShowIcon = false; this.ClientSize = new System.Drawing.Size(679, 561);
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Controls.Add(this.groupBox5);
this.Text = "NES Nametable Viewer"; this.Controls.Add(this.groupBox4);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.NESNameTableViewer_FormClosed); this.Controls.Add(this.groupBox3);
this.Load += new System.EventHandler(this.NESNameTableViewer_Load); this.Controls.Add(this.groupBox2);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.NESNameTableViewer_KeyDown); this.Controls.Add(this.groupBox1);
this.groupBox1.ResumeLayout(false); this.Controls.Add(this.menuStrip1);
this.contextMenuStrip1.ResumeLayout(false); this.MainMenuStrip = this.menuStrip1;
this.menuStrip1.ResumeLayout(false); this.MinimumSize = new System.Drawing.Size(687, 588);
this.menuStrip1.PerformLayout(); this.Name = "NESNameTableViewer";
this.groupBox2.ResumeLayout(false); this.ShowIcon = false;
this.groupBox2.PerformLayout(); this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.groupBox3.ResumeLayout(false); this.Text = "NES Nametable Viewer";
this.groupBox3.PerformLayout(); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.NESNameTableViewer_FormClosed);
this.groupBox4.ResumeLayout(false); this.Load += new System.EventHandler(this.NESNameTableViewer_Load);
this.groupBox4.PerformLayout(); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.NesNameTableViewer_KeyDown);
this.groupBox5.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox5.PerformLayout(); this.contextMenuStrip1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.RefreshRate)).EndInit(); this.menuStrip1.ResumeLayout(false);
this.ResumeLayout(false); this.menuStrip1.PerformLayout();
this.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 System.Windows.Forms.GroupBox groupBox1;
private NameTableViewer NameTableView; private NameTableViewer NameTableView;
private MenuStripEx menuStrip1; private MenuStripEx menuStrip1;
private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem OptionsSubMenu;
private System.Windows.Forms.ToolStripMenuItem autoloadToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem AutoloadMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveWindowPositionToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem SaveWindowPositionMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.TextBox txtScanline; private System.Windows.Forms.TextBox txtScanline;
private System.Windows.Forms.RadioButton rbNametableNW; private System.Windows.Forms.RadioButton rbNametableNW;
private System.Windows.Forms.RadioButton rbNametableNE; private System.Windows.Forms.RadioButton rbNametableNE;
@ -524,15 +534,17 @@
private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label6;
private System.Windows.Forms.TrackBar RefreshRate; private System.Windows.Forms.TrackBar RefreshRate;
private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label7;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem FileSubMenu;
private System.Windows.Forms.ToolStripMenuItem screenshotToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem ScreenshotMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; 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.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem screenshotAsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem ScreenshotAsContextMenuItem;
private System.Windows.Forms.ToolStripMenuItem refreshImageToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem RefreshImageContextMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveImageClipboardToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem SaveImageClipboardMenuItem;
private System.Windows.Forms.ToolStripMenuItem screenshotToClipboardToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem ScreenshotToClipboardMenuItem;
private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem;
private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem;
} }
} }

View File

@ -2,124 +2,49 @@
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Emulation.Cores.Nintendo.NES;
using BizHawk.Client.Common; using BizHawk.Client.Common;
using BizHawk.Emulation.Cores.Nintendo.NES;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public partial class NESNameTableViewer : Form, IToolForm public partial class NESNameTableViewer : Form, IToolForm
{ {
//TODO: // TODO:
//Show Scroll Lines + UI Toggle // Show Scroll Lines + UI Toggle
private readonly NES.PPU.DebugCallback _callback = new NES.PPU.DebugCallback();
private NES _nes; 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() public NESNameTableViewer()
{ {
InitializeComponent(); InitializeComponent();
Closing += (o, e) => SaveConfigSettings(); Closing += (o, e) =>
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)
{ {
ytable += 2; Global.Config.NesNameTableSettings.Wndx = Location.X;
yline = 240; Global.Config.NesNameTableSettings.Wndx = Location.Y;
} Global.Config.NESNameTableRefreshRate = RefreshRate.Value;
for (int x = 0; x < 512; x++, dptr++) };
{ TopMost = Global.Config.NesNameTableSettings.TopMost;
int table = (x >> 8) + ytable; _callback.Callback = () => Generate();
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();
} }
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; Location = Global.Config.NesNameTableSettings.WindowPosition;
ppu.NTViewCallback = Callback;
}
else
{
Close();
} }
_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() public void Restart()
{ {
if (Global.Emulator is NES) 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) if (Global.Emulator is NES)
Location = new Point(Global.Config.NESNameTableWndx, Global.Config.NESNameTableWndy); {
(Global.Emulator as NES).ppu.NTViewCallback = _callback;
_nes = Global.Emulator as NES; }
RefreshRate.Value = Global.Config.NESNameTableRefreshRate; else
Generate(true); {
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(); 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; 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; Global.Config.NesNameTableSettings.TopMost ^= true;
saveWindowPositionToolStripMenuItem.Checked = Global.Config.NESNameTableSaveWindowPosition; TopMost = Global.Config.NesNameTableSettings.TopMost;
} }
private void txtScanline_TextChanged(object sender, EventArgs e) private void FloatingWindowMenuItem_Click(object sender, EventArgs e)
{ {
int temp; Global.Config.NesNameTableSettings.FloatingWindow ^= true;
if (int.TryParse(txtScanline.Text, out temp)) 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) private void NESNameTableViewer_FormClosed(object sender, FormClosedEventArgs e)
{ {
if (_nes == null) return; if (_nes != null && _nes.ppu.NTViewCallback == _callback)
if (_nes.ppu.NTViewCallback == Callback) {
_nes.ppu.NTViewCallback = null; _nes.ppu.NTViewCallback = null;
}
} }
private void ScanlineTextbox_TextChanged(object sender, EventArgs e)
private void rbNametable_CheckedChanged(object sender, EventArgs e)
{ {
if (rbNametableNW.Checked) NameTableView.Which = NameTableViewer.WhichNametable.NT_2000; int temp;
if (rbNametableNE.Checked) NameTableView.Which = NameTableViewer.WhichNametable.NT_2400; if (int.TryParse(txtScanline.Text, out temp))
if (rbNametableSW.Checked) NameTableView.Which = NameTableViewer.WhichNametable.NT_2800; {
if (rbNametableSE.Checked) NameTableView.Which = NameTableViewer.WhichNametable.NT_2C00; _callback.Scanline = temp;
if (rbNametableAll.Checked) NameTableView.Which = NameTableViewer.WhichNametable.NT_ALL; }
}
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) private void NameTableView_MouseMove(object sender, MouseEventArgs e)
@ -221,12 +330,12 @@ namespace BizHawk.Client.EmuHawk
TileX = e.X / 16; TileX = e.X / 16;
TileY = e.Y / 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); 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); 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(); TableLabel.Text = NameTable.ToString();
int ytable = 0, yline = 0; int ytable = 0, yline = 0;
@ -251,50 +360,15 @@ namespace BizHawk.Client.EmuHawk
private void NameTableView_MouseLeave(object sender, EventArgs e) private void NameTableView_MouseLeave(object sender, EventArgs e)
{ {
XYLabel.Text = ""; XYLabel.Text = string.Empty;
PPUAddressLabel.Text = ""; PPUAddressLabel.Text = string.Empty;
TileIDLabel.Text = ""; TileIDLabel.Text = string.Empty;
TableLabel.Text = ""; TableLabel.Text = string.Empty;
PaletteLabel.Text = ""; PaletteLabel.Text = string.Empty;
} }
private void screenshotToolStripMenuItem_Click(object sender, EventArgs e) #endregion
{
NameTableView.Screenshot();
}
private void screenshotAsToolStripMenuItem_Click(object sender, EventArgs e) #endregion
{
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();
}
} }
} }