diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs index d337430210..c32908ae32 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs @@ -459,26 +459,18 @@ namespace BizHawk.Client.Common { int? divergentPoint = DivergantPoint(_log, branch.InputLog); - _log = branch.InputLog.ToList(); + _log = branch.InputLog; _changes = true; LagLog.FromLagLog(branch.LagLog); if (divergentPoint.HasValue) - { StateManager.Invalidate(divergentPoint.Value); - - // For now, even though we loaded the lag log, we are invalidating it the same as savestates to show the user the space isn't navigatable without re-emulating - LagLog.RemoveFrom(divergentPoint.Value); - } else - { StateManager.Invalidate(branch.InputLog.Count); - } StateManager.SetState(branch.Frame, branch.CoreData); - // TODO: we save the changelog, but not to disk, also this may not be intended behavior - //ChangeLog = branch.ChangeLog; + ChangeLog = branch.ChangeLog; } // TODO: use LogGenerators rather than string comparisons diff --git a/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs b/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs index ccf7a4ea6c..8cac9f61e6 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasStateManager.cs @@ -292,6 +292,9 @@ namespace BizHawk.Client.Common } private void StateAccessed(int index) { + if (index == 0 && _movie.StartsFromSavestate) + return; + bool removed = accessed.Remove(index); accessed.Add(index); @@ -355,31 +358,39 @@ namespace BizHawk.Client.Common accessed.Clear(); Used = 0; DiskUsed = 0; + clearDiskStates(); } - public void ClearStateHistory() { if (States.Any()) { KeyValuePair power = States.FirstOrDefault(s => s.Key == 0); - if (power.Value == null) - { - StateAccessed(power.Key); + StateAccessed(power.Key); + if (power.Value == null) // if it was on disk power = States.FirstOrDefault(s => s.Key == 0); - } + States.Clear(); accessed.Clear(); - if (power.Value.Length > 0) + if (power.Value != null) // savestate-anchored movie? { SetState(0, power.Value); Used = (ulong)power.Value.Length; } else - { Used = 0; - DiskUsed = 0; - } + + DiskUsed = 0; + clearDiskStates(); + } + } + private void clearDiskStates() + { + string path = PathManager.MakeAbsolutePath(Global.Config.PathEntries["Global", "TAStudio states"].Path, null); + if (Directory.Exists(path)) + { + Directory.Delete(path, true); + Directory.CreateDirectory(path); } } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs index 00ee2d4949..b3f1981f0b 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs @@ -220,7 +220,7 @@ namespace BizHawk.Client.EmuHawk public void Branch() { - var branch = CreateBranch(); + TasBranch branch = CreateBranch(); Branches.Add(branch); BranchView.RowCount = Branches.Count; CurrentBranch = Branches.IndexOf(branch); diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index 5ee64f2215..c37973cdd2 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -42,6 +42,11 @@ namespace BizHawk.Client.EmuHawk Size = new Size(256, 240), }; + public string statesPath + { + get { return PathManager.MakeAbsolutePath(Global.Config.PathEntries["Global", "TAStudio states"].Path, null); } + } + [ConfigPersist] public TAStudioSettings Settings { get; set; } @@ -517,8 +522,8 @@ namespace BizHawk.Client.EmuHawk Global.Config.MovieEndAction = _originalEndAction; GlobalWin.MainForm.SetMainformMovieInfo(); // Do not keep TAStudio's disk save states. - if (Directory.Exists(PathManager.MakeAbsolutePath(Global.Config.PathEntries["Global", "TAStudio states"].Path, null))) - Directory.Delete(PathManager.MakeAbsolutePath(Global.Config.PathEntries["Global", "TAStudio states"].Path, null), true); + if (Directory.Exists(statesPath)) + Directory.Delete(statesPath, true); } ///