Add command-line switch --open-ext-tool-dll
takes an absolute path; or a relative path with or without `.dll` (relative to ExternalTools)
This commit is contained in:
parent
0109386049
commit
e128cb82f2
|
@ -39,6 +39,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public HttpCommunication httpCommunication = null;
|
public HttpCommunication httpCommunication = null;
|
||||||
public SocketServer socketServer = null;
|
public SocketServer socketServer = null;
|
||||||
public MemoryMappedFiles memoryMappedFiles = null;
|
public MemoryMappedFiles memoryMappedFiles = null;
|
||||||
|
public string openExtToolDll;
|
||||||
|
|
||||||
/// <exception cref="ArgParserException"><c>--socket_ip</c> passed without specifying <c>--socket_port</c> or vice-versa</exception>
|
/// <exception cref="ArgParserException"><c>--socket_ip</c> passed without specifying <c>--socket_port</c> or vice-versa</exception>
|
||||||
public void ParseArguments(string[] args, Func<byte[]> takeScreenshotCallback)
|
public void ParseArguments(string[] args, Func<byte[]> takeScreenshotCallback)
|
||||||
|
@ -146,6 +147,13 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
audiosync = arg.Substring(arg.IndexOf('=') + 1) == "true";
|
audiosync = arg.Substring(arg.IndexOf('=') + 1) == "true";
|
||||||
}
|
}
|
||||||
|
else if (arg.StartsWith("--open-ext-tool-dll="))
|
||||||
|
{
|
||||||
|
// the first ext. tool from ExternalToolManager.ToolStripMenu which satisfies both of these will be opened:
|
||||||
|
// - available (no load errors, correct system/rom, etc.)
|
||||||
|
// - dll path matches given string; or dll filename matches given string with or without `.dll`
|
||||||
|
openExtToolDll = args[i].Substring(20);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmdRom = args[i];
|
cmdRom = args[i];
|
||||||
|
|
|
@ -153,6 +153,26 @@ namespace BizHawk.Client.EmuHawk
|
||||||
};
|
};
|
||||||
UpdateChecker.GlobalConfig = Config;
|
UpdateChecker.GlobalConfig = Config;
|
||||||
UpdateChecker.BeginCheck(); // Won't actually check unless enabled by user
|
UpdateChecker.BeginCheck(); // Won't actually check unless enabled by user
|
||||||
|
|
||||||
|
// open requested ext. tool
|
||||||
|
var requestedExtToolDll = _argParser.openExtToolDll;
|
||||||
|
if (requestedExtToolDll != null)
|
||||||
|
{
|
||||||
|
var enabled = ExternalToolManager.ToolStripMenu.Where(item => item.Enabled)
|
||||||
|
.Select(item => (ValueTuple<string, string>) item.Tag)
|
||||||
|
.ToList();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var found = enabled.First(tuple => tuple.Item1 == requestedExtToolDll
|
||||||
|
|| Path.GetFileName(tuple.Item1) == requestedExtToolDll
|
||||||
|
|| Path.GetFileNameWithoutExtension(tuple.Item1) == requestedExtToolDll);
|
||||||
|
Tools.LoadExternalToolForm(found.Item1, found.Item2);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"requested ext. tool dll {requestedExtToolDll} could not be loaded");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static MainForm()
|
static MainForm()
|
||||||
|
@ -1552,6 +1572,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
// input state which has been destined for client hotkey consumption are colesced here
|
// input state which has been destined for client hotkey consumption are colesced here
|
||||||
private readonly InputCoalescer _hotkeyCoalescer = new InputCoalescer();
|
private readonly InputCoalescer _hotkeyCoalescer = new InputCoalescer();
|
||||||
|
|
||||||
|
private readonly (string, string)? _loadExtToolForm;
|
||||||
|
|
||||||
private readonly PresentationPanel PresentationPanel;
|
private readonly PresentationPanel PresentationPanel;
|
||||||
|
|
||||||
// countdown for saveram autoflushing
|
// countdown for saveram autoflushing
|
||||||
|
|
Loading…
Reference in New Issue