Refactored Movie folder. Added some functions, merged some functions, and added some comments regarding some questions I have about a few of the functions.

This commit is contained in:
offspring131313 2011-05-16 03:55:17 +00:00
parent 96b80f4789
commit 644106575e
3 changed files with 22 additions and 18 deletions

View File

@ -57,7 +57,7 @@ namespace BizHawk.MultiClient
{
MovieMode = MOVIEMODE.RECORD;
Log.Clear();
Header = new MovieHeader("BizHawk v1.0.0", MovieHeader.MovieVersion, Global.Emulator.SystemId, Global.Game.Name, "", 0);
Header = new MovieHeader(MainForm.EMUVERSION, MovieHeader.MovieVersion, Global.Emulator.SystemId, Global.Game.Name, "", 0);
}
public void StartPlayback()
@ -87,11 +87,16 @@ namespace BizHawk.MultiClient
}
//Movie editing tools may like to have something like this
public void AddMovieRecord(string record)
public void AddFrame(string record)
{
Log.AddFrame(record);
}
public void AddFrameAt(string record, int frame)
{
Log.AddFrameAt(record, frame);
}
public void WriteMovie()
{
if (IsText)
@ -255,7 +260,7 @@ namespace BizHawk.MultiClient
}
else if (str[0] == '|')
{
break;
break;//This right?
}
else
{
@ -267,7 +272,7 @@ namespace BizHawk.MultiClient
}
return true;
}
}//Also this method is never called, can delete? What is purpose?
private bool LoadBinary()
{
@ -306,7 +311,7 @@ namespace BizHawk.MultiClient
if (line == "[/Input]") break;
if (line[0] == '|')
Log.AddFrame(line);
}
}//can this be reduced to just if(line[0] == '|') Log.AddFrame(line) ??
}
public void IncrementRerecordCount()
@ -333,7 +338,7 @@ namespace BizHawk.MultiClient
public void SetHeaderLine(string key, string value)
{
Header.SetHeaderLine(key, value);
Header.AddHeaderLine(key, value);
}
public string GetTime()
@ -367,7 +372,7 @@ namespace BizHawk.MultiClient
}
private double GetSeconds()
{
{ //Should these be placed somewhere more accessible? Perhaps as a public dictionary object in MainForm?
const double NES_PAL = 50.006977968268290849;
const double NES_NTSC = (double)60.098813897440515532;
const double PCE_PAL = 50.0; //TODO ?

View File

@ -53,10 +53,7 @@ namespace BizHawk.MultiClient
/// <param name="value"></param>
public void AddHeaderLine(string key, string value)
{
string temp = value;
if (!HeaderParams.TryGetValue(key, out temp)) //TODO: does a failed attempt mess with value?
HeaderParams.Add(key, value);
HeaderParams.Add(key, value);
}
public void UpdateRerecordCount(int count)
@ -80,10 +77,5 @@ namespace BizHawk.MultiClient
HeaderParams.TryGetValue(key, out value);
return value;
}
public void SetHeaderLine(string key, string value)
{
HeaderParams[key] = value;
}
}
}

View File

@ -16,7 +16,8 @@ namespace BizHawk.MultiClient
public MovieLog()
{
//Should this class initialize with an empty string to MovieRecords so that first frame is index 1?
//MovieRecords.Add("");
}
public int Length()
@ -39,9 +40,15 @@ namespace BizHawk.MultiClient
MovieRecords.Add(frame);
}
public void AddFrameAt(string frame, int frameNum)
{
MovieRecords.Insert(frameNum, frame);
}
public void Truncate(int frame)
{
//TODO
if (frame >= 0 && frame < Length())
{ MovieRecords.RemoveRange(frame,Length() - frame); }
}
public string GetFrame(int frameCount) //Frame count is 0 based here, should it be?