make tastudio.setplayback correctly restore the recording flag after it finishes seeking from the greenzone to the target frame
This commit is contained in:
parent
136c071ee8
commit
ea2188dc46
|
@ -518,7 +518,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
// autohold/autofire must not be affected by the following inputs
|
||||
Global.ActiveController.Overrides(Global.LuaAndAdaptor);
|
||||
|
||||
if (GlobalWin.Tools.Has<LuaConsole>())
|
||||
if (GlobalWin.Tools.Has<LuaConsole>() && !SuppressLua)
|
||||
{
|
||||
GlobalWin.Tools.LuaConsole.ResumeScripts(false);
|
||||
}
|
||||
|
@ -626,6 +626,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
public bool TurboFastForward = false;
|
||||
public bool RestoreReadWriteOnStop = false;
|
||||
|
||||
//runloop won't exec lua
|
||||
public bool SuppressLua;
|
||||
|
||||
public long MouseWheelTracker;
|
||||
|
||||
private int? _pauseOnFrame;
|
||||
|
@ -639,7 +642,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (value == null) // TODO: make an Event handler instead, but the logic here is that after turbo seeking, tools will want to do a real update when the emulator finally pauses
|
||||
{
|
||||
bool skipScripts = !(Global.Config.TurboSeek && !Global.Config.RunLuaDuringTurbo);
|
||||
bool skipScripts = !(Global.Config.TurboSeek && !Global.Config.RunLuaDuringTurbo && !SuppressLua);
|
||||
GlobalWin.Tools.UpdateToolsBefore(skipScripts);
|
||||
GlobalWin.Tools.UpdateToolsAfter(skipScripts);
|
||||
}
|
||||
|
@ -2694,6 +2697,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
StepRunLoop_Core(true);
|
||||
}
|
||||
|
||||
public void SeekFrameAdvance()
|
||||
{
|
||||
PressFrameAdvance = true;
|
||||
StepRunLoop_Core(true);
|
||||
PressFrameAdvance = false;
|
||||
}
|
||||
|
||||
public bool IsLagFrame
|
||||
{
|
||||
get
|
||||
|
@ -2784,7 +2794,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Global.ClickyVirtualPadController.FrameTick();
|
||||
Global.LuaAndAdaptor.FrameTick();
|
||||
|
||||
if (GlobalWin.Tools.Has<LuaConsole>())
|
||||
if (GlobalWin.Tools.Has<LuaConsole>() && !SuppressLua)
|
||||
{
|
||||
GlobalWin.Tools.LuaConsole.LuaImp.CallFrameBeforeEvent();
|
||||
}
|
||||
|
@ -2852,7 +2862,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
PressFrameAdvance = false;
|
||||
|
||||
if (GlobalWin.Tools.Has<LuaConsole>())
|
||||
if (GlobalWin.Tools.Has<LuaConsole>() && !SuppressLua)
|
||||
{
|
||||
GlobalWin.Tools.LuaConsole.LuaImp.CallFrameAfterEvent();
|
||||
}
|
||||
|
@ -2863,7 +2873,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
UpdateToolsAfter();
|
||||
UpdateToolsAfter(SuppressLua);
|
||||
}
|
||||
|
||||
if (GlobalWin.Tools.IsLoaded<TAStudio>() &&
|
||||
|
|
|
@ -167,7 +167,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (frame is double) f = (int)(double)frame;
|
||||
else
|
||||
{
|
||||
//r marker = Tastudio.CurrentTasMovie.Markers.Get(frame);
|
||||
f = Tastudio.CurrentTasMovie.Markers.FindIndex((string)frame);
|
||||
if (f == -1) return;
|
||||
f = Tastudio.CurrentTasMovie.Markers[f].Frame;
|
||||
|
|
|
@ -819,6 +819,31 @@ namespace BizHawk.Client.EmuHawk
|
|||
LoadState(closestState);
|
||||
}
|
||||
|
||||
if (fromLua)
|
||||
{
|
||||
bool wasPaused = Mainform.EmulatorPaused;
|
||||
|
||||
//why not use this? because I'm not letting the form freely run. it all has to be under this loop.
|
||||
//i could use this and then poll StepRunLoop_Core() repeatedly, but.. that's basically what I'm doing
|
||||
//PauseOnFrame = frame;
|
||||
|
||||
//can't re-enter lua while doing this
|
||||
Mainform.SuppressLua = true;
|
||||
while (Emulator.Frame != frame)
|
||||
Mainform.SeekFrameAdvance();
|
||||
Mainform.SuppressLua = false;
|
||||
|
||||
if(!wasPaused) Mainform.UnpauseEmulator();
|
||||
|
||||
//lua botting users will want to re-activate record mode automatically -- it should be like nothing ever happened
|
||||
if (_wasRecording)
|
||||
{
|
||||
TastudioRecordMode();
|
||||
}
|
||||
|
||||
//now the next section won't happen since we're at the right spot
|
||||
}
|
||||
|
||||
// frame == Emualtor.Frame when frame == 0
|
||||
if (frame > Emulator.Frame)
|
||||
{
|
||||
|
@ -828,13 +853,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
if (_wasRecording)
|
||||
{
|
||||
//lua botting users will want to re-activate record mode automatically -- it should be like nothing ever happened
|
||||
//GUI users on the other hand need to be protected from clobbering their video when skipping around
|
||||
if(fromLua)
|
||||
TastudioRecordMode();
|
||||
}
|
||||
//GUI users hand need to be protected from clobbering their video when skipping around
|
||||
//so we don't re-enable recording
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue