remove remaining globals in LuaFunctionList

This commit is contained in:
adelikat 2020-04-12 14:17:16 -05:00
parent 42c6168c7e
commit e0df266cb7
3 changed files with 7 additions and 7 deletions

View File

@ -42,16 +42,16 @@ namespace BizHawk.Client.Common
}
}
public void Clear()
public void Clear(IEmulator emulator)
{
if (Global.Emulator.InputCallbacksAvailable())
if (emulator.InputCallbacksAvailable())
{
Global.Emulator.AsInputPollable().InputCallbacks.RemoveAll(_functions.Select(w => w.Callback));
emulator.AsInputPollable().InputCallbacks.RemoveAll(_functions.Select(w => w.Callback));
}
if (Global.Emulator.MemoryCallbacksAvailable())
if (emulator.MemoryCallbacksAvailable())
{
var memoryCallbacks = Global.Emulator.AsDebuggable().MemoryCallbacks;
var memoryCallbacks = emulator.AsDebuggable().MemoryCallbacks;
memoryCallbacks.RemoveAll(_functions.Select(w => w.MemCallback));
}

View File

@ -170,7 +170,7 @@ namespace BizHawk.Client.EmuHawk
public override void Close()
{
RegisteredFunctions.Clear();
RegisteredFunctions.Clear(Global.Emulator); // TODO: don't use globals
FormsLibrary.DestroyAll();
_lua.Close();
_lua = new Lua();

View File

@ -1257,7 +1257,7 @@ namespace BizHawk.Client.EmuHawk
private void ClearRegisteredFunctionsContextMenuItem_Click(object sender, EventArgs e)
{
LuaImp.RegisteredFunctions.Clear();
LuaImp.RegisteredFunctions.Clear(Emulator);
}
#endregion