diff --git a/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs b/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs
index 6789a5f3d3..9e0529e3e6 100644
--- a/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs
@@ -87,11 +87,23 @@ namespace BizHawk.Client.EmuHawk
///
/// Loads the tool dialog T (T must implement ) , if it does not exist it will be created, if it is already open, it will be focused
///
- /// Define if the tool form has to get the focus or not (Default is true)
- /// Path to the .dll of the external tool
/// Type of tool you want to load
+ /// Define if the tool form has to get the focus or not (Default is true)
/// An instantiated
- public T Load(bool focus = true, string toolPath = "")
+ public T Load(bool focus = true)
+ where T : class, IToolForm
+ {
+ return Load("", focus);
+ }
+
+ ///
+ /// Loads the tool dialog T (T must implement ) , if it does not exist it will be created, if it is already open, it will be focused
+ ///
+ /// Type of tool you want to load
+ /// Path to the .dll of the external tool
+ /// Define if the tool form has to get the focus or not (Default is true)
+ /// An instantiated
+ public T Load(string toolPath, bool focus = true)
where T : class, IToolForm
{
if (!IsAvailable()) return null;
@@ -111,7 +123,8 @@ namespace BizHawk.Client.EmuHawk
_tools.Remove(existingTool);
}
- if (!(CreateInstance(toolPath) is T newTool)) return null;
+ var newTool = CreateInstance(toolPath);
+ if (newTool == null) return null;
if (newTool is Form form) form.Owner = _owner;
ServiceInjector.UpdateServices(_emulator.ServiceProvider, newTool);
@@ -140,7 +153,7 @@ namespace BizHawk.Client.EmuHawk
newTool.Restart();
newTool.Show();
- return newTool;
+ return (T)newTool;
}
/// Loads the external tool's entry form.