small optimization
This commit is contained in:
parent
bc39f81b8a
commit
cc82bfbefc
|
@ -847,23 +847,23 @@ namespace BizHawk.MultiClient
|
||||||
/// <param name="includeFrameWaiters">should frame waiters be waken up? only use this immediately before a frame of emulation</param>
|
/// <param name="includeFrameWaiters">should frame waiters be waken up? only use this immediately before a frame of emulation</param>
|
||||||
public void ResumeScripts(bool includeFrameWaiters)
|
public void ResumeScripts(bool includeFrameWaiters)
|
||||||
{
|
{
|
||||||
foreach (var s in luaList)
|
for (int i = 0; i < luaList.Count; i++)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LuaImp.gui_drawNewEmu();
|
LuaImp.gui_drawNewEmu();
|
||||||
//LuaImp.gui_clearGraphics();
|
//LuaImp.gui_clearGraphics();
|
||||||
if (s.Enabled && s.Thread != null && !s.Paused)
|
if (luaList[i].Enabled && luaList[i].Thread != null && !(luaList[i].Paused))
|
||||||
{
|
{
|
||||||
bool prohibit = false;
|
bool prohibit = false;
|
||||||
if (s.FrameWaiting && !includeFrameWaiters)
|
if (luaList[i].FrameWaiting && !includeFrameWaiters)
|
||||||
prohibit = true;
|
prohibit = true;
|
||||||
|
|
||||||
if (!prohibit)
|
if (!prohibit)
|
||||||
{
|
{
|
||||||
var result = LuaImp.ResumeScript(s.Thread);
|
var result = LuaImp.ResumeScript(luaList[i].Thread);
|
||||||
if(result.Terminated) s.Stop();
|
if (result.Terminated) luaList[i].Stop();
|
||||||
s.FrameWaiting = result.WaitForFrame;
|
luaList[i].FrameWaiting = result.WaitForFrame;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LuaImp.gui_drawFinishEmu();
|
LuaImp.gui_drawFinishEmu();
|
||||||
|
@ -872,8 +872,8 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
if (ex is LuaInterface.LuaScriptException || ex is LuaInterface.LuaException)
|
if (ex is LuaInterface.LuaScriptException || ex is LuaInterface.LuaException)
|
||||||
{
|
{
|
||||||
s.Enabled = false;
|
luaList[i].Enabled = false;
|
||||||
s.Thread = null;
|
luaList[i].Thread = null;
|
||||||
AddText(ex.ToString());
|
AddText(ex.ToString());
|
||||||
UpdateNumberOfScripts();
|
UpdateNumberOfScripts();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue