Refactor the movie object, replacing Getfunctions with public properties, renaming of some functions, removing a duplicate function, other misc things

This commit is contained in:
andres.delikat 2011-07-17 14:39:15 +00:00
parent bc31a49c4a
commit e6b2c794d4
8 changed files with 79 additions and 96 deletions

View File

@ -146,13 +146,13 @@ namespace BizHawk.MultiClient
public void StopUserMovie() public void StopUserMovie()
{ {
string message = "Movie "; string message = "Movie ";
if (UserMovie.GetMovieMode() == MOVIEMODE.RECORD) if (UserMovie.Mode == MOVIEMODE.RECORD)
message += "recording "; message += "recording ";
else if (UserMovie.GetMovieMode() == MOVIEMODE.PLAY else if (UserMovie.Mode == MOVIEMODE.PLAY
|| UserMovie.GetMovieMode() == MOVIEMODE.FINISHED) || UserMovie.Mode == MOVIEMODE.FINISHED)
message += "playback "; message += "playback ";
message += "stopped."; message += "stopped.";
if (UserMovie.GetMovieMode() != MOVIEMODE.INACTIVE) if (UserMovie.Mode != MOVIEMODE.INACTIVE)
{ {
UserMovie.StopMovie(); UserMovie.StopMovie();
Global.MovieMode = false; Global.MovieMode = false;
@ -163,7 +163,7 @@ namespace BizHawk.MultiClient
public void StopInputLog() public void StopInputLog()
{ {
if (InputLog.GetMovieMode() == MOVIEMODE.RECORD) if (InputLog.Mode == MOVIEMODE.RECORD)
InputLog.StopMovie(); InputLog.StopMovie();
} }
@ -844,7 +844,7 @@ namespace BizHawk.MultiClient
contextMenuStrip1.Items[1].Visible = false; contextMenuStrip1.Items[1].Visible = false;
contextMenuStrip1.Items[2].Visible = false; contextMenuStrip1.Items[2].Visible = false;
if (UserMovie.GetMovieMode() == MOVIEMODE.INACTIVE) if (UserMovie.Mode == MOVIEMODE.INACTIVE)
{ {
contextMenuStrip1.Items[3].Visible = true; contextMenuStrip1.Items[3].Visible = true;
contextMenuStrip1.Items[4].Visible = true; contextMenuStrip1.Items[4].Visible = true;

View File

@ -930,7 +930,7 @@ namespace BizHawk.MultiClient
if (File.Exists(game.SaveRamPath)) if (File.Exists(game.SaveRamPath))
LoadSaveRam(); LoadSaveRam();
if (UserMovie.GetMovieMode() == MOVIEMODE.INACTIVE) if (UserMovie.Mode == MOVIEMODE.INACTIVE)
{ {
InputLog.SetHeaderLine(MovieHeader.PLATFORM, Global.Emulator.SystemId); InputLog.SetHeaderLine(MovieHeader.PLATFORM, Global.Emulator.SystemId);
InputLog.SetHeaderLine(MovieHeader.GAMENAME, Global.Game.FilesystemSafeName); InputLog.SetHeaderLine(MovieHeader.GAMENAME, Global.Game.FilesystemSafeName);
@ -1411,12 +1411,12 @@ namespace BizHawk.MultiClient
else if (!Global.Config.MuteFrameAdvance) else if (!Global.Config.MuteFrameAdvance)
genSound = true; genSound = true;
if (UserMovie.GetMovieMode() != MOVIEMODE.INACTIVE) if (UserMovie.Mode != MOVIEMODE.INACTIVE)
{ {
UserMovie.LatchInputFromLog(); UserMovie.LatchInputFromLog();
} }
if (UserMovie.GetMovieMode() == MOVIEMODE.RECORD) if (UserMovie.Mode == MOVIEMODE.RECORD)
{ {
if (UserMovie.MultiTrack.IsActive) if (UserMovie.MultiTrack.IsActive)
{ {
@ -1429,30 +1429,30 @@ namespace BizHawk.MultiClient
UserMovie.CommitFrame(); UserMovie.CommitFrame();
} }
if (UserMovie.GetMovieMode() == MOVIEMODE.INACTIVE) if (UserMovie.Mode == MOVIEMODE.INACTIVE)
{ {
UserMovie.LatchInputFromPlayer(); UserMovie.LatchInputFromPlayer();
InputLog.CommitFrame(); InputLog.CommitFrame();
} }
if (UserMovie.GetMovieMode() == MOVIEMODE.PLAY) if (UserMovie.Mode == MOVIEMODE.PLAY)
{ {
if (UserMovie.GetMovieLength() == Global.Emulator.Frame) if (UserMovie.Length() == Global.Emulator.Frame)
{ {
UserMovie.SetMovieFinished(); UserMovie.SetMovieFinished();
Global.MovieMode = false; Global.MovieMode = false;
} }
} }
if (UserMovie.GetMovieMode() == MOVIEMODE.FINISHED) if (UserMovie.Mode == MOVIEMODE.FINISHED)
{ {
if (UserMovie.GetMovieLength() > Global.Emulator.Frame) if (UserMovie.Length() > Global.Emulator.Frame)
{ {
UserMovie.StartPlayback(); UserMovie.StartPlayback();
Global.MovieControllerAdapter.SetControllersAsMnemonic(UserMovie.GetInputFrame(Global.Emulator.Frame)); Global.MovieControllerAdapter.SetControllersAsMnemonic(UserMovie.GetInputFrame(Global.Emulator.Frame));
} }
} }
if (UserMovie.GetMovieMode() == MOVIEMODE.RECORD && UserMovie.MultiTrack.IsActive) if (UserMovie.Mode == MOVIEMODE.RECORD && UserMovie.MultiTrack.IsActive)
{ {
Global.MovieControllerAdapter.SetControllersAsMnemonic(UserMovie.GetInputFrame(Global.Emulator.Frame-1)); Global.MovieControllerAdapter.SetControllersAsMnemonic(UserMovie.GetInputFrame(Global.Emulator.Frame-1));
Console.WriteLine("Out: " + UserMovie.GetInputFrame(Global.Emulator.Frame)); Console.WriteLine("Out: " + UserMovie.GetInputFrame(Global.Emulator.Frame));
@ -1537,11 +1537,11 @@ namespace BizHawk.MultiClient
private void HandleMovieSaveState(StreamWriter writer) private void HandleMovieSaveState(StreamWriter writer)
{ {
if (UserMovie.GetMovieMode() != MOVIEMODE.INACTIVE) if (UserMovie.Mode != MOVIEMODE.INACTIVE)
{ {
UserMovie.DumpLogIntoSavestateText(writer); UserMovie.DumpLogIntoSavestateText(writer);
} }
else if (InputLog.GetMovieMode() != MOVIEMODE.INACTIVE) else if (InputLog.Mode != MOVIEMODE.INACTIVE)
InputLog.DumpLogIntoSavestateText(writer); InputLog.DumpLogIntoSavestateText(writer);
} }
@ -1587,7 +1587,7 @@ namespace BizHawk.MultiClient
private void HandleMovieLoadState(StreamReader reader) private void HandleMovieLoadState(StreamReader reader)
{ {
//Note, some of the situations in these IF's may be identical and could be combined but I intentionally separated it out for clarity //Note, some of the situations in these IF's may be identical and could be combined but I intentionally separated it out for clarity
if (UserMovie.GetMovieMode() == MOVIEMODE.RECORD) if (UserMovie.Mode == MOVIEMODE.RECORD)
{ {
if (ReadOnly) if (ReadOnly)
{ {
@ -1608,7 +1608,7 @@ namespace BizHawk.MultiClient
UserMovie.LoadLogFromSavestateText(reader); UserMovie.LoadLogFromSavestateText(reader);
} }
} }
else if (UserMovie.GetMovieMode() == MOVIEMODE.PLAY) else if (UserMovie.Mode == MOVIEMODE.PLAY)
{ {
if (ReadOnly) if (ReadOnly)
{ {
@ -1624,12 +1624,12 @@ namespace BizHawk.MultiClient
UserMovie.LoadLogFromSavestateText(reader); UserMovie.LoadLogFromSavestateText(reader);
} }
} }
else if (UserMovie.GetMovieMode() == MOVIEMODE.FINISHED) else if (UserMovie.Mode == MOVIEMODE.FINISHED)
{ {
//TODO: have the input log kick in upon movie finished mode and stop upon movie resume //TODO: have the input log kick in upon movie finished mode and stop upon movie resume
if (ReadOnly) if (ReadOnly)
{ {
if (Global.Emulator.Frame > UserMovie.GetMovieLength()) if (Global.Emulator.Frame > UserMovie.Length())
{ {
Global.MovieMode = false; Global.MovieMode = false;
//Post movie savestate //Post movie savestate
@ -1648,7 +1648,7 @@ namespace BizHawk.MultiClient
} }
else else
{ {
if (Global.Emulator.Frame > UserMovie.GetMovieLength()) if (Global.Emulator.Frame > UserMovie.Length())
{ {
Global.MovieMode = false; Global.MovieMode = false;
//Post movie savestate //Post movie savestate
@ -1666,7 +1666,7 @@ namespace BizHawk.MultiClient
} }
else else
{ {
if (InputLog.GetMovieMode() == MOVIEMODE.RECORD) if (InputLog.Mode == MOVIEMODE.RECORD)
InputLog.LoadLogFromSavestateText(reader); InputLog.LoadLogFromSavestateText(reader);
} }
} }
@ -2299,7 +2299,7 @@ namespace BizHawk.MultiClient
private void movieToolStripMenuItem_DropDownOpened(object sender, EventArgs e) private void movieToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{ {
if (UserMovie.GetMovieMode() == MOVIEMODE.INACTIVE) if (UserMovie.Mode == MOVIEMODE.INACTIVE)
{ {
stopMovieToolStripMenuItem.Enabled = false; stopMovieToolStripMenuItem.Enabled = false;
playFromBeginningToolStripMenuItem.Enabled = false; playFromBeginningToolStripMenuItem.Enabled = false;
@ -2347,15 +2347,15 @@ namespace BizHawk.MultiClient
public void SetMainformMovieInfo() public void SetMainformMovieInfo()
{ {
if (UserMovie.GetMovieMode() == MOVIEMODE.PLAY || UserMovie.GetMovieMode() == MOVIEMODE.FINISHED) if (UserMovie.Mode == MOVIEMODE.PLAY || UserMovie.Mode == MOVIEMODE.FINISHED)
{ {
Text = DisplayNameForSystem(Global.Game.System) + " - " + Global.Game.Name + " - " + Path.GetFileName(UserMovie.GetFilePath()); Text = DisplayNameForSystem(Global.Game.System) + " - " + Global.Game.Name + " - " + Path.GetFileName(UserMovie.Filename);
PlayRecordStatus.Image = BizHawk.MultiClient.Properties.Resources.Play; PlayRecordStatus.Image = BizHawk.MultiClient.Properties.Resources.Play;
PlayRecordStatus.ToolTipText = "Movie is in playback mode"; PlayRecordStatus.ToolTipText = "Movie is in playback mode";
} }
else if (UserMovie.GetMovieMode() == MOVIEMODE.RECORD) else if (UserMovie.Mode == MOVIEMODE.RECORD)
{ {
Text = DisplayNameForSystem(Global.Game.System) + " - " + Global.Game.Name + " - " + Path.GetFileName(UserMovie.GetFilePath()); Text = DisplayNameForSystem(Global.Game.System) + " - " + Global.Game.Name + " - " + Path.GetFileName(UserMovie.Filename);
PlayRecordStatus.Image = BizHawk.MultiClient.Properties.Resources.RecordHS; PlayRecordStatus.Image = BizHawk.MultiClient.Properties.Resources.RecordHS;
PlayRecordStatus.ToolTipText = "Movie is in record mode"; PlayRecordStatus.ToolTipText = "Movie is in record mode";
} }
@ -2374,7 +2374,7 @@ namespace BizHawk.MultiClient
InputLog.StopMovie(); InputLog.StopMovie();
LoadRom(Global.MainForm.CurrentlyOpenRom); LoadRom(Global.MainForm.CurrentlyOpenRom);
UserMovie.LoadMovie(); UserMovie.LoadMovie();
Global.Config.RecentMovies.Add(m.GetFilePath()); Global.Config.RecentMovies.Add(m.Filename);
if (record) if (record)
{ {
@ -2390,9 +2390,9 @@ namespace BizHawk.MultiClient
public Movie GetActiveMovie() public Movie GetActiveMovie()
{ {
if (UserMovie.GetMovieMode() != MOVIEMODE.INACTIVE) if (UserMovie.Mode != MOVIEMODE.INACTIVE)
return UserMovie; return UserMovie;
else if (InputLog.GetMovieMode() != MOVIEMODE.INACTIVE) else if (InputLog.Mode != MOVIEMODE.INACTIVE)
return InputLog; return InputLog;
else else
return null; return null;
@ -2400,9 +2400,9 @@ namespace BizHawk.MultiClient
public bool MovieActive() public bool MovieActive()
{ {
if (UserMovie.GetMovieMode() != MOVIEMODE.INACTIVE) if (UserMovie.Mode != MOVIEMODE.INACTIVE)
return true; return true;
else if (InputLog.GetMovieMode() != MOVIEMODE.INACTIVE) else if (InputLog.Mode != MOVIEMODE.INACTIVE)
return true; return true;
else else
return false; return false;
@ -2422,7 +2422,7 @@ namespace BizHawk.MultiClient
public void PlayMovieFromBeginning() public void PlayMovieFromBeginning()
{ {
if (UserMovie.GetMovieMode() != MOVIEMODE.INACTIVE) if (UserMovie.Mode != MOVIEMODE.INACTIVE)
{ {
LoadRom(CurrentlyOpenRom); LoadRom(CurrentlyOpenRom);
UserMovie.StartPlayback(); UserMovie.StartPlayback();
@ -2496,7 +2496,7 @@ namespace BizHawk.MultiClient
private void viewSubtitlesToolStripMenuItem_Click(object sender, EventArgs e) private void viewSubtitlesToolStripMenuItem_Click(object sender, EventArgs e)
{ {
if (UserMovie.GetMovieMode() == MOVIEMODE.INACTIVE) return; if (UserMovie.Mode == MOVIEMODE.INACTIVE) return;
EditSubtitlesForm s = new EditSubtitlesForm(); EditSubtitlesForm s = new EditSubtitlesForm();
s.ReadOnly = ReadOnly; s.ReadOnly = ReadOnly;
@ -2570,7 +2570,7 @@ namespace BizHawk.MultiClient
private void viewCommentsToolStripMenuItem_Click(object sender, EventArgs e) private void viewCommentsToolStripMenuItem_Click(object sender, EventArgs e)
{ {
if (UserMovie.GetMovieMode() == MOVIEMODE.INACTIVE) return; if (UserMovie.Mode == MOVIEMODE.INACTIVE) return;
EditCommentsForm c = new EditCommentsForm(); EditCommentsForm c = new EditCommentsForm();
c.ReadOnly = ReadOnly; c.ReadOnly = ReadOnly;

View File

@ -32,7 +32,7 @@ namespace BizHawk.MultiClient
{ {
text = ""; text = "";
if (column == 0) //File if (column == 0) //File
text = Path.GetFileName(MovieList[index].GetFilePath()); text = Path.GetFileName(MovieList[index].Filename);
if (column == 1) //System if (column == 1) //System
text = MovieList[index].GetSysID(); text = MovieList[index].GetSysID();
if (column == 2) //Game if (column == 2) //Game
@ -119,7 +119,7 @@ namespace BizHawk.MultiClient
private int IsDuplicate(string filename) private int IsDuplicate(string filename)
{ {
for (int x = 0; x < MovieList.Count; x++) for (int x = 0; x < MovieList.Count; x++)
if (MovieList[x].GetFilePath() == filename) if (MovieList[x].Filename == filename)
return x; return x;
return 0; return 0;
} }
@ -172,7 +172,7 @@ namespace BizHawk.MultiClient
List<int> TAS = new List<int>(); List<int> TAS = new List<int>();
for (int x = 0; x < Indexes.Count; x++) for (int x = 0; x < Indexes.Count; x++)
{ {
if (Path.GetExtension(MovieList[Indexes[x]].GetFilePath()).ToUpper() == ".TAS") if (Path.GetExtension(MovieList[Indexes[x]].Filename).ToUpper() == ".TAS")
TAS.Add(x); TAS.Add(x);
} }
if (TAS.Count == 1) if (TAS.Count == 1)
@ -185,12 +185,12 @@ namespace BizHawk.MultiClient
//Final tie breaker - Last used file //Final tie breaker - Last used file
DateTime t = new DateTime(); DateTime t = new DateTime();
FileInfo f = new FileInfo(MovieList[Indexes[0]].GetFilePath()); FileInfo f = new FileInfo(MovieList[Indexes[0]].Filename);
t = f.LastAccessTime; t = f.LastAccessTime;
int mostRecent = Indexes[0]; int mostRecent = Indexes[0];
for (int x = 1; x < Indexes.Count; x++) for (int x = 1; x < Indexes.Count; x++)
{ {
f = new FileInfo(MovieList[Indexes[0]].GetFilePath()); f = new FileInfo(MovieList[Indexes[0]].Filename);
if (f.LastAccessTime > t) if (f.LastAccessTime > t)
{ {
t = f.LastAccessTime; t = f.LastAccessTime;

View File

@ -340,7 +340,7 @@ namespace BizHawk.MultiClient
Color c; Color c;
x = GetX(Global.Config.DispInpx, Global.Config.DispInpanchor); x = GetX(Global.Config.DispInpx, Global.Config.DispInpanchor);
y = GetY(Global.Config.DispInpy, Global.Config.DispInpanchor); y = GetY(Global.Config.DispInpy, Global.Config.DispInpanchor);
if (Global.MainForm.UserMovie.GetMovieMode() == MOVIEMODE.PLAY) if (Global.MainForm.UserMovie.Mode == MOVIEMODE.PLAY)
{ {
c = Color.FromArgb(Global.Config.MovieInput); c = Color.FromArgb(Global.Config.MovieInput);
} }
@ -399,15 +399,15 @@ namespace BizHawk.MultiClient
} }
//TODO: clean this up or replace with simple draw symbols //TODO: clean this up or replace with simple draw symbols
if (Global.MainForm.UserMovie.GetMovieMode() == MOVIEMODE.PLAY if (Global.MainForm.UserMovie.Mode == MOVIEMODE.PLAY
|| Global.MainForm.UserMovie.GetMovieMode() == MOVIEMODE.PLAY) || Global.MainForm.UserMovie.Mode == MOVIEMODE.PLAY)
{ {
MessageFont.DrawString(null, "Play", backingControl.Size.Width - 47, MessageFont.DrawString(null, "Play", backingControl.Size.Width - 47,
0 + 1, new Color4(Color.Black)); 0 + 1, new Color4(Color.Black));
MessageFont.DrawString(null, "Play", backingControl.Size.Width - 48, MessageFont.DrawString(null, "Play", backingControl.Size.Width - 48,
0, Color.FromArgb(Global.Config.MovieColor)); 0, Color.FromArgb(Global.Config.MovieColor));
} }
else if (Global.MainForm.UserMovie.GetMovieMode() == MOVIEMODE.RECORD) else if (Global.MainForm.UserMovie.Mode == MOVIEMODE.RECORD)
{ {
AlertFont.DrawString(null, "Record", backingControl.Size.Width - 65, AlertFont.DrawString(null, "Record", backingControl.Size.Width - 65,
0 + 1, new Color4(Color.Black)); 0 + 1, new Color4(Color.Black));
@ -428,15 +428,15 @@ namespace BizHawk.MultiClient
private string MakeFrameCounter() private string MakeFrameCounter()
{ {
if (Global.MainForm.UserMovie.GetMovieMode() == MOVIEMODE.FINISHED) if (Global.MainForm.UserMovie.Mode == MOVIEMODE.FINISHED)
{ {
return Global.Emulator.Frame.ToString() + "/" + Global.MainForm.UserMovie.GetMovieLength().ToString() + " (Finished)"; return Global.Emulator.Frame.ToString() + "/" + Global.MainForm.UserMovie.Length().ToString() + " (Finished)";
} }
else if (Global.MainForm.UserMovie.GetMovieMode() == MOVIEMODE.PLAY) else if (Global.MainForm.UserMovie.Mode == MOVIEMODE.PLAY)
{ {
return Global.Emulator.Frame.ToString() + "/" + Global.MainForm.UserMovie.GetMovieLength().ToString(); return Global.Emulator.Frame.ToString() + "/" + Global.MainForm.UserMovie.Length().ToString();
} }
else if (Global.MainForm.UserMovie.GetMovieMode() == MOVIEMODE.RECORD) else if (Global.MainForm.UserMovie.Mode == MOVIEMODE.RECORD)
return Global.Emulator.Frame.ToString(); return Global.Emulator.Frame.ToString();
else else
{ {
@ -492,7 +492,7 @@ namespace BizHawk.MultiClient
public string MakeRerecordCount() public string MakeRerecordCount()
{ {
string tmp = ""; string tmp = "";
if (Global.MainForm.UserMovie.GetMovieMode() != MOVIEMODE.INACTIVE) if (Global.MainForm.UserMovie.Mode != MOVIEMODE.INACTIVE)
{ {
tmp += "Rerecord Count: "; tmp += "Rerecord Count: ";
tmp += Global.MainForm.GetActiveMovie().GetRerecordCount().ToString(); tmp += Global.MainForm.GetActiveMovie().GetRerecordCount().ToString();

View File

@ -140,8 +140,8 @@ namespace BizHawk.MultiClient
get get
{ {
string Bind = ""; string Bind = "";
if (Global.Config.BindSavestatesToMovies && Global.MainForm.UserMovie.GetMovieMode() != MOVIEMODE.INACTIVE) if (Global.Config.BindSavestatesToMovies && Global.MainForm.UserMovie.Mode != MOVIEMODE.INACTIVE)
Bind += " - " + Path.GetFileNameWithoutExtension(Global.MainForm.UserMovie.GetFilePath()); Bind += " - " + Path.GetFileNameWithoutExtension(Global.MainForm.UserMovie.Filename);
switch (System) switch (System)
{ {
case "SMS": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathSMSSavestates, "SMS"), filesystemSafeName + Bind); case "SMS": return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathSMSSavestates, "SMS"), filesystemSafeName + Bind);

View File

@ -13,14 +13,14 @@ namespace BizHawk.MultiClient
private MovieHeader Header = new MovieHeader(); private MovieHeader Header = new MovieHeader();
private MovieLog Log = new MovieLog(); private MovieLog Log = new MovieLog();
public SubtitleList Subtitles = new SubtitleList(); public SubtitleList Subtitles = new SubtitleList();
private bool IsText = true;
public string Filename; //TODO: replace GetFilename() method
public bool MakeBackup = true; //Flag for making backup before altering movie
private MOVIEMODE MovieMode = new MOVIEMODE();
public MultitrackRecording MultiTrack = new MultitrackRecording(); public MultitrackRecording MultiTrack = new MultitrackRecording();
public bool IsText { get; private set; }
public string Filename { get; private set; }
public MOVIEMODE Mode { get; private set; }
public bool MakeBackup = true; //Flag - make backup before altering movie
public int Frames = 0; public int Frames = 0;
public int lastLog; public int lastLog;
public int rerecordCount; public int rerecordCount;
@ -44,28 +44,26 @@ namespace BizHawk.MultiClient
Filename = filename; Filename = filename;
exists = true; exists = true;
} }
MovieMode = m; Mode = m;
lastLog = 0; lastLog = 0;
rerecordCount = 0; rerecordCount = 0;
IsText = true;
} }
public Movie(string filename, MOVIEMODE m) public Movie(string filename, MOVIEMODE m)
{ {
MovieMode = m; Mode = m;
lastLog = 0; lastLog = 0;
rerecordCount = 0; rerecordCount = 0;
this.Filename = filename; this.Filename = filename;
IsText = true;
} }
public Movie() public Movie()
{ {
Filename = ""; //Note: note this must be populated before playing movie Filename = ""; //Note: note this must be populated before playing movie
MovieMode = MOVIEMODE.INACTIVE; Mode = MOVIEMODE.INACTIVE;
} IsText = true;
public string GetFilePath()
{
return Filename;
} }
public string GetSysID() public string GetSysID()
@ -77,21 +75,21 @@ namespace BizHawk.MultiClient
{ {
return Header.GetHeaderLine(MovieHeader.GAMENAME); return Header.GetHeaderLine(MovieHeader.GAMENAME);
} }
public int GetLength() public int Length()
{ {
return Log.Length(); return Log.Length();
} }
public void StopMovie() public void StopMovie()
{ {
if (MovieMode == MOVIEMODE.RECORD) if (Mode == MOVIEMODE.RECORD)
WriteMovie(); WriteMovie();
MovieMode = MOVIEMODE.INACTIVE; Mode = MOVIEMODE.INACTIVE;
} }
public void StartNewRecording() public void StartNewRecording()
{ {
MovieMode = MOVIEMODE.RECORD; Mode = MOVIEMODE.RECORD;
if (Global.Config.EnableBackupMovies && MakeBackup && Log.Length() > 0) if (Global.Config.EnableBackupMovies && MakeBackup && Log.Length() > 0)
{ {
WriteBackup(); WriteBackup();
@ -102,12 +100,7 @@ namespace BizHawk.MultiClient
public void StartPlayback() public void StartPlayback()
{ {
MovieMode = MOVIEMODE.PLAY; Mode = MOVIEMODE.PLAY;
}
public MOVIEMODE GetMovieMode()
{
return MovieMode;
} }
public void LatchMultitrackPlayerInput() public void LatchMultitrackPlayerInput()
@ -164,13 +157,12 @@ namespace BizHawk.MultiClient
public string GetInputFrame(int frame) public string GetInputFrame(int frame)
{ {
lastLog = frame; lastLog = frame;
if (frame < Log.GetMovieLength()) if (frame < Log.Length())
return Log.GetFrame(frame); return Log.GetFrame(frame);
else else
return ""; return "";
} }
//Movie editing tools may like to have something like this
public void AppendFrame(string record) public void AppendFrame(string record)
{ {
Log.AddFrame(record); Log.AddFrame(record);
@ -208,7 +200,7 @@ namespace BizHawk.MultiClient
private void WriteText(string file) private void WriteText(string file)
{ {
if (file.Length == 0) return; //Nothing to write if (file.Length == 0) return; //Nothing to write
int length = Log.GetMovieLength(); int length = Log.Length();
using (StreamWriter sw = new StreamWriter(file)) using (StreamWriter sw = new StreamWriter(file))
{ {
@ -422,10 +414,6 @@ namespace BizHawk.MultiClient
return LoadText(); return LoadText();
} }
public int GetMovieLength()
{
return Log.GetMovieLength();
}
public void DumpLogIntoSavestateText(TextWriter writer) public void DumpLogIntoSavestateText(TextWriter writer)
{ {
@ -499,8 +487,8 @@ namespace BizHawk.MultiClient
public void SetMovieFinished() public void SetMovieFinished()
{ {
if (MovieMode == MOVIEMODE.PLAY) if (Mode == MOVIEMODE.PLAY)
MovieMode = MOVIEMODE.FINISHED; Mode = MOVIEMODE.FINISHED;
} }
public void SetHeaderLine(string key, string value) public void SetHeaderLine(string key, string value)
@ -691,7 +679,7 @@ namespace BizHawk.MultiClient
private int CompareFileName(Movie Other) private int CompareFileName(Movie Other)
{ {
string otherName = Path.GetFileName(Other.GetFilePath()); string otherName = Path.GetFileName(Other.Filename);
string thisName = Path.GetFileName(this.Filename); string thisName = Path.GetFileName(this.Filename);
return thisName.CompareTo(otherName); return thisName.CompareTo(otherName);

View File

@ -31,11 +31,6 @@ namespace BizHawk.MultiClient
MovieRecords.Clear(); MovieRecords.Clear();
} }
public int GetMovieLength()
{
return MovieRecords.Count;
}
public void AddFrame(string frame) public void AddFrame(string frame)
{ {
MovieRecords.Add(frame); MovieRecords.Add(frame);
@ -73,7 +68,7 @@ namespace BizHawk.MultiClient
public void WriteText(StreamWriter sw) public void WriteText(StreamWriter sw)
{ {
int length = GetMovieLength(); int length = Length();
for (int x = 0; x < length; x++) for (int x = 0; x < length; x++)
{ {
sw.WriteLine(GetFrame(x)); sw.WriteLine(GetFrame(x));

View File

@ -45,7 +45,7 @@ namespace BizHawk.MultiClient
public void UpdateValues() public void UpdateValues()
{ {
if (!this.IsHandleCreated || this.IsDisposed) return; if (!this.IsHandleCreated || this.IsDisposed) return;
if (Global.MainForm.UserMovie.GetMovieMode() == MOVIEMODE.INACTIVE) if (Global.MainForm.UserMovie.Mode == MOVIEMODE.INACTIVE)
TASView.ItemCount = 0; TASView.ItemCount = 0;
else else
DisplayList(); DisplayList();
@ -75,7 +75,7 @@ namespace BizHawk.MultiClient
private void DisplayList() private void DisplayList()
{ {
TASView.ItemCount = Global.MainForm.UserMovie.GetMovieLength(); TASView.ItemCount = Global.MainForm.UserMovie.Length();
TASView.ensureVisible(Global.Emulator.Frame); TASView.ensureVisible(Global.Emulator.Frame);
} }