diff --git a/BizHawk.MultiClient/Input/ControllerBinding.cs b/BizHawk.MultiClient/Input/ControllerBinding.cs index 9bcba19b6a..c3c36f62bc 100644 --- a/BizHawk.MultiClient/Input/ControllerBinding.cs +++ b/BizHawk.MultiClient/Input/ControllerBinding.cs @@ -207,7 +207,7 @@ namespace BizHawk.MultiClient for (int i = 1; i < 3; i++) { if (mnemonic.Length < (1+7*i)) return; - //if (mnemonic[1] != '.') programmaticallyPressedButtons.Add("Reset"); + //if (mnemonic[1] != '.' && mnemonic[1] != '0') programmaticallyPressedButtons.Add("Reset"); if (mnemonic[(i - 1) * 7 +3] != '.') programmaticallyPressedButtons.Add("P" + i.ToString() + " Up"); if (mnemonic[(i - 1) * 7 + 4] != '.') programmaticallyPressedButtons.Add("P" + i.ToString() + " Down"); if (mnemonic[(i - 1) * 7 + 5] != '.') programmaticallyPressedButtons.Add("P" + i.ToString() + " Left"); @@ -239,7 +239,7 @@ namespace BizHawk.MultiClient if (type.Name == "NES Controls") { if (mnemonic.Length < 10) return; - //if (mnemonic[1] != '.') programmaticallyPressedButtons.Add("Reset"); + //if (mnemonic[1] != '.' && mnemonic[1] != '0') programmaticallyPressedButtons.Add("Reset"); if (mnemonic[3] != '.') programmaticallyPressedButtons.Add("Right"); if (mnemonic[4] != '.') programmaticallyPressedButtons.Add("Left"); if (mnemonic[5] != '.') programmaticallyPressedButtons.Add("Down"); diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 2bb9ab4777..c2994d8a32 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -1126,10 +1126,15 @@ namespace BizHawk.MultiClient { if (ReadOnly) { - UserMovie.WriteMovie(); - UserMovie.StartPlayback(); - Global.ActiveController.MovieMode = true; - //run loadstate-readonly function + int x = UserMovie.CheckTimeLines(reader); + //if (x >= 0) + // MessageBox.Show("Savestate input log does not match the movie at frame " + (x+1).ToString() + "!", "Timeline error", MessageBoxButtons.OK); //TODO: replace with a not annoying message once savestate logic is running smoothly + //else + { + UserMovie.WriteMovie(); + UserMovie.StartPlayback(); + Global.ActiveController.MovieMode = true; + } } else { @@ -1141,7 +1146,9 @@ namespace BizHawk.MultiClient { if (ReadOnly) { - //do a loadstate-read-only function which will check timeline & other factors to determine it is from this movie + int x = UserMovie.CheckTimeLines(reader); + //if (x >= 0) + // MessageBox.Show("Savestate input log does not match the movie at frame " + (x+1).ToString() + "!", "Timeline error", MessageBoxButtons.OK); //TODO: replace with a not annoying message once savestate logic is running smoothly } else { diff --git a/BizHawk.MultiClient/movie/Movie.cs b/BizHawk.MultiClient/movie/Movie.cs index 82cfbf9532..e94e0573a0 100644 --- a/BizHawk.MultiClient/movie/Movie.cs +++ b/BizHawk.MultiClient/movie/Movie.cs @@ -31,6 +31,12 @@ namespace BizHawk.MultiClient rerecordCount = 0; } + public Movie() + { + Filename = ""; //Note: note this must be populated before playing movie + MovieMode = MOVIEMODE.INACTIVE; + } + public string GetFilePath() { return Filename; @@ -432,5 +438,32 @@ namespace BizHawk.MultiClient return frames / 60.0; } } + + public int CheckTimeLines(StreamReader reader) + { + //This function will compare the movie data to the savestate movie data to see if they match + //TODO: Will eventually check header data too such as GUI + MovieLog l = new MovieLog(); + string line; + while (true) + { + line = reader.ReadLine(); + if (line.Trim() == "") continue; + else if (line == "[Input]") continue; + else if (line == "[/Input]") break; + else if (line[0] == '|') + l.AddFrame(line); + } + + for (int x = 0; x < Log.Length(); x++) + { + string xs = Log.GetFrame(x); + string ys = l.GetFrame(x); + //if (Log.GetFrame(x) != l.GetFrame(x)) + if (xs != ys) + return x; + } + return -1; + } } }