Movies - CheckTimelines function, disabled until rerecording is smoothed out better

This commit is contained in:
andres.delikat 2011-05-17 01:10:04 +00:00
parent 311af36737
commit e5af4418da
3 changed files with 47 additions and 7 deletions

View File

@ -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");

View File

@ -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
{

View File

@ -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;
}
}
}