diff --git a/src/BizHawk.Client.Common/lua/CommonLibs/ClientLuaLibrary.cs b/src/BizHawk.Client.Common/lua/CommonLibs/ClientLuaLibrary.cs index 7270d4bb0c..6b57320eeb 100644 --- a/src/BizHawk.Client.Common/lua/CommonLibs/ClientLuaLibrary.cs +++ b/src/BizHawk.Client.Common/lua/CommonLibs/ClientLuaLibrary.cs @@ -91,13 +91,13 @@ namespace BizHawk.Client.Common bool wasPaused = MainForm.EmulatorPaused; // can't re-enter lua while doing this - _luaLibsImpl.SupressUpdate(); + _luaLibsImpl.IsUpdateSupressed = true; while (Emulator.Frame != frame) { MainForm.SeekFrameAdvance(); } - _luaLibsImpl.EnableUpdate(); + _luaLibsImpl.IsUpdateSupressed = false; if (!wasPaused) { diff --git a/src/BizHawk.Client.Common/lua/CommonLibs/SaveStateLuaLibrary.cs b/src/BizHawk.Client.Common/lua/CommonLibs/SaveStateLuaLibrary.cs index 5e5e659c13..0845b16808 100644 --- a/src/BizHawk.Client.Common/lua/CommonLibs/SaveStateLuaLibrary.cs +++ b/src/BizHawk.Client.Common/lua/CommonLibs/SaveStateLuaLibrary.cs @@ -13,22 +13,22 @@ namespace BizHawk.Client.Common [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) { - _luaLibsImpl.SupressUpdate(); + _luaLibsImpl.IsUpdateSupressed = true; APIs.SaveState.Load(path, suppressOSD); - _luaLibsImpl.EnableUpdate(); + _luaLibsImpl.IsUpdateSupressed = false; } [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) { - _luaLibsImpl.SupressUpdate(); + _luaLibsImpl.IsUpdateSupressed = true; APIs.SaveState.LoadSlot(slotNum, suppressOSD); - _luaLibsImpl.EnableUpdate(); + _luaLibsImpl.IsUpdateSupressed = false; } [LuaMethodExample("savestate.save( \"C:\\state.bin\" );")] diff --git a/src/BizHawk.Client.Common/lua/LuaLibraries.cs b/src/BizHawk.Client.Common/lua/LuaLibraries.cs index 717e875f04..0c3e231698 100644 --- a/src/BizHawk.Client.Common/lua/LuaLibraries.cs +++ b/src/BizHawk.Client.Common/lua/LuaLibraries.cs @@ -23,17 +23,7 @@ namespace BizHawk.Client.Common public bool IsRebootingCore { get; set; } // pretty hacky.. we don't want a lua script to be able to restart itself by rebooting the core - public bool IsUpdateSupressed { get; private set;} - - public void SupressUpdate() - { - IsUpdateSupressed = true; - } - - public void EnableUpdate() - { - IsUpdateSupressed = false; - } + public bool IsUpdateSupressed { get; set; } public EventWaitHandle LuaWait { get; protected set; } diff --git a/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/TAStudioLuaLibrary.cs b/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/TAStudioLuaLibrary.cs index 77aaaf0ab5..aa5a4dbf13 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/TAStudioLuaLibrary.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Lua/Libraries/TAStudioLuaLibrary.cs @@ -136,7 +136,7 @@ namespace BizHawk.Client.EmuHawk { if (Engaged()) { - _luaLibsImpl.SupressUpdate(); + _luaLibsImpl.IsUpdateSupressed = true; int f; if (frame is double frameNumber) @@ -159,7 +159,7 @@ namespace BizHawk.Client.EmuHawk Tastudio.GoToFrame(f, true); } - _luaLibsImpl.EnableUpdate(); + _luaLibsImpl.IsUpdateSupressed = false; } } @@ -292,7 +292,7 @@ namespace BizHawk.Client.EmuHawk { if (Engaged()) { - _luaLibsImpl.SupressUpdate(); + _luaLibsImpl.IsUpdateSupressed = true; if (_changeList.Count > 0) { @@ -330,7 +330,7 @@ namespace BizHawk.Client.EmuHawk Tastudio.DoAutoRestore(); } - _luaLibsImpl.EnableUpdate(); + _luaLibsImpl.IsUpdateSupressed = false; } } @@ -413,11 +413,11 @@ namespace BizHawk.Client.EmuHawk { if (Engaged()) { - _luaLibsImpl.SupressUpdate(); + _luaLibsImpl.IsUpdateSupressed = true; Tastudio.LoadBranchByIndex(index); - _luaLibsImpl.EnableUpdate(); + _luaLibsImpl.IsUpdateSupressed = false; } }