From 8b006b3b59db82c0617510b7544e33201a2e15e0 Mon Sep 17 00:00:00 2001 From: goyuken Date: Sat, 8 Feb 2014 16:40:15 +0000 Subject: [PATCH] PCE: add tile viewer. it doesn't have as many bells and whistles as the other viewers, but it does a basic job of it. --- .../BizHawk.Client.EmuHawk.csproj | 9 + BizHawk.Client.EmuHawk/MainForm.Designer.cs | 110 +++++----- BizHawk.Client.EmuHawk/MainForm.cs | 5 +- BizHawk.Client.EmuHawk/MainForm.resx | 4 +- .../tools/PCE/PCETileViewer.Designer.cs | 136 ++++++++++++ .../tools/PCE/PCETileViewer.cs | 202 ++++++++++++++++++ .../tools/PCE/PCETileViewer.resx | 120 +++++++++++ 7 files changed, 533 insertions(+), 53 deletions(-) create mode 100644 BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.Designer.cs create mode 100644 BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs create mode 100644 BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.resx diff --git a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj index 553d0a4fbd..6d2d4399b6 100644 --- a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj +++ b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj @@ -662,6 +662,12 @@ PCEBGViewer.cs + + Form + + + PCETileViewer.cs + Form @@ -1073,6 +1079,9 @@ PCEBGViewer.cs + + PCETileViewer.cs + SNESGameGenie.cs diff --git a/BizHawk.Client.EmuHawk/MainForm.Designer.cs b/BizHawk.Client.EmuHawk/MainForm.Designer.cs index de331be325..ee3fee01f5 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Designer.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Designer.cs @@ -127,13 +127,13 @@ this.ConfigSubMenu = new System.Windows.Forms.ToolStripMenuItem(); this.ControllersMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.HotkeysMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.MessagesMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.PathsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.DisplayConfigMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SoundMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.PathsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.FirmwaresMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.MessagesMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.AutofireMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.RewindOptionsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.DisplayConfigMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.FirmwaresMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator(); this.ConfigEnableSubMenu = new System.Windows.Forms.ToolStripMenuItem(); this.EnableContextMenuMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -341,6 +341,7 @@ this.ClearSRAMContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ShowMenuContextMenuSeparator = new System.Windows.Forms.ToolStripSeparator(); this.ShowMenuContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.PCEtileViewerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MainformMenu.SuspendLayout(); this.MainStatusBar.SuspendLayout(); this.MainFormContextMenu.SuspendLayout(); @@ -1242,7 +1243,7 @@ // this.ControllersMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.GameController; this.ControllersMenuItem.Name = "ControllersMenuItem"; - this.ControllersMenuItem.Size = new System.Drawing.Size(152, 22); + this.ControllersMenuItem.Size = new System.Drawing.Size(150, 22); this.ControllersMenuItem.Text = "&Controllers..."; this.ControllersMenuItem.Click += new System.EventHandler(this.ControllersMenuItem_Click); // @@ -1250,39 +1251,55 @@ // this.HotkeysMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.HotKeys; this.HotkeysMenuItem.Name = "HotkeysMenuItem"; - this.HotkeysMenuItem.Size = new System.Drawing.Size(152, 22); + this.HotkeysMenuItem.Size = new System.Drawing.Size(150, 22); this.HotkeysMenuItem.Text = "&Hotkeys..."; this.HotkeysMenuItem.Click += new System.EventHandler(this.HotkeysMenuItem_Click); // - // MessagesMenuItem + // DisplayConfigMenuItem // - this.MessagesMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.MessageConfig; - this.MessagesMenuItem.Name = "MessagesMenuItem"; - this.MessagesMenuItem.Size = new System.Drawing.Size(152, 22); - this.MessagesMenuItem.Text = "&Messages..."; - this.MessagesMenuItem.Click += new System.EventHandler(this.MessagesMenuItem_Click); - // - // PathsMenuItem - // - this.PathsMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.CopyFolderHS; - this.PathsMenuItem.Name = "PathsMenuItem"; - this.PathsMenuItem.Size = new System.Drawing.Size(152, 22); - this.PathsMenuItem.Text = "Paths..."; - this.PathsMenuItem.Click += new System.EventHandler(this.PathsMenuItem_Click); + this.DisplayConfigMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("DisplayConfigMenuItem.Image"))); + this.DisplayConfigMenuItem.Name = "DisplayConfigMenuItem"; + this.DisplayConfigMenuItem.Size = new System.Drawing.Size(150, 22); + this.DisplayConfigMenuItem.Text = "Display..."; + this.DisplayConfigMenuItem.Click += new System.EventHandler(this.DisplayConfigMenuItem_Click); // // SoundMenuItem // this.SoundMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.AudioHS; this.SoundMenuItem.Name = "SoundMenuItem"; - this.SoundMenuItem.Size = new System.Drawing.Size(152, 22); + this.SoundMenuItem.Size = new System.Drawing.Size(150, 22); this.SoundMenuItem.Text = "&Sound..."; this.SoundMenuItem.Click += new System.EventHandler(this.SoundMenuItem_Click); // + // PathsMenuItem + // + this.PathsMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.CopyFolderHS; + this.PathsMenuItem.Name = "PathsMenuItem"; + this.PathsMenuItem.Size = new System.Drawing.Size(150, 22); + this.PathsMenuItem.Text = "Paths..."; + this.PathsMenuItem.Click += new System.EventHandler(this.PathsMenuItem_Click); + // + // FirmwaresMenuItem + // + this.FirmwaresMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("FirmwaresMenuItem.Image"))); + this.FirmwaresMenuItem.Name = "FirmwaresMenuItem"; + this.FirmwaresMenuItem.Size = new System.Drawing.Size(150, 22); + this.FirmwaresMenuItem.Text = "&Firmwares"; + this.FirmwaresMenuItem.Click += new System.EventHandler(this.FirmwaresMenuItem_Click); + // + // MessagesMenuItem + // + this.MessagesMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.MessageConfig; + this.MessagesMenuItem.Name = "MessagesMenuItem"; + this.MessagesMenuItem.Size = new System.Drawing.Size(150, 22); + this.MessagesMenuItem.Text = "&Messages..."; + this.MessagesMenuItem.Click += new System.EventHandler(this.MessagesMenuItem_Click); + // // AutofireMenuItem // this.AutofireMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Lightning; this.AutofireMenuItem.Name = "AutofireMenuItem"; - this.AutofireMenuItem.Size = new System.Drawing.Size(152, 22); + this.AutofireMenuItem.Size = new System.Drawing.Size(150, 22); this.AutofireMenuItem.Text = "&Autofire..."; this.AutofireMenuItem.Click += new System.EventHandler(this.AutofireMenuItem_Click); // @@ -1290,30 +1307,14 @@ // this.RewindOptionsMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Previous; this.RewindOptionsMenuItem.Name = "RewindOptionsMenuItem"; - this.RewindOptionsMenuItem.Size = new System.Drawing.Size(152, 22); + this.RewindOptionsMenuItem.Size = new System.Drawing.Size(150, 22); this.RewindOptionsMenuItem.Text = "&Rewind..."; this.RewindOptionsMenuItem.Click += new System.EventHandler(this.RewindOptionsMenuItem_Click); // - // DisplayConfigMenuItem - // - this.DisplayConfigMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("DisplayConfigMenuItem.Image"))); - this.DisplayConfigMenuItem.Name = "DisplayConfigMenuItem"; - this.DisplayConfigMenuItem.Size = new System.Drawing.Size(152, 22); - this.DisplayConfigMenuItem.Text = "Display..."; - this.DisplayConfigMenuItem.Click += new System.EventHandler(this.DisplayConfigMenuItem_Click); - // - // FirmwaresMenuItem - // - this.FirmwaresMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("FirmwaresMenuItem.Image"))); - this.FirmwaresMenuItem.Name = "FirmwaresMenuItem"; - this.FirmwaresMenuItem.Size = new System.Drawing.Size(152, 22); - this.FirmwaresMenuItem.Text = "&Firmwares"; - this.FirmwaresMenuItem.Click += new System.EventHandler(this.FirmwaresMenuItem_Click); - // // toolStripSeparator9 // this.toolStripSeparator9.Name = "toolStripSeparator9"; - this.toolStripSeparator9.Size = new System.Drawing.Size(149, 6); + this.toolStripSeparator9.Size = new System.Drawing.Size(147, 6); // // ConfigEnableSubMenu // @@ -1325,7 +1326,7 @@ this.FrameAdvanceSkipLagMenuItem, this.BackupSaveramMenuItem}); this.ConfigEnableSubMenu.Name = "ConfigEnableSubMenu"; - this.ConfigEnableSubMenu.Size = new System.Drawing.Size(152, 22); + this.ConfigEnableSubMenu.Size = new System.Drawing.Size(150, 22); this.ConfigEnableSubMenu.Text = "&Enable"; this.ConfigEnableSubMenu.DropDownOpened += new System.EventHandler(this.EnableMenuItem_DropDownOpened); // @@ -1387,7 +1388,7 @@ this.toolStripSeparator23, this.LogWindowAsConsoleMenuItem}); this.GuiSubMenu.Name = "GuiSubMenu"; - this.GuiSubMenu.Size = new System.Drawing.Size(152, 22); + this.GuiSubMenu.Size = new System.Drawing.Size(150, 22); this.GuiSubMenu.Text = "GUI"; this.GuiSubMenu.DropDownOpened += new System.EventHandler(this.GuiSubMenu_DropDownOpened); // @@ -1498,7 +1499,7 @@ this.Speed150MenuItem, this.Speed200MenuItem}); this.SpeedSkipSubMenu.Name = "SpeedSkipSubMenu"; - this.SpeedSkipSubMenu.Size = new System.Drawing.Size(152, 22); + this.SpeedSkipSubMenu.Size = new System.Drawing.Size(150, 22); this.SpeedSkipSubMenu.Text = "Speed/Skip"; this.SpeedSkipSubMenu.DropDownOpened += new System.EventHandler(this.FrameSkipMenuItem_DropDownOpened); // @@ -1664,7 +1665,7 @@ this.InputOverHkMenuItem, this.HkOverInputMenuItem}); this.KeyPrioritySubMenu.Name = "KeyPrioritySubMenu"; - this.KeyPrioritySubMenu.Size = new System.Drawing.Size(152, 22); + this.KeyPrioritySubMenu.Size = new System.Drawing.Size(150, 22); this.KeyPrioritySubMenu.Text = "Key Priority"; this.KeyPrioritySubMenu.DropDownOpened += new System.EventHandler(this.KeyPriorityMenuItem_DropDownOpened); // @@ -1696,7 +1697,7 @@ this.SavestateBinaryMenuItem, this.SavestateTextMenuItem}); this.SavestateTypeSubMenu.Name = "SavestateTypeSubMenu"; - this.SavestateTypeSubMenu.Size = new System.Drawing.Size(152, 22); + this.SavestateTypeSubMenu.Size = new System.Drawing.Size(150, 22); this.SavestateTypeSubMenu.Text = "Savestate Type"; this.SavestateTypeSubMenu.DropDownOpened += new System.EventHandler(this.SavestateTypeMenuItem_DropDownOpened); // @@ -1724,13 +1725,13 @@ // toolStripSeparator10 // this.toolStripSeparator10.Name = "toolStripSeparator10"; - this.toolStripSeparator10.Size = new System.Drawing.Size(149, 6); + this.toolStripSeparator10.Size = new System.Drawing.Size(147, 6); // // SaveConfigMenuItem // this.SaveConfigMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Save; this.SaveConfigMenuItem.Name = "SaveConfigMenuItem"; - this.SaveConfigMenuItem.Size = new System.Drawing.Size(152, 22); + this.SaveConfigMenuItem.Size = new System.Drawing.Size(150, 22); this.SaveConfigMenuItem.Text = "Save Config"; this.SaveConfigMenuItem.Click += new System.EventHandler(this.SaveConfigMenuItem_Click); // @@ -1738,14 +1739,14 @@ // this.LoadConfigMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.LoadConfig; this.LoadConfigMenuItem.Name = "LoadConfigMenuItem"; - this.LoadConfigMenuItem.Size = new System.Drawing.Size(152, 22); + this.LoadConfigMenuItem.Size = new System.Drawing.Size(150, 22); this.LoadConfigMenuItem.Text = "Load Config"; this.LoadConfigMenuItem.Click += new System.EventHandler(this.LoadConfigMenuItem_Click); // // toolStripSeparator8 // this.toolStripSeparator8.Name = "toolStripSeparator8"; - this.toolStripSeparator8.Size = new System.Drawing.Size(149, 6); + this.toolStripSeparator8.Size = new System.Drawing.Size(147, 6); // // coreSelectionToolStripMenuItem // @@ -1753,7 +1754,7 @@ this.gBInSGBToolStripMenuItem, this.nESInQuickNESToolStripMenuItem}); this.coreSelectionToolStripMenuItem.Name = "coreSelectionToolStripMenuItem"; - this.coreSelectionToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.coreSelectionToolStripMenuItem.Size = new System.Drawing.Size(150, 22); this.coreSelectionToolStripMenuItem.Text = "Core Selection"; this.coreSelectionToolStripMenuItem.DropDownOpened += new System.EventHandler(this.coreSelectionToolStripMenuItem_DropDownOpened); this.coreSelectionToolStripMenuItem.Click += new System.EventHandler(this.coreSelectionToolStripMenuItem_Click); @@ -1988,6 +1989,7 @@ // this.PCESubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.PCEBGViewerMenuItem, + this.PCEtileViewerToolStripMenuItem, this.toolStripSeparator25, this.PCEAlwaysPerformSpriteLimitMenuItem, this.PCEAlwaysEqualizeVolumesMenuItem, @@ -2975,6 +2977,13 @@ this.ShowMenuContextMenuItem.Text = "Show Menu"; this.ShowMenuContextMenuItem.Click += new System.EventHandler(this.ShowMenuContextMenuItem_Click); // + // PCEtileViewerToolStripMenuItem + // + this.PCEtileViewerToolStripMenuItem.Name = "PCEtileViewerToolStripMenuItem"; + this.PCEtileViewerToolStripMenuItem.Size = new System.Drawing.Size(240, 22); + this.PCEtileViewerToolStripMenuItem.Text = "&Tile Viewer"; + this.PCEtileViewerToolStripMenuItem.Click += new System.EventHandler(this.PCEtileViewerToolStripMenuItem_Click); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 14F); @@ -3328,6 +3337,7 @@ private System.Windows.Forms.ToolStripMenuItem nESInQuickNESToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem batchRunnerToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem DisplayConfigMenuItem; + private System.Windows.Forms.ToolStripMenuItem PCEtileViewerToolStripMenuItem; } } diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index 07c8d4367c..8db0445c62 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -3052,7 +3052,10 @@ namespace BizHawk.Client.EmuHawk new config.DisplayConfigLite().ShowDialog(); } - + private void PCEtileViewerToolStripMenuItem_Click(object sender, EventArgs e) + { + GlobalWin.Tools.Load(); + } } } diff --git a/BizHawk.Client.EmuHawk/MainForm.resx b/BizHawk.Client.EmuHawk/MainForm.resx index 823b7da20e..0cf3f4c279 100644 --- a/BizHawk.Client.EmuHawk/MainForm.resx +++ b/BizHawk.Client.EmuHawk/MainForm.resx @@ -124,7 +124,7 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjExR/NC + YQUAAAAJcEhZcwAADsEAAA7BAbiRa+0AAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjExR/NC NwAAAaRJREFUOE+dk0FLAlEUhd9/kgwFMUQMhMEIhJLIhVCRDIRhAznEIEYtlBiQYApBSGQw2xhBlhLE zCLQTa3bt2nd8tR5pFTaLLxwuJd7vgNv3syIv+Xz+fA9TpSX96s0TZsAp+0862fAM3xpN5DNZpHL5VAo FFAqlVCpVFCtVsEgxZk7emTIMsOsyGQyGAwGM4lZkU6n4bouVg4aCO1cQDGusXbyiA1rIMWZO3pkyEYi @@ -138,7 +138,7 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAAEEwAABBMAbXL4wQAAABwSURBVDhPzZDhCgAhCIN99HvzTgNj6k6i/lzwaW3DKJFH + YQUAAAAJcEhZcwAAEEsAABBLAeePRXsAAABwSURBVDhPzZDhCgAhCIN99HvzTgNj6k6i/lzwaW3DKJFH xhVMtMU6xYraIDR4BqlCQ87OfBEacnbmtfzsCYr/eu4UK+EJH2hyUjw82CAkeDsDjrDit/nNjofyOUDF BA4ow9YGzBIimaWheQQVt5HxAoOkokovUz91AAAAAElFTkSuQmCC diff --git a/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.Designer.cs b/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.Designer.cs new file mode 100644 index 0000000000..545c1d42c1 --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.Designer.cs @@ -0,0 +1,136 @@ +namespace BizHawk.Client.EmuHawk +{ + partial class PCETileViewer + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.checkBoxVDC2 = new System.Windows.Forms.CheckBox(); + this.bmpViewSPPal = new BizHawk.Client.EmuHawk.BmpView(); + this.bmpViewSP = new BizHawk.Client.EmuHawk.BmpView(); + this.bmpViewBGPal = new BizHawk.Client.EmuHawk.BmpView(); + this.bmpViewBG = new BizHawk.Client.EmuHawk.BmpView(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.bmpViewBGPal); + this.groupBox1.Controls.Add(this.bmpViewBG); + this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(786, 281); + this.groupBox1.TabIndex = 4; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Background"; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.bmpViewSPPal); + this.groupBox2.Controls.Add(this.bmpViewSP); + this.groupBox2.Location = new System.Drawing.Point(12, 299); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(786, 281); + this.groupBox2.TabIndex = 5; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Sprite"; + // + // checkBoxVDC2 + // + this.checkBoxVDC2.AutoSize = true; + this.checkBoxVDC2.Location = new System.Drawing.Point(12, 586); + this.checkBoxVDC2.Name = "checkBoxVDC2"; + this.checkBoxVDC2.Size = new System.Drawing.Size(57, 17); + this.checkBoxVDC2.TabIndex = 6; + this.checkBoxVDC2.Text = "VDC 2"; + this.checkBoxVDC2.UseVisualStyleBackColor = true; + this.checkBoxVDC2.CheckedChanged += new System.EventHandler(this.checkBoxVDC2_CheckedChanged); + // + // bmpViewSPPal + // + this.bmpViewSPPal.Location = new System.Drawing.Point(524, 19); + this.bmpViewSPPal.Name = "bmpViewSPPal"; + this.bmpViewSPPal.Size = new System.Drawing.Size(256, 256); + this.bmpViewSPPal.TabIndex = 1; + this.bmpViewSPPal.Text = "bmpView4"; + this.bmpViewSPPal.MouseClick += new System.Windows.Forms.MouseEventHandler(this.bmpViewSPPal_MouseClick); + // + // bmpViewSP + // + this.bmpViewSP.Location = new System.Drawing.Point(6, 19); + this.bmpViewSP.Name = "bmpViewSP"; + this.bmpViewSP.Size = new System.Drawing.Size(512, 256); + this.bmpViewSP.TabIndex = 0; + this.bmpViewSP.Text = "bmpView3"; + // + // bmpViewBGPal + // + this.bmpViewBGPal.Location = new System.Drawing.Point(524, 19); + this.bmpViewBGPal.Name = "bmpViewBGPal"; + this.bmpViewBGPal.Size = new System.Drawing.Size(256, 256); + this.bmpViewBGPal.TabIndex = 3; + this.bmpViewBGPal.Text = "bmpView2"; + this.bmpViewBGPal.MouseClick += new System.Windows.Forms.MouseEventHandler(this.bmpViewBGPal_MouseClick); + // + // bmpViewBG + // + this.bmpViewBG.Location = new System.Drawing.Point(6, 19); + this.bmpViewBG.Name = "bmpViewBG"; + this.bmpViewBG.Size = new System.Drawing.Size(512, 256); + this.bmpViewBG.TabIndex = 2; + this.bmpViewBG.Text = "bmpView1"; + // + // PCETileViewer + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(810, 615); + this.Controls.Add(this.checkBoxVDC2); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.Name = "PCETileViewer"; + this.Text = "Tile Viewer"; + this.groupBox1.ResumeLayout(false); + this.groupBox2.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.CheckBox checkBoxVDC2; + private BmpView bmpViewBGPal; + private BmpView bmpViewBG; + private BmpView bmpViewSPPal; + private BmpView bmpViewSP; + } +} \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs b/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs new file mode 100644 index 0000000000..f62fce90d7 --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs @@ -0,0 +1,202 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +using BizHawk.Client.Common; +using BizHawk.Emulation.Cores.PCEngine; +using System.Drawing.Imaging; + +namespace BizHawk.Client.EmuHawk +{ + public partial class PCETileViewer : Form, IToolForm + { + private PCEngine emu; + private VDC vdc; + private VCE vce; + + private int bgpalnum; + private int sppalnum; + + public PCETileViewer() + { + InitializeComponent(); + bmpViewBG.ChangeBitmapSize(512, 256); + bmpViewSP.ChangeBitmapSize(512, 256); + bmpViewBGPal.ChangeBitmapSize(256, 256); + bmpViewSPPal.ChangeBitmapSize(256, 256); + + Restart(); + } + + #region IToolForm + + public void UpdateValues() + { + DrawBacks(); + DrawSprites(); + DrawPalettes(); + bmpViewBG.Refresh(); + bmpViewBGPal.Refresh(); + bmpViewSP.Refresh(); + bmpViewSPPal.Refresh(); + } + + + unsafe static void Draw16x16(byte* src, int* dest, int pitch, int* pal) + { + int inc = pitch - 16; + dest -= inc; + for (int i = 0; i < 256; i++) + { + if ((i & 15) == 0) + dest += inc; + *dest++ = pal[*src++]; + } + } + + unsafe static void Draw8x8(byte* src, int* dest, int pitch, int* pal) + { + int inc = pitch - 8; + dest -= inc; + for (int i = 0; i < 64; i++) + { + if ((i & 7) == 0) + dest += inc; + *dest++ = pal[*src++]; + } + } + + unsafe void DrawSprites() + { + var lockdata = bmpViewSP.bmp.LockBits(new Rectangle(0, 0, 512, 256), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); + + int* dest = (int*)lockdata.Scan0; + int pitch = lockdata.Stride / sizeof(int); + fixed (byte* src = vdc.SpriteBuffer) + { + fixed (int* pal = &vce.Palette[256 + sppalnum * 16]) + { + for (int tile = 0; tile < 512; tile++) + { + int srcaddr = tile * 256; + int tx = tile & 31; + int ty = tile >> 5; + int destaddr = ty * 16 * pitch + tx * 16; + Draw16x16(src + srcaddr, dest + destaddr, pitch, pal); + } + } + } + bmpViewSP.bmp.UnlockBits(lockdata); + } + + unsafe void DrawBacks() + { + var lockdata = bmpViewBG.bmp.LockBits(new Rectangle(0, 0, 512, 256), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); + + int* dest = (int*)lockdata.Scan0; + int pitch = lockdata.Stride / sizeof(int); + fixed (byte* src = vdc.PatternBuffer) + { + fixed (int* pal = &vce.Palette[0 + bgpalnum * 16]) + { + for (int tile = 0; tile < 2048; tile++) + { + int srcaddr = tile * 64; + int tx = tile & 63; + int ty = tile >> 6; + int destaddr = ty * 8 * pitch + tx * 8; + Draw8x8(src + srcaddr, dest + destaddr, pitch, pal); + } + } + } + bmpViewBG.bmp.UnlockBits(lockdata); + } + + unsafe void DrawPalettes() + { + fixed (int* pal = vce.Palette) + { + DrawPalette(bmpViewBGPal.bmp, pal); + DrawPalette(bmpViewSPPal.bmp, pal + 256); + } + } + + unsafe static void DrawPalette(Bitmap bmp, int* pal) + { + var lockdata = bmp.LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); + + int* dest = (int*)lockdata.Scan0; + int pitch = lockdata.Stride / sizeof(int); + int inc = pitch - 256; + for (int j = 0; j < 256; j++) + { + for (int i = 0; i < 256; i++) + { + int pindex = j & 0xf0 | i >> 4; + *dest++ = pal[pindex]; + } + dest += inc; + } + bmp.UnlockBits(lockdata); + } + + public void Restart() + { + if (!(Global.Emulator is PCEngine)) + Close(); + emu = (PCEngine)Global.Emulator; + + vce = emu.VCE; + + if (emu.SystemId == "SGX") + { + checkBoxVDC2.Enabled = true; + } + else + { + checkBoxVDC2.Enabled = false; + checkBoxVDC2.Checked = false; + } + checkBoxVDC2_CheckedChanged(null, null); + } + + public bool AskSave() + { + return true; + } + + public bool UpdateBefore + { + get { return true; } + } + + #endregion + + private void checkBoxVDC2_CheckedChanged(object sender, EventArgs e) + { + vdc = checkBoxVDC2.Checked ? emu.VDC2 : emu.VDC1; + UpdateValues(); + } + + private void bmpViewBGPal_MouseClick(object sender, MouseEventArgs e) + { + int p = Math.Min(Math.Max(e.Y / 16, 0), 15); + bgpalnum = p; + DrawBacks(); + bmpViewBG.Refresh(); + } + + private void bmpViewSPPal_MouseClick(object sender, MouseEventArgs e) + { + int p = Math.Min(Math.Max(e.Y / 16, 0), 15); + sppalnum = p; + DrawSprites(); + bmpViewSP.Refresh(); + } + } +} diff --git a/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.resx b/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.resx new file mode 100644 index 0000000000..29dcb1b3a3 --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file