Lua - simplify some logic
This commit is contained in:
parent
84d9419637
commit
de2da910c2
|
@ -209,20 +209,20 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_lua.Pop();
|
_lua.Pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResumeResult ResumeScript(Lua script)
|
public override ResumeResult ResumeScript(LuaFile lf)
|
||||||
{
|
{
|
||||||
_currThread = script;
|
_currThread = lf.Thread;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LuaLibraryBase.SetCurrentThread(_currThread);
|
LuaLibraryBase.SetCurrentThread(_currThread);
|
||||||
|
|
||||||
var execResult = script.Resume(0);
|
var execResult = _currThread.Resume(0);
|
||||||
|
|
||||||
_lua.RunScheduledDisposes();
|
_lua.RunScheduledDisposes();
|
||||||
|
|
||||||
// not sure how this is going to work out, so do this too
|
// not sure how this is going to work out, so do this too
|
||||||
script.RunScheduledDisposes();
|
_currThread.RunScheduledDisposes();
|
||||||
|
|
||||||
_currThread = null;
|
_currThread = null;
|
||||||
var result = new ResumeResult();
|
var result = new ResumeResult();
|
||||||
|
@ -246,11 +246,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ResumeResult ResumeScriptFromThreadOf(LuaFile lf)
|
|
||||||
{
|
|
||||||
return ResumeScript(lf.Thread);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Print(params object[] outputs)
|
public static void Print(params object[] outputs)
|
||||||
{
|
{
|
||||||
ConsoleLuaLibrary.Log(outputs);
|
ConsoleLuaLibrary.Log(outputs);
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
private static readonly EmuLuaLibrary.ResumeResult EmptyResumeResult = new EmuLuaLibrary.ResumeResult();
|
private static readonly EmuLuaLibrary.ResumeResult EmptyResumeResult = new EmuLuaLibrary.ResumeResult();
|
||||||
public override EmuLuaLibrary.ResumeResult ResumeScriptFromThreadOf(LuaFile lf)
|
public override EmuLuaLibrary.ResumeResult ResumeScript(LuaFile lf)
|
||||||
{
|
{
|
||||||
return EmptyResumeResult;
|
return EmptyResumeResult;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public abstract void EndLuaDrawing();
|
public abstract void EndLuaDrawing();
|
||||||
public abstract void ExecuteString(string command);
|
public abstract void ExecuteString(string command);
|
||||||
public abstract void Restart(IEmulatorServiceProvider newServiceProvider);
|
public abstract void Restart(IEmulatorServiceProvider newServiceProvider);
|
||||||
public abstract EmuLuaLibrary.ResumeResult ResumeScriptFromThreadOf(LuaFile lf);
|
public abstract EmuLuaLibrary.ResumeResult ResumeScript(LuaFile lf);
|
||||||
public abstract void SpawnAndSetFileThread(string pathToLoad, LuaFile lf);
|
public abstract void SpawnAndSetFileThread(string pathToLoad, LuaFile lf);
|
||||||
public abstract void StartLuaDrawing();
|
public abstract void StartLuaDrawing();
|
||||||
public abstract void WindowClosed(IntPtr handle);
|
public abstract void WindowClosed(IntPtr handle);
|
||||||
|
|
|
@ -551,7 +551,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
var prohibit = lf.FrameWaiting && !includeFrameWaiters;
|
var prohibit = lf.FrameWaiting && !includeFrameWaiters;
|
||||||
if (!prohibit)
|
if (!prohibit)
|
||||||
{
|
{
|
||||||
var result = LuaImp.ResumeScriptFromThreadOf(lf);
|
var result = LuaImp.ResumeScript(lf);
|
||||||
if (result.Terminated)
|
if (result.Terminated)
|
||||||
{
|
{
|
||||||
LuaImp.CallExitEvent(lf);
|
LuaImp.CallExitEvent(lf);
|
||||||
|
|
Loading…
Reference in New Issue