From 340370fd6872f3c69a70f33ac4851d2c05b5a668 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 23 May 2020 20:58:00 -0500 Subject: [PATCH] simplify Bkm importing --- .../movie/import/BkmImport.cs | 3 +-- .../movie/import/bkm/BkmHeader.cs | 21 ------------------- .../movie/import/bkm/BkmMovie.cs | 13 ++---------- 3 files changed, 3 insertions(+), 34 deletions(-) diff --git a/src/BizHawk.Client.Common/movie/import/BkmImport.cs b/src/BizHawk.Client.Common/movie/import/BkmImport.cs index aee76b628a..11baa89327 100644 --- a/src/BizHawk.Client.Common/movie/import/BkmImport.cs +++ b/src/BizHawk.Client.Common/movie/import/BkmImport.cs @@ -16,7 +16,7 @@ } Result.Movie.HeaderEntries.Clear(); - foreach (var kvp in bkm.HeaderEntries) + foreach (var kvp in bkm.Header) { Result.Movie.HeaderEntries[kvp.Key] = kvp.Value; } @@ -35,7 +35,6 @@ Result.Movie.Subtitles.Add(sub); } - Result.Movie.TextSavestate = bkm.TextSavestate; Result.Movie.BinarySavestate = bkm.BinarySavestate; } } diff --git a/src/BizHawk.Client.Common/movie/import/bkm/BkmHeader.cs b/src/BizHawk.Client.Common/movie/import/bkm/BkmHeader.cs index a1d5d0d362..b8bb217862 100644 --- a/src/BizHawk.Client.Common/movie/import/bkm/BkmHeader.cs +++ b/src/BizHawk.Client.Common/movie/import/bkm/BkmHeader.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Text; namespace BizHawk.Client.Common { @@ -7,7 +6,6 @@ namespace BizHawk.Client.Common { public BkmHeader() { - this[HeaderKeys.EmulationVersion] = VersionInfo.GetEmuVersion(); this[HeaderKeys.GameName] = ""; this[HeaderKeys.Author] = ""; this[HeaderKeys.Rerecords] = "0"; @@ -58,25 +56,6 @@ namespace BizHawk.Client.Common base.Clear(); } - public override string ToString() - { - var sb = new StringBuilder(); - - foreach (var kvp in this) - { - sb - .Append(kvp.Key) - .Append(' ') - .Append(kvp.Value) - .AppendLine(); - } - - sb.Append(Subtitles); - Comments.ForEach(comment => sb.AppendLine(comment)); - - return sb.ToString(); - } - public bool ParseLineFromFile(string line) { if (!string.IsNullOrWhiteSpace(line)) diff --git a/src/BizHawk.Client.Common/movie/import/bkm/BkmMovie.cs b/src/BizHawk.Client.Common/movie/import/bkm/BkmMovie.cs index d5d45a5b3d..026ba5f761 100644 --- a/src/BizHawk.Client.Common/movie/import/bkm/BkmMovie.cs +++ b/src/BizHawk.Client.Common/movie/import/bkm/BkmMovie.cs @@ -7,20 +7,14 @@ namespace BizHawk.Client.Common internal class BkmMovie { private readonly List _log = new List(); - - public string PreferredExtension => "bkm"; - public BkmHeader Header { get; } = new BkmHeader(); public string Filename { get; set; } = ""; public bool Loaded { get; private set; } - - public int InputLogLength => _log.Count; - - public int FrameCount => Loaded ? _log.Count : 0; + public int InputLogLength => Loaded ? _log.Count : 0; public BkmControllerAdapter GetInputState(int frame) { - if (frame < FrameCount && frame >= 0) + if (frame < InputLogLength && frame >= 0) { var adapter = new BkmControllerAdapter { @@ -33,8 +27,6 @@ namespace BizHawk.Client.Common return null; } - public IDictionary HeaderEntries => Header; - public SubtitleList Subtitles => Header.Subtitles; public IList Comments => Header.Comments; @@ -45,7 +37,6 @@ namespace BizHawk.Client.Common set => Header[HeaderKeys.SyncSettings] = value; } - public string TextSavestate { get; set; } public byte[] BinarySavestate { get; set; } public bool Load()