Replace class Win32LuaLibraries.ResumeResult with tuples
This commit is contained in:
parent
fd4a534fa7
commit
20111fb4a2
|
@ -42,7 +42,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 Win32LuaLibraries.ResumeResult ResumeScript(LuaFile lf);
|
public abstract (bool WaitForFrame, bool Terminated) 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);
|
||||||
|
|
|
@ -40,11 +40,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public override void Restart(IEmulatorServiceProvider newServiceProvider)
|
public override void Restart(IEmulatorServiceProvider newServiceProvider)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
private static readonly Win32LuaLibraries.ResumeResult EmptyResumeResult = new Win32LuaLibraries.ResumeResult();
|
|
||||||
public override Win32LuaLibraries.ResumeResult ResumeScript(LuaFile lf)
|
public override (bool WaitForFrame, bool Terminated) ResumeScript(LuaFile lf) => (false, false);
|
||||||
{
|
|
||||||
return EmptyResumeResult;
|
|
||||||
}
|
|
||||||
public override void SpawnAndSetFileThread(string pathToLoad, LuaFile lf)
|
public override void SpawnAndSetFileThread(string pathToLoad, LuaFile lf)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public override void RunScheduledDisposes() => _lua.RunScheduledDisposes();
|
public override void RunScheduledDisposes() => _lua.RunScheduledDisposes();
|
||||||
|
|
||||||
public override ResumeResult ResumeScript(LuaFile lf)
|
public override (bool WaitForFrame, bool Terminated) ResumeScript(LuaFile lf)
|
||||||
{
|
{
|
||||||
_currThread = lf.Thread;
|
_currThread = lf.Thread;
|
||||||
|
|
||||||
|
@ -214,17 +214,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_currThread.RunScheduledDisposes();
|
_currThread.RunScheduledDisposes();
|
||||||
|
|
||||||
_currThread = null;
|
_currThread = null;
|
||||||
var result = new ResumeResult();
|
var result = execResult == 0
|
||||||
if (execResult == 0)
|
? (WaitForFrame: false, Terminated: true) // terminated
|
||||||
{
|
: (WaitForFrame: FrameAdvanceRequested, Terminated: false); // yielded
|
||||||
// terminated
|
|
||||||
result.Terminated = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// yielded
|
|
||||||
result.WaitForFrame = FrameAdvanceRequested;
|
|
||||||
}
|
|
||||||
|
|
||||||
FrameAdvanceRequested = false;
|
FrameAdvanceRequested = false;
|
||||||
return result;
|
return result;
|
||||||
|
@ -250,11 +242,5 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
_currThread.Yield(0);
|
_currThread.Yield(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ResumeResult
|
|
||||||
{
|
|
||||||
public bool WaitForFrame { get; set; }
|
|
||||||
public bool Terminated { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue