diff --git a/BizHawk.Client.Common/BinarySaveStates.cs b/BizHawk.Client.Common/BinarySaveStates.cs index 22712d7a42..fa55374fc4 100644 --- a/BizHawk.Client.Common/BinarySaveStates.cs +++ b/BizHawk.Client.Common/BinarySaveStates.cs @@ -231,13 +231,6 @@ namespace BizHawk.Client.Common } } - [Obsolete] - public bool HasLump(BinaryStateLump lump) - { - ZipEntry e; - return _entriesbyname.TryGetValue(lump.ReadName, out e); - } - /// /// Gets a lump /// diff --git a/BizHawk.Client.Common/SavestateManager.cs b/BizHawk.Client.Common/SavestateManager.cs index 9b69e86ccc..561c75606b 100644 --- a/BizHawk.Client.Common/SavestateManager.cs +++ b/BizHawk.Client.Common/SavestateManager.cs @@ -173,30 +173,29 @@ namespace BizHawk.Client.Common bl.GetLump(BinaryStateLump.Framebuffer, false, PopulateFramebuffer); - if (bl.HasLump(BinaryStateLump.UserData)) + string userData = string.Empty; + bl.GetLump(BinaryStateLump.UserData, false, delegate(TextReader tr) { - string userData = string.Empty; - bl.GetLump(BinaryStateLump.UserData, false, delegate(TextReader tr) + string line; + while ((line = tr.ReadLine()) != null) { - string line; - while ((line = tr.ReadLine()) != null) + if (!string.IsNullOrWhiteSpace(line)) { - if (!string.IsNullOrWhiteSpace(line)) - { - userData = line; - } + userData = line; } - }); + } + }); + if (!string.IsNullOrWhiteSpace(userData)) + { Global.UserBag = (Dictionary)ConfigService.LoadWithType(userData); } - if (bl.HasLump(BinaryStateLump.LagLog) - && Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie is TasMovie) + if (Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie is TasMovie) { bl.GetLump(BinaryStateLump.LagLog, false, delegate(BinaryReader br, long length) { - (Global.MovieSession.Movie as TasMovie).TasLagLog.Load(br); + ((TasMovie)Global.MovieSession.Movie).TasLagLog.Load(br); }); } } diff --git a/BizHawk.Client.Common/movie/bk2/Bk2Movie.IO.cs b/BizHawk.Client.Common/movie/bk2/Bk2Movie.IO.cs index f2e0c805fb..74eb23a73a 100644 --- a/BizHawk.Client.Common/movie/bk2/Bk2Movie.IO.cs +++ b/BizHawk.Client.Common/movie/bk2/Bk2Movie.IO.cs @@ -70,51 +70,43 @@ namespace BizHawk.Client.Common } }); - if (bl.HasLump(BinaryStateLump.Comments)) + bl.GetLump(BinaryStateLump.Comments, false, delegate(TextReader tr) { - bl.GetLump(BinaryStateLump.Comments, true, delegate(TextReader tr) + string line; + while ((line = tr.ReadLine()) != null) { - string line; - while ((line = tr.ReadLine()) != null) + if (!string.IsNullOrWhiteSpace(line)) { - if (!string.IsNullOrWhiteSpace(line)) - { - Comments.Add(line); - } + Comments.Add(line); } - }); - } + } + }); - if (bl.HasLump(BinaryStateLump.Subtitles)) + bl.GetLump(BinaryStateLump.Subtitles, false, delegate(TextReader tr) { - bl.GetLump(BinaryStateLump.Subtitles, true, delegate(TextReader tr) + string line; + while ((line = tr.ReadLine()) != null) { - string line; - while ((line = tr.ReadLine()) != null) + if (!string.IsNullOrWhiteSpace(line)) { - if (!string.IsNullOrWhiteSpace(line)) - { - Subtitles.AddFromString(line); - } + Subtitles.AddFromString(line); } - Subtitles.Sort(); - }); - } + } - if (bl.HasLump(BinaryStateLump.SyncSettings)) + Subtitles.Sort(); + }); + + bl.GetLump(BinaryStateLump.SyncSettings, false, delegate(TextReader tr) { - bl.GetLump(BinaryStateLump.SyncSettings, true, delegate(TextReader tr) + string line; + while ((line = tr.ReadLine()) != null) { - string line; - while ((line = tr.ReadLine()) != null) + if (!string.IsNullOrWhiteSpace(line)) { - if (!string.IsNullOrWhiteSpace(line)) - { - _syncSettingsJson = line; - } + _syncSettingsJson = line; } - }); - } + } + }); bl.GetLump(BinaryStateLump.Input, true, delegate(TextReader tr) { diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs index 38c1539f26..4ef3d4225e 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs @@ -188,13 +188,10 @@ namespace BizHawk.Client.Common } // TasMovie enhanced information - if (bl.HasLump(BinaryStateLump.LagLog)) + bl.GetLump(BinaryStateLump.LagLog, false, delegate(BinaryReader br, long length) { - bl.GetLump(BinaryStateLump.LagLog, false, delegate(BinaryReader br, long length) - { - LagLog.Load(br); - }); - } + LagLog.Load(br); + }); bl.GetLump(BinaryStateLump.StateHistorySettings, false, delegate(TextReader tr) { @@ -213,10 +210,10 @@ namespace BizHawk.Client.Common } }); - if (GetClientSettingsOnLoad != null && bl.HasLump(BinaryStateLump.ClientSettings)) + if (GetClientSettingsOnLoad != null) { string clientSettings = string.Empty; - bl.GetLump(BinaryStateLump.ClientSettings, true, delegate(TextReader tr) + bl.GetLump(BinaryStateLump.ClientSettings, false, delegate(TextReader tr) { string line; while ((line = tr.ReadLine()) != null) @@ -228,30 +225,30 @@ namespace BizHawk.Client.Common } }); - GetClientSettingsOnLoad(clientSettings); - } - - if (bl.HasLump(BinaryStateLump.VerificationLog)) - { - bl.GetLump(BinaryStateLump.VerificationLog, true, delegate(TextReader tr) + if (!string.IsNullOrWhiteSpace(clientSettings)) { - VerificationLog.Clear(); - while (true) - { - var line = tr.ReadLine(); - if (string.IsNullOrEmpty(line)) - { - break; - } - - if (line.StartsWith("|")) - { - VerificationLog.Add(line); - } - } - }); + GetClientSettingsOnLoad(clientSettings); + } } + bl.GetLump(BinaryStateLump.VerificationLog, false, delegate(TextReader tr) + { + VerificationLog.Clear(); + while (true) + { + var line = tr.ReadLine(); + if (string.IsNullOrEmpty(line)) + { + break; + } + + if (line.StartsWith("|")) + { + VerificationLog.Add(line); + } + } + }); + Branches.Load(bl, this); if (StateManager.Settings.BranchStatesInTasproj) {