diff --git a/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs b/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs
index 9e0529e3e6..b09cfd7617 100644
--- a/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/ToolManager.cs
@@ -64,10 +64,10 @@ namespace BizHawk.Client.EmuHawk
{
throw new ArgumentException($"Type {toolType.Name} does not implement {nameof(IToolForm)}.");
}
-
- // The type[] in parameter is used to avoid an ambiguous name exception
- MethodInfo method = GetType().GetMethod("Load", new Type[] { typeof(bool) }).MakeGenericMethod(toolType);
- return (IToolForm)method.Invoke(this, new object[] { focus });
+
+ return (IToolForm) typeof(ToolManager).GetMethod("Load", new[] { typeof(bool), typeof(string) })
+ .MakeGenericMethod(toolType)
+ .Invoke(this, new object[] { focus, "" });
}
// If the form inherits ToolFormBase, it will set base properties such as Tools, Config, etc
@@ -87,23 +87,11 @@ 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
///
- /// 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)
- 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)
+ /// Type of tool you want to load
/// An instantiated
- public T Load(string toolPath, bool focus = true)
+ public T Load(bool focus = true, string toolPath = "")
where T : class, IToolForm
{
if (!IsAvailable()) return null;
@@ -123,8 +111,7 @@ namespace BizHawk.Client.EmuHawk
_tools.Remove(existingTool);
}
- var newTool = CreateInstance(toolPath);
- if (newTool == null) return null;
+ if (!(CreateInstance(toolPath) is T newTool)) return null;
if (newTool is Form form) form.Owner = _owner;
ServiceInjector.UpdateServices(_emulator.ServiceProvider, newTool);
@@ -153,7 +140,7 @@ namespace BizHawk.Client.EmuHawk
newTool.Restart();
newTool.Show();
- return (T)newTool;
+ return newTool;
}
/// Loads the external tool's entry form.