From cc1b3832f4642fdb25b11c1552308b407094c3e8 Mon Sep 17 00:00:00 2001 From: adelikat Date: Wed, 17 Dec 2014 03:28:10 +0000 Subject: [PATCH] Automate the ToolBox tool, it generates its buttons based on IToolForm implementations, that are released (or all in developer build), and that are available (current core provides all necessary dependencies) --- .../tools/ToolBox.Designer.cs | 308 ------------------ BizHawk.Client.EmuHawk/tools/ToolBox.cs | 219 +++---------- BizHawk.Client.EmuHawk/tools/ToolBox.resx | 38 --- 3 files changed, 42 insertions(+), 523 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/ToolBox.Designer.cs b/BizHawk.Client.EmuHawk/tools/ToolBox.Designer.cs index 1bbe9f0d85..804069b982 100644 --- a/BizHawk.Client.EmuHawk/tools/ToolBox.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/ToolBox.Designer.cs @@ -30,31 +30,6 @@ { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ToolBox)); this.ToolBoxStrip = new ToolStripEx(); - this.CheatsToolBarItem = new System.Windows.Forms.ToolStripButton(); - this.RamWatchToolbarItem = new System.Windows.Forms.ToolStripButton(); - this.RamSearchToolbarItem = new System.Windows.Forms.ToolStripButton(); - this.HexEditorToolbarItem = new System.Windows.Forms.ToolStripButton(); - this.LuaConsoleToolbarItem = new System.Windows.Forms.ToolStripButton(); - this.TAStudioToolbarItem = new System.Windows.Forms.ToolStripButton(); - this.VirtualpadToolbarItem = new System.Windows.Forms.ToolStripButton(); - this.NesPPUToolbarItem = new System.Windows.Forms.ToolStripButton(); - this.NesNameTableToolbarItem = new System.Windows.Forms.ToolStripButton(); - this.NesGameGenieToolbarItem = new System.Windows.Forms.ToolStripButton(); - this.TI83KeypadToolbarItem = new System.Windows.Forms.ToolStripButton(); - this.SNESGraphicsDebuggerToolbarItem = new System.Windows.Forms.ToolStripButton(); - this.SNESGameGenieToolbarItem = new System.Windows.Forms.ToolStripButton(); - this.GGGameGenieToolbarItem = new System.Windows.Forms.ToolStripButton(); - this.GbGpuViewerToolBarItem = new System.Windows.Forms.ToolStripButton(); - this.GBGameGenieToolbarItem = new System.Windows.Forms.ToolStripButton(); - this.PceTileToolbarItem = new System.Windows.Forms.ToolStripButton(); - this.PceCdlToolbarItem = new System.Windows.Forms.ToolStripButton(); - this.PceBgViewerToolbarItem = new System.Windows.Forms.ToolStripButton(); - this.PceSoundDebuggerButton = new System.Windows.Forms.ToolStripButton(); - this.GbaGpuViewerToolBarItem = new System.Windows.Forms.ToolStripButton(); - this.GenesisVdpToolBarItem = new System.Windows.Forms.ToolStripButton(); - this.GenesisGameGenieToolBarItem = new System.Windows.Forms.ToolStripButton(); - this.SmsVdpToolbarItem = new System.Windows.Forms.ToolStripButton(); - this.ToolBoxStrip.SuspendLayout(); this.SuspendLayout(); // // ToolBoxStrip @@ -67,31 +42,6 @@ this.ToolBoxStrip.ClickThrough = true; this.ToolBoxStrip.Dock = System.Windows.Forms.DockStyle.None; this.ToolBoxStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; - this.ToolBoxStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.CheatsToolBarItem, - this.RamWatchToolbarItem, - this.RamSearchToolbarItem, - this.HexEditorToolbarItem, - this.LuaConsoleToolbarItem, - this.TAStudioToolbarItem, - this.VirtualpadToolbarItem, - this.NesPPUToolbarItem, - this.NesNameTableToolbarItem, - this.NesGameGenieToolbarItem, - this.TI83KeypadToolbarItem, - this.SNESGraphicsDebuggerToolbarItem, - this.SNESGameGenieToolbarItem, - this.GGGameGenieToolbarItem, - this.GbGpuViewerToolBarItem, - this.GBGameGenieToolbarItem, - this.PceTileToolbarItem, - this.PceCdlToolbarItem, - this.PceBgViewerToolbarItem, - this.PceSoundDebuggerButton, - this.GbaGpuViewerToolBarItem, - this.GenesisVdpToolBarItem, - this.GenesisGameGenieToolBarItem, - this.SmsVdpToolbarItem}); this.ToolBoxStrip.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow; this.ToolBoxStrip.Location = new System.Drawing.Point(2, 2); this.ToolBoxStrip.Name = "ToolBoxStrip"; @@ -101,238 +51,6 @@ this.ToolBoxStrip.TabIndex = 0; this.ToolBoxStrip.TabStop = true; // - // CheatsToolBarItem - // - this.CheatsToolBarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Freeze; - this.CheatsToolBarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.CheatsToolBarItem.Name = "CheatsToolBarItem"; - this.CheatsToolBarItem.Size = new System.Drawing.Size(23, 20); - this.CheatsToolBarItem.ToolTipText = "Cheats"; - this.CheatsToolBarItem.Click += new System.EventHandler(this.CheatsToolBarItem_Click); - // - // RamWatchToolbarItem - // - this.RamWatchToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.FindHS; - this.RamWatchToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.RamWatchToolbarItem.Name = "RamWatchToolbarItem"; - this.RamWatchToolbarItem.Size = new System.Drawing.Size(23, 20); - this.RamWatchToolbarItem.ToolTipText = "Ram Watch"; - this.RamWatchToolbarItem.Click += new System.EventHandler(this.RamWatchToolbarItem_Click); - // - // RamSearchToolbarItem - // - this.RamSearchToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.search; - this.RamSearchToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.RamSearchToolbarItem.Name = "RamSearchToolbarItem"; - this.RamSearchToolbarItem.Size = new System.Drawing.Size(23, 20); - this.RamSearchToolbarItem.ToolTipText = "Ram Search"; - this.RamSearchToolbarItem.Click += new System.EventHandler(this.RamSearchToolbarItem_Click); - // - // HexEditorToolbarItem - // - this.HexEditorToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.poke; - this.HexEditorToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.HexEditorToolbarItem.Name = "HexEditorToolbarItem"; - this.HexEditorToolbarItem.Size = new System.Drawing.Size(23, 20); - this.HexEditorToolbarItem.ToolTipText = "Hex Editor"; - this.HexEditorToolbarItem.Click += new System.EventHandler(this.HexEditorToolbarItem_Click); - // - // LuaConsoleToolbarItem - // - this.LuaConsoleToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.textdoc; - this.LuaConsoleToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.LuaConsoleToolbarItem.Name = "LuaConsoleToolbarItem"; - this.LuaConsoleToolbarItem.Size = new System.Drawing.Size(23, 20); - this.LuaConsoleToolbarItem.ToolTipText = "Lua Console"; - this.LuaConsoleToolbarItem.Click += new System.EventHandler(this.LuaConsoleToolbarItem_Click); - // - // TAStudioToolbarItem - // - this.TAStudioToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.TAStudio; - this.TAStudioToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.TAStudioToolbarItem.Name = "TAStudioToolbarItem"; - this.TAStudioToolbarItem.Size = new System.Drawing.Size(23, 20); - this.TAStudioToolbarItem.ToolTipText = "TAStudio"; - this.TAStudioToolbarItem.Click += new System.EventHandler(this.TAStudioToolbarItem_Click); - // - // VirtualpadToolbarItem - // - this.VirtualpadToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.GameController; - this.VirtualpadToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.VirtualpadToolbarItem.Name = "VirtualpadToolbarItem"; - this.VirtualpadToolbarItem.Size = new System.Drawing.Size(23, 20); - this.VirtualpadToolbarItem.ToolTipText = "Virtualpads"; - this.VirtualpadToolbarItem.Click += new System.EventHandler(this.VirtualpadToolbarItem_Click); - // - // NesPPUToolbarItem - // - this.NesPPUToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.NESControllerIcon; - this.NesPPUToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.NesPPUToolbarItem.Name = "NesPPUToolbarItem"; - this.NesPPUToolbarItem.Size = new System.Drawing.Size(49, 20); - this.NesPPUToolbarItem.Text = "PPU"; - this.NesPPUToolbarItem.ToolTipText = "Nes PPU Viewer"; - this.NesPPUToolbarItem.Click += new System.EventHandler(this.NesPPUToolbarItem_Click); - // - // NesNameTableToolbarItem - // - this.NesNameTableToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.NESControllerIcon; - this.NesNameTableToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.NesNameTableToolbarItem.Name = "NesNameTableToolbarItem"; - this.NesNameTableToolbarItem.Size = new System.Drawing.Size(40, 20); - this.NesNameTableToolbarItem.Text = "Nt"; - this.NesNameTableToolbarItem.ToolTipText = "Nes Nametable Viewer"; - this.NesNameTableToolbarItem.Click += new System.EventHandler(this.NesNameTableToolbarItem_Click); - // - // NesGameGenieToolbarItem - // - this.NesGameGenieToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.NESControllerIcon; - this.NesGameGenieToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.NesGameGenieToolbarItem.Name = "NesGameGenieToolbarItem"; - this.NesGameGenieToolbarItem.Size = new System.Drawing.Size(43, 20); - this.NesGameGenieToolbarItem.Text = "GG"; - this.NesGameGenieToolbarItem.ToolTipText = "NES Game Genie Encoder/Decoder"; - this.NesGameGenieToolbarItem.Click += new System.EventHandler(this.NesGameGenieToolbarItem_Click); - // - // TI83KeypadToolbarItem - // - this.TI83KeypadToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.calculator; - this.TI83KeypadToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.TI83KeypadToolbarItem.Name = "TI83KeypadToolbarItem"; - this.TI83KeypadToolbarItem.Size = new System.Drawing.Size(23, 20); - this.TI83KeypadToolbarItem.ToolTipText = "TI83 Keypad"; - this.TI83KeypadToolbarItem.Click += new System.EventHandler(this.TI83KeypadToolbarItem_Click); - // - // SNESGraphicsDebuggerToolbarItem - // - this.SNESGraphicsDebuggerToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SNESControllerIcon; - this.SNESGraphicsDebuggerToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.SNESGraphicsDebuggerToolbarItem.Name = "SNESGraphicsDebuggerToolbarItem"; - this.SNESGraphicsDebuggerToolbarItem.Size = new System.Drawing.Size(44, 20); - this.SNESGraphicsDebuggerToolbarItem.Text = "Gfx"; - this.SNESGraphicsDebuggerToolbarItem.ToolTipText = "SNES Gfx Debugger"; - this.SNESGraphicsDebuggerToolbarItem.Click += new System.EventHandler(this.SNESGraphicsDebuggerToolbarItem_Click); - // - // SNESGameGenieToolbarItem - // - this.SNESGameGenieToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SNESControllerIcon; - this.SNESGameGenieToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.SNESGameGenieToolbarItem.Name = "SNESGameGenieToolbarItem"; - this.SNESGameGenieToolbarItem.Size = new System.Drawing.Size(43, 20); - this.SNESGameGenieToolbarItem.Text = "GG"; - this.SNESGameGenieToolbarItem.ToolTipText = "SNES Game Genie Encoder/Decoder"; - this.SNESGameGenieToolbarItem.Click += new System.EventHandler(this.SNESGameGenieToolbarItem_Click); - // - // GGGameGenieToolbarItem - // - this.GGGameGenieToolbarItem.Image = ((System.Drawing.Image)(resources.GetObject("GGGameGenieToolbarItem.Image"))); - this.GGGameGenieToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.GGGameGenieToolbarItem.Name = "GGGameGenieToolbarItem"; - this.GGGameGenieToolbarItem.Size = new System.Drawing.Size(43, 20); - this.GGGameGenieToolbarItem.Text = "GG"; - this.GGGameGenieToolbarItem.ToolTipText = "Game Gear Game Genie Encoder/Decoder"; - this.GGGameGenieToolbarItem.Click += new System.EventHandler(this.GGGameGenieToolbarItem_Click); - // - // GbGpuViewerToolBarItem - // - this.GbGpuViewerToolBarItem.Image = ((System.Drawing.Image)(resources.GetObject("GbGpuViewerToolBarItem.Image"))); - this.GbGpuViewerToolBarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.GbGpuViewerToolBarItem.Name = "GbGpuViewerToolBarItem"; - this.GbGpuViewerToolBarItem.Size = new System.Drawing.Size(49, 20); - this.GbGpuViewerToolBarItem.Text = "Gpu"; - this.GbGpuViewerToolBarItem.ToolTipText = "Gameboy Game Genie Encoder/Decoder"; - this.GbGpuViewerToolBarItem.Click += new System.EventHandler(this.GbGpuViewerToolBarItem_Click); - // - // GBGameGenieToolbarItem - // - this.GBGameGenieToolbarItem.Image = ((System.Drawing.Image)(resources.GetObject("GBGameGenieToolbarItem.Image"))); - this.GBGameGenieToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.GBGameGenieToolbarItem.Name = "GBGameGenieToolbarItem"; - this.GBGameGenieToolbarItem.Size = new System.Drawing.Size(43, 20); - this.GBGameGenieToolbarItem.Text = "GG"; - this.GBGameGenieToolbarItem.ToolTipText = "Gameboy Game Genie Encoder/Decoder"; - this.GBGameGenieToolbarItem.Click += new System.EventHandler(this.GBGameGenieToolbarItem_Click); - // - // PceTileToolbarItem - // - this.PceTileToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.pcejin1; - this.PceTileToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.PceTileToolbarItem.Name = "PceTileToolbarItem"; - this.PceTileToolbarItem.Size = new System.Drawing.Size(46, 20); - this.PceTileToolbarItem.Text = "Tile"; - this.PceTileToolbarItem.ToolTipText = "PC Engine Tile Viewer"; - this.PceTileToolbarItem.Click += new System.EventHandler(this.PceTileToolbarItem_Click); - // - // PceCdlToolbarItem - // - this.PceCdlToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.pcejin1; - this.PceCdlToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.PceCdlToolbarItem.Name = "PceCdlToolbarItem"; - this.PceCdlToolbarItem.Size = new System.Drawing.Size(45, 20); - this.PceCdlToolbarItem.Text = "Cdl"; - this.PceCdlToolbarItem.ToolTipText = "PC Engine Code Data Logger"; - this.PceCdlToolbarItem.Click += new System.EventHandler(this.PceCdlToolbarItem_Click); - // - // PceBgViewerToolbarItem - // - this.PceBgViewerToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.pcejin1; - this.PceBgViewerToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.PceBgViewerToolbarItem.Name = "PceBgViewerToolbarItem"; - this.PceBgViewerToolbarItem.Size = new System.Drawing.Size(41, 20); - this.PceBgViewerToolbarItem.Text = "Bg"; - this.PceBgViewerToolbarItem.ToolTipText = "PC Engine Background Viewer"; - this.PceBgViewerToolbarItem.Click += new System.EventHandler(this.PceBgViewerToolbarItem_Click); - // - // PceSoundDebuggerButton - // - this.PceSoundDebuggerButton.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.pcejin1; - this.PceSoundDebuggerButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.PceSoundDebuggerButton.Name = "PceSoundDebuggerButton"; - this.PceSoundDebuggerButton.Size = new System.Drawing.Size(47, 20); - this.PceSoundDebuggerButton.Text = "Snd"; - this.PceSoundDebuggerButton.ToolTipText = "Sound Debugger"; - this.PceSoundDebuggerButton.Click += new System.EventHandler(this.PceSoundDebuggerButton_Click); - // - // GbaGpuViewerToolBarItem - // - this.GbaGpuViewerToolBarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.gba_icon; - this.GbaGpuViewerToolBarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.GbaGpuViewerToolBarItem.Name = "GbaGpuViewerToolBarItem"; - this.GbaGpuViewerToolBarItem.Size = new System.Drawing.Size(49, 20); - this.GbaGpuViewerToolBarItem.Text = "Gpu"; - this.GbaGpuViewerToolBarItem.ToolTipText = "Gameboy Advance Gpu Viewer"; - this.GbaGpuViewerToolBarItem.Click += new System.EventHandler(this.GbaGpuViewerToolBarItem_Click); - // - // GenesisVdpToolBarItem - // - this.GenesisVdpToolBarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.GenesisControllerIcon; - this.GenesisVdpToolBarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.GenesisVdpToolBarItem.Name = "GenesisVdpToolBarItem"; - this.GenesisVdpToolBarItem.Size = new System.Drawing.Size(49, 20); - this.GenesisVdpToolBarItem.Text = "VDP"; - this.GenesisVdpToolBarItem.ToolTipText = "Genesis VDP/Tile Viewer"; - this.GenesisVdpToolBarItem.Click += new System.EventHandler(this.GenesisVdpToolBarItem_Click); - // - // GenesisGameGenieToolBarItem - // - this.GenesisGameGenieToolBarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.GenesisControllerIcon; - this.GenesisGameGenieToolBarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.GenesisGameGenieToolBarItem.Name = "GenesisGameGenieToolBarItem"; - this.GenesisGameGenieToolBarItem.Size = new System.Drawing.Size(43, 20); - this.GenesisGameGenieToolBarItem.Text = "GG"; - this.GenesisGameGenieToolBarItem.ToolTipText = "Genesis Game Genie Encoder/Decoder"; - this.GenesisGameGenieToolBarItem.Click += new System.EventHandler(this.GenesisGameGenieToolBarItem_Click); - // - // SmsVdpToolbarItem - // - this.SmsVdpToolbarItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.sms_icon; - this.SmsVdpToolbarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.SmsVdpToolbarItem.Name = "SmsVdpToolbarItem"; - this.SmsVdpToolbarItem.Size = new System.Drawing.Size(49, 20); - this.SmsVdpToolbarItem.Text = "VDP"; - this.SmsVdpToolbarItem.ToolTipText = "SMS VDP Viewer"; - this.SmsVdpToolbarItem.Click += new System.EventHandler(this.SmsVdpToolbarItem_Click); - // // ToolBox // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -345,8 +63,6 @@ this.Name = "ToolBox"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Load += new System.EventHandler(this.ToolBox_Load); - this.ToolBoxStrip.ResumeLayout(false); - this.ToolBoxStrip.PerformLayout(); this.ResumeLayout(false); } @@ -354,30 +70,6 @@ #endregion private ToolStripEx ToolBoxStrip; - private System.Windows.Forms.ToolStripButton CheatsToolBarItem; - private System.Windows.Forms.ToolStripButton RamWatchToolbarItem; - private System.Windows.Forms.ToolStripButton RamSearchToolbarItem; - private System.Windows.Forms.ToolStripButton HexEditorToolbarItem; - private System.Windows.Forms.ToolStripButton LuaConsoleToolbarItem; - private System.Windows.Forms.ToolStripButton NesPPUToolbarItem; - private System.Windows.Forms.ToolStripButton NesGameGenieToolbarItem; - private System.Windows.Forms.ToolStripButton NesNameTableToolbarItem; - private System.Windows.Forms.ToolStripButton TI83KeypadToolbarItem; - private System.Windows.Forms.ToolStripButton VirtualpadToolbarItem; - private System.Windows.Forms.ToolStripButton SNESGraphicsDebuggerToolbarItem; - private System.Windows.Forms.ToolStripButton SNESGameGenieToolbarItem; - private System.Windows.Forms.ToolStripButton TAStudioToolbarItem; - private System.Windows.Forms.ToolStripButton GGGameGenieToolbarItem; - private System.Windows.Forms.ToolStripButton PceBgViewerToolbarItem; - private System.Windows.Forms.ToolStripButton GBGameGenieToolbarItem; - private System.Windows.Forms.ToolStripButton GbGpuViewerToolBarItem; - private System.Windows.Forms.ToolStripButton GbaGpuViewerToolBarItem; - private System.Windows.Forms.ToolStripButton GenesisGameGenieToolBarItem; - private System.Windows.Forms.ToolStripButton PceCdlToolbarItem; - private System.Windows.Forms.ToolStripButton SmsVdpToolbarItem; - private System.Windows.Forms.ToolStripButton PceTileToolbarItem; - private System.Windows.Forms.ToolStripButton GenesisVdpToolBarItem; - private System.Windows.Forms.ToolStripButton PceSoundDebuggerButton; } } \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/tools/ToolBox.cs b/BizHawk.Client.EmuHawk/tools/ToolBox.cs index 7cef40de47..1be1e0da42 100644 --- a/BizHawk.Client.EmuHawk/tools/ToolBox.cs +++ b/BizHawk.Client.EmuHawk/tools/ToolBox.cs @@ -14,6 +14,7 @@ using BizHawk.Emulation.Cores.PCEngine; using BizHawk.Emulation.Cores.Sega.MasterSystem; using BizHawk.Client.Common; +using System.Reflection; namespace BizHawk.Client.EmuHawk { @@ -30,12 +31,6 @@ namespace BizHawk.Client.EmuHawk GlobalWin.MainForm.Location.X + GlobalWin.MainForm.Size.Width, GlobalWin.MainForm.Location.Y ); - - SetTools(); - SetSize(); - - ToolBoxStrip.Select(); - ToolBoxItems.First().Select(); } public bool AskSaveChanges() { return true; } @@ -50,57 +45,51 @@ namespace BizHawk.Client.EmuHawk public void Restart() { SetTools(); + SetSize(); + + ToolBoxStrip.Select(); + ToolBoxItems.First().Select(); } private void SetTools() { - HexEditorToolbarItem.Visible = - RamWatchToolbarItem.Visible = - RamSearchToolbarItem.Visible = - CheatsToolBarItem.Visible = - Global.Emulator.HasMemoryDomains(); - - NesPPUToolbarItem.Visible = - NesNameTableToolbarItem.Visible = - Global.Emulator is NES; - - NesGameGenieToolbarItem.Visible = Global.Emulator.SystemId == "NES"; - - TI83KeypadToolbarItem.Visible = Global.Emulator is TI83; - - SNESGraphicsDebuggerToolbarItem.Visible = - SNESGameGenieToolbarItem.Visible = - Global.Emulator is LibsnesCore; - - GGGameGenieToolbarItem.Visible = - Global.Game.System == "GG"; - - PceCdlToolbarItem.Visible = - PceBgViewerToolbarItem.Visible = - PceTileToolbarItem.Visible = - PceSoundDebuggerButton.Visible = - Global.Emulator is PCEngine; - - GBGameGenieToolbarItem.Visible = - GbGpuViewerToolBarItem.Visible = - Global.Game.System == "GB"; - - GbaGpuViewerToolBarItem.Visible = Global.Emulator is GBA; - - GenesisGameGenieToolBarItem.Visible = Global.Emulator.SystemId == "GEN" && VersionInfo.DeveloperBuild; - GenesisVdpToolBarItem.Visible = Global.Emulator is GPGX; - - SmsVdpToolbarItem.Visible = Global.Emulator is SMS; - - TAStudioToolbarItem.Visible = Global.Emulator.HasSavestates() && Global.Emulator.CanPollInput(); - - foreach (var button in ToolBoxItems) - { - if (button.Visible) + var availableTools = Assembly + .GetAssembly(typeof(IToolForm)) + .GetTypes() + .Where(t => typeof(IToolForm).IsAssignableFrom(t)) + .Where(t => typeof(Form).IsAssignableFrom(t)) + .Where(t => !(typeof(ToolBox).IsAssignableFrom(t))) + .Where(t => VersionInfo.DeveloperBuild ? true : !(t.GetCustomAttributes(false) + .OfType().Any(a => !a.Released))) + .Where(t => !(t == typeof(GBGameGenie))) // Hack, this tool is specific to a system id and a sub-system (gb and gg) we have no reasonable way to declare a dependency like that + .Where(t => GlobalWin.Tools.IsAvailable(t)) + .Select(t => Activator.CreateInstance(t)) + .Select(instance => new { - var toolBtn = button as ToolStripButton; - toolBtn.Click += (o, e) => Close(); - } + Type = instance.GetType(), + Instance = instance, + Icon = (instance as Form).Icon.ToBitmap(), + Text = (instance as Form).Text, + ShowIcon = (instance as Form).ShowIcon + }) + .ToList(); + + foreach (var tool in availableTools) + { + var t = new ToolStripButton + { + Image = tool.Icon, + Text = tool.Text, + DisplayStyle = tool.ShowIcon ? ToolStripItemDisplayStyle.Image : ToolStripItemDisplayStyle.Text + }; + + t.Click += (o, e) => + { + GlobalWin.Tools.Load(tool.Type); + Close(); + }; + + ToolBoxStrip.Items.Add(t); } } @@ -115,7 +104,7 @@ namespace BizHawk.Client.EmuHawk { get { - return ToolBoxStrip.Items.Cast().Where(x => x.Visible); + return ToolBoxStrip.Items.Cast(); } } @@ -131,129 +120,5 @@ namespace BizHawk.Client.EmuHawk return base.ProcessCmdKey(ref msg, keyData); } } - - #region Icon Clicks - - private void CheatsToolBarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.Load(); - } - - private void RamWatchToolbarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.LoadRamWatch(true); - } - - private void RamSearchToolbarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.Load(); - } - - private void HexEditorToolbarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.Load(); - } - - private void LuaConsoleToolbarItem_Click(object sender, EventArgs e) - { - GlobalWin.MainForm.OpenLuaConsole(); - } - - private void NesPPUToolbarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.Load(); - } - - private void NesGameGenieToolbarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.LoadGameGenieEc(); - } - - private void NesNameTableToolbarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.Load(); - } - - private void TI83KeypadToolbarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.Load(); - } - - private void TAStudioToolbarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.Load(); - } - - private void SNESGraphicsDebuggerToolbarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.Load(); - } - - private void VirtualpadToolbarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.Load(); - } - - private void SNESGameGenieToolbarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.LoadGameGenieEc(); - } - - private void GGGameGenieToolbarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.LoadGameGenieEc(); - } - - private void GBGameGenieToolbarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.LoadGameGenieEc(); - } - - private void GbGpuViewerToolBarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.Load(); - } - - private void PceCdlToolbarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.Load(); - } - - private void PceBgViewerToolbarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.Load(); - } - - private void PceSoundDebuggerButton_Click(object sender, EventArgs e) - { - GlobalWin.Tools.Load(); - } - - private void GbaGpuViewerToolBarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.Load(); - } - - private void GenesisGameGenieToolBarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.Load(); - } - - private void SmsVdpToolbarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.Load(); - } - - private void PceTileToolbarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.Load(); - } - - private void GenesisVdpToolBarItem_Click(object sender, EventArgs e) - { - GlobalWin.Tools.Load(); - } - - #endregion } } diff --git a/BizHawk.Client.EmuHawk/tools/ToolBox.resx b/BizHawk.Client.EmuHawk/tools/ToolBox.resx index a0bdbfd8e6..7295c6fd33 100644 --- a/BizHawk.Client.EmuHawk/tools/ToolBox.resx +++ b/BizHawk.Client.EmuHawk/tools/ToolBox.resx @@ -121,44 +121,6 @@ 17, 17 - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJTSURBVFhH7VQ9a1RBFB1YMIXY6uIPSAo7LbJpAhEhYKNg - OiHb5AsJCNbaiGgVCwnYpJAUKrHafokJhGhIJBKChDRaWaSKGwyBQK73zNszue+9eRujbPcuHO7MnXvP - ObPzWFdGGWVEQrqMwvANy6sbXQV1IGgjNEw8fJzC5erV/wJ57t0f98gYCREVr1arol3i9vqkty5RgbNw - ozaYMkBAM5FOovD2o5OPPEj2LzjLQFQcwDBv8l0kikYrAX4lN9MjrnnFr2EavMjggujIM4ma6GgA0K6o - KPBUCxD2uW0Ca8y5ej38AhDHM2JfaACH9t1Ym+lxKVHXL54QQl5Yb43cbCqhMQAuywNAGPucATbYt0Yj - 98oZbgxxaTWCAQIGuCYXxZhRYz1lgAe2iXWQURyQAR3UX4F7osgA+eyFwJ0ygCKHuLYGrND+8W/ZUR+f - FSOtI3G718StVJInwEeoIFdW9MmLWZ9zT4BGDrH5zbtG2IevXPPa8S+5vaBmFkWuH4pM/5iSW19fJeeA - MQBBK8rnAHfOAIA1xVnzBto3O3nr5MPJvjyYWxI3+14uHR3K6M5dubk3L/LT+XNkzECYolYcSBnAxjoj - rAFLfvHbkLhtHd5w8nxL86Ji4fQcGTPkteLWRM5ATBwAWa1WCxj7eEEOPlXkYLONL4r1SqrHGiAP16zn - DLABwzYDQ8N3PF6+nvcZ/3BYM/OcsJyWG8gaQISmrLg1gY/qb3BecUSqOSYO8APthE7itgbNRPo0fNE2 - WXFLks3nAXUgWBS2qRsoo4wyTDj3B3uOB2ePDD1gAAAAAElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEQSURBVFhH7ZXRDYMwDEQzC7OwArMwS2dhBXZKdQ4XOZAQ - UMDpR096KgTse1/U/Xr8BsJfs/hpmgRcz/NMGRMRvyxLFCCQsBKRIkj0EoklvURk8TAMsQSciWAmjD6T - KECuiGBuozlRwK0f4YqIvP+GwMevVRGeYzasaMtBgJREzARyIl0EyF/ARADJlYPXBQhjKrCXAIyZQE0E - 1yYChEUafY7ZsKItSSG+87zX50TfY3b7Y2pKsjQnQEoCJKy7n6SgJgFKAiSsvZ5kMRboMg2fnwmElfeS - LdOwmJQEwrr7kUW5Qt6zQD/fC8imxlRF9LkWkOkHcxDZg/JxHOU9mXgpRRGLcp1ExLpch8Vdyh+Ic19s - EmBku+z2SQAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEQSURBVFhH7ZXRDYMwDEQzC7OwArMwS2dhBXZKdQ4XOZAQ - UMDpR096KgTse1/U/Xr8BsJfs/hpmgRcz/NMGRMRvyxLFCCQsBKRIkj0EoklvURk8TAMsQSciWAmjD6T - KECuiGBuozlRwK0f4YqIvP+GwMevVRGeYzasaMtBgJREzARyIl0EyF/ARADJlYPXBQhjKrCXAIyZQE0E - 1yYChEUafY7ZsKItSSG+87zX50TfY3b7Y2pKsjQnQEoCJKy7n6SgJgFKAiSsvZ5kMRboMg2fnwmElfeS - LdOwmJQEwrr7kUW5Qt6zQD/fC8imxlRF9LkWkOkHcxDZg/JxHOU9mXgpRRGLcp1ExLpch8Vdyh+Ic19s - EmBku+z2SQAAAABJRU5ErkJggg== - - AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAABMLAAATCwAAAAAAAAAA