Inline LuaLibraries.EnableUpdate/SupressUpdate

"suppress" isn't even speled corectly
This commit is contained in:
YoshiRulz 2020-12-05 06:46:09 +10:00
parent e4a0175351
commit c3c02eaad3
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
4 changed files with 13 additions and 23 deletions

View File

@ -91,13 +91,13 @@ namespace BizHawk.Client.Common
bool wasPaused = MainForm.EmulatorPaused; bool wasPaused = MainForm.EmulatorPaused;
// can't re-enter lua while doing this // can't re-enter lua while doing this
_luaLibsImpl.SupressUpdate(); _luaLibsImpl.IsUpdateSupressed = true;
while (Emulator.Frame != frame) while (Emulator.Frame != frame)
{ {
MainForm.SeekFrameAdvance(); MainForm.SeekFrameAdvance();
} }
_luaLibsImpl.EnableUpdate(); _luaLibsImpl.IsUpdateSupressed = false;
if (!wasPaused) if (!wasPaused)
{ {

View File

@ -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).")] [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) public void Load(string path, bool suppressOSD = false)
{ {
_luaLibsImpl.SupressUpdate(); _luaLibsImpl.IsUpdateSupressed = true;
APIs.SaveState.Load(path, suppressOSD); APIs.SaveState.Load(path, suppressOSD);
_luaLibsImpl.EnableUpdate(); _luaLibsImpl.IsUpdateSupressed = false;
} }
[LuaMethodExample("savestate.loadslot( 7 );")] [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.")] [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) public void LoadSlot(int slotNum, bool suppressOSD = false)
{ {
_luaLibsImpl.SupressUpdate(); _luaLibsImpl.IsUpdateSupressed = true;
APIs.SaveState.LoadSlot(slotNum, suppressOSD); APIs.SaveState.LoadSlot(slotNum, suppressOSD);
_luaLibsImpl.EnableUpdate(); _luaLibsImpl.IsUpdateSupressed = false;
} }
[LuaMethodExample("savestate.save( \"C:\\state.bin\" );")] [LuaMethodExample("savestate.save( \"C:\\state.bin\" );")]

View File

@ -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 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 bool IsUpdateSupressed { get; set; }
public void SupressUpdate()
{
IsUpdateSupressed = true;
}
public void EnableUpdate()
{
IsUpdateSupressed = false;
}
public EventWaitHandle LuaWait { get; protected set; } public EventWaitHandle LuaWait { get; protected set; }

View File

@ -136,7 +136,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (Engaged()) if (Engaged())
{ {
_luaLibsImpl.SupressUpdate(); _luaLibsImpl.IsUpdateSupressed = true;
int f; int f;
if (frame is double frameNumber) if (frame is double frameNumber)
@ -159,7 +159,7 @@ namespace BizHawk.Client.EmuHawk
Tastudio.GoToFrame(f, true); Tastudio.GoToFrame(f, true);
} }
_luaLibsImpl.EnableUpdate(); _luaLibsImpl.IsUpdateSupressed = false;
} }
} }
@ -292,7 +292,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (Engaged()) if (Engaged())
{ {
_luaLibsImpl.SupressUpdate(); _luaLibsImpl.IsUpdateSupressed = true;
if (_changeList.Count > 0) if (_changeList.Count > 0)
{ {
@ -330,7 +330,7 @@ namespace BizHawk.Client.EmuHawk
Tastudio.DoAutoRestore(); Tastudio.DoAutoRestore();
} }
_luaLibsImpl.EnableUpdate(); _luaLibsImpl.IsUpdateSupressed = false;
} }
} }
@ -413,11 +413,11 @@ namespace BizHawk.Client.EmuHawk
{ {
if (Engaged()) if (Engaged())
{ {
_luaLibsImpl.SupressUpdate(); _luaLibsImpl.IsUpdateSupressed = true;
Tastudio.LoadBranchByIndex(index); Tastudio.LoadBranchByIndex(index);
_luaLibsImpl.EnableUpdate(); _luaLibsImpl.IsUpdateSupressed = false;
} }
} }