From b8070bc92fa86cf14b6dcf27418c35b5ff2ed765 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 6 Oct 2012 16:13:45 +0000 Subject: [PATCH] Lua - fix emu.registerbefore() and emu.registerafter() --- BizHawk.MultiClient/MainForm.cs | 15 ++++++++++++--- BizHawk.MultiClient/tools/LuaConsole.cs | 15 ++++++++++++++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 78adcf5c38..2eb67f2bf0 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -2317,8 +2317,11 @@ namespace BizHawk.MultiClient /// public void UpdateToolsBefore() { - +#if WINDOWS + LuaConsole1.StartLuaDrawing(); LuaConsole1.LuaImp.FrameRegisterBefore(); + +#endif NESNameTableViewer1.UpdateValues(); NESPPU1.UpdateValues(); PCEBGViewer1.UpdateValues(); @@ -2335,18 +2338,24 @@ namespace BizHawk.MultiClient public void UpdateToolsAfter() { #if WINDOWS + LuaConsole1.ResumeScripts(true); - Global.DisplayManager.PreFrameUpdateLuaSource(); + #endif RamWatch1.UpdateValues(); RamSearch1.UpdateValues(); HexEditor1.UpdateValues(); //The other tool updates are earlier, TAStudio needs to be later so it can display the latest //frame of execution in its list view. - LuaConsole1.LuaImp.FrameRegisterAfter(); + TAStudio1.UpdateValues(); SNESGraphicsDebugger1.UpdateToolsAfter(); TraceLogger1.UpdateValues(); +#if WINDOWS + LuaConsole1.LuaImp.FrameRegisterAfter(); + Global.DisplayManager.PreFrameUpdateLuaSource(); + LuaConsole1.EndLuaDrawing(); +#endif } private unsafe Image MakeScreenshotImage() diff --git a/BizHawk.MultiClient/tools/LuaConsole.cs b/BizHawk.MultiClient/tools/LuaConsole.cs index d98a964e54..2438b10021 100644 --- a/BizHawk.MultiClient/tools/LuaConsole.cs +++ b/BizHawk.MultiClient/tools/LuaConsole.cs @@ -840,7 +840,10 @@ namespace BizHawk.MultiClient /// should frame waiters be waken up? only use this immediately before a frame of emulation public void ResumeScripts(bool includeFrameWaiters) { - LuaImp.gui_drawNewEmu(); + if (LuaImp.luaSurface == null) + { + LuaImp.gui_drawNewEmu(); + } for (int i = 0; i < luaList.Count; i++) { try @@ -872,6 +875,16 @@ namespace BizHawk.MultiClient else MessageBox.Show(ex.ToString()); } } + //LuaImp.gui_drawFinishEmu(); + } + + public void StartLuaDrawing() + { + LuaImp.gui_drawNewEmu(); + } + + public void EndLuaDrawing() + { LuaImp.gui_drawFinishEmu(); }