Movie class clean up, add movie version to header, save game name and emulator version to header, movie code will load any non-header or input log as a comment, GetFrame does bounds checks, cleaned up todos

This commit is contained in:
andres.delikat 2011-05-08 01:00:13 +00:00
parent 33c300ff7b
commit a91c8ecbd7
3 changed files with 21 additions and 7 deletions

View File

@ -36,6 +36,7 @@ namespace BizHawk.MultiClient
{
MovieMode = MOVIEMODE.RECORD;
Log.Clear();
Header = new MovieHeader("v1.0.0", MovieHeader.MovieVersion, Global.Emulator.SystemId, Global.Game.Name);
}
public void StartPlayback()
@ -67,8 +68,6 @@ namespace BizHawk.MultiClient
//Movie editing tools may like to have something like this
public void AddMovieRecord(string record)
{
//TODO: validate input
//Format into string acceptable by MovieLog
Log.AddFrame(record);
}
@ -156,11 +155,11 @@ namespace BizHawk.MultiClient
}
else if (str[0] == '|')
{
Log.AddFrame(str); //TODO: validate proper formatting
Log.AddFrame(str);
}
else
{
//TODO: Something has gone wrong here!
Header.Comments.Add(str);
}
}

View File

@ -15,12 +15,15 @@ namespace BizHawk.MultiClient
//TODO: GUID, checksum of game, other stuff
Dictionary<string, string> HeaderParams = new Dictionary<string, string>(); //Platform specific options go here
public List<string> Comments = new List<string>();
public const string EMULATIONVERSION = "EmulationVersion";
public const string MOVIEVERSION = "MovieVersion";
public const string PLATFORM = "Platform";
public const string GAMENAME = "GameName";
public static string MovieVersion = "v0.0.1";
public MovieHeader() //All required fields will be set to default values
{
HeaderParams.Add(EMULATIONVERSION, "v1.0.0");

View File

@ -10,6 +10,8 @@ namespace BizHawk.MultiClient
/// </summary>
class MovieLog
{
//TODO: Insert(int frame) not useful for convenctional tasing but TAStudio will want it
List<string> MovieRecords = new List<string>();
public MovieLog()
@ -29,13 +31,23 @@ namespace BizHawk.MultiClient
public void AddFrame(string frame)
{
MovieRecords.Add(frame); //Validate the format? Or shoudl the Movie class be resonible for formatting?
MovieRecords.Add(frame);
}
public void Truncate(int frame)
{
//TODO
}
public string GetFrame(int frameCount) //Frame count is 0 based here, should it be?
{
if (frameCount >= 0)
return MovieRecords[frameCount];
{
if (frameCount < MovieRecords.Count)
return MovieRecords[frameCount];
else
return "";
}
else
return ""; //TODO: throw an exception?
}