Pass the instance of MovieSession into movies, instead of referencing them from a global
This commit is contained in:
parent
1711914488
commit
ca39eca22c
|
@ -289,7 +289,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public void RunQueuedMovie(bool recordMode, IEmulator emulator)
|
||||
{
|
||||
_queuedMovie.Attach(emulator);
|
||||
_queuedMovie.Attach(this, emulator);
|
||||
foreach (var previousPref in _preferredCores)
|
||||
{
|
||||
Global.Config.PreferredCores[previousPref.Key] = previousPref.Value;
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace BizHawk.Client.Common
|
|||
int? stateFrame = null;
|
||||
|
||||
// We are in record mode so replace the movie log with the one from the savestate
|
||||
if (!Global.MovieSession.MultiTrack.IsActive)
|
||||
if (!Session.MultiTrack.IsActive)
|
||||
{
|
||||
if (Global.Config.EnableBackupMovies && MakeBackup && Log.Count != 0)
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace BizHawk.Client.Common
|
|||
Header[HeaderKeys.MovieVersion] = "BizHawk v2.0.0";
|
||||
}
|
||||
|
||||
public virtual void Attach(IEmulator emulator)
|
||||
public virtual void Attach(IMovieSession session, IEmulator emulator)
|
||||
{
|
||||
if (!Emulator.IsNull())
|
||||
{
|
||||
|
@ -27,9 +27,11 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
Emulator = emulator;
|
||||
Session = session;
|
||||
}
|
||||
|
||||
public IEmulator Emulator { get; private set; }
|
||||
public IMovieSession Session { get; private set; }
|
||||
|
||||
protected bool MakeBackup { get; set; } = true;
|
||||
|
||||
|
@ -113,7 +115,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
// This is a bad way to do multitrack logic, pass the info in instead of going to the global
|
||||
// and it is weird for Truncate to possibly not truncate
|
||||
if (!Global.MovieSession.MultiTrack.IsActive)
|
||||
if (!Session.MultiTrack.IsActive)
|
||||
{
|
||||
if (frame < Log.Count)
|
||||
{
|
||||
|
@ -127,7 +129,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
if (frame < FrameCount && frame >= 0)
|
||||
{
|
||||
_adapter ??= new Bk2Controller(Global.MovieSession.MovieController.Definition);
|
||||
_adapter ??= new Bk2Controller(Session.MovieController.Definition);
|
||||
_adapter.SetFromMnemonic(Log[frame]);
|
||||
return _adapter;
|
||||
}
|
||||
|
@ -144,7 +146,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public virtual void ClearFrame(int frame)
|
||||
{
|
||||
var lg = LogGeneratorInstance(Global.MovieSession.MovieController);
|
||||
var lg = LogGeneratorInstance(Session.MovieController);
|
||||
SetFrameAt(frame, lg.EmptyEntry);
|
||||
Changes = true;
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ namespace BizHawk.Client.Common
|
|||
/// Thrown if attempting to attach a core when one is already attached
|
||||
/// or if the given core does not meet all required dependencies
|
||||
/// </exception>
|
||||
void Attach(IEmulator emulator);
|
||||
void Attach(IMovieSession session, IEmulator emulator);
|
||||
|
||||
/// <summary>
|
||||
/// The currently attached core or null if not yet attached
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace BizHawk.Client.Common
|
|||
Func<string> ClientSettingsForSave { set; }
|
||||
Action<string> GetClientSettingsOnLoad { set; }
|
||||
ITasMovieRecord this[int index] { get; }
|
||||
ITasSession Session { get; }
|
||||
ITasSession TasSession { get; }
|
||||
TasMovieMarkerList Markers { get; }
|
||||
ITasBranchCollection Branches { get; }
|
||||
TasLagLog LagLog { get; }
|
||||
|
|
|
@ -256,7 +256,7 @@ namespace BizHawk.Client.Common
|
|||
frame = Log.Count();
|
||||
}
|
||||
|
||||
var lg = LogGeneratorInstance(Global.MovieSession.MovieController);
|
||||
var lg = LogGeneratorInstance(Session.MovieController);
|
||||
Log.InsertRange(frame, Enumerable.Repeat(lg.EmptyEntry, count).ToList());
|
||||
|
||||
ShiftBindedMarkers(frame, count);
|
||||
|
@ -273,7 +273,7 @@ namespace BizHawk.Client.Common
|
|||
int oldLength = InputLogLength;
|
||||
ChangeLog.AddGeneralUndo(oldLength, oldLength + numFrames - 1);
|
||||
|
||||
Global.MovieSession.MovieController.SetFromSticky(Global.InputManager.AutofireStickyXorAdapter);
|
||||
Session.MovieController.SetFromSticky(Global.InputManager.AutofireStickyXorAdapter);
|
||||
|
||||
// account for autohold. needs autohold pattern to be already recorded in the current frame
|
||||
var lg = LogGeneratorInstance(Global.InputManager.MovieOutputHardpoint);
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace BizHawk.Client.Common
|
|||
Branches.Save(bs);
|
||||
}
|
||||
|
||||
bs.PutLump(BinaryStateLump.Session, tw => tw.WriteLine(JsonConvert.SerializeObject(Session)));
|
||||
bs.PutLump(BinaryStateLump.Session, tw => tw.WriteLine(JsonConvert.SerializeObject(TasSession)));
|
||||
|
||||
if (TasStateManager.Settings.SaveStateHistory && !backup)
|
||||
{
|
||||
|
@ -253,7 +253,7 @@ namespace BizHawk.Client.Common
|
|||
var json = tr.ReadToEnd();
|
||||
try
|
||||
{
|
||||
Session = JsonConvert.DeserializeObject<TasSession>(json);
|
||||
TasSession = JsonConvert.DeserializeObject<TasSession>(json);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace BizHawk.Client.Common
|
|||
Markers.Add(0, startsFromSavestate ? "Savestate" : "Power on");
|
||||
}
|
||||
|
||||
public override void Attach(IEmulator emulator)
|
||||
public override void Attach(IMovieSession session, IEmulator emulator)
|
||||
{
|
||||
if (!emulator.HasSavestates())
|
||||
{
|
||||
|
@ -39,12 +39,12 @@ namespace BizHawk.Client.Common
|
|||
|
||||
_inputPollable = emulator.AsInputPollable();
|
||||
TasStateManager.Attach(emulator);
|
||||
base.Attach(emulator);
|
||||
base.Attach(session, emulator);
|
||||
}
|
||||
|
||||
public IStringLog VerificationLog { get; } = StringLogUtil.MakeStringLog(); // For movies that do not begin with power-on, this is the input required to get into the initial state
|
||||
public ITasBranchCollection Branches { get; }
|
||||
public ITasSession Session { get; private set; } = new TasSession();
|
||||
public ITasSession TasSession { get; private set; } = new TasSession();
|
||||
|
||||
public int LastEditedFrame { get; private set; } = -1;
|
||||
public bool LastPositionStable { get; set; } = true;
|
||||
|
@ -97,7 +97,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
LastEditedFrame = frame;
|
||||
|
||||
if (anyInvalidated && Global.MovieSession.Movie.IsCountingRerecords)
|
||||
if (anyInvalidated && IsCountingRerecords)
|
||||
{
|
||||
Rerecords++;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ namespace BizHawk.Client.Common
|
|||
var newLog = new List<string>();
|
||||
|
||||
// We are in record mode so replace the movie log with the one from the savestate
|
||||
if (!Global.MovieSession.MultiTrack.IsActive)
|
||||
if (!Session.MultiTrack.IsActive)
|
||||
{
|
||||
_timelineBranchFrame = null;
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Branches.Add(branch);
|
||||
BranchView.RowCount = Branches.Count;
|
||||
Branches.Current = Branches.Count - 1;
|
||||
Movie.Session.UpdateValues(Tastudio.Emulator.Frame, Branches.Current);
|
||||
Movie.TasSession.UpdateValues(Tastudio.Emulator.Frame, Branches.Current);
|
||||
BranchView.ScrollToIndex(Branches.Current);
|
||||
Select(Branches.Current, true);
|
||||
BranchView.Refresh();
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
refreshNeeded = AutoAdjustInput();
|
||||
}
|
||||
|
||||
CurrentTasMovie.Session.UpdateValues(Emulator.Frame, CurrentTasMovie.Branches.Current);
|
||||
CurrentTasMovie.TasSession.UpdateValues(Emulator.Frame, CurrentTasMovie.Branches.Current);
|
||||
MaybeFollowCursor();
|
||||
|
||||
if (TasView.IsPartiallyVisible(Emulator.Frame) || TasView.IsPartiallyVisible(_lastRefresh))
|
||||
|
|
|
@ -644,7 +644,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
GoToFrame(CurrentTasMovie.Session.CurrentFrame);
|
||||
GoToFrame(CurrentTasMovie.TasSession.CurrentFrame);
|
||||
}
|
||||
|
||||
// If we are loading an existing non-default movie, we will already have columns generated
|
||||
|
@ -657,7 +657,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
SetUpToolStripColumns();
|
||||
|
||||
CurrentTasMovie.PropertyChanged += TasMovie_OnPropertyChanged;
|
||||
CurrentTasMovie.Branches.Current = CurrentTasMovie.Session.CurrentBranch;
|
||||
CurrentTasMovie.Branches.Current = CurrentTasMovie.TasSession.CurrentBranch;
|
||||
BookMarkControl.UpdateTextColumnWidth();
|
||||
MarkerControl.UpdateTextColumnWidth();
|
||||
// clear all selections
|
||||
|
|
Loading…
Reference in New Issue