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;
// 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)
{

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).")]
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\" );")]

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 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; }

View File

@ -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;
}
}