From fd6a1a88da22fca5b9073074b611cea3c5ca39da Mon Sep 17 00:00:00 2001 From: rolanmen1 Date: Thu, 5 Apr 2012 01:42:24 +0000 Subject: [PATCH] Emulator Won't Crash When User Loads A State That Is Not Embedded To A Movie --- BizHawk.MultiClient/movie/Movie.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/BizHawk.MultiClient/movie/Movie.cs b/BizHawk.MultiClient/movie/Movie.cs index dbefcfd802..252d88540c 100644 --- a/BizHawk.MultiClient/movie/Movie.cs +++ b/BizHawk.MultiClient/movie/Movie.cs @@ -550,10 +550,26 @@ namespace BizHawk.MultiClient } } + private bool IsStateFromAMovie(StreamReader reader) + { + while (true) + { + if (reader.ReadLine().Contains("GUID")) + break; + if (reader.EndOfStream) + return false; + } + return true; + } + public bool CheckTimeLines(string path, bool OnlyGUID) { //This function will compare the movie data to the savestate movie data to see if they match var reader = new StreamReader(path); + + if (!IsStateFromAMovie(reader)) + return false; + MovieLog l = new MovieLog(); string line; string GUID;