diff --git a/BizHawk.MultiClient/MainForm.Movie.cs b/BizHawk.MultiClient/MainForm.Movie.cs index a23e6c5d00..74ca554c2b 100644 --- a/BizHawk.MultiClient/MainForm.Movie.cs +++ b/BizHawk.MultiClient/MainForm.Movie.cs @@ -121,7 +121,7 @@ namespace BizHawk.MultiClient if (ReadOnly) { - if (!UserMovie.CheckTimeLines(reader)) + if (!UserMovie.CheckTimeLines(reader, false)) return false; //Timeline/GUID error else { @@ -132,7 +132,8 @@ namespace BizHawk.MultiClient } else { - //TODO: GUID check + if (!UserMovie.CheckTimeLines(reader, true)) + return false; //GUID Error UserMovie.LoadLogFromSavestateText(reader); } } @@ -140,14 +141,14 @@ namespace BizHawk.MultiClient { if (ReadOnly) { - if (!UserMovie.CheckTimeLines(reader)) + if (!UserMovie.CheckTimeLines(reader, false)) return false; //Timeline/GUID error //Frame loop automatically handles the rewinding effect based on Global.Emulator.Frame so nothing else is needed here } else { - //TODO: GUID check - //QUESTIONABLE - control whether the movie gets truncated here? + if (!UserMovie.CheckTimeLines(reader, true)) + return false; //GUID Error UserMovie.StartNewRecording(!Global.MovieSession.MultiTrack.IsActive); SetMainformMovieInfo(); UserMovie.LoadLogFromSavestateText(reader); @@ -165,7 +166,7 @@ namespace BizHawk.MultiClient } else { - if (!UserMovie.CheckTimeLines(reader)) + if (!UserMovie.CheckTimeLines(reader, false)) return false; //Timeline/GUID error UserMovie.StartPlayback(); SetMainformMovieInfo(); @@ -181,7 +182,8 @@ namespace BizHawk.MultiClient } else { - //TODO: GUID check + if (!UserMovie.CheckTimeLines(reader, true)) + return false; //GUID Error UserMovie.StartNewRecording(); SetMainformMovieInfo(); UserMovie.LoadLogFromSavestateText(reader); diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index aca1551a60..971a721f35 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -1597,14 +1597,17 @@ namespace BizHawk.MultiClient private void LoadStateFile(string path, string name) { var reader = new StreamReader(path); - + if (HandleMovieLoadState(reader)) { + reader.BaseStream.Position = 0; //Reset position after movie code has had its way with it Global.Emulator.LoadStateText(reader); UpdateTools(); reader.Close(); Global.RenderPanel.AddMessage("Loaded state: " + name); } + else + Global.RenderPanel.AddMessage("Loadstate error!"); } private void LoadState(string name) diff --git a/BizHawk.MultiClient/movie/Movie.cs b/BizHawk.MultiClient/movie/Movie.cs index b849da3d90..8e5b83965d 100644 --- a/BizHawk.MultiClient/movie/Movie.cs +++ b/BizHawk.MultiClient/movie/Movie.cs @@ -478,7 +478,7 @@ namespace BizHawk.MultiClient } } - public bool CheckTimeLines(StreamReader reader) + public bool CheckTimeLines(StreamReader reader, bool OnlyGUID) { //This function will compare the movie data to the savestate movie data to see if they match @@ -503,6 +503,11 @@ namespace BizHawk.MultiClient if (result == DialogResult.No) return false; } + else if (OnlyGUID) + { + reader.BaseStream.Position = 0; + return true; + } } else if (line == "[Input]") continue; else if (line == "[/Input]") break; @@ -513,6 +518,8 @@ namespace BizHawk.MultiClient reader.BaseStream.Position = 0; //Reset position because this stream may be read again by other code + if (OnlyGUID) return true; + if (Log.Length() < l.Length()) { //Future event error