diff --git a/BizHawk.Client.Common/BinarySaveStates.cs b/BizHawk.Client.Common/BinarySaveStates.cs index 17a19c6ff2..a4c93a35f9 100644 --- a/BizHawk.Client.Common/BinarySaveStates.cs +++ b/BizHawk.Client.Common/BinarySaveStates.cs @@ -26,7 +26,8 @@ namespace BizHawk.Client.Common Greenzone, GreenzoneSettings, Markers, - ClientSettings + ClientSettings, + VerificationLog } public static class BinaryStateFileNames @@ -61,6 +62,7 @@ namespace BizHawk.Client.Common AddLumpName(BinaryStateLump.GreenzoneSettings, "GreenZoneSettings.txt"); AddLumpName(BinaryStateLump.Markers, "Markers.txt"); AddLumpName(BinaryStateLump.ClientSettings, "ClientSettings.json"); + AddLumpName(BinaryStateLump.VerificationLog, "VerificationLog.txt"); } public static string GetReadName(BinaryStateLump lump) diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs index 2fd389cf31..255fcfa045 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs @@ -1,6 +1,8 @@ using System; +using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text; using BizHawk.Common; using BizHawk.Common.CollectionExtensions; @@ -30,7 +32,8 @@ namespace BizHawk.Client.Common bs.PutLump(BinaryStateLump.Input, tw => tw.WriteLine(RawInputLog())); - + // TasProj extras + bs.PutLump(BinaryStateLump.GreenzoneSettings, tw => tw.WriteLine(StateManager.Settings.ToString())); if (StateManager.Settings.SaveGreenzone) { @@ -57,6 +60,11 @@ namespace BizHawk.Client.Common var clientSettingsJson = ClientSettingsForSave(); bs.PutLump(BinaryStateLump.ClientSettings, (TextWriter tw) => tw.Write(clientSettingsJson)); } + + if (VerificationLog.Any()) + { + bs.PutLump(BinaryStateLump.VerificationLog, tw => tw.WriteLine(InputLogToString(VerificationLog))); + } } Changes = false; @@ -200,6 +208,27 @@ namespace BizHawk.Client.Common GetClientSettingsOnLoad(clientSettings); } + + if (bl.HasLump(BinaryStateLump.VerificationLog)) + { + bl.GetLump(BinaryStateLump.VerificationLog, true, delegate(TextReader tr) + { + VerificationLog.Clear(); + while (true) + { + var line = tr.ReadLine(); + if (string.IsNullOrEmpty(line)) + { + break; + } + + if (line.StartsWith("|")) + { + VerificationLog.Add(line); + } + } + }); + } } Changes = false; @@ -212,5 +241,16 @@ namespace BizHawk.Client.Common StateManager.Clear(); Markers.Clear(); } + + private static string InputLogToString(List log) + { + var sb = new StringBuilder(); + foreach (var record in log) + { + sb.AppendLine(record); + } + + return sb.ToString(); + } } } diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs index c8b3f260e9..c14fb80d43 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs @@ -18,6 +18,7 @@ namespace BizHawk.Client.Common private readonly TasStateManager StateManager; private readonly List LagLog = new List(); private readonly Dictionary InputStateCache = new Dictionary(); + private readonly List VerificationLog = new List(); // For movies that do not begin with power-on, this is the input required to get into the initial state public TasMovie(string path, bool startsFromSavestate = false) : base(path) {