Clean up toggle/refresh buttons in Lua Console

This commit is contained in:
YoshiRulz 2021-05-04 23:54:48 +10:00
parent 0a9d496ece
commit 3fee117c5f
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 13 additions and 7 deletions

View File

@ -310,11 +310,7 @@ namespace BizHawk.Client.EmuHawk
{
// Even after _watches is cleared, these callbacks hang around! So this check is necessary
var script = LuaImp.ScriptList.FirstOrDefault(s => s.Path == e.FullPath && s.Enabled);
if (script != null)
{
Invoke(new MethodInvoker(delegate { RefreshScriptMenuItem_Click(null, null); }));
}
if (script != null) Invoke((MethodInvoker) (() => RefreshLuaScript(script)));
}
public void LoadLuaFile(string path)
@ -1416,8 +1412,12 @@ namespace BizHawk.Client.EmuHawk
private void RefreshScriptMenuItem_Click(object sender, EventArgs e)
{
ToggleScriptMenuItem_Click(sender, e);
ToggleScriptMenuItem_Click(sender, e);
if (!(LuaImp is Win32LuaLibraries luaLibsImpl)) return;
var files = !SelectedFiles.Any() && Settings.ToggleAllIfNoneSelected
? luaLibsImpl.ScriptList
: SelectedFiles;
foreach (var file in files) RefreshLuaScript(file);
UpdateDialog();
}
private void InputBox_KeyDown(object sender, KeyEventArgs e)
@ -1566,6 +1566,12 @@ namespace BizHawk.Client.EmuHawk
}
}
private void RefreshLuaScript(LuaFile file)
{
ToggleLuaScript(file);
ToggleLuaScript(file);
}
[RestoreDefaults]
private void RestoreDefaults()
{