Skip to content

Commit f2f2de8

Browse files
author
adelikat
committed
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
1 parent 3174a67 commit f2f2de8

File tree

7 files changed

+10
-89
lines changed

7 files changed

+10
-89
lines changed

src/BizHawk.Client.Common/Api/Classes/MovieApi.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public List<string> GetSubtitles() =>
9898

9999
public bool IsLoaded() => Global.MovieSession.Movie.IsActive();
100100

101-
public double Length() => Global.MovieSession.Movie.FrameCount;
101+
public int Length() => Global.MovieSession.Movie.FrameCount;
102102

103103
public string Mode() => Global.MovieSession.Movie.Mode.ToString().ToUpper();
104104

src/BizHawk.Client.Common/Api/Interfaces/IInputMovie.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public interface IInputMovie : IExternalApi
1313
ulong GetRerecordCount();
1414
bool GetRerecordCounting();
1515
bool IsLoaded();
16-
double Length();
16+
int Length();
1717
string Mode();
1818
void Save(string filename = "");
1919
void SetReadOnly(bool readOnly);

src/BizHawk.Client.Common/movie/HeaderKeys.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public static class HeaderKeys
1818
public const string Pal = "PAL";
1919
public const string BoardName = "BoardName";
2020
public const string SyncSettings = "SyncSettings";
21-
public const string LoopOffset = "LoopOffset";
2221
public const string VBlankCount = "VBlankCount";
2322
public const string CycleCount = "CycleCount";
2423
public const string Core = "Core";

src/BizHawk.Client.Common/movie/bk2/Bk2Movie.HeaderApi.cs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -190,32 +190,6 @@ public string FirmwareHash
190190
}
191191
}
192192

193-
protected int? LoopOffset
194-
{
195-
get
196-
{
197-
var offsetStr = Header[HeaderKeys.LoopOffset];
198-
if (!string.IsNullOrWhiteSpace(offsetStr))
199-
{
200-
return int.Parse(offsetStr);
201-
}
202-
203-
return null;
204-
}
205-
206-
set
207-
{
208-
if (value.HasValue)
209-
{
210-
Header[HeaderKeys.LoopOffset] = value.ToString();
211-
}
212-
else
213-
{
214-
Header.Remove(HeaderKeys.LoopOffset);
215-
}
216-
}
217-
}
218-
219193
protected string CommentsString()
220194
{
221195
var sb = new StringBuilder();

src/BizHawk.Client.Common/movie/bk2/Bk2Movie.InputLog.cs

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,9 @@ public void WriteInputLog(TextWriter writer)
2828

2929
public string GetInputLogEntry(int frame)
3030
{
31-
if (frame < FrameCount && frame >= 0)
32-
{
33-
int getFrame;
34-
35-
if (LoopOffset.HasValue)
36-
{
37-
if (frame < Log.Count)
38-
{
39-
getFrame = frame;
40-
}
41-
else
42-
{
43-
getFrame = ((frame - LoopOffset.Value) % (Log.Count - LoopOffset.Value)) + LoopOffset.Value;
44-
}
45-
}
46-
else
47-
{
48-
getFrame = frame;
49-
}
50-
51-
return Log[getFrame];
52-
}
53-
54-
return "";
31+
return frame < FrameCount && frame >= 0
32+
? Log[frame]
33+
: "";
5534
}
5635

5736
public virtual bool ExtractInputLog(TextReader reader, out string errorMessage)

src/BizHawk.Client.Common/movie/bk2/Bk2Movie.cs

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,7 @@ public ILogEntryGenerator LogGeneratorInstance(IController source)
4444
return new Bk2LogEntryGenerator(Global.Emulator.SystemId, source);
4545
}
4646

47-
public double FrameCount
48-
{
49-
get
50-
{
51-
if (LoopOffset.HasValue)
52-
{
53-
return double.PositiveInfinity;
54-
}
55-
56-
return Log.Count;
57-
}
58-
}
59-
47+
public int FrameCount => Log.Count;
6048
public int InputLogLength => Log.Count;
6149

6250
public ulong TimeLength
@@ -123,26 +111,7 @@ public IMovieController GetInputState(int frame)
123111
if (frame < FrameCount && frame >= 0)
124112
{
125113
_adapter ??= new Bk2Controller(Global.MovieSession.MovieController.Definition);
126-
127-
int getFrame;
128-
129-
if (LoopOffset.HasValue)
130-
{
131-
if (frame < Log.Count)
132-
{
133-
getFrame = frame;
134-
}
135-
else
136-
{
137-
getFrame = ((frame - LoopOffset.Value) % (Log.Count - LoopOffset.Value)) + LoopOffset.Value;
138-
}
139-
}
140-
else
141-
{
142-
getFrame = frame;
143-
}
144-
145-
_adapter.SetFromMnemonic(Log[getFrame]);
114+
_adapter.SetFromMnemonic(Log[frame]);
146115
return _adapter;
147116
}
148117

src/BizHawk.Client.Common/movie/interfaces/IMovie.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ public interface IMovie
4646

4747
/// <summary>
4848
/// Gets the total number of frames that count towards the completion time of the movie
49-
/// Possibly (but unlikely different from InputLogLength (could be infinity, or maybe an implementation automatically discounts empty frames at the end of a movie, etc)
5049
/// </summary>
51-
double FrameCount { get; }
50+
int FrameCount { get; }
5251

5352
/// <summary>
54-
/// Gets the actual length of the input log, should only be used by code that iterates or needs a real length
53+
/// Gets the actual length of the input log, should only be used by code that needs a the input log length
54+
/// specifically, not the frame count
5555
/// </summary>
5656
int InputLogLength { get; }
5757

0 commit comments

Comments
 (0)