From f2f2de8bddc0cd333f4ee64769528746e52fadc2 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 23 May 2020 10:55:02 -0500 Subject: [PATCH] Rip out the Infinite movie feature, it was a gimmick that has run its course. It isn't much code but it does complicate the API for a feature that would never lead to a published tas movie --- .../Api/Classes/MovieApi.cs | 2 +- .../Api/Interfaces/IInputMovie.cs | 2 +- src/BizHawk.Client.Common/movie/HeaderKeys.cs | 1 - .../movie/bk2/Bk2Movie.HeaderApi.cs | 26 -------------- .../movie/bk2/Bk2Movie.InputLog.cs | 27 ++------------ .../movie/bk2/Bk2Movie.cs | 35 ++----------------- .../movie/interfaces/IMovie.cs | 6 ++-- 7 files changed, 10 insertions(+), 89 deletions(-) diff --git a/src/BizHawk.Client.Common/Api/Classes/MovieApi.cs b/src/BizHawk.Client.Common/Api/Classes/MovieApi.cs index bf77fa43c1..dd1731eafd 100644 --- a/src/BizHawk.Client.Common/Api/Classes/MovieApi.cs +++ b/src/BizHawk.Client.Common/Api/Classes/MovieApi.cs @@ -98,7 +98,7 @@ namespace BizHawk.Client.Common public bool IsLoaded() => Global.MovieSession.Movie.IsActive(); - public double Length() => Global.MovieSession.Movie.FrameCount; + public int Length() => Global.MovieSession.Movie.FrameCount; public string Mode() => Global.MovieSession.Movie.Mode.ToString().ToUpper(); diff --git a/src/BizHawk.Client.Common/Api/Interfaces/IInputMovie.cs b/src/BizHawk.Client.Common/Api/Interfaces/IInputMovie.cs index a54bbd24f7..f9144e4bff 100644 --- a/src/BizHawk.Client.Common/Api/Interfaces/IInputMovie.cs +++ b/src/BizHawk.Client.Common/Api/Interfaces/IInputMovie.cs @@ -13,7 +13,7 @@ namespace BizHawk.Client.Common ulong GetRerecordCount(); bool GetRerecordCounting(); bool IsLoaded(); - double Length(); + int Length(); string Mode(); void Save(string filename = ""); void SetReadOnly(bool readOnly); diff --git a/src/BizHawk.Client.Common/movie/HeaderKeys.cs b/src/BizHawk.Client.Common/movie/HeaderKeys.cs index 4cc6f5e58b..af3e1d4fab 100644 --- a/src/BizHawk.Client.Common/movie/HeaderKeys.cs +++ b/src/BizHawk.Client.Common/movie/HeaderKeys.cs @@ -18,7 +18,6 @@ namespace BizHawk.Client.Common public const string Pal = "PAL"; public const string BoardName = "BoardName"; public const string SyncSettings = "SyncSettings"; - public const string LoopOffset = "LoopOffset"; public const string VBlankCount = "VBlankCount"; public const string CycleCount = "CycleCount"; public const string Core = "Core"; diff --git a/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.HeaderApi.cs b/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.HeaderApi.cs index 02f9b0046a..e790571ef2 100644 --- a/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.HeaderApi.cs +++ b/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.HeaderApi.cs @@ -190,32 +190,6 @@ namespace BizHawk.Client.Common } } - protected int? LoopOffset - { - get - { - var offsetStr = Header[HeaderKeys.LoopOffset]; - if (!string.IsNullOrWhiteSpace(offsetStr)) - { - return int.Parse(offsetStr); - } - - return null; - } - - set - { - if (value.HasValue) - { - Header[HeaderKeys.LoopOffset] = value.ToString(); - } - else - { - Header.Remove(HeaderKeys.LoopOffset); - } - } - } - protected string CommentsString() { var sb = new StringBuilder(); diff --git a/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.InputLog.cs b/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.InputLog.cs index 302c64e8c0..f397612050 100644 --- a/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.InputLog.cs +++ b/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.InputLog.cs @@ -28,30 +28,9 @@ namespace BizHawk.Client.Common public string GetInputLogEntry(int frame) { - if (frame < FrameCount && frame >= 0) - { - int getFrame; - - if (LoopOffset.HasValue) - { - if (frame < Log.Count) - { - getFrame = frame; - } - else - { - getFrame = ((frame - LoopOffset.Value) % (Log.Count - LoopOffset.Value)) + LoopOffset.Value; - } - } - else - { - getFrame = frame; - } - - return Log[getFrame]; - } - - return ""; + return frame < FrameCount && frame >= 0 + ? Log[frame] + : ""; } public virtual bool ExtractInputLog(TextReader reader, out string errorMessage) diff --git a/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.cs b/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.cs index 39a7b582d5..a48e3fe4ec 100644 --- a/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.cs +++ b/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.cs @@ -44,19 +44,7 @@ namespace BizHawk.Client.Common return new Bk2LogEntryGenerator(Global.Emulator.SystemId, source); } - public double FrameCount - { - get - { - if (LoopOffset.HasValue) - { - return double.PositiveInfinity; - } - - return Log.Count; - } - } - + public int FrameCount => Log.Count; public int InputLogLength => Log.Count; public ulong TimeLength @@ -123,26 +111,7 @@ namespace BizHawk.Client.Common if (frame < FrameCount && frame >= 0) { _adapter ??= new Bk2Controller(Global.MovieSession.MovieController.Definition); - - int getFrame; - - if (LoopOffset.HasValue) - { - if (frame < Log.Count) - { - getFrame = frame; - } - else - { - getFrame = ((frame - LoopOffset.Value) % (Log.Count - LoopOffset.Value)) + LoopOffset.Value; - } - } - else - { - getFrame = frame; - } - - _adapter.SetFromMnemonic(Log[getFrame]); + _adapter.SetFromMnemonic(Log[frame]); return _adapter; } diff --git a/src/BizHawk.Client.Common/movie/interfaces/IMovie.cs b/src/BizHawk.Client.Common/movie/interfaces/IMovie.cs index c7295e6c89..7a2564b5af 100644 --- a/src/BizHawk.Client.Common/movie/interfaces/IMovie.cs +++ b/src/BizHawk.Client.Common/movie/interfaces/IMovie.cs @@ -46,12 +46,12 @@ namespace BizHawk.Client.Common /// /// Gets the total number of frames that count towards the completion time of the movie - /// Possibly (but unlikely different from InputLogLength (could be infinity, or maybe an implementation automatically discounts empty frames at the end of a movie, etc) /// - double FrameCount { get; } + int FrameCount { get; } /// - /// Gets the actual length of the input log, should only be used by code that iterates or needs a real length + /// Gets the actual length of the input log, should only be used by code that needs a the input log length + /// specifically, not the frame count /// int InputLogLength { get; }