diff --git a/BizHawk.Client.Common/BinarySaveStates.cs b/BizHawk.Client.Common/BinarySaveStates.cs index d413c9f901..aea80e74d8 100644 --- a/BizHawk.Client.Common/BinarySaveStates.cs +++ b/BizHawk.Client.Common/BinarySaveStates.cs @@ -62,6 +62,8 @@ 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")] + public static BinaryStateLump BranchMarkers { get; private set; } [AttributeUsage(AttributeTargets.Property)] diff --git a/BizHawk.Client.Common/movie/tasproj/TasBranch.cs b/BizHawk.Client.Common/movie/tasproj/TasBranch.cs index db57c16f3b..ae4c1a18f3 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasBranch.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasBranch.cs @@ -28,6 +28,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.BranchMarkers); foreach (var b in this) { bs.PutLump(nheader, delegate(TextWriter tw) @@ -58,6 +59,11 @@ namespace BizHawk.Client.Common b.LagLog.Save(bw); }); + bs.PutLump(nmarkers, delegate (TextWriter tw) + { + tw.WriteLine(b.Markers.ToString()); + }); + nheader.Increment(); ncore.Increment(); ninput.Increment(); @@ -66,13 +72,14 @@ namespace BizHawk.Client.Common } } - public void Load(BinaryStateLoader bl) + public void Load(BinaryStateLoader bl, TasMovie movie) { var nheader = new IndexedStateLump(BinaryStateLump.BranchHeader); var ncore = new IndexedStateLump(BinaryStateLump.BranchCoreData); var ninput = new IndexedStateLump(BinaryStateLump.BranchInputLog); var nframebuffer = new IndexedStateLump(BinaryStateLump.BranchFrameBuffer); var nlaglog = new IndexedStateLump(BinaryStateLump.BranchLagLog); + var nmarkers = new IndexedStateLump(BinaryStateLump.Markers); Clear(); @@ -127,6 +134,19 @@ namespace BizHawk.Client.Common b.LagLog.Load(br); }); + b.Markers = new TasMovieMarkerList(movie); + bl.GetLump(nmarkers, false, delegate (TextReader tr) + { + string line; + while ((line = tr.ReadLine()) != null) + { + if (!string.IsNullOrWhiteSpace(line)) + { + b.Markers.Add(new TasMovieMarker(line)); + } + } + }); + Add(b); nheader.Increment(); diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs index fe8dbf7d9b..ecd20f53de 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs @@ -287,7 +287,7 @@ namespace BizHawk.Client.Common }); } - Branches.Load(bl); + Branches.Load(bl, this); } Changes = false;