diff --git a/BizHawk.Client.Common/movie/bk2/Bk2Movie.cs b/BizHawk.Client.Common/movie/bk2/Bk2Movie.cs index 34aa219d0c..574fe38912 100644 --- a/BizHawk.Client.Common/movie/bk2/Bk2Movie.cs +++ b/BizHawk.Client.Common/movie/bk2/Bk2Movie.cs @@ -114,7 +114,7 @@ namespace BizHawk.Client.Common } } - public IController GetInputState(int frame) + public virtual IController GetInputState(int frame) { if (frame < FrameCount && frame >= 0) { diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs index 90d706c005..5c6bd240ca 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs @@ -256,6 +256,7 @@ namespace BizHawk.Client.Common } // TODO: try not to need this, or at least use GetInputState and then a log entry generator + // TODO: this is being called in Clone and probably other places, and that's bad, they are capturing the current frame for other frames! public string GetInputLogEntry(int frame) { if (Global.Emulator.Frame == frame && !StateManager.HasState(frame)) @@ -303,5 +304,24 @@ namespace BizHawk.Client.Common Changes = true; } } + + public override IController GetInputState(int frame) + { + // TODO: states and lag capture + if (Global.Emulator.Frame == frame) // Take this opportunity to capture lag and state info if we do not have it + { + if (frame == LagLog.Count) // I intentionally did not do >=, if it were >= we missed some entries somewhere, oops, maybe this shoudl be a dictionary with frame values? + { + LagLog.Add(Global.Emulator.IsLagFrame); + } + + if (!StateManager.HasState(frame)) + { + StateManager.Capture(); + } + } + + return base.GetInputState(frame); + } } }