Tastudio branches - save and load markers to disk
This commit is contained in:
parent
ff0844413c
commit
2f3f5ad465
|
@ -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)]
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -287,7 +287,7 @@ namespace BizHawk.Client.Common
|
|||
});
|
||||
}
|
||||
|
||||
Branches.Load(bl);
|
||||
Branches.Load(bl, this);
|
||||
}
|
||||
|
||||
Changes = false;
|
||||
|
|
Loading…
Reference in New Issue