Movie Loadstate - GUID checking in read-only mode + fix a crash bug
This commit is contained in:
parent
3481943b74
commit
64e38e83c8
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue