Movies - CheckTimelines function, disabled until rerecording is smoothed out better
This commit is contained in:
parent
311af36737
commit
e5af4418da
|
@ -207,7 +207,7 @@ namespace BizHawk.MultiClient
|
||||||
for (int i = 1; i < 3; i++)
|
for (int i = 1; i < 3; i++)
|
||||||
{
|
{
|
||||||
if (mnemonic.Length < (1+7*i)) return;
|
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 +3] != '.') programmaticallyPressedButtons.Add("P" + i.ToString() + " Up");
|
||||||
if (mnemonic[(i - 1) * 7 + 4] != '.') programmaticallyPressedButtons.Add("P" + i.ToString() + " Down");
|
if (mnemonic[(i - 1) * 7 + 4] != '.') programmaticallyPressedButtons.Add("P" + i.ToString() + " Down");
|
||||||
if (mnemonic[(i - 1) * 7 + 5] != '.') programmaticallyPressedButtons.Add("P" + i.ToString() + " Left");
|
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 (type.Name == "NES Controls")
|
||||||
{
|
{
|
||||||
if (mnemonic.Length < 10) return;
|
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[3] != '.') programmaticallyPressedButtons.Add("Right");
|
||||||
if (mnemonic[4] != '.') programmaticallyPressedButtons.Add("Left");
|
if (mnemonic[4] != '.') programmaticallyPressedButtons.Add("Left");
|
||||||
if (mnemonic[5] != '.') programmaticallyPressedButtons.Add("Down");
|
if (mnemonic[5] != '.') programmaticallyPressedButtons.Add("Down");
|
||||||
|
|
|
@ -1126,10 +1126,15 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
if (ReadOnly)
|
if (ReadOnly)
|
||||||
{
|
{
|
||||||
UserMovie.WriteMovie();
|
int x = UserMovie.CheckTimeLines(reader);
|
||||||
UserMovie.StartPlayback();
|
//if (x >= 0)
|
||||||
Global.ActiveController.MovieMode = true;
|
// 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
|
||||||
//run loadstate-readonly function
|
//else
|
||||||
|
{
|
||||||
|
UserMovie.WriteMovie();
|
||||||
|
UserMovie.StartPlayback();
|
||||||
|
Global.ActiveController.MovieMode = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1141,7 +1146,9 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
if (ReadOnly)
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,6 +31,12 @@ namespace BizHawk.MultiClient
|
||||||
rerecordCount = 0;
|
rerecordCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Movie()
|
||||||
|
{
|
||||||
|
Filename = ""; //Note: note this must be populated before playing movie
|
||||||
|
MovieMode = MOVIEMODE.INACTIVE;
|
||||||
|
}
|
||||||
|
|
||||||
public string GetFilePath()
|
public string GetFilePath()
|
||||||
{
|
{
|
||||||
return Filename;
|
return Filename;
|
||||||
|
@ -432,5 +438,32 @@ namespace BizHawk.MultiClient
|
||||||
return frames / 60.0;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue