Use a single-source-of-truth for tools' icons in menus and Tool Box

reverts 733b6c49b
some more `[SpecializedTool]`s have icons now
This commit is contained in:
YoshiRulz 2023-02-08 07:06:58 +10:00
parent 0d02d5c498
commit 8b7cba96bb
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
32 changed files with 244 additions and 76 deletions

View File

@ -102,6 +102,9 @@ namespace BizHawk.Client.EmuHawk
} }
} }
public static Icon ToolIcon
=> Properties.Resources.Logo;
[ConfigPersist] [ConfigPersist]
private Dictionary<string, CoreInfo> KnownCores { get; set; } private Dictionary<string, CoreInfo> KnownCores { get; set; }
@ -114,7 +117,7 @@ namespace BizHawk.Client.EmuHawk
public CoreFeatureAnalysis() public CoreFeatureAnalysis()
{ {
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.Logo; Icon = ToolIcon;
KnownCores = new Dictionary<string, CoreInfo>(); KnownCores = new Dictionary<string, CoreInfo>();
} }

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
@ -15,6 +16,9 @@ namespace BizHawk.Client.EmuHawk
{ {
public partial class LogWindow : ToolFormBase, IToolFormAutoConfig public partial class LogWindow : ToolFormBase, IToolFormAutoConfig
{ {
public static Icon ToolIcon
=> Properties.Resources.CommandWindow;
// TODO: only show add to game db when this is a Rom details dialog // TODO: only show add to game db when this is a Rom details dialog
// Let user decide what type (instead of always adding it as a good dump) // Let user decide what type (instead of always adding it as a good dump)
private readonly List<string> _lines = new List<string>(); private readonly List<string> _lines = new List<string>();
@ -32,7 +36,7 @@ namespace BizHawk.Client.EmuHawk
public LogWindow() public LogWindow()
{ {
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.CommandWindow; Icon = ToolIcon;
AddToGameDbBtn.Image = Properties.Resources.Add; AddToGameDbBtn.Image = Properties.Resources.Add;
Closing += (o, e) => Closing += (o, e) =>
{ {

View File

@ -261,34 +261,51 @@ namespace BizHawk.Client.EmuHawk
ProfilesMenuItem.Image = Properties.Resources.Profile; ProfilesMenuItem.Image = Properties.Resources.Profile;
SaveConfigMenuItem.Image = Properties.Resources.Save; SaveConfigMenuItem.Image = Properties.Resources.Save;
LoadConfigMenuItem.Image = Properties.Resources.LoadConfig; LoadConfigMenuItem.Image = Properties.Resources.LoadConfig;
ToolBoxMenuItem.Image = Properties.Resources.ToolBox; (ToolBoxMenuItem.Image, /*ToolBoxMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(ToolBox)]
RamWatchMenuItem.Image = Properties.Resources.Watch; = (/*ToolBox.ToolIcon.ToBitmap()*/Properties.Resources.ToolBox, "Tool Box");
RamSearchMenuItem.Image = Properties.Resources.Search; (RamWatchMenuItem.Image, /*RamWatchMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(RamWatch)]
LuaConsoleMenuItem.Image = Properties.Resources.TextDoc; = (/*RamWatch.ToolIcon.ToBitmap()*/Properties.Resources.Watch, "RAM Watch");
TAStudioMenuItem.Image = Properties.Resources.TAStudio; (RamSearchMenuItem.Image, /*RamSearchMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(RamSearch)]
HexEditorMenuItem.Image = Properties.Resources.Poke; = (/*RamSearch.ToolIcon.ToBitmap()*/Properties.Resources.Search, "RAM Search");
TraceLoggerMenuItem.Image = Properties.Resources.Pencil; (LuaConsoleMenuItem.Image, /*LuaConsoleMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(LuaConsole)]
DebuggerMenuItem.Image = Properties.Resources.Bug; = (/*LuaConsole.ToolIcon.ToBitmap()*/Properties.Resources.TextDoc, "Lua Console");
CodeDataLoggerMenuItem.Image = Properties.Resources.CdLogger; (TAStudioMenuItem.Image, /*TAStudioMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(TAStudio)]
VirtualPadMenuItem.Image = Properties.Resources.GameController; = (/*TAStudio.ToolIcon.ToBitmap()*/Properties.Resources.TAStudio, "TAStudio");
BasicBotMenuItem.Image = Properties.Resources.BasicBotBit; (HexEditorMenuItem.Image, /*HexEditorMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(HexEditor)]
CheatsMenuItem.Image = Properties.Resources.Freeze; = (/*HexEditor.ToolIcon.ToBitmap()*/Properties.Resources.Poke, "Hex Editor");
GameSharkConverterMenuItem.Image = Properties.Resources.Shark; (TraceLoggerMenuItem.Image, /*TraceLoggerMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(TraceLogger)]
MultiDiskBundlerFileMenuItem.Image = Properties.Resources.SaveConfig; = (/*TraceLogger.ToolIcon.ToBitmap()*/Properties.Resources.Pencil, "Trace Logger");
(DebuggerMenuItem.Image, /*DebuggerMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(GenericDebugger)]
= (/*GenericDebugger.ToolIcon.ToBitmap()*/Properties.Resources.Bug, "Debugger");
(CodeDataLoggerMenuItem.Image, /*CodeDataLoggerMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(CDL)]
= (/*CDL.ToolIcon.ToBitmap()*/Properties.Resources.CdLogger, "Code Data Logger");
(VirtualPadMenuItem.Image, /*VirtualPadMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(VirtualpadTool)]
= (/*VirtualpadTool.ToolIcon.ToBitmap()*/Properties.Resources.GameController, "Virtual Pads");
(BasicBotMenuItem.Image, /*BasicBotMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(BasicBot)]
= (/*BasicBot.ToolIcon.ToBitmap()*/Properties.Resources.BasicBotBit, "Basic Bot");
(CheatsMenuItem.Image, /*CheatsMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(Cheats)]
= (/*Cheats.ToolIcon.ToBitmap()*/Properties.Resources.Freeze, "Cheats");
(GameSharkConverterMenuItem.Image, /*GameSharkConverterMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(GameShark)]
= (/*GameShark.ToolIcon.ToBitmap()*/Properties.Resources.Shark, "Cheat Code Converter");
(MultiDiskBundlerFileMenuItem.Image, /*MultiDiskBundlerFileMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(MultiDiskBundler)]
= (/*MultiDiskBundler.ToolIcon.ToBitmap()*/Properties.Resources.SaveConfig, "Multi-disk Bundler");
NesControllerSettingsMenuItem.Image = Properties.Resources.GameController; NesControllerSettingsMenuItem.Image = Properties.Resources.GameController;
NESGraphicSettingsMenuItem.Image = Properties.Resources.TvIcon; NESGraphicSettingsMenuItem.Image = Properties.Resources.TvIcon;
NESSoundChannelsMenuItem.Image = Properties.Resources.Audio; NESSoundChannelsMenuItem.Image = Properties.Resources.Audio;
KeypadMenuItem.Image = Properties.Resources.Calculator; (KeypadMenuItem.Image, /*KeypadMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(TI83KeyPad)]
= (/*TI83KeyPad.ToolIcon.ToBitmap()*/Properties.Resources.Calculator, "TI-83 Virtual KeyPad");
PSXControllerSettingsMenuItem.Image = Properties.Resources.GameController; PSXControllerSettingsMenuItem.Image = Properties.Resources.GameController;
SNESControllerConfigurationMenuItem.Image = Properties.Resources.GameController; SNESControllerConfigurationMenuItem.Image = Properties.Resources.GameController;
SnesGfxDebuggerMenuItem.Image = Properties.Resources.Bug; (SnesGfxDebuggerMenuItem.Image, /*SnesGfxDebuggerMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(SNESGraphicsDebugger)]
= (/*SNESGraphicsDebugger.ToolIcon.ToBitmap()*/Properties.Resources.Bug, "Graphics Debugger");
ColecoControllerSettingsMenuItem.Image = Properties.Resources.GameController; ColecoControllerSettingsMenuItem.Image = Properties.Resources.GameController;
N64PluginSettingsMenuItem.Image = Properties.Resources.Monitor; N64PluginSettingsMenuItem.Image = Properties.Resources.Monitor;
N64ControllerSettingsMenuItem.Image = Properties.Resources.GameController; N64ControllerSettingsMenuItem.Image = Properties.Resources.GameController;
IntVControllerSettingsMenuItem.Image = Properties.Resources.GameController; IntVControllerSettingsMenuItem.Image = Properties.Resources.GameController;
OnlineHelpMenuItem.Image = Properties.Resources.Help; OnlineHelpMenuItem.Image = Properties.Resources.Help;
ForumsMenuItem.Image = Properties.Resources.TAStudio; ForumsMenuItem.Image = Properties.Resources.TAStudio;
FeaturesMenuItem.Image = Properties.Resources.KitchenSink; (FeaturesMenuItem.Image, /*FeaturesMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(CoreFeatureAnalysis)]
= (/*CoreFeatureAnalysis.ToolIcon.ToBitmap()*/Properties.Resources.KitchenSink, "Core Features");
AboutMenuItem.Image = Properties.Resources.CorpHawkSmall; AboutMenuItem.Image = Properties.Resources.CorpHawkSmall;
DumpStatusButton.Image = Properties.Resources.Blank; DumpStatusButton.Image = Properties.Resources.Blank;
PlayRecordStatusButton.Image = Properties.Resources.Blank; PlayRecordStatusButton.Image = Properties.Resources.Blank;
@ -2147,10 +2164,8 @@ namespace BizHawk.Client.EmuHawk
GenericCoreSubMenu.DropDownItems.Add(new ToolStripSeparator()); GenericCoreSubMenu.DropDownItems.Add(new ToolStripSeparator());
foreach (var toolType in specializedTools) foreach (var toolType in specializedTools)
{ {
ToolStripMenuItem item = new() var (icon, name) = Tools.GetIconAndNameFor(toolType);
{ ToolStripMenuItem item = new() { Image = icon, Text = $"&{name}" };
Text = $"&{toolType.GetCustomAttribute<SpecializedToolAttribute>().DisplayName}",
};
item.Click += (_, _) => Tools.Load(toolType); item.Click += (_, _) => Tools.Load(toolType);
GenericCoreSubMenu.DropDownItems.Add(item); GenericCoreSubMenu.DropDownItems.Add(item);
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -19,6 +19,9 @@ namespace BizHawk.Client.EmuHawk
{ {
private static readonly FilesystemFilterSet BotFilesFSFilterSet = new(new FilesystemFilter("Bot files", new[] { "bot" })); private static readonly FilesystemFilterSet BotFilesFSFilterSet = new(new FilesystemFilter("Bot files", new[] { "bot" }));
public static Icon ToolIcon
=> Resources.BasicBot;
private string _currentFileName = ""; private string _currentFileName = "";
private string CurrentFileName private string CurrentFileName
@ -91,7 +94,7 @@ namespace BizHawk.Client.EmuHawk
public BasicBot() public BasicBot()
{ {
InitializeComponent(); InitializeComponent();
Icon = Resources.BasicBot; Icon = ToolIcon;
NewMenuItem.Image = Resources.NewFile; NewMenuItem.Image = Resources.NewFile;
OpenMenuItem.Image = Resources.OpenFile; OpenMenuItem.Image = Resources.OpenFile;
SaveMenuItem.Image = Resources.SaveAs; SaveMenuItem.Image = Resources.SaveAs;

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
@ -22,6 +23,9 @@ namespace BizHawk.Client.EmuHawk
{ {
private static readonly FilesystemFilterSet CDLFilesFSFilterSet = new(new FilesystemFilter("Code Data Logger Files", new[] { "cdl" })); private static readonly FilesystemFilterSet CDLFilesFSFilterSet = new(new FilesystemFilter("Code Data Logger Files", new[] { "cdl" }));
public static Icon ToolIcon
=> Resources.CdLoggerIcon;
private RecentFiles _recentFld = new RecentFiles(); private RecentFiles _recentFld = new RecentFiles();
[ConfigPersist] [ConfigPersist]
@ -75,7 +79,7 @@ namespace BizHawk.Client.EmuHawk
tsbLoggingActive.Image = Resources.Placeholder; tsbLoggingActive.Image = Resources.Placeholder;
tsbViewUpdate.Image = Resources.Placeholder; tsbViewUpdate.Image = Resources.Placeholder;
tsbExportText.Image = Resources.LoadConfig; tsbExportText.Image = Resources.LoadConfig;
Icon = Resources.CdLoggerIcon; Icon = ToolIcon;
tsbViewStyle.SelectedIndex = 0; tsbViewStyle.SelectedIndex = 0;

View File

@ -29,6 +29,9 @@ namespace BizHawk.Client.EmuHawk
private static readonly FilesystemFilterSet CheatsFSFilterSet = new(new FilesystemFilter("Cheat Files", new[] { "cht" })); private static readonly FilesystemFilterSet CheatsFSFilterSet = new(new FilesystemFilter("Cheat Files", new[] { "cht" }));
public static Icon ToolIcon
=> Resources.FreezeIcon;
private string _sortedColumn; private string _sortedColumn;
private bool _sortReverse; private bool _sortReverse;
@ -37,7 +40,7 @@ namespace BizHawk.Client.EmuHawk
public Cheats() public Cheats()
{ {
InitializeComponent(); InitializeComponent();
Icon = Resources.FreezeIcon; Icon = ToolIcon;
ToggleContextMenuItem.Image = Resources.Refresh; ToggleContextMenuItem.Image = Resources.Refresh;
RemoveContextMenuItem.Image = Resources.Delete; RemoveContextMenuItem.Image = Resources.Delete;
DisableAllContextMenuItem.Image = Resources.Stop; DisableAllContextMenuItem.Image = Resources.Stop;

View File

@ -14,12 +14,15 @@ namespace BizHawk.Client.EmuHawk
private const string AddressColumnName = "Address"; private const string AddressColumnName = "Address";
private const string InstructionColumnName = "Instruction"; private const string InstructionColumnName = "Instruction";
public static Icon ToolIcon
=> Properties.Resources.BugIcon;
protected override string WindowTitleStatic => "Debugger"; protected override string WindowTitleStatic => "Debugger";
public GenericDebugger() public GenericDebugger()
{ {
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.BugIcon; Icon = ToolIcon;
Closing += (o, e) => DisengageDebugger(); Closing += (o, e) => DisengageDebugger();
DisassemblerView.QueryItemText += DisassemblerView_QueryItemText; DisassemblerView.QueryItemText += DisassemblerView_QueryItemText;

View File

@ -13,6 +13,9 @@ namespace BizHawk.Client.EmuHawk
{ {
public partial class GbGpuView : ToolFormBase, IToolFormAutoConfig public partial class GbGpuView : ToolFormBase, IToolFormAutoConfig
{ {
public static Icon ToolIcon
=> Properties.Resources.GambatteIcon;
[RequiredService] [RequiredService]
public IGameboyCommon Gb { get; private set; } public IGameboyCommon Gb { get; private set; }
@ -69,7 +72,7 @@ namespace BizHawk.Client.EmuHawk
public GbGpuView() public GbGpuView()
{ {
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.GambatteIcon; Icon = ToolIcon;
bmpViewBG.ChangeBitmapSize(256, 256); bmpViewBG.ChangeBitmapSize(256, 256);
bmpViewWin.ChangeBitmapSize(256, 256); bmpViewWin.ChangeBitmapSize(256, 256);
bmpViewTiles1.ChangeBitmapSize(128, 192); bmpViewTiles1.ChangeBitmapSize(128, 192);

View File

@ -16,6 +16,9 @@ namespace BizHawk.Client.EmuHawk
// the bg color // the bg color
private static readonly uint PaperColor = (uint)Color.AntiqueWhite.ToArgb(); private static readonly uint PaperColor = (uint)Color.AntiqueWhite.ToArgb();
public static Icon ToolIcon
=> Properties.Resources.GambatteIcon;
private readonly ColorMatrix _paperAdjustment; private readonly ColorMatrix _paperAdjustment;
[RequiredService] [RequiredService]
@ -35,7 +38,7 @@ namespace BizHawk.Client.EmuHawk
public GBPrinterView() public GBPrinterView()
{ {
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.GambatteIcon; Icon = ToolIcon;
// adjust the color of the printed output to be more papery // adjust the color of the printed output to be more papery
_paperAdjustment = new ColorMatrix _paperAdjustment = new ColorMatrix

View File

@ -14,6 +14,9 @@ namespace BizHawk.Client.EmuHawk
[SpecializedTool("GPU Viewer")] [SpecializedTool("GPU Viewer")]
public partial class GbaGpuView : ToolFormBase, IToolFormAutoConfig public partial class GbaGpuView : ToolFormBase, IToolFormAutoConfig
{ {
public static Icon ToolIcon
=> Properties.Resources.GbaIcon.Value;
[RequiredService] [RequiredService]
private IGBAGPUViewable GBA { get; set; } private IGBAGPUViewable GBA { get; set; }
@ -34,7 +37,7 @@ namespace BizHawk.Client.EmuHawk
public GbaGpuView() public GbaGpuView()
{ {
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.GbaIcon.Value; Icon = ToolIcon;
// TODO: hook up something // TODO: hook up something
// we do this twice to avoid having to & 0x7fff with every color // we do this twice to avoid having to & 0x7fff with every color
int[] tmp = GBColors.GetLut(GBColors.ColorType.vivid); int[] tmp = GBColors.GetLut(GBColors.ColorType.vivid);

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Drawing;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
using BizHawk.Client.Common; using BizHawk.Client.Common;
@ -18,6 +19,9 @@ namespace BizHawk.Client.EmuHawk
unsupportedCores: new[] { CoreNames.Snes9X })] unsupportedCores: new[] { CoreNames.Snes9X })]
public partial class GameShark : ToolFormBase, IToolFormAutoConfig public partial class GameShark : ToolFormBase, IToolFormAutoConfig
{ {
public static Icon ToolIcon
=> Properties.Resources.SharkIcon;
[RequiredService] [RequiredService]
// ReSharper disable once UnusedAutoPropertyAccessor.Local // ReSharper disable once UnusedAutoPropertyAccessor.Local
private IMemoryDomains MemoryDomains { get; set; } private IMemoryDomains MemoryDomains { get; set; }
@ -31,7 +35,7 @@ namespace BizHawk.Client.EmuHawk
public GameShark() public GameShark()
{ {
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.SharkIcon; Icon = ToolIcon;
} }
private void Go_Click(object sender, EventArgs e) private void Go_Click(object sender, EventArgs e)

View File

@ -53,6 +53,9 @@ namespace BizHawk.Client.EmuHawk
private static readonly FilesystemFilterSet TextTablesFSFilterSet = new(new FilesystemFilter("Text Table Files", new[] { "tbl" })); private static readonly FilesystemFilterSet TextTablesFSFilterSet = new(new FilesystemFilter("Text Table Files", new[] { "tbl" }));
public static Icon ToolIcon
=> Resources.PokeIcon;
private static FilesystemFilterSet CreateBinaryDumpFSFilterSet(string ext) private static FilesystemFilterSet CreateBinaryDumpFSFilterSet(string ext)
=> new(new FilesystemFilter("Binary", new[] { ext })); => new(new FilesystemFilter("Binary", new[] { ext }));
@ -148,7 +151,7 @@ namespace BizHawk.Client.EmuHawk
if (OSTailoredCode.IsUnixHost) _fontHeight -= MAGIC_FIX_NUMBER_H; if (OSTailoredCode.IsUnixHost) _fontHeight -= MAGIC_FIX_NUMBER_H;
InitializeComponent(); InitializeComponent();
Icon = Resources.PokeIcon; Icon = ToolIcon;
SaveMenuItem.Image = Resources.SaveAs; SaveMenuItem.Image = Resources.SaveAs;
CopyMenuItem.Image = Resources.Duplicate; CopyMenuItem.Image = Resources.Duplicate;
PasteMenuItem.Image = Resources.Paste; PasteMenuItem.Image = Resources.Paste;

View File

@ -30,6 +30,9 @@ namespace BizHawk.Client.EmuHawk
private static readonly FilesystemFilterSet SessionsFSFilterSet = new FilesystemFilterSet(new FilesystemFilter("Lua Session Files", new[] { "luases" })); private static readonly FilesystemFilterSet SessionsFSFilterSet = new FilesystemFilterSet(new FilesystemFilter("Lua Session Files", new[] { "luases" }));
public static Icon ToolIcon
=> Resources.TextDocIcon;
private readonly LuaAutocompleteInstaller _luaAutoInstaller = new LuaAutocompleteInstaller(); private readonly LuaAutocompleteInstaller _luaAutoInstaller = new LuaAutocompleteInstaller();
private readonly Dictionary<LuaFile, FileSystemWatcher> _watches = new(); private readonly Dictionary<LuaFile, FileSystemWatcher> _watches = new();
@ -117,7 +120,7 @@ namespace BizHawk.Client.EmuHawk
InsertSeparatorToolbarItem.Image = Resources.InsertSeparator; InsertSeparatorToolbarItem.Image = Resources.InsertSeparator;
EraseToolbarItem.Image = Resources.Erase; EraseToolbarItem.Image = Resources.Erase;
RecentScriptsSubMenu.Image = Resources.Recent; RecentScriptsSubMenu.Image = Resources.Recent;
Icon = Resources.TextDocIcon; Icon = ToolIcon;
Closing += (o, e) => Closing += (o, e) =>
{ {

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using System.IO; using System.IO;
@ -17,6 +18,9 @@ namespace BizHawk.Client.EmuHawk
public static readonly FilesystemFilterSet MacrosFSFilterSet = new FilesystemFilterSet(new FilesystemFilter("Movie Macros", new[] { "bk2m" })); public static readonly FilesystemFilterSet MacrosFSFilterSet = new FilesystemFilterSet(new FilesystemFilter("Movie Macros", new[] { "bk2m" }));
public static Icon ToolIcon
=> Properties.Resources.TAStudioIcon;
private readonly List<MovieZone> _zones = new List<MovieZone>(); private readonly List<MovieZone> _zones = new List<MovieZone>();
private readonly List<int> _unsavedZones = new List<int>(); private readonly List<int> _unsavedZones = new List<int>();
private bool _selecting; private bool _selecting;
@ -34,7 +38,7 @@ namespace BizHawk.Client.EmuHawk
{ {
_initializing = true; _initializing = true;
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.TAStudioIcon; Icon = ToolIcon;
} }
private void MacroInputTool_Load(object sender, EventArgs e) private void MacroInputTool_Load(object sender, EventArgs e)

View File

@ -20,6 +20,9 @@ namespace BizHawk.Client.EmuHawk
{ {
private static readonly FilesystemFilterSet BundlesFSFilterSet = new(new FilesystemFilter("XML Files", new[] { "xml" })); private static readonly FilesystemFilterSet BundlesFSFilterSet = new(new FilesystemFilter("XML Files", new[] { "xml" }));
public static Icon ToolIcon
=> Properties.Resources.DualIcon;
private XElement _currentXml; private XElement _currentXml;
[RequiredService] [RequiredService]
@ -30,7 +33,7 @@ namespace BizHawk.Client.EmuHawk
public MultiDiskBundler() public MultiDiskBundler()
{ {
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.DualIcon; Icon = ToolIcon;
SystemDropDown.Items.AddRange(new[] SystemDropDown.Items.AddRange(new[]
{ {
VSystemID.Raw.AmstradCPC, VSystemID.Raw.AmstradCPC,

View File

@ -1,4 +1,6 @@
using System; using System;
using System.Drawing;
using BizHawk.Client.Common; using BizHawk.Client.Common;
using BizHawk.Emulation.Cores.Nintendo.NES; using BizHawk.Emulation.Cores.Nintendo.NES;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
@ -7,6 +9,9 @@ namespace BizHawk.Client.EmuHawk
{ {
public partial class BarcodeEntry : ToolFormBase public partial class BarcodeEntry : ToolFormBase
{ {
public static Icon ToolIcon
=> Properties.Resources.NesControllerIcon;
[RequiredService] [RequiredService]
private DatachBarcode Reader { get; set; } private DatachBarcode Reader { get; set; }
@ -15,7 +20,7 @@ namespace BizHawk.Client.EmuHawk
public BarcodeEntry() public BarcodeEntry()
{ {
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.NesControllerIcon; Icon = ToolIcon;
} }
public override void Restart() public override void Restart()

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Linq; using System.Linq;
@ -22,6 +23,9 @@ namespace BizHawk.Client.EmuHawk
AppendAllFilesEntry = false, AppendAllFilesEntry = false,
}; };
public static Icon ToolIcon
=> Properties.Resources.NesControllerIcon;
[RequiredService] [RequiredService]
private NES Nes { get; set; } private NES Nes { get; set; }
@ -30,7 +34,7 @@ namespace BizHawk.Client.EmuHawk
public NESMusicRipper() public NESMusicRipper()
{ {
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.NesControllerIcon; Icon = ToolIcon;
SyncContents(); SyncContents();
} }

View File

@ -13,6 +13,10 @@ namespace BizHawk.Client.EmuHawk
{ {
// TODO: // TODO:
// Show Scroll Lines + UI Toggle // Show Scroll Lines + UI Toggle
public static Icon ToolIcon
=> Properties.Resources.NesControllerIcon;
[RequiredService] [RequiredService]
private INESPPUViewable _ppu { get; set; } private INESPPUViewable _ppu { get; set; }
[RequiredService] [RequiredService]
@ -32,7 +36,7 @@ namespace BizHawk.Client.EmuHawk
public NESNameTableViewer() public NESNameTableViewer()
{ {
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.NesControllerIcon; Icon = ToolIcon;
} }
private void NESNameTableViewer_Load(object sender, EventArgs e) private void NESNameTableViewer_Load(object sender, EventArgs e)

View File

@ -16,6 +16,10 @@ namespace BizHawk.Client.EmuHawk
// Speedups // Speedups
// Smarter refreshing? only refresh when things of changed, perhaps peek at the ppu to when the pattern table has changed, or sprites have moved // Smarter refreshing? only refresh when things of changed, perhaps peek at the ppu to when the pattern table has changed, or sprites have moved
// Maybe 48 individual bitmaps for sprites is faster than the overhead of redrawing all that transparent space // Maybe 48 individual bitmaps for sprites is faster than the overhead of redrawing all that transparent space
public static Icon ToolIcon
=> Properties.Resources.NesControllerIcon;
private readonly byte[] _ppuBusPrev = new byte[0x3000]; private readonly byte[] _ppuBusPrev = new byte[0x3000];
private readonly byte[] _palRamPrev = new byte[0x20]; private readonly byte[] _palRamPrev = new byte[0x20];
@ -49,7 +53,7 @@ namespace BizHawk.Client.EmuHawk
public NesPPU() public NesPPU()
{ {
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.NesControllerIcon; Icon = ToolIcon;
CalculateFormSize(); CalculateFormSize();
} }

View File

@ -12,6 +12,9 @@ namespace BizHawk.Client.EmuHawk
[SpecializedTool("BG Viewer")] [SpecializedTool("BG Viewer")]
public partial class PceBgViewer : ToolFormBase, IToolFormAutoConfig public partial class PceBgViewer : ToolFormBase, IToolFormAutoConfig
{ {
public static Icon ToolIcon
=> Properties.Resources.PceIcon;
[RequiredService] [RequiredService]
public IPceGpuView Viewer { get; private set; } public IPceGpuView Viewer { get; private set; }
[RequiredService] [RequiredService]
@ -32,7 +35,7 @@ namespace BizHawk.Client.EmuHawk
public PceBgViewer() public PceBgViewer()
{ {
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.PceIcon; Icon = ToolIcon;
Activated += (o, e) => Generate(); Activated += (o, e) => Generate();
} }

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Drawing;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Collections.Generic; using System.Collections.Generic;
@ -14,6 +15,9 @@ namespace BizHawk.Client.EmuHawk
[SpecializedTool("Sound Debugger")] [SpecializedTool("Sound Debugger")]
public partial class PCESoundDebugger : ToolFormBase, IToolFormAutoConfig public partial class PCESoundDebugger : ToolFormBase, IToolFormAutoConfig
{ {
public static Icon ToolIcon
=> Properties.Resources.BugIcon;
[RequiredService] [RequiredService]
private PCEngine PCE { get; set; } private PCEngine PCE { get; set; }
@ -22,7 +26,7 @@ namespace BizHawk.Client.EmuHawk
public PCESoundDebugger() public PCESoundDebugger()
{ {
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.BugIcon; Icon = ToolIcon;
SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.UserPaint, true);

View File

@ -12,6 +12,9 @@ namespace BizHawk.Client.EmuHawk
[SpecializedTool("Tile Viewer")] [SpecializedTool("Tile Viewer")]
public partial class PceTileViewer : ToolFormBase, IToolFormAutoConfig public partial class PceTileViewer : ToolFormBase, IToolFormAutoConfig
{ {
public static Icon ToolIcon
=> Properties.Resources.PceIcon;
[RequiredService] [RequiredService]
public IPceGpuView Viewer { get; private set; } public IPceGpuView Viewer { get; private set; }
@ -26,7 +29,7 @@ namespace BizHawk.Client.EmuHawk
public PceTileViewer() public PceTileViewer()
{ {
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.PceIcon; Icon = ToolIcon;
bmpViewBG.ChangeBitmapSize(512, 256); bmpViewBG.ChangeBitmapSize(512, 256);
bmpViewSP.ChangeBitmapSize(512, 256); bmpViewSP.ChangeBitmapSize(512, 256);
bmpViewBGPal.ChangeBitmapSize(256, 256); bmpViewBGPal.ChangeBitmapSize(256, 256);

View File

@ -12,6 +12,9 @@ namespace BizHawk.Client.EmuHawk
[SpecializedTool("VDP Viewer")] [SpecializedTool("VDP Viewer")]
public partial class SmsVdpViewer : ToolFormBase, IToolFormAutoConfig public partial class SmsVdpViewer : ToolFormBase, IToolFormAutoConfig
{ {
public static Icon ToolIcon
=> Properties.Resources.SmsIcon;
[RequiredService] [RequiredService]
private ISmsGpuView Vdp { get; set; } private ISmsGpuView Vdp { get; set; }
@ -25,7 +28,7 @@ namespace BizHawk.Client.EmuHawk
public SmsVdpViewer() public SmsVdpViewer()
{ {
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.SmsIcon; Icon = ToolIcon;
bmpViewTiles.ChangeBitmapSize(256, 128); bmpViewTiles.ChangeBitmapSize(256, 128);
bmpViewPalette.ChangeBitmapSize(16, 2); bmpViewPalette.ChangeBitmapSize(16, 2);

View File

@ -18,6 +18,9 @@ namespace BizHawk.Client.EmuHawk
{ {
public static readonly FilesystemFilterSet TAStudioProjectsFSFilterSet = new(FilesystemFilter.TAStudioProjects); public static readonly FilesystemFilterSet TAStudioProjectsFSFilterSet = new(FilesystemFilter.TAStudioProjects);
public static Icon ToolIcon
=> Resources.TAStudioIcon;
public override bool BlocksInputWhenFocused => IsInMenuLoop; public override bool BlocksInputWhenFocused => IsInMenuLoop;
public new IMainFormForTools MainForm => base.MainForm; public new IMainFormForTools MainForm => base.MainForm;
@ -125,7 +128,7 @@ namespace BizHawk.Client.EmuHawk
recentMacrosToolStripMenuItem.Image = Resources.Recent; recentMacrosToolStripMenuItem.Image = Resources.Recent;
TASEditorManualOnlineMenuItem.Image = Resources.Help; TASEditorManualOnlineMenuItem.Image = Resources.Help;
ForumThreadMenuItem.Image = Resources.TAStudio; ForumThreadMenuItem.Image = Resources.TAStudio;
Icon = Resources.TAStudioIcon; Icon = ToolIcon;
_defaultMainSplitDistance = MainVertialSplit.SplitterDistance; _defaultMainSplitDistance = MainVertialSplit.SplitterDistance;
_defaultBranchMarkerSplitDistance = BranchesMarkersSplit.SplitterDistance; _defaultBranchMarkerSplitDistance = BranchesMarkersSplit.SplitterDistance;

View File

@ -11,6 +11,9 @@ namespace BizHawk.Client.EmuHawk
{ {
public sealed partial class TI83KeyPad : ToolFormBase, IToolFormAutoConfig public sealed partial class TI83KeyPad : ToolFormBase, IToolFormAutoConfig
{ {
public static Icon ToolIcon
=> Resources.CalculateIcon;
[RequiredService] [RequiredService]
// ReSharper disable once UnusedAutoPropertyAccessor.Local // ReSharper disable once UnusedAutoPropertyAccessor.Local
public TI83Common Emu { get; private set; } public TI83Common Emu { get; private set; }
@ -20,7 +23,7 @@ namespace BizHawk.Client.EmuHawk
public TI83KeyPad() public TI83KeyPad()
{ {
InitializeComponent(); InitializeComponent();
Icon = Resources.CalculateIcon; Icon = ToolIcon;
LeftButton.Image = Resources.WhiteTriLeft; LeftButton.Image = Resources.WhiteTriLeft;
RightButton.Image = Resources.WhiteTriRight; RightButton.Image = Resources.WhiteTriRight;
DownButton.Image = Resources.WhiteTriDown; DownButton.Image = Resources.WhiteTriDown;

View File

@ -14,6 +14,9 @@ namespace BizHawk.Client.EmuHawk
{ {
private static readonly Lazy<Image> IconMissingIcon = new(() => Properties.Resources.Logo.ToBitmap()); private static readonly Lazy<Image> IconMissingIcon = new(() => Properties.Resources.Logo.ToBitmap());
public static Icon ToolIcon
=> Properties.Resources.ToolBoxIcon;
private static readonly Lazy<IReadOnlyCollection<Type>> ToolTypes = new(() => EmuHawk.ReflectionCache.Types private static readonly Lazy<IReadOnlyCollection<Type>> ToolTypes = new(() => EmuHawk.ReflectionCache.Types
.Where(static t => typeof(IToolForm).IsAssignableFrom(t) && typeof(Form).IsAssignableFrom(t)) .Where(static t => typeof(IToolForm).IsAssignableFrom(t) && typeof(Form).IsAssignableFrom(t))
.Where(VersionInfo.DeveloperBuild .Where(VersionInfo.DeveloperBuild
@ -29,7 +32,7 @@ namespace BizHawk.Client.EmuHawk
public ToolBox() public ToolBox()
{ {
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.ToolBoxIcon; Icon = ToolIcon;
} }
private void ToolBox_Load(object sender, EventArgs e) private void ToolBox_Load(object sender, EventArgs e)
@ -55,33 +58,11 @@ namespace BizHawk.Client.EmuHawk
foreach (var t in ToolTypes.Value) foreach (var t in ToolTypes.Value)
{ {
if (!ServiceInjector.IsAvailable(Emulator.ServiceProvider, t)) continue; if (!ServiceInjector.IsAvailable(Emulator.ServiceProvider, t)) continue;
Icon/*?*/ image_t = null; var (icon, name) = Tools.GetIconAndNameFor(t);
if (t.FullName == "BizHawk.Client.EmuHawk.CoreFeatureAnalysis") { image_t = Properties.Resources.Logo; }
if (t.FullName == "BizHawk.Client.EmuHawk.LogWindow") { image_t = Properties.Resources.CommandWindow; }
if (t.FullName == "BizHawk.Client.EmuHawk.LuaConsole") { image_t = Properties.Resources.TextDocIcon; }
if (t.FullName == "BizHawk.Client.EmuHawk.MacroInputTool") { image_t = Properties.Resources.TAStudioIcon; }
if (t.FullName == "BizHawk.Client.EmuHawk.MultiDiskBundler") { image_t = Properties.Resources.DualIcon; }
if (t.FullName == "BizHawk.Client.EmuHawk.VirtualpadTool") { image_t = Properties.Resources.GameControllerIcon; }
if (t.FullName == "BizHawk.Client.EmuHawk.BasicBot") { image_t = Properties.Resources.BasicBot; }
if (t.FullName == "BizHawk.Client.EmuHawk.CDL") { image_t = Properties.Resources.CdLoggerIcon; }
if (t.FullName == "BizHawk.Client.EmuHawk.Cheats") { image_t = Properties.Resources.BugIcon; }
if (t.FullName == "BizHawk.Client.EmuHawk.GenericDebugger") { image_t = Properties.Resources.BugIcon; }
if (t.FullName == "BizHawk.Client.EmuHawk.GameShark") { image_t = Properties.Resources.SharkIcon; }
if (t.FullName == "BizHawk.Client.EmuHawk.GBPrinterView") { image_t = Properties.Resources.GambatteIcon; }
if (t.FullName == "BizHawk.Client.EmuHawk.GbGpuView") { image_t = Properties.Resources.GambatteIcon; }
if (t.FullName == "BizHawk.Client.EmuHawk.HexEditor") { image_t = Properties.Resources.FreezeIcon; }
if (t.FullName == "BizHawk.Client.EmuHawk.TAStudio") { image_t = Properties.Resources.TAStudioIcon; }
if (t.FullName == "BizHawk.Client.EmuHawk.TraceLogger") { image_t = Properties.Resources.PencilIcon; }
if (t.FullName == "BizHawk.Client.EmuHawk.RamSearch") { image_t = Properties.Resources.SearchIcon; }
if (t.FullName == "BizHawk.Client.EmuHawk.RamWatch") { image_t = Properties.Resources.WatchIcon; }
if (t.FullName == "BizHawk.Client.EmuHawk.NESSoundConfig") { image_t = Properties.Resources.NesControllerIcon; }
if (t.FullName == "BizHawk.Client.EmuHawk.NESMusicRipper") { image_t = Properties.Resources.NesControllerIcon; }
if (t.FullName == "BizHawk.Client.EmuHawk.NesPPU") { image_t = Properties.Resources.MonitorIcon; }
if (t.FullName == "BizHawk.Client.EmuHawk.NESNameTableViewer") { image_t = Properties.Resources.MonitorIcon; }
if (t.FullName == "BizHawk.Client.EmuHawk.SmsVdpViewer") { image_t = Properties.Resources.SmsIcon; }
ToolStripButton tsb = new() { ToolStripButton tsb = new() {
DisplayStyle = ToolStripItemDisplayStyle.Image, DisplayStyle = ToolStripItemDisplayStyle.Image,
Image = image_t?.ToBitmap() ?? IconMissingIcon.Value, Image = icon ?? IconMissingIcon.Value,
Text = name,
}; };
tsb.Click += (_, _) => Tools.Load(t); tsb.Click += (_, _) => Tools.Load(t);
ToolBoxStrip.Items.Add(tsb); ToolBoxStrip.Items.Add(tsb);

View File

@ -447,6 +447,7 @@ namespace BizHawk.Client.EmuHawk
/// Determines whether a given IToolForm is already loaded /// Determines whether a given IToolForm is already loaded
/// </summary> /// </summary>
/// <typeparam name="T">Type of tool to check</typeparam> /// <typeparam name="T">Type of tool to check</typeparam>
/// <remarks>yo why do we have 4 versions of this, each with slightly different behaviour in edge cases --yoshi</remarks>
public bool IsLoaded<T>() where T : IToolForm public bool IsLoaded<T>() where T : IToolForm
=> _tools.OfType<T>().FirstOrDefault()?.IsActive is true; => _tools.OfType<T>().FirstOrDefault()?.IsActive is true;
@ -482,6 +483,80 @@ namespace BizHawk.Client.EmuHawk
return Load<T>(false); return Load<T>(false);
} }
/// <summary>
/// returns the instance of <paramref name="toolType"/>, regardless of whether it's loaded,<br/>
/// but doesn't create and load a new instance if it's not found
/// </summary>
/// <remarks>
/// does not check <paramref name="toolType"/> is a class implementing <see cref="IToolForm"/>;<br/>
/// you may pass any class or interface
/// </remarks>
public IToolForm/*?*/ LazyGet(Type toolType)
=> _tools.Find(t => toolType.IsAssignableFrom(t.GetType()));
internal static readonly IDictionary<Type, (Image/*?*/ Icon, string Name)> IconAndNameCache = new Dictionary<Type, (Image/*?*/ Icon, string Name)>
{
[typeof(LogWindow)] = (LogWindow.ToolIcon.ToBitmap(), "Log Window"), // can't do this lazily, see https://github.com/TASEmulators/BizHawk/issues/2741#issuecomment-1421014589
};
private static PropertyInfo/*?*/ _PInfo_FormBase_WindowTitleStatic = null;
private static PropertyInfo PInfo_FormBase_WindowTitleStatic
=> _PInfo_FormBase_WindowTitleStatic ??= typeof(FormBase).GetProperty("WindowTitleStatic", BindingFlags.NonPublic | BindingFlags.Instance);
private static bool CaptureIconAndName(object tool, Type toolType, ref Image/*?*/ icon, ref string/*?*/ name)
{
if (IconAndNameCache.ContainsKey(toolType)) return true;
Form winform = null;
if (name is null)
{
winform = tool as FormBase;
if (winform is not null)
{
// then `tool is Formbase` and this getter call is safe
name = (string) PInfo_FormBase_WindowTitleStatic.GetValue(tool);
// could do `tool._windowTitleStatic ??= tool.WindowTitleStatic`, but the getter's only being run 1 extra time here anyway so not worth the LOC
}
winform ??= tool as Form;
if (winform is not null)
{
icon = winform.Icon?.ToBitmap();
name ??= winform.Name;
}
}
if (!string.IsNullOrWhiteSpace(name))
{
IconAndNameCache[toolType] = (icon, name);
return true;
}
// else don't cache anything
name = winform?.Text;
return false;
}
private static void CaptureIconAndName(object tool, Type toolType)
{
Image/*?*/ icon = null;
string/*?*/ name = null;
CaptureIconAndName(tool, toolType, ref icon, ref name);
}
public (Image/*?*/ Icon, string Name) GetIconAndNameFor(Type toolType)
{
if (IconAndNameCache.TryGetValue(toolType, out var tuple)) return tuple;
Image/*?*/ icon = null;
var name = toolType.GetCustomAttribute<SpecializedToolAttribute>()?.DisplayName; //TODO codegen ToolIcon and WindowTitleStatic from [Tool] or some new attribute -- Bitmap..ctor(Type, string)
var instance = LazyGet(toolType);
if (instance is not null)
{
if (CaptureIconAndName(instance, toolType, ref icon, ref name)) return (icon, name);
// else fall through
}
return (
icon ?? (toolType.GetProperty("ToolIcon", BindingFlags.Public | BindingFlags.Static)?.GetValue(null) as Icon)?.ToBitmap(),
string.IsNullOrWhiteSpace(name) ? toolType.Name : name);
}
public IEnumerable<Type> AvailableTools => EmuHawk.ReflectionCache.Types public IEnumerable<Type> AvailableTools => EmuHawk.ReflectionCache.Types
.Where(t => !t.IsInterface && typeof(IToolForm).IsAssignableFrom(t) && IsAvailable(t)); .Where(t => !t.IsInterface && typeof(IToolForm).IsAssignableFrom(t) && IsAvailable(t));
@ -650,7 +725,7 @@ namespace BizHawk.Client.EmuHawk
{ {
tool = (IToolForm)Activator.CreateInstance(toolType); tool = (IToolForm)Activator.CreateInstance(toolType);
} }
CaptureIconAndName(tool, toolType);
// Add to our list of tools // Add to our list of tools
_tools.Add(tool); _tools.Add(tool);
return tool; return tool;
@ -735,6 +810,7 @@ namespace BizHawk.Client.EmuHawk
_tools.Remove(tool); _tools.Remove(tool);
} }
tool = new T(); tool = new T();
CaptureIconAndName(tool, typeof(T));
_tools.Add(tool); _tools.Add(tool);
return tool; return tool;
} }

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -13,6 +14,9 @@ namespace BizHawk.Client.EmuHawk
{ {
public partial class TraceLogger : ToolFormBase, IToolFormAutoConfig public partial class TraceLogger : ToolFormBase, IToolFormAutoConfig
{ {
public static Icon ToolIcon
=> Properties.Resources.PencilIcon;
private static readonly FilesystemFilterSet LogFilesFSFilterSet = new( private static readonly FilesystemFilterSet LogFilesFSFilterSet = new(
new FilesystemFilter("Log Files", new[] { "log" }), new FilesystemFilter("Log Files", new[] { "log" }),
FilesystemFilter.TextFiles); FilesystemFilter.TextFiles);
@ -70,7 +74,7 @@ namespace BizHawk.Client.EmuHawk
public TraceLogger() public TraceLogger()
{ {
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.PencilIcon; Icon = ToolIcon;
SaveLogMenuItem.Image = Properties.Resources.SaveAs; SaveLogMenuItem.Image = Properties.Resources.SaveAs;
TraceView.QueryItemText += TraceView_QueryItemText; TraceView.QueryItemText += TraceView_QueryItemText;

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
@ -11,6 +12,9 @@ namespace BizHawk.Client.EmuHawk
{ {
public partial class VirtualpadTool : ToolFormBase, IToolFormAutoConfig public partial class VirtualpadTool : ToolFormBase, IToolFormAutoConfig
{ {
public static Icon ToolIcon
=> Properties.Resources.GameControllerIcon;
[RequiredService] [RequiredService]
private IEmulator Emulator { get; set; } private IEmulator Emulator { get; set; }
@ -47,7 +51,7 @@ namespace BizHawk.Client.EmuHawk
{ {
StickyPads = true; StickyPads = true;
InitializeComponent(); InitializeComponent();
Icon = Properties.Resources.GameControllerIcon; Icon = ToolIcon;
} }
private void VirtualpadTool_Load(object sender, EventArgs e) private void VirtualpadTool_Load(object sender, EventArgs e)

View File

@ -26,6 +26,9 @@ namespace BizHawk.Client.EmuHawk
private const int MaxDetailedSize = 1024 * 1024; // 1mb, semi-arbitrary decision, sets the size to check for and automatically switch to fast mode for the user private const int MaxDetailedSize = 1024 * 1024; // 1mb, semi-arbitrary decision, sets the size to check for and automatically switch to fast mode for the user
private const int MaxSupportedSize = 1024 * 1024 * 64; // 64mb, semi-arbitrary decision, sets the maximum size RAM Search will support (as it will crash beyond this) private const int MaxSupportedSize = 1024 * 1024 * 64; // 64mb, semi-arbitrary decision, sets the maximum size RAM Search will support (as it will crash beyond this)
public static Icon ToolIcon
=> Resources.SearchIcon;
// TODO: DoSearch grabs the state of widgets and passes it to the engine before running, so rip out code that is attempting to keep the state up to date through change events // TODO: DoSearch grabs the state of widgets and passes it to the engine before running, so rip out code that is attempting to keep the state up to date through change events
private string _currentFileName = ""; private string _currentFileName = "";
@ -48,7 +51,7 @@ namespace BizHawk.Client.EmuHawk
SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
InitializeComponent(); InitializeComponent();
Icon = Resources.SearchIcon; Icon = ToolIcon;
SearchMenuItem.Image = Resources.Search; SearchMenuItem.Image = Resources.Search;
DoSearchContextMenuItem.Image = Resources.Search; DoSearchContextMenuItem.Image = Resources.Search;
NewSearchContextMenuItem.Image = Resources.Restart; NewSearchContextMenuItem.Image = Resources.Restart;

View File

@ -18,6 +18,9 @@ namespace BizHawk.Client.EmuHawk
{ {
public partial class RamWatch : ToolFormBase, IToolFormAutoConfig public partial class RamWatch : ToolFormBase, IToolFormAutoConfig
{ {
public static Icon ToolIcon
=> Resources.WatchIcon;
private WatchList _watches; private WatchList _watches;
private string _sortedColumn; private string _sortedColumn;
@ -81,7 +84,7 @@ namespace BizHawk.Client.EmuHawk
MoveDownMenuItem.Image = Resources.MoveDown; MoveDownMenuItem.Image = Resources.MoveDown;
MoveTopMenuItem.Image = Resources.MoveTop; MoveTopMenuItem.Image = Resources.MoveTop;
MoveBottomMenuItem.Image = Resources.MoveBottom; MoveBottomMenuItem.Image = Resources.MoveBottom;
Icon = Resources.WatchIcon; Icon = ToolIcon;
Settings = new RamWatchSettings(); Settings = new RamWatchSettings();