Update Lua registered functions window after restart

Make registered functions window show functions for new LuaImp after core restart/reopening the Lua console
This commit is contained in:
kalimag 2022-11-27 19:54:07 +01:00 committed by James Groom
parent ee66faba0b
commit 6aa7c48402
2 changed files with 7 additions and 4 deletions

View File

@ -736,11 +736,13 @@ namespace BizHawk.Client.EmuHawk
return true; return true;
} }
private static void UpdateRegisteredFunctionsDialog() private void UpdateRegisteredFunctionsDialog()
{ {
if (LuaImp is null) return;
foreach (var form in Application.OpenForms.OfType<LuaRegisteredFunctionsList>().ToList()) foreach (var form in Application.OpenForms.OfType<LuaRegisteredFunctionsList>().ToList())
{ {
form.UpdateValues(); form.UpdateValues(LuaImp.RegisteredFunctions);
} }
} }

View File

@ -10,7 +10,7 @@ namespace BizHawk.Client.EmuHawk
{ {
private readonly IMainFormForApi _mainForm; private readonly IMainFormForApi _mainForm;
private readonly LuaFunctionList _registeredFunctions; private LuaFunctionList _registeredFunctions;
public LuaRegisteredFunctionsList(IMainFormForApi mainForm, LuaFunctionList registeredFunctions) public LuaRegisteredFunctionsList(IMainFormForApi mainForm, LuaFunctionList registeredFunctions)
{ {
@ -22,8 +22,9 @@ namespace BizHawk.Client.EmuHawk
public Point StartLocation { get; set; } = new Point(0, 0); public Point StartLocation { get; set; } = new Point(0, 0);
public void UpdateValues() public void UpdateValues(LuaFunctionList registeredFunctions)
{ {
_registeredFunctions = registeredFunctions;
PopulateListView(); PopulateListView();
} }