From f81f41f6f7aac2486bf117016904971c7ee61239 Mon Sep 17 00:00:00 2001 From: feos Date: Thu, 8 Mar 2018 14:44:09 +0300 Subject: [PATCH] tastudio: fix #916 --- .../movie/tasproj/TasMovie.cs | 24 ++++++++----------- .../tools/TAStudio/GreenzoneSettings.cs | 2 +- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs index 7c81db6b9e..e500a1e833 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs @@ -16,29 +16,24 @@ namespace BizHawk.Client.Common private readonly TasStateManager _stateManager; private readonly TasLagLog _lagLog = new TasLagLog(); private readonly Dictionary _inputStateCache = new Dictionary(); - private BackgroundWorker _progressReportWorker; - public new const string Extension = "tasproj"; - public const string DefaultProjectName = "default"; - - public bool LastPositionStable { get; set; } = true; - public string NewBranchText { get; set; } = ""; - public readonly IStringLog VerificationLog = StringLogUtil.MakeStringLog(); // For movies that do not begin with power-on, this is the input required to get into the initial state public readonly TasBranchCollection Branches = new TasBranchCollection(); public readonly TasSession Session; - public TasLagLog TasLagLog => _lagLog; - - public IStringLog InputLog => Log; - + public new const string Extension = "tasproj"; + public const string DefaultProjectName = "default"; + public string NewBranchText { get; set; } = ""; + public int LastEditedFrame { get; set; } = -1; + public bool LastPositionStable { get; set; } = true; public TasMovieMarkerList Markers { get; private set; } - public bool BindMarkersToInput { get; set; } public bool UseInputCache { get; set; } public int CurrentBranch { get; set; } + public TasLagLog TasLagLog => _lagLog; + public IStringLog InputLog => Log; public int BranchCount => Branches.Count; public int LastValidFrame => _lagLog.LastValidFrame; public override string PreferredExtension => Extension; @@ -155,7 +150,8 @@ namespace BizHawk.Client.Common { var anyInvalidated = _lagLog.RemoveFrom(frame); _stateManager.Invalidate(frame + 1); - Changes = true; // TODO check if this actually removed anything before flagging changes + Changes = anyInvalidated; + LastEditedFrame = frame; if (anyInvalidated && Global.MovieSession.Movie.IsCountingRerecords) { @@ -239,7 +235,7 @@ namespace BizHawk.Client.Common if (!_stateManager.HasState(Global.Emulator.Frame)) { - _stateManager.Capture(); + _stateManager.Capture(Global.Emulator.Frame == LastEditedFrame - 1); } } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.cs index 3dcc360e30..b579cba631 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/GreenzoneSettings.cs @@ -34,7 +34,7 @@ namespace BizHawk.Client.EmuHawk _settings.DiskSaveCapacitymb : MemCapacityNumeric.Maximum; MemStateGapDividerNumeric.Maximum = Statable.SaveStateBinary().Length / 1024 / 2 + 1; - MemStateGapDividerNumeric.Minimum = Statable.SaveStateBinary().Length / 1024 / 16; + MemStateGapDividerNumeric.Minimum = Math.Max(Statable.SaveStateBinary().Length / 1024 / 16, 1); MemStateGapDividerNumeric.Value = NumberExtensions.Clamp(_settings.MemStateGapDivider, MemStateGapDividerNumeric.Minimum, MemStateGapDividerNumeric.Maximum);