From 4fd55da52a4c2f3aed1244dbde0cb27dc5cbbce2 Mon Sep 17 00:00:00 2001 From: feos Date: Sun, 13 Sep 2015 11:44:15 +0300 Subject: [PATCH] tastudio: various fixes. - saving and loading tasproj markers - flagging changes after branch operations - clearing InputRoll selection --- BizHawk.Client.Common/BinarySaveStates.cs | 2 +- BizHawk.Client.Common/movie/tasproj/TasBranch.cs | 8 +++++++- BizHawk.Client.Common/movie/tasproj/TasMovie.cs | 9 +++++++-- BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs | 4 +++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/BizHawk.Client.Common/BinarySaveStates.cs b/BizHawk.Client.Common/BinarySaveStates.cs index aea80e74d8..71ef1668f9 100644 --- a/BizHawk.Client.Common/BinarySaveStates.cs +++ b/BizHawk.Client.Common/BinarySaveStates.cs @@ -62,7 +62,7 @@ namespace BizHawk.Client.Common public static BinaryStateLump BranchLagLog { get; private set; } [Name("Branches\\Header", "json")] public static BinaryStateLump BranchHeader { get; private set; } - [Name("Branches\\Markers", "markers")] + [Name("Branches\\Markers", "txt")] public static BinaryStateLump BranchMarkers { get; private set; } diff --git a/BizHawk.Client.Common/movie/tasproj/TasBranch.cs b/BizHawk.Client.Common/movie/tasproj/TasBranch.cs index ae4c1a18f3..eff17981e6 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasBranch.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasBranch.cs @@ -40,20 +40,24 @@ namespace BizHawk.Client.Common TimeStamp = b.TimeStamp })); }); + bs.PutLump(ncore, delegate(Stream s) { s.Write(b.CoreData, 0, b.CoreData.Length); }); + bs.PutLump(ninput, delegate(TextWriter tw) { foreach (var line in b.InputLog) tw.WriteLine(line); }); + bs.PutLump(nframebuffer, delegate(Stream s) { var vp = new BitmapBufferVideoProvider(b.OSDFrameBuffer); QuickBmpFile.Save(vp, s, b.OSDFrameBuffer.Width, b.OSDFrameBuffer.Height); }); + bs.PutLump(nlaglog, delegate(BinaryWriter bw) { b.LagLog.Save(bw); @@ -69,6 +73,7 @@ namespace BizHawk.Client.Common ninput.Increment(); nframebuffer.Increment(); nlaglog.Increment(); + nmarkers.Increment(); } } @@ -79,7 +84,7 @@ namespace BizHawk.Client.Common var ninput = new IndexedStateLump(BinaryStateLump.BranchInputLog); var nframebuffer = new IndexedStateLump(BinaryStateLump.BranchFrameBuffer); var nlaglog = new IndexedStateLump(BinaryStateLump.BranchLagLog); - var nmarkers = new IndexedStateLump(BinaryStateLump.Markers); + var nmarkers = new IndexedStateLump(BinaryStateLump.BranchMarkers); Clear(); @@ -154,6 +159,7 @@ namespace BizHawk.Client.Common ninput.Increment(); nframebuffer.Increment(); nlaglog.Increment(); + nmarkers.Increment(); } } } diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs index 3ef7c94476..01307aa681 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs @@ -473,15 +473,16 @@ namespace BizHawk.Client.Common int? divergentPoint = DivergantPoint(_log, branch.InputLog); _log = branch.InputLog.ToList(); - _changes = true; + //_changes = true; LagLog.FromLagLog(branch.LagLog); StateManager.LoadBranch(Branches.IndexOf(branch)); StateManager.SetState(branch.Frame, branch.CoreData); - ChangeLog = branch.ChangeLog; + //ChangeLog = branch.ChangeLog; Markers = branch.Markers; + Changes = true; } // TODO: use LogGenerators rather than string comparisons @@ -508,12 +509,14 @@ namespace BizHawk.Client.Common { Branches.Add(branch); TasStateManager.AddBranch(); + Changes = true; } public void RemoveBranch(TasBranch branch) { TasStateManager.RemoveBranch(Branches.IndexOf(branch)); Branches.Remove(branch); + Changes = true; } public void UpdateBranch(TasBranch old, TasBranch newBranch) @@ -521,6 +524,7 @@ namespace BizHawk.Client.Common int index = Branches.IndexOf(old); Branches[index] = newBranch; TasStateManager.UpdateBranch(index); + Changes = true; } public void SwapBranches(int b1, int b2) @@ -532,6 +536,7 @@ namespace BizHawk.Client.Common Branches.Remove(branch); Branches.Insert(b2, branch); + Changes = true; } } } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index c39779945a..85ced34cad 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -453,9 +453,11 @@ namespace BizHawk.Client.EmuHawk CurrentTasMovie.ClearChanges(); // Don't ask to save changes here. HandleMovieLoadStuff(); CurrentTasMovie.TasStateManager.Capture(); // Capture frame 0 always. - + // clear all selections + TasView.DeselectAll(); BookMarkControl.Restart(); MarkerControl.Restart(); + RefreshDialog(); } }