tastudio: refactor out a variable

fix autorestore triggering while drawing on future frames
This commit is contained in:
feos 2019-06-12 22:34:16 +03:00
parent b90e4b9838
commit bc990061b7
4 changed files with 8 additions and 22 deletions

View File

@ -146,8 +146,6 @@ namespace BizHawk.Client.Common
{ {
_lagLog.Clear(); _lagLog.Clear();
_wasLag.Clear(); _wasLag.Clear();
////if (br.BaseStream.Length > 0)
////{ BaseStream.Length does not return the expected value.
int formatVersion = br.ReadByte(); int formatVersion = br.ReadByte();
if (formatVersion == 0) if (formatVersion == 0)
{ {
@ -175,7 +173,6 @@ namespace BizHawk.Client.Common
_wasLag.Add(br.ReadBoolean()); _wasLag.Add(br.ReadBoolean());
} }
} }
////}
} }
public bool? History(int frame) public bool? History(int frame)
@ -193,19 +190,6 @@ namespace BizHawk.Client.Common
return null; return null;
} }
public int LastValidFrame
{
get
{
if (_lagLog.Count == 0)
{
return 0;
}
return _lagLog.Count - 1;
}
}
public TasLagLog Clone() public TasLagLog Clone()
{ {
return new TasLagLog return new TasLagLog

View File

@ -35,7 +35,7 @@ namespace BizHawk.Client.Common
public TasLagLog TasLagLog => _lagLog; public TasLagLog TasLagLog => _lagLog;
public IStringLog InputLog => Log; public IStringLog InputLog => Log;
public int BranchCount => Branches.Count; public int BranchCount => Branches.Count;
public int LastValidFrame => _lagLog.LastValidFrame; public int LastStatedFrame => _stateManager.LastStatedFrame;
public override string PreferredExtension => Extension; public override string PreferredExtension => Extension;
public TasStateManager TasStateManager => _stateManager; public TasStateManager TasStateManager => _stateManager;
@ -225,7 +225,9 @@ namespace BizHawk.Client.Common
public void GreenzoneCurrentFrame() public void GreenzoneCurrentFrame()
{ {
if (Global.Emulator.Frame > LastValidFrame) // todo: this isn't working quite right when autorestore is off and we're editing while seeking
// but accounting for that requires access to Mainform.IsSeeking
if (Global.Emulator.Frame > LastEditedFrame)
{ {
// emulated a new frame, current editing segment may change now. taseditor logic // emulated a new frame, current editing segment may change now. taseditor logic
LastPositionStable = false; LastPositionStable = false;

View File

@ -66,9 +66,9 @@ namespace BizHawk.Client.EmuHawk
public void JumpToGreenzone() public void JumpToGreenzone()
{ {
if (Emulator.Frame > CurrentTasMovie.LastValidFrame) if (Emulator.Frame > CurrentTasMovie.LastEditedFrame)
{ {
GoToLastEmulatedFrameIfNecessary(CurrentTasMovie.LastValidFrame); GoToLastEmulatedFrameIfNecessary(CurrentTasMovie.LastEditedFrame);
} }
else else
{ {
@ -1132,7 +1132,7 @@ namespace BizHawk.Client.EmuHawk
if (!Settings.AutoRestoreOnMouseUpOnly) if (!Settings.AutoRestoreOnMouseUpOnly)
{ {
_triggerAutoRestore = true; _triggerAutoRestore = startVal < Emulator.Frame && endVal < Emulator.Frame;
DoTriggeredAutoRestoreIfNeeded(); DoTriggeredAutoRestoreIfNeeded();
} }
} }

View File

@ -807,7 +807,7 @@ namespace BizHawk.Client.EmuHawk
GoToFrame(0); GoToFrame(0);
int lastState = 0; int lastState = 0;
int goToFrame = CurrentTasMovie.TasStateManager.LastStatedFrame; int goToFrame = CurrentTasMovie.LastStatedFrame;
do do
{ {
Mainform.FrameAdvance(); Mainform.FrameAdvance();