Use new _luaLibsImpl prop instead of LuaConsole.LuaImp via globals
This commit is contained in:
parent
a6d1c6595a
commit
db63222f32
|
@ -101,13 +101,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
bool wasPaused = MainForm.EmulatorPaused;
|
||||
|
||||
// can't re-enter lua while doing this
|
||||
GlobalWin.Tools.LuaConsole?.LuaImp.SupressUpdate();
|
||||
_luaLibsImpl.SupressUpdate();
|
||||
while (Emulator.Frame != frame)
|
||||
{
|
||||
MainForm.SeekFrameAdvance();
|
||||
}
|
||||
|
||||
GlobalWin.Tools.LuaConsole?.LuaImp.EnableUpdate();
|
||||
_luaLibsImpl.EnableUpdate();
|
||||
|
||||
if (!wasPaused)
|
||||
{
|
||||
|
@ -199,9 +199,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
[LuaMethod("reboot_core", "Reboots the currently loaded core")]
|
||||
public void RebootCore()
|
||||
{
|
||||
((LuaConsole)GlobalWin.Tools.Get<LuaConsole>()).LuaImp.IsRebootingCore = true;
|
||||
_luaLibsImpl.IsRebootingCore = true;
|
||||
APIs.EmuClient.RebootCore();
|
||||
((LuaConsole)GlobalWin.Tools.Get<LuaConsole>()).LuaImp.IsRebootingCore = false;
|
||||
_luaLibsImpl.IsRebootingCore = false;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local incliscr = client.screenheight( );")]
|
||||
|
|
|
@ -26,10 +26,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
[LuaMethodExample("local stconget = console.getluafunctionslist( );")]
|
||||
[LuaMethod("getluafunctionslist", "returns a list of implemented functions")]
|
||||
public static string GetLuaFunctionsList()
|
||||
public string GetLuaFunctionsList()
|
||||
{
|
||||
var list = new StringBuilder();
|
||||
foreach (var function in GlobalWin.Tools.LuaConsole.LuaImp.Docs)
|
||||
foreach (var function in _luaLibsImpl.Docs)
|
||||
{
|
||||
list.AppendLine(function.Name);
|
||||
}
|
||||
|
|
|
@ -353,7 +353,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
"newform", "creates a new default dialog, if both width and height are specified it will create a dialog of the specified size. If title is specified it will be the caption of the dialog, else the dialog caption will be 'Lua Dialog'. The function will return an int representing the handle of the dialog created.")]
|
||||
public int NewForm(int? width = null, int? height = null, string title = null, LuaFunction onClose = null)
|
||||
{
|
||||
var form = new LuaWinform(CurrentFile, GlobalWin.Tools.LuaConsole.LuaImp);
|
||||
var form = new LuaWinform(CurrentFile, _luaLibsImpl);
|
||||
_luaForms.Add(form);
|
||||
if (width.HasValue && height.HasValue)
|
||||
{
|
||||
|
|
|
@ -17,24 +17,22 @@ namespace BizHawk.Client.EmuHawk
|
|||
[LuaMethod("load", "Loads a savestate with the given path. If EmuHawk is deferring quicksaves, to TAStudio for example, that form will do what it likes (and the path is ignored).")]
|
||||
public void Load(string path, bool suppressOSD = false)
|
||||
{
|
||||
// TODO: find a non-global way to access LuaImp from Lua libraries!
|
||||
GlobalWin.Tools.LuaConsole?.LuaImp.SupressUpdate();
|
||||
_luaLibsImpl.SupressUpdate();
|
||||
|
||||
APIs.SaveState.Load(path, suppressOSD);
|
||||
|
||||
GlobalWin.Tools.LuaConsole?.LuaImp.EnableUpdate();
|
||||
_luaLibsImpl.EnableUpdate();
|
||||
}
|
||||
|
||||
[LuaMethodExample("savestate.loadslot( 7 );")]
|
||||
[LuaMethod("loadslot", "Loads the savestate at the given slot number (must be an integer between 0 and 9). If EmuHawk is deferring quicksaves, to TAStudio for example, that form will do what it likes with the slot number.")]
|
||||
public void LoadSlot(int slotNum, bool suppressOSD = false)
|
||||
{
|
||||
// TODO: find a non-global way to access LuaImp from Lua libraries!
|
||||
GlobalWin.Tools.LuaConsole?.LuaImp.SupressUpdate();
|
||||
_luaLibsImpl.SupressUpdate();
|
||||
|
||||
APIs.SaveState.LoadSlot(slotNum, suppressOSD);
|
||||
|
||||
GlobalWin.Tools.LuaConsole?.LuaImp.EnableUpdate();
|
||||
_luaLibsImpl.EnableUpdate();
|
||||
}
|
||||
|
||||
[LuaMethodExample("savestate.save( \"C:\\state.bin\" );")]
|
||||
|
|
|
@ -134,8 +134,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (Engaged())
|
||||
{
|
||||
// TODO: find a non-global way to access LuaImp from Lua libraries!
|
||||
GlobalWin.Tools.LuaConsole?.LuaImp.SupressUpdate();
|
||||
_luaLibsImpl.SupressUpdate();
|
||||
|
||||
int f;
|
||||
if (frame is double frameNumber)
|
||||
|
@ -158,7 +157,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Tastudio.GoToFrame(f, true);
|
||||
}
|
||||
|
||||
GlobalWin.Tools.LuaConsole?.LuaImp.EnableUpdate();
|
||||
_luaLibsImpl.EnableUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,8 +290,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (Engaged())
|
||||
{
|
||||
// TODO: find a non-global way to access LuaImp from Lua libraries!
|
||||
GlobalWin.Tools.LuaConsole?.LuaImp.SupressUpdate();
|
||||
_luaLibsImpl.SupressUpdate();
|
||||
|
||||
if (_changeList.Count > 0)
|
||||
{
|
||||
|
@ -330,7 +328,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Tastudio.DoAutoRestore();
|
||||
}
|
||||
|
||||
GlobalWin.Tools.LuaConsole?.LuaImp.EnableUpdate();
|
||||
_luaLibsImpl.EnableUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -425,12 +423,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (Engaged())
|
||||
{
|
||||
// TODO: find a non-global way to access LuaImp from Lua libraries!
|
||||
GlobalWin.Tools.LuaConsole?.LuaImp.SupressUpdate();
|
||||
_luaLibsImpl.SupressUpdate();
|
||||
|
||||
Tastudio.LoadBranchByIndex(index);
|
||||
|
||||
GlobalWin.Tools.LuaConsole?.LuaImp.EnableUpdate();
|
||||
_luaLibsImpl.EnableUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue