From 01fd28f4b0ff83b72efaf3fc6d518bf849d364a2 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 14 Jun 2014 00:42:45 +0000 Subject: [PATCH] Some bk2 progress --- BizHawk.Client.Common/BinarySaveStates.cs | 4 +++- .../movie/bk2/Bk2Movie.HeaderApi.cs | 23 ++++++------------- .../movie/bk2/Bk2Movie.IO.cs | 3 +++ 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/BizHawk.Client.Common/BinarySaveStates.cs b/BizHawk.Client.Common/BinarySaveStates.cs index f8d7b9498e..7b8e13cb6c 100644 --- a/BizHawk.Client.Common/BinarySaveStates.cs +++ b/BizHawk.Client.Common/BinarySaveStates.cs @@ -17,7 +17,8 @@ namespace BizHawk.Client.Common // Only for movies they probably shoudln't be leaching this stuff Movieheader, Comments, - Subtitles + Subtitles, + SyncSettings } public class BinaryStateFileNames @@ -46,6 +47,7 @@ namespace BizHawk.Client.Common // Only for movies they probably shoudln't be leaching this stuff LumpNames[BinaryStateLump.Comments] = "Comments"; LumpNames[BinaryStateLump.Subtitles] = "Subtitles"; + LumpNames[BinaryStateLump.SyncSettings] = "SyncSettings"; } public static string Get(BinaryStateLump lump) diff --git a/BizHawk.Client.Common/movie/bk2/Bk2Movie.HeaderApi.cs b/BizHawk.Client.Common/movie/bk2/Bk2Movie.HeaderApi.cs index 9d7cc454a1..92cd49c37f 100644 --- a/BizHawk.Client.Common/movie/bk2/Bk2Movie.HeaderApi.cs +++ b/BizHawk.Client.Common/movie/bk2/Bk2Movie.HeaderApi.cs @@ -8,6 +8,9 @@ namespace BizHawk.Client.Common public partial class Bk2Movie : IMovie { private readonly Bk2Header Header = new Bk2Header(); + private string _syncSettingsJson = string.Empty; + private string _savestateBlob = string.Empty; + public IDictionary HeaderEntries { @@ -19,32 +22,20 @@ namespace BizHawk.Client.Common public string SyncSettingsJson { - get { return Header[HeaderKeys.SYNCSETTINGS]; } - set { Header[HeaderKeys.SYNCSETTINGS] = value; } + get { return _syncSettingsJson; } + set { _syncSettingsJson = value; } } public string SavestateBinaryBase64Blob { get { - if (Header.ContainsKey(HeaderKeys.SAVESTATEBINARYBASE64BLOB)) - { - return Header[HeaderKeys.SAVESTATEBINARYBASE64BLOB]; - } - - return null; + return _savestateBlob; } set { - if (value == null) - { - Header.Remove(HeaderKeys.SAVESTATEBINARYBASE64BLOB); - } - else - { - Header.Add(HeaderKeys.SAVESTATEBINARYBASE64BLOB, value); - } + _savestateBlob = value; } } diff --git a/BizHawk.Client.Common/movie/bk2/Bk2Movie.IO.cs b/BizHawk.Client.Common/movie/bk2/Bk2Movie.IO.cs index 3bb1715331..cbb794df07 100644 --- a/BizHawk.Client.Common/movie/bk2/Bk2Movie.IO.cs +++ b/BizHawk.Client.Common/movie/bk2/Bk2Movie.IO.cs @@ -54,6 +54,8 @@ namespace BizHawk.Client.Common _log.Clear(); Subtitles.Clear(); Comments.Clear(); + _syncSettingsJson = string.Empty; + _savestateBlob = string.Empty; } throw new NotImplementedException(); @@ -76,6 +78,7 @@ namespace BizHawk.Client.Common bs.PutLump(BinaryStateLump.Comments, (tw) => tw.WriteLine(CommentsString())); bs.PutLump(BinaryStateLump.Subtitles, (tw) => tw.WriteLine(Subtitles.ToString())); + bs.PutLump(BinaryStateLump.SyncSettings, (tw) => tw.WriteLine(_syncSettingsJson)); if (StartsFromSavestate) {