Fix `--open-ext-tool-dll`

fixes 4566b744d
This commit is contained in:
YoshiRulz 2023-02-08 06:25:09 +10:00
parent 3c3ab6578e
commit a86860faaa
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 11 additions and 11 deletions

View File

@ -187,11 +187,11 @@ namespace BizHawk.Client.EmuHawk
if (requestedExtToolDll != null)
{
var found = ExtToolManager.ToolStripMenu.Where(static item => item.Enabled)
.Select(static item => ((string, string)) item.Tag)
.FirstOrNull(tuple => tuple.Item1 == requestedExtToolDll
|| Path.GetFileName(tuple.Item1) == requestedExtToolDll
|| Path.GetFileNameWithoutExtension(tuple.Item1) == requestedExtToolDll);
if (found is not null) Tools.LoadExternalToolForm(found.Value.Item1, found.Value.Item2, skipExtToolWarning: true);
.Select(static item => (ExternalToolManager.MenuItemInfo) item.Tag)
.FirstOrNull(info => info.AsmFilename == requestedExtToolDll
|| Path.GetFileName(info.AsmFilename) == requestedExtToolDll
|| Path.GetFileNameWithoutExtension(info.AsmFilename) == requestedExtToolDll);
if (found is not null) found.Value.TryLoad();
else Console.WriteLine($"requested ext. tool dll {requestedExtToolDll} could not be loaded");
}

View File

@ -18,14 +18,14 @@ namespace BizHawk.Client.EmuHawk
{
private readonly string _asmChecksum;
private readonly string _asmFilename;
private readonly string _entryPointTypeName;
private readonly ExternalToolManager _extToolMan;
private bool _skipExtToolWarning;
public readonly string AsmFilename;
public MenuItemInfo(
ExternalToolManager extToolMan,
string asmChecksum,
@ -33,21 +33,21 @@ namespace BizHawk.Client.EmuHawk
string entryPointTypeName)
{
_asmChecksum = asmChecksum;
_asmFilename = asmFilename;
_entryPointTypeName = entryPointTypeName;
_extToolMan = extToolMan;
_skipExtToolWarning = _extToolMan._config.TrustedExtTools.TryGetValue(_asmFilename, out var s) && s == _asmChecksum;
_skipExtToolWarning = _extToolMan._config.TrustedExtTools.TryGetValue(asmFilename, out var s) && s == _asmChecksum;
AsmFilename = asmFilename;
}
public void TryLoad()
{
var success = _extToolMan._loadCallback(
/*toolPath:*/ _asmFilename,
/*toolPath:*/ AsmFilename,
/*customFormTypeName:*/ _entryPointTypeName,
/*skipExtToolWarning:*/ _skipExtToolWarning);
if (!success || _skipExtToolWarning) return;
_skipExtToolWarning = true;
_extToolMan._config.TrustedExtTools[_asmFilename] = _asmChecksum;
_extToolMan._config.TrustedExtTools[AsmFilename] = _asmChecksum;
}
}