Skip to content

Commit 268ab96

Browse files
author
adelikat
committed
remove built-in multitrack movie recorder, justification: tastudio is a much better alternative, it isn't used, and it's causing strain on better movie architecture, also this logic is easily done via lua script. It could be built from scratch one day in a way that plays nice with better movie architecture, if there's demand, but we need to remove this to keep moving forward
1 parent 03d10ce commit 268ab96

13 files changed

+24
-362
lines changed

src/BizHawk.Client.Common/config/Binding.cs

-5
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,6 @@ public static List<Binding> DefaultValues
186186
Bind("Movie", "Stop Movie"),
187187
Bind("Movie", "Play from beginning"),
188188
Bind("Movie", "Save Movie"),
189-
Bind("Movie", "Toggle MultiTrack"),
190-
Bind("Movie", "MT Select All"),
191-
Bind("Movie", "MT Select None"),
192-
Bind("Movie", "MT Increment Player"),
193-
Bind("Movie", "MT Decrement Player"),
194189

195190
Bind("Tools", "RAM Watch"),
196191
Bind("Tools", "RAM Search"),

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

+1-62
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ public MovieSession(
3838
?? throw new ArgumentNullException($"{nameof(pauseCallback)} cannot be null.");
3939
_modeChangedCallback = modeChangedCallback
4040
?? throw new ArgumentNullException($"{nameof(modeChangedCallback)} CannotUnloadAppDomainException be null.");
41-
42-
MultiTrack.RewiringAdapter.Source = MovieIn;
4341
}
4442

4543
public IMovieConfig Settings { get; }
@@ -57,8 +55,6 @@ public MovieSession(
5755

5856
public IMovieController MovieController { get; private set; } = new Bk2Controller("", NullController.Instance.Definition);
5957

60-
public MultitrackRecorder MultiTrack { get; } = new MultitrackRecorder();
61-
6258
public IMovieController GenerateMovieController(ControllerDefinition definition = null)
6359
{
6460
// TODO: expose Movie.LogKey and pass in here
@@ -242,7 +238,6 @@ public void RunQueuedMovie(bool recordMode, IEmulator emulator, IDictionary<stri
242238

243239
Movie = _queuedMovie;
244240
_queuedMovie = null;
245-
MultiTrack.Restart(Movie.Emulator.ControllerDefinition.PlayerCount);
246241

247242
Movie.ProcessSavestate(Movie.Emulator);
248243
Movie.ProcessSram(Movie.Emulator);
@@ -258,31 +253,6 @@ public void RunQueuedMovie(bool recordMode, IEmulator emulator, IDictionary<stri
258253
}
259254
}
260255

261-
public void ToggleMultitrack()
262-
{
263-
if (Movie.IsActive())
264-
{
265-
if (Settings.VBAStyleMovieLoadState)
266-
{
267-
Output("Multi-track can not be used in Full Movie Loadstates mode");
268-
}
269-
else if (Movie is ITasMovie)
270-
{
271-
Output("Multi-track can not be used with tasproj movies");
272-
}
273-
else
274-
{
275-
MultiTrack.IsActive ^= true;
276-
MultiTrack.SelectNone();
277-
Output(MultiTrack.IsActive ? "MultiTrack Enabled" : "MultiTrack Disabled");
278-
}
279-
}
280-
else
281-
{
282-
Output("MultiTrack cannot be enabled while not recording.");
283-
}
284-
}
285-
286256
public void StopMovie(bool saveChanges = true)
287257
{
288258
if (Movie.IsActive())
@@ -299,8 +269,6 @@ public void StopMovie(bool saveChanges = true)
299269

300270
message += "stopped.";
301271

302-
MultiTrack.Restart(1);
303-
304272
var result = Movie.Stop(saveChanges);
305273
if (result)
306274
{
@@ -347,28 +315,6 @@ private void Output(string message)
347315
_messageCallback?.Invoke(message);
348316
}
349317

350-
private void LatchInputToMultitrackUser()
351-
{
352-
if (MultiTrack.IsActive)
353-
{
354-
var rewiredSource = MultiTrack.RewiringAdapter;
355-
rewiredSource.PlayerSource = 1;
356-
rewiredSource.PlayerTargetMask = 1 << MultiTrack.CurrentPlayer;
357-
if (MultiTrack.RecordAll)
358-
{
359-
rewiredSource.PlayerTargetMask = unchecked((int)0xFFFFFFFF);
360-
}
361-
362-
if (Movie.InputLogLength > Movie.Emulator.Frame)
363-
{
364-
var input = Movie.GetInputState(Movie.Emulator.Frame);
365-
MovieController.SetFrom(input);
366-
}
367-
368-
MovieController.SetPlayerFrom(rewiredSource, MultiTrack.CurrentPlayer);
369-
}
370-
}
371-
372318
private void LatchInputToUser()
373319
{
374320
MovieOut.Source = MovieIn;
@@ -439,14 +385,7 @@ private void HandleFrameLoopForRecordMode()
439385
}
440386
else
441387
{
442-
if (MultiTrack.IsActive)
443-
{
444-
LatchInputToMultitrackUser();
445-
}
446-
else
447-
{
448-
LatchInputToUser();
449-
}
388+
LatchInputToUser();
450389
}
451390

452391
Movie.RecordFrame(Movie.Emulator.Frame, MovieController);

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

-30
Original file line numberDiff line numberDiff line change
@@ -59,36 +59,6 @@ public void SetFrom(IController source)
5959
}
6060
}
6161

62-
public void SetPlayerFrom(IController playerSource, int controllerNum)
63-
{
64-
foreach (var button in playerSource.Definition.BoolButtons)
65-
{
66-
var bnp = ButtonNameParser.Parse(button);
67-
68-
if (bnp?.PlayerNum != controllerNum)
69-
{
70-
continue;
71-
}
72-
73-
var val = playerSource.IsPressed(button);
74-
_myBoolButtons[button] = val;
75-
}
76-
77-
foreach (var button in Definition.AxisControls)
78-
{
79-
var bnp = ButtonNameParser.Parse(button);
80-
81-
if (bnp?.PlayerNum != controllerNum)
82-
{
83-
continue;
84-
}
85-
86-
var val = playerSource.AxisValue(button);
87-
88-
_myAxisControls[button] = val;
89-
}
90-
}
91-
9262
public void SetFromSticky(IStickyController controller)
9363
{
9464
foreach (var button in Definition.BoolButtons)

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

+20-53
Original file line numberDiff line numberDiff line change
@@ -38,69 +38,36 @@ public virtual bool ExtractInputLog(TextReader reader, out string errorMessage)
3838
int? stateFrame = null;
3939

4040
// We are in record mode so replace the movie log with the one from the savestate
41-
if (!Session.MultiTrack.IsActive)
41+
if (Session.Settings.EnableBackupMovies && MakeBackup && Log.Count != 0)
4242
{
43-
if (Session.Settings.EnableBackupMovies && MakeBackup && Log.Count != 0)
43+
SaveBackup();
44+
MakeBackup = false;
45+
}
46+
47+
Log.Clear();
48+
string line;
49+
while ((line = reader.ReadLine()) != null)
50+
{
51+
if (line.StartsWith("|"))
4452
{
45-
SaveBackup();
46-
MakeBackup = false;
53+
Log.Add(line);
4754
}
48-
49-
Log.Clear();
50-
string line;
51-
while ((line = reader.ReadLine()) != null)
55+
else if (line.StartsWith("Frame "))
5256
{
53-
if (line.StartsWith("|"))
54-
{
55-
Log.Add(line);
56-
}
57-
else if (line.StartsWith("Frame "))
57+
var strs = line.Split(' ');
58+
try
5859
{
59-
var strs = line.Split(' ');
60-
try
61-
{
62-
stateFrame = int.Parse(strs[1]);
63-
}
64-
catch
65-
{
66-
errorMessage = "Savestate Frame number failed to parse";
67-
return false;
68-
}
60+
stateFrame = int.Parse(strs[1]);
6961
}
70-
else if (line.StartsWith("LogKey:"))
62+
catch
7163
{
72-
LogKey = line.Replace("LogKey:", "");
64+
errorMessage = "Savestate Frame number failed to parse";
65+
return false;
7366
}
7467
}
75-
}
76-
else
77-
{
78-
var i = 0;
79-
string line;
80-
while ((line = reader.ReadLine()) != null)
68+
else if (line.StartsWith("LogKey:"))
8169
{
82-
if (line.StartsWith("|"))
83-
{
84-
SetFrameAt(i, line);
85-
i++;
86-
}
87-
else if (line.StartsWith("Frame "))
88-
{
89-
var strs = line.Split(' ');
90-
try
91-
{
92-
stateFrame = int.Parse(strs[1]);
93-
}
94-
catch
95-
{
96-
errorMessage = "Savestate Frame number failed to parse";
97-
return false;
98-
}
99-
}
100-
else if (line.StartsWith("LogKey:"))
101-
{
102-
LogKey = line.Replace("LogKey:", "");
103-
}
70+
LogKey = line.Replace("LogKey:", "");
10471
}
10572
}
10673

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

+3-7
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,10 @@ public virtual void RecordFrame(int frame, IController source)
130130
public virtual void Truncate(int frame)
131131
{
132132
// This is a bad way to do multitrack logic, pass the info in instead of going to the global
133-
// and it is weird for Truncate to possibly not truncate
134-
if (!Session.MultiTrack.IsActive)
133+
if (frame < Log.Count)
135134
{
136-
if (frame < Log.Count)
137-
{
138-
Log.RemoveRange(frame, Log.Count - frame);
139-
Changes = true;
140-
}
135+
Log.RemoveRange(frame, Log.Count - frame);
136+
Changes = true;
141137
}
142138
}
143139

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

-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ public interface IMovieController : IController
99
/// </summary>
1010
void SetFrom(IController source);
1111

12-
/// <summary>
13-
/// Latches to only the buttons in the given <see cref="IController" /> for the given controller
14-
/// </summary>
15-
void SetPlayerFrom(IController playerSource, int controllerNum);
16-
1712
/// <summary>
1813
/// Latches to the given <see cref="IStickyController" />
1914
/// For buttons it latches autohold state, for analogs it latches mid value.

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

-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public interface IMovieSession
2121
string QueuedSyncSettings { get; }
2222

2323
IMovieController MovieController { get; }
24-
MultitrackRecorder MultiTrack { get; }
2524

2625
/// <summary>
2726
/// Provides a source for sticky controls ot use when recording
@@ -69,8 +68,6 @@ public interface IMovieSession
6968
/// </summary>
7069
void RunQueuedMovie(bool recordMode, IEmulator emulator, IDictionary<string, string> preferredCores);
7170

72-
void ToggleMultitrack();
73-
7471
void StopMovie(bool saveChanges = true);
7572

7673
/// <summary>

src/BizHawk.Client.Common/movie/multitrack/ButtonNameParser.cs

-37
This file was deleted.

0 commit comments

Comments
 (0)