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; MovieMode = MOVIEMODE.RECORD;
Log.Clear(); Log.Clear();
Header = new MovieHeader("v1.0.0", MovieHeader.MovieVersion, Global.Emulator.SystemId, Global.Game.Name);
} }
public void StartPlayback() public void StartPlayback()
@ -67,8 +68,6 @@ namespace BizHawk.MultiClient
//Movie editing tools may like to have something like this //Movie editing tools may like to have something like this
public void AddMovieRecord(string record) public void AddMovieRecord(string record)
{ {
//TODO: validate input
//Format into string acceptable by MovieLog
Log.AddFrame(record); Log.AddFrame(record);
} }
@ -156,11 +155,11 @@ namespace BizHawk.MultiClient
} }
else if (str[0] == '|') else if (str[0] == '|')
{ {
Log.AddFrame(str); //TODO: validate proper formatting Log.AddFrame(str);
} }
else 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 //TODO: GUID, checksum of game, other stuff
Dictionary<string, string> HeaderParams = new Dictionary<string, string>(); //Platform specific options go here 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 EMULATIONVERSION = "EmulationVersion";
public const string MOVIEVERSION = "MovieVersion"; public const string MOVIEVERSION = "MovieVersion";
public const string PLATFORM = "Platform"; public const string PLATFORM = "Platform";
public const string GAMENAME = "GameName"; public const string GAMENAME = "GameName";
public static string MovieVersion = "v0.0.1";
public MovieHeader() //All required fields will be set to default values public MovieHeader() //All required fields will be set to default values
{ {
HeaderParams.Add(EMULATIONVERSION, "v1.0.0"); HeaderParams.Add(EMULATIONVERSION, "v1.0.0");

View File

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