diff --git a/BizHawk.MultiClient/movie/Movie.cs b/BizHawk.MultiClient/movie/Movie.cs index 4c1da7be4e..da2279aa5e 100644 --- a/BizHawk.MultiClient/movie/Movie.cs +++ b/BizHawk.MultiClient/movie/Movie.cs @@ -441,6 +441,11 @@ namespace BizHawk.MultiClient #region Public Misc Methods + public bool FrameLagged(int frame) + { + return Log.FrameLagged(frame); + } + public void CaptureState() { if (StateCapturing == true) diff --git a/BizHawk.MultiClient/movie/MovieLog.cs b/BizHawk.MultiClient/movie/MovieLog.cs index 201730dcda..38288e8f67 100644 --- a/BizHawk.MultiClient/movie/MovieLog.cs +++ b/BizHawk.MultiClient/movie/MovieLog.cs @@ -51,7 +51,14 @@ namespace BizHawk.MultiClient { get { - return StateRecords.Count * StateRecords[0].State.Length; + if (StateRecords.Count > 0) + { + return StateCount * StateRecords[0].State.Length; + } + else + { + return 0; + } } } @@ -84,7 +91,7 @@ namespace BizHawk.MultiClient if (Global.Emulator.Frame < StateFirstIndex) { StateRecords.Clear(); - StateRecords.Add(new StateRecordStruct(Global.Emulator.Frame, state)); + StateRecords.Add(new StateRecord(Global.Emulator.Frame, state)); } if (Global.Emulator.Frame > StateLastIndex) { @@ -93,7 +100,7 @@ namespace BizHawk.MultiClient // Discard the oldest state to save space. StateRecords.RemoveAt(0); } - StateRecords.Add(new StateRecordStruct(Global.Emulator.Frame,state)); + StateRecords.Add(new StateRecord(Global.Emulator.Frame,state)); } } @@ -169,11 +176,11 @@ namespace BizHawk.MultiClient } } - public string GetFrame(int frameCount) + public string GetFrame(int frame) { - if (frameCount >= 0 && frameCount < MovieRecords.Count) + if (frame >= 0 && frame < MovieRecords.Count) { - return MovieRecords[frameCount]; + return MovieRecords[frame]; } else { @@ -198,24 +205,38 @@ namespace BizHawk.MultiClient } } + public bool FrameLagged(int frame) + { + if (frame >= StateFirstIndex && frame <= StateLastIndex) + { + return StateRecords[frame].Lagged; + } + else + { + return false; + } + } + #endregion #region private fields - private class StateRecordStruct + private class StateRecord { - public StateRecordStruct(int index, byte[] state) + public StateRecord(int index, byte[] state) { - this.Index = index; - this.State = state; + Index = index; + State = state; + Lagged = Global.Emulator.IsLagFrame; } public int Index; public byte[] State; + public bool Lagged; } private List MovieRecords = new List(); - private List StateRecords = new List(); + private List StateRecords = new List(); //TODO: Make this size limit configurable by the user private int MaxStateRecordSize = 1024 * 1024 * 1024; //To limit memory usage. diff --git a/BizHawk.MultiClient/tools/TAStudio.cs b/BizHawk.MultiClient/tools/TAStudio.cs index 643de295a0..01d3ab1c13 100644 --- a/BizHawk.MultiClient/tools/TAStudio.cs +++ b/BizHawk.MultiClient/tools/TAStudio.cs @@ -117,7 +117,9 @@ namespace BizHawk.MultiClient //TODO: remove this hack with a nes controls pad if (Global.Emulator.SystemId == "NES") + { str.Append("0|"); + } for (int x = 0; x < Pads.Count; x++) str.Append(Pads[x].GetMnemonic()); @@ -126,15 +128,23 @@ namespace BizHawk.MultiClient private void TASView_QueryItemBkColor(int index, int column, ref Color color) { - if (0 == index && 0 == Global.MovieSession.Movie.StateFirstIndex) + if (index == 0 && Global.MovieSession.Movie.StateFirstIndex == 0) + { color = Color.LightGreen; //special case for frame 0. Normally we need to go back an extra frame, but for frame 0 we can reload the rom. - if (index > Global.MovieSession.Movie.StateFirstIndex && index <= Global.MovieSession.Movie.StateLastIndex) - color = Color.LightGreen; - if ("" != Global.MovieSession.Movie.GetInput(index) && - Global.COMMANDS[Global.MovieInputSourceAdapter.Type.Name].ContainsKey("Lag") && - Global.MovieSession.Movie.GetInput(index)[1] == Global.COMMANDS[Global.MovieInputSourceAdapter.Type.Name]["Lag"][0]) + } + else if (Global.MovieSession.Movie.FrameLagged(index)) + { color = Color.Pink; - if (index == Global.Emulator.Frame) + + //TODO: remove references to this lag + //Global.COMMANDS[Global.MovieInputSourceAdapter.Type.Name].ContainsKey("Lag") && + //Global.MovieSession.Movie.GetInput(index)[1] == Global.COMMANDS[Global.MovieInputSourceAdapter.Type.Name]["Lag"][0]) + } + else if (index > Global.MovieSession.Movie.StateFirstIndex && index <= Global.MovieSession.Movie.StateLastIndex) + { + color = Color.LightGreen; + } + else if (index == Global.Emulator.Frame) { color = Color.LightBlue; }