Movie refactoring - round 2
This commit is contained in:
parent
c9b3f7bedf
commit
8f408737da
|
@ -340,16 +340,18 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private string MakeFrameCounter()
|
||||
{
|
||||
if (Global.MovieSession.Movie.Mode == MOVIEMODE.FINISHED)
|
||||
if (Global.MovieSession.Movie.IsFinished)
|
||||
{
|
||||
return Global.Emulator.Frame.ToString() + "/" + Global.MovieSession.Movie.TotalFrames.ToString() + " (Finished)";
|
||||
return Global.Emulator.Frame.ToString() + "/" + Global.MovieSession.Movie.Frames.ToString() + " (Finished)";
|
||||
}
|
||||
else if (Global.MovieSession.Movie.Mode == MOVIEMODE.PLAY)
|
||||
else if (Global.MovieSession.Movie.IsPlaying)
|
||||
{
|
||||
return Global.Emulator.Frame.ToString() + "/" + Global.MovieSession.Movie.TotalFrames.ToString();
|
||||
return Global.Emulator.Frame.ToString() + "/" + Global.MovieSession.Movie.Frames.ToString();
|
||||
}
|
||||
else if (Global.MovieSession.Movie.Mode == MOVIEMODE.RECORD)
|
||||
else if (Global.MovieSession.Movie.IsRecording)
|
||||
{
|
||||
return Global.Emulator.Frame.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Global.Emulator.Frame.ToString();
|
||||
|
@ -421,22 +423,31 @@ namespace BizHawk.MultiClient
|
|||
public string MakeInputDisplay()
|
||||
{
|
||||
StringBuilder s;
|
||||
if (Global.MovieSession.Movie.Mode == MOVIEMODE.INACTIVE || Global.MovieSession.Movie.Mode == MOVIEMODE.FINISHED)
|
||||
if (Global.MovieSession.Movie.IsPlaying)
|
||||
{
|
||||
s = new StringBuilder(Global.GetOutputControllersAsMnemonic());
|
||||
}
|
||||
else
|
||||
s = new StringBuilder(Global.MovieSession.Movie.GetInputFrame(Global.Emulator.Frame - 1));
|
||||
s.Replace(".", " ").Replace("|", "").Replace("l", ""); //If l is ever a mnemonic this will squash it.
|
||||
{
|
||||
s = new StringBuilder(Global.MovieSession.Movie.GetInput(Global.Emulator.Frame - 1));
|
||||
}
|
||||
|
||||
s.Replace(".", " ").Replace("|", "").Replace("l", ""); //Note: if l is ever a mnemonic this will squash it. But this is done because on the NES core I put l in the command mnemonic to indicate lag (was a bad a idea)
|
||||
|
||||
return s.ToString();
|
||||
}
|
||||
|
||||
public string MakeRerecordCount()
|
||||
{
|
||||
if (Global.MovieSession.Movie.Mode != MOVIEMODE.INACTIVE)
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
return "Rerecord Count: " + Global.MovieSession.Movie.Rerecords.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Display all screen info objects like fps, frame counter, lag counter, and input display
|
||||
|
@ -457,12 +468,14 @@ namespace BizHawk.MultiClient
|
|||
Color c;
|
||||
float x = GetX(g, Global.Config.DispInpx, Global.Config.DispInpanchor, MessageFont, input);
|
||||
float y = GetY(g, Global.Config.DispInpy, Global.Config.DispInpanchor, MessageFont, input);
|
||||
if (Global.MovieSession.Movie.Mode == MOVIEMODE.PLAY)
|
||||
if (Global.MovieSession.Movie.IsPlaying && !Global.MovieSession.Movie.IsRecording)
|
||||
{
|
||||
c = Color.FromArgb(Global.Config.MovieInput);
|
||||
}
|
||||
else
|
||||
{
|
||||
c = Color.FromArgb(Global.Config.MessagesColor);
|
||||
}
|
||||
|
||||
g.DrawString(input, MessageFont, Color.Black, x+1,y+1);
|
||||
g.DrawString(input, MessageFont, c, x,y);
|
||||
|
@ -513,38 +526,37 @@ namespace BizHawk.MultiClient
|
|||
g.DrawString(rerec, MessageFont, FixedMessagesColor, x, y);
|
||||
}
|
||||
|
||||
if (Global.MovieSession.Movie.Mode == MOVIEMODE.PLAY)
|
||||
{
|
||||
//TODO
|
||||
//int r = (int)g.ClipBounds.Width;
|
||||
//Point[] p = { new Point(r - 20, 2),
|
||||
// new Point(r - 4, 12),
|
||||
// new Point(r - 20, 22) };
|
||||
//g.FillPolygon(new SolidBrush(Color.Red), p);
|
||||
//g.DrawPolygon(new Pen(new SolidBrush(Color.Pink)), p);
|
||||
//if (Global.MovieSession.Movie.IsPlaying)
|
||||
//{
|
||||
// //int r = (int)g.ClipBounds.Width;
|
||||
// //Point[] p = { new Point(r - 20, 2),
|
||||
// // new Point(r - 4, 12),
|
||||
// // new Point(r - 20, 22) };
|
||||
// //g.FillPolygon(new SolidBrush(Color.Red), p);
|
||||
// //g.DrawPolygon(new Pen(new SolidBrush(Color.Pink)), p);
|
||||
|
||||
}
|
||||
else if (Global.MovieSession.Movie.Mode == MOVIEMODE.RECORD)
|
||||
//}
|
||||
//else if (Global.MovieSession.Movie.IsRecording)
|
||||
//{
|
||||
// //g.FillEllipse(new SolidBrush(Color.Red), new Rectangle((int)g.ClipBounds.Width - 22, 2, 20, 20));
|
||||
// //g.DrawEllipse(new Pen(new SolidBrush(Color.Pink)), new Rectangle((int)g.ClipBounds.Width - 22, 2, 20, 20));
|
||||
//}
|
||||
|
||||
if (Global.MovieSession.Movie.IsActive && Global.Config.DisplaySubtitles)
|
||||
{
|
||||
//TODO
|
||||
//g.FillEllipse(new SolidBrush(Color.Red), new Rectangle((int)g.ClipBounds.Width - 22, 2, 20, 20));
|
||||
//g.DrawEllipse(new Pen(new SolidBrush(Color.Pink)), new Rectangle((int)g.ClipBounds.Width - 22, 2, 20, 20));
|
||||
}
|
||||
|
||||
if (Global.MovieSession.Movie.Mode != MOVIEMODE.INACTIVE && Global.Config.DisplaySubtitles)
|
||||
{
|
||||
|
||||
List<Subtitle> s = Global.MovieSession.Movie.Subtitles.GetSubtitles(Global.Emulator.Frame);
|
||||
if (s == null) return;
|
||||
if (s == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < s.Count; i++)
|
||||
{
|
||||
g.DrawString(s[i].Message, MessageFont, Color.Black,
|
||||
s[i].X + 1, s[i].Y + 1);
|
||||
g.DrawString(s[i].Message, MessageFont, Color.FromArgb((int)s[i].Color),
|
||||
s[i].X, s[i].Y);
|
||||
g.DrawString(s[i].Message, MessageFont, Color.Black, s[i].X + 1, s[i].Y + 1);
|
||||
g.DrawString(s[i].Message, MessageFont, Color.FromArgb((int)s[i].Color), s[i].X, s[i].Y);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1790,7 +1790,22 @@ namespace BizHawk.MultiClient
|
|||
//----------------------------------------------------
|
||||
public string movie_mode()
|
||||
{
|
||||
return Global.MovieSession.Movie.Mode.ToString();
|
||||
if (Global.MovieSession.Movie.IsFinished)
|
||||
{
|
||||
return "FINISHED";
|
||||
}
|
||||
else if (Global.MovieSession.Movie.IsPlaying)
|
||||
{
|
||||
return "PLAY";
|
||||
}
|
||||
else if (Global.MovieSession.Movie.IsRecording)
|
||||
{
|
||||
return "RECORD";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "INACTIVE";
|
||||
}
|
||||
}
|
||||
|
||||
public string movie_rerecordcount()
|
||||
|
@ -1800,20 +1815,24 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public void movie_stop()
|
||||
{
|
||||
Global.MovieSession.Movie.StopMovie();
|
||||
Global.MovieSession.Movie.Stop();
|
||||
}
|
||||
|
||||
public bool movie_isloaded()
|
||||
{
|
||||
if (Global.MovieSession.Movie.Mode == MOVIEMODE.INACTIVE)
|
||||
return false;
|
||||
else
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int movie_length()
|
||||
{
|
||||
return Global.MovieSession.Movie.TotalFrames;
|
||||
return Global.MovieSession.Movie.Frames;
|
||||
}
|
||||
|
||||
public string movie_filename()
|
||||
|
@ -1838,7 +1857,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
LuaTable input = lua.NewTable();
|
||||
|
||||
string s = Global.MovieSession.Movie.GetInputFrame(LuaInt(frame));
|
||||
string s = Global.MovieSession.Movie.GetInput(LuaInt(frame));
|
||||
MovieControllerAdapter m = new MovieControllerAdapter();
|
||||
m.Type = Global.MovieSession.MovieControllerAdapter.Type;
|
||||
m.SetControllersAsMnemonic(s);
|
||||
|
@ -1850,15 +1869,15 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public bool movie_getrerecordcounting()
|
||||
{
|
||||
return Global.MovieSession.Movie.RerecordCounting;
|
||||
return Global.MovieSession.Movie.IsCountingRerecords;
|
||||
}
|
||||
|
||||
public void movie_setrerecordcounting(object lua_input)
|
||||
{
|
||||
if (lua_input.ToString().ToUpper() == "TRUE" || lua_input.ToString() == "1")
|
||||
Global.MovieSession.Movie.RerecordCounting = true;
|
||||
Global.MovieSession.Movie.IsCountingRerecords = true;
|
||||
else
|
||||
Global.MovieSession.Movie.RerecordCounting = false;
|
||||
Global.MovieSession.Movie.IsCountingRerecords = false;
|
||||
}
|
||||
//----------------------------------------------------
|
||||
//Input library
|
||||
|
|
|
@ -968,20 +968,7 @@ namespace BizHawk.MultiClient
|
|||
cmiLoadLastRom.Visible = false;
|
||||
toolStripSeparator_afterRomLoading.Visible = false;
|
||||
|
||||
if (Global.MovieSession.Movie.Mode == MOVIEMODE.INACTIVE)
|
||||
{
|
||||
cmiRecordMovie.Visible = true;
|
||||
cmiPlayMovie.Visible = true;
|
||||
cmiRestartMovie.Visible = false;
|
||||
cmiStopMovie.Visible = false;
|
||||
cmiLoadLastMovie.Visible = true;
|
||||
cmiMakeMovieBackup.Visible = false;
|
||||
cmiViewSubtitles.Visible = false;
|
||||
cmiViewComments.Visible = false;
|
||||
toolStripSeparator_afterMovie.Visible = true;
|
||||
cmiAddSubtitle.Visible = false;
|
||||
}
|
||||
else
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
cmiRecordMovie.Visible = false;
|
||||
cmiPlayMovie.Visible = false;
|
||||
|
@ -1005,6 +992,19 @@ namespace BizHawk.MultiClient
|
|||
cmiAddSubtitle.Visible = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cmiRecordMovie.Visible = true;
|
||||
cmiPlayMovie.Visible = true;
|
||||
cmiRestartMovie.Visible = false;
|
||||
cmiStopMovie.Visible = false;
|
||||
cmiLoadLastMovie.Visible = true;
|
||||
cmiMakeMovieBackup.Visible = false;
|
||||
cmiViewSubtitles.Visible = false;
|
||||
cmiViewComments.Visible = false;
|
||||
toolStripSeparator_afterMovie.Visible = true;
|
||||
cmiAddSubtitle.Visible = false;
|
||||
}
|
||||
|
||||
cmiUndoSavestate.Visible = true;
|
||||
|
||||
|
@ -1135,23 +1135,25 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void viewCommentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Global.MovieSession.Movie.Mode == MOVIEMODE.INACTIVE) return;
|
||||
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
EditCommentsForm c = new EditCommentsForm();
|
||||
c.ReadOnly = ReadOnly;
|
||||
c.GetMovie(Global.MovieSession.Movie);
|
||||
c.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void viewSubtitlesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Global.MovieSession.Movie.Mode == MOVIEMODE.INACTIVE) return;
|
||||
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
EditSubtitlesForm s = new EditSubtitlesForm();
|
||||
s.ReadOnly = ReadOnly;
|
||||
s.GetMovie(Global.MovieSession.Movie);
|
||||
s.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void debuggerToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -1200,16 +1202,16 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void movieToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
if (Global.MovieSession.Movie.Mode == MOVIEMODE.INACTIVE)
|
||||
{
|
||||
stopMovieToolStripMenuItem.Enabled = false;
|
||||
playFromBeginningToolStripMenuItem.Enabled = false;
|
||||
}
|
||||
else
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
stopMovieToolStripMenuItem.Enabled = true;
|
||||
playFromBeginningToolStripMenuItem.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
stopMovieToolStripMenuItem.Enabled = false;
|
||||
playFromBeginningToolStripMenuItem.Enabled = false;
|
||||
}
|
||||
|
||||
readonlyToolStripMenuItem.Checked = ReadOnly;
|
||||
bindSavestatesToMoviesToolStripMenuItem.Checked = Global.Config.BindSavestatesToMovies;
|
||||
|
|
|
@ -20,7 +20,10 @@ namespace BizHawk.MultiClient
|
|||
|
||||
LoadRom(Global.MainForm.CurrentlyOpenRom);
|
||||
if (!record)
|
||||
{
|
||||
Global.MovieSession.Movie.LoadMovie();
|
||||
}
|
||||
|
||||
Global.Config.RecentMovies.Add(m.Filename);
|
||||
if (Global.MovieSession.Movie.StartsFromSavestate)
|
||||
{
|
||||
|
@ -42,13 +45,13 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public void SetMainformMovieInfo()
|
||||
{
|
||||
if (Global.MovieSession.Movie.Mode == MOVIEMODE.PLAY || Global.MovieSession.Movie.Mode == MOVIEMODE.FINISHED)
|
||||
if (Global.MovieSession.Movie.IsPlaying)
|
||||
{
|
||||
Text = DisplayNameForSystem(Global.Game.System) + " - " + Global.Game.Name + " - " + Path.GetFileName(Global.MovieSession.Movie.Filename);
|
||||
PlayRecordStatus.Image = BizHawk.MultiClient.Properties.Resources.Play;
|
||||
PlayRecordStatus.ToolTipText = "Movie is in playback mode";
|
||||
}
|
||||
else if (Global.MovieSession.Movie.Mode == MOVIEMODE.RECORD)
|
||||
else if (Global.MovieSession.Movie.IsRecording)
|
||||
{
|
||||
Text = DisplayNameForSystem(Global.Game.System) + " - " + Global.Game.Name + " - " + Path.GetFileName(Global.MovieSession.Movie.Filename);
|
||||
PlayRecordStatus.Image = BizHawk.MultiClient.Properties.Resources.RecordHS;
|
||||
|
@ -62,14 +65,6 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
public bool MovieActive()
|
||||
{
|
||||
if (Global.MovieSession.Movie.Mode != MOVIEMODE.INACTIVE)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public void PlayMovie()
|
||||
{
|
||||
PlayMovie p = new PlayMovie();
|
||||
|
@ -84,7 +79,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public void PlayMovieFromBeginning()
|
||||
{
|
||||
if (Global.MovieSession.Movie.Mode != MOVIEMODE.INACTIVE)
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
LoadRom(CurrentlyOpenRom);
|
||||
if (Global.MovieSession.Movie.StartsFromSavestate)
|
||||
|
@ -102,15 +97,20 @@ namespace BizHawk.MultiClient
|
|||
public void StopMovie()
|
||||
{
|
||||
string message = "Movie ";
|
||||
if (Global.MovieSession.Movie.Mode == MOVIEMODE.RECORD)
|
||||
message += "recording ";
|
||||
else if (Global.MovieSession.Movie.Mode == MOVIEMODE.PLAY
|
||||
|| Global.MovieSession.Movie.Mode == MOVIEMODE.FINISHED)
|
||||
message += "playback ";
|
||||
message += "stopped.";
|
||||
if (Global.MovieSession.Movie.Mode != MOVIEMODE.INACTIVE)
|
||||
if (Global.MovieSession.Movie.IsRecording)
|
||||
{
|
||||
Global.MovieSession.Movie.StopMovie();
|
||||
message += "recording ";
|
||||
}
|
||||
else if (Global.MovieSession.Movie.IsPlaying)
|
||||
{
|
||||
message += "playback ";
|
||||
}
|
||||
|
||||
message += "stopped.";
|
||||
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
Global.MovieSession.Movie.Stop();
|
||||
Global.OSD.AddMessage(message);
|
||||
SetMainformMovieInfo();
|
||||
Global.MainForm.ReadOnly = true;
|
||||
|
@ -120,12 +120,12 @@ namespace BizHawk.MultiClient
|
|||
private bool HandleMovieLoadState(string path)
|
||||
{
|
||||
//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 (Global.MovieSession.Movie.Mode == MOVIEMODE.INACTIVE)
|
||||
if (!Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
else if (Global.MovieSession.Movie.Mode == MOVIEMODE.RECORD)
|
||||
else if (Global.MovieSession.Movie.IsRecording)
|
||||
{
|
||||
|
||||
if (ReadOnly)
|
||||
|
@ -151,7 +151,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
else if (Global.MovieSession.Movie.Mode == MOVIEMODE.PLAY)
|
||||
else if (Global.MovieSession.Movie.IsPlaying && !Global.MovieSession.Movie.IsFinished)
|
||||
{
|
||||
if (ReadOnly)
|
||||
{
|
||||
|
@ -167,12 +167,12 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
return false; //GUID Error
|
||||
}
|
||||
Global.MovieSession.Movie.ResumeRecording();
|
||||
Global.MovieSession.Movie.Record();
|
||||
SetMainformMovieInfo();
|
||||
Global.MovieSession.Movie.LoadLogFromSavestateText(path);
|
||||
}
|
||||
}
|
||||
else if (Global.MovieSession.Movie.Mode == MOVIEMODE.FINISHED)
|
||||
else if (Global.MovieSession.Movie.IsFinished)
|
||||
{
|
||||
if (ReadOnly)
|
||||
{
|
||||
|
@ -181,7 +181,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
return false; //Timeline/GUID error
|
||||
}
|
||||
else if (Global.MovieSession.Movie.Mode == MOVIEMODE.FINISHED) //TimeLine check can change a movie to finished, hence the check here (not a good design)
|
||||
else if (Global.MovieSession.Movie.IsFinished) //TimeLine check can change a movie to finished, hence the check here (not a good design)
|
||||
{
|
||||
Global.MovieSession.LatchInputFromPlayer(Global.MovieInputSourceAdapter);
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
return false; //GUID Error
|
||||
}
|
||||
else if (Global.MovieSession.Movie.Mode == MOVIEMODE.FINISHED)
|
||||
else if (Global.MovieSession.Movie.IsFinished)
|
||||
{
|
||||
Global.MovieSession.LatchInputFromPlayer(Global.MovieInputSourceAdapter);
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void HandleMovieSaveState(StreamWriter writer)
|
||||
{
|
||||
if (Global.MovieSession.Movie.Mode != MOVIEMODE.INACTIVE)
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
Global.MovieSession.Movie.DumpLogIntoSavestateText(writer);
|
||||
}
|
||||
|
@ -225,9 +225,39 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void HandleMovieOnFrameLoop()
|
||||
{
|
||||
switch (Global.MovieSession.Movie.Mode)
|
||||
if (!Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
Global.MovieSession.LatchInputFromPlayer(Global.MovieInputSourceAdapter);
|
||||
}
|
||||
|
||||
else if (Global.MovieSession.Movie.IsFinished)
|
||||
{
|
||||
if (Global.Emulator.Frame < Global.MovieSession.Movie.Frames) //This scenario can happen from rewinding (suddenly we are back in the movie, so hook back up to the movie
|
||||
{
|
||||
Global.MovieSession.Movie.StartPlayback();
|
||||
Global.MovieSession.LatchInputFromLog();
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.MovieSession.LatchInputFromPlayer(Global.MovieInputSourceAdapter);
|
||||
}
|
||||
}
|
||||
|
||||
else if (Global.MovieSession.Movie.IsPlaying)
|
||||
{
|
||||
if (Global.Emulator.Frame >= Global.MovieSession.Movie.Frames)
|
||||
{
|
||||
Global.MovieSession.Movie.Finish();
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.MovieSession.Movie.CaptureState();
|
||||
Global.MovieSession.LatchInputFromLog();
|
||||
}
|
||||
}
|
||||
|
||||
else if (Global.MovieSession.Movie.IsRecording)
|
||||
{
|
||||
case MOVIEMODE.RECORD:
|
||||
Global.MovieSession.Movie.CaptureState();
|
||||
if (Global.MovieSession.MultiTrack.IsActive)
|
||||
{
|
||||
|
@ -240,39 +270,9 @@ namespace BizHawk.MultiClient
|
|||
//the movie session makes sure that the correct input has been read and merged to its MovieControllerAdapter;
|
||||
//this has been wired to Global.MovieOutputHardpoint in RewireInputChain
|
||||
Global.MovieSession.Movie.CommitFrame(Global.Emulator.Frame, Global.MovieOutputHardpoint);
|
||||
break;
|
||||
case MOVIEMODE.PLAY:
|
||||
int x = Global.MovieSession.Movie.TotalFrames;
|
||||
if (Global.Emulator.Frame >= Global.MovieSession.Movie.TotalFrames)
|
||||
{
|
||||
Global.MovieSession.Movie.SetMovieFinished();
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.MovieSession.Movie.CaptureState();
|
||||
Global.MovieSession.LatchInputFromLog();
|
||||
}
|
||||
x++;
|
||||
break;
|
||||
case MOVIEMODE.FINISHED:
|
||||
int xx = Global.MovieSession.Movie.TotalFrames;
|
||||
if (Global.Emulator.Frame < Global.MovieSession.Movie.TotalFrames) //This scenario can happen from rewinding (suddenly we are back in the movie, so hook back up to the movie
|
||||
{
|
||||
Global.MovieSession.Movie.StartPlayback();
|
||||
Global.MovieSession.LatchInputFromLog();
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.MovieSession.LatchInputFromPlayer(Global.MovieInputSourceAdapter);
|
||||
}
|
||||
xx++;
|
||||
break;
|
||||
case MOVIEMODE.INACTIVE:
|
||||
Global.MovieSession.LatchInputFromPlayer(Global.MovieInputSourceAdapter);
|
||||
break;
|
||||
}
|
||||
|
||||
//adelikat; Scheduled for deletion: RestoreReadWriteOnStop, should just be a type of movie finished, we need a menu item for what to do when a movie finishes (closes, resumes recording, goes into finished mode)
|
||||
//adelikat TODO: Scheduled for deletion: RestoreReadWriteOnStop, should just be a type of movie finished, we need a menu item for what to do when a movie finishes (closes, resumes recording, goes into finished mode)
|
||||
//if (StopOnFrame != -1 && StopOnFrame == Global.Emulator.Frame + 1)
|
||||
//{
|
||||
// if (StopOnFrame == Global.MovieSession.Movie.LogLength())
|
||||
|
|
|
@ -143,7 +143,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
Global.CheatList.SaveSettings();
|
||||
CloseGame();
|
||||
Global.MovieSession.Movie.StopMovie();
|
||||
Global.MovieSession.Movie.Stop();
|
||||
CloseTools();
|
||||
SaveConfig();
|
||||
};
|
||||
|
@ -219,14 +219,19 @@ namespace BizHawk.MultiClient
|
|||
if (cmdMovie != null)
|
||||
{
|
||||
if (Global.Game == null)
|
||||
OpenROM();
|
||||
if (Global.Game != null)
|
||||
{
|
||||
Movie m = new Movie(cmdMovie, MOVIEMODE.PLAY);
|
||||
OpenROM();
|
||||
}
|
||||
else
|
||||
{
|
||||
Movie m = new Movie(cmdMovie);
|
||||
m.Play();
|
||||
ReadOnly = true;
|
||||
// if user is dumping and didnt supply dump length, make it as long as the loaded movie
|
||||
if (autoDumpLength == 0)
|
||||
autoDumpLength = m.TotalFrames;
|
||||
{
|
||||
autoDumpLength = m.Frames;
|
||||
}
|
||||
StartNewMovie(m, false);
|
||||
Global.Config.RecentMovies.Add(cmdMovie);
|
||||
}
|
||||
|
@ -234,19 +239,26 @@ namespace BizHawk.MultiClient
|
|||
else if (Global.Config.AutoLoadMostRecentMovie && !Global.Config.RecentMovies.IsEmpty())
|
||||
{
|
||||
if (Global.Game == null)
|
||||
OpenROM();
|
||||
if (Global.Game != null)
|
||||
{
|
||||
Movie m = new Movie(Global.Config.RecentMovies.GetRecentFileByPosition(0), MOVIEMODE.PLAY);
|
||||
OpenROM();
|
||||
}
|
||||
else
|
||||
{
|
||||
Movie m = new Movie(Global.Config.RecentMovies.GetRecentFileByPosition(0));
|
||||
m.Play();
|
||||
ReadOnly = true;
|
||||
StartNewMovie(m, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (cmdLoadState != null && Global.Game != null)
|
||||
{
|
||||
LoadState("QuickSave" + cmdLoadState);
|
||||
}
|
||||
else if (Global.Config.AutoLoadLastSaveSlot && Global.Game != null)
|
||||
{
|
||||
LoadState("QuickSave" + Global.Config.SaveSlot.ToString());
|
||||
}
|
||||
|
||||
if (Global.Config.AutoLoadRamWatch)
|
||||
{
|
||||
|
@ -514,7 +526,8 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void LoadMoviesFromRecent(string movie)
|
||||
{
|
||||
Movie m = new Movie(movie, MOVIEMODE.PLAY);
|
||||
Movie m = new Movie(movie);
|
||||
m.Play();
|
||||
|
||||
if (!m.Loaded)
|
||||
{
|
||||
|
@ -915,7 +928,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
else if (IsValidMovieExtension(Path.GetExtension(filePaths[0])))
|
||||
{
|
||||
Movie m = new Movie(filePaths[0], MOVIEMODE.PLAY);
|
||||
Movie m = new Movie(filePaths[0]);
|
||||
StartNewMovie(m, false);
|
||||
|
||||
}
|
||||
|
@ -1491,7 +1504,7 @@ namespace BizHawk.MultiClient
|
|||
Global.Emulator = new NullEmulator();
|
||||
Global.ActiveController = Global.NullControls;
|
||||
Global.AutoFireController = Global.AutofireNullControls;
|
||||
Global.MovieSession.Movie.StopMovie();
|
||||
Global.MovieSession.Movie.Stop();
|
||||
}
|
||||
|
||||
private static void SaveRam()
|
||||
|
@ -1729,7 +1742,7 @@ namespace BizHawk.MultiClient
|
|||
case "Soft Reset": SoftReset(); break;
|
||||
case "Toggle MultiTrack":
|
||||
{
|
||||
if (Global.MovieSession.Movie.Mode > MOVIEMODE.INACTIVE)
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
Global.MovieSession.MultiTrack.IsActive = !Global.MovieSession.MultiTrack.IsActive;
|
||||
if (Global.MovieSession.MultiTrack.IsActive)
|
||||
|
@ -1859,7 +1872,7 @@ namespace BizHawk.MultiClient
|
|||
runFrame = true;
|
||||
}
|
||||
|
||||
bool ReturnToRecording = Global.MovieSession.Movie.Mode == MOVIEMODE.RECORD;
|
||||
bool ReturnToRecording = Global.MovieSession.Movie.IsRecording;
|
||||
if (Global.Config.RewindEnabled && (Global.ClientControls["Rewind"] || PressRewind))
|
||||
{
|
||||
Rewind(1);
|
||||
|
@ -1873,14 +1886,18 @@ namespace BizHawk.MultiClient
|
|||
runFrame = true;
|
||||
}
|
||||
//we don't want to capture input when rewinding, even in record mode
|
||||
if (Global.MovieSession.Movie.Mode == MOVIEMODE.RECORD)
|
||||
Global.MovieSession.Movie.Mode = MOVIEMODE.PLAY;
|
||||
if (Global.MovieSession.Movie.IsRecording)
|
||||
{
|
||||
Global.MovieSession.Movie.Play();
|
||||
}
|
||||
if (true == UpdateFrame)
|
||||
}
|
||||
if (UpdateFrame == true)
|
||||
{
|
||||
runFrame = true;
|
||||
if (Global.MovieSession.Movie.Mode == MOVIEMODE.RECORD)
|
||||
Global.MovieSession.Movie.Mode = MOVIEMODE.PLAY;
|
||||
if (Global.MovieSession.Movie.IsRecording)
|
||||
{
|
||||
Global.MovieSession.Movie.Play();
|
||||
}
|
||||
}
|
||||
|
||||
bool genSound = false;
|
||||
|
@ -1975,7 +1992,7 @@ namespace BizHawk.MultiClient
|
|||
UpdateToolsAfter();
|
||||
if (ReturnToRecording)
|
||||
{
|
||||
Global.MovieSession.Movie.Mode = MOVIEMODE.RECORD;
|
||||
Global.MovieSession.Movie.Record();
|
||||
}
|
||||
PressRewind = false;
|
||||
}
|
||||
|
@ -1983,7 +2000,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
if (ReturnToRecording)
|
||||
{
|
||||
Global.MovieSession.Movie.Mode = MOVIEMODE.RECORD;
|
||||
Global.MovieSession.Movie.Record();
|
||||
}
|
||||
UpdateFrame = false;
|
||||
}
|
||||
|
@ -2651,14 +2668,18 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public void ToggleReadOnly()
|
||||
{
|
||||
if (Global.MovieSession.Movie.Mode > MOVIEMODE.INACTIVE)
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
ReadOnly ^= true;
|
||||
if (ReadOnly)
|
||||
{
|
||||
Global.OSD.AddMessage("Movie read-only mode");
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.OSD.AddMessage("Movie read+write mode");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.OSD.AddMessage("No movie active");
|
||||
|
@ -2728,10 +2749,12 @@ namespace BizHawk.MultiClient
|
|||
if (Global.Emulator.ControllerDefinition.BoolButtons.Contains("Reset"))
|
||||
{
|
||||
Global.ClickyVirtualPadController.Click("Reset");
|
||||
if (Global.MovieSession.Movie.Mode == MOVIEMODE.INACTIVE && Global.Emulator is NES)
|
||||
if (!Global.MovieSession.Movie.IsActive && Global.Emulator is NES)
|
||||
{
|
||||
Global.Emulator.ResetFrameCounter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateStatusSlots()
|
||||
{
|
||||
|
@ -3319,5 +3342,12 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
public void ClearSaveRAM()
|
||||
{
|
||||
string x = PathManager.SaveRamPath(Global.Game);
|
||||
|
||||
var file = new FileInfo(PathManager.SaveRamPath(Global.Game));
|
||||
if (file.Exists) file.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,9 +94,9 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
if (file.Extension.ToUpper() == "STATE")
|
||||
{
|
||||
Movie m = new Movie(file.FullName, MOVIEMODE.INACTIVE);
|
||||
Movie m = new Movie(file.FullName);
|
||||
m.LoadMovie(); //State files will have to load everything unfortunately
|
||||
if (m.TotalFrames == 0)
|
||||
if (m.Frames == 0)
|
||||
{
|
||||
MessageBox.Show("No input log detected in this savestate, aborting", "Can not load file", MessageBoxButtons.OK, MessageBoxIcon.Hand);
|
||||
return;
|
||||
|
@ -125,9 +125,9 @@ namespace BizHawk.MultiClient
|
|||
int x = IsDuplicate(filename);
|
||||
if (x == 0)
|
||||
{
|
||||
Movie m = new Movie(file.CanonicalFullPath, MOVIEMODE.INACTIVE);
|
||||
Movie m = new Movie(file.CanonicalFullPath);
|
||||
m.LoadMovie(); //State files will have to load everything unfortunately
|
||||
if (m.TotalFrames > 0)
|
||||
if (m.Frames > 0)
|
||||
{
|
||||
MovieList.Add(m);
|
||||
sortReverse = false;
|
||||
|
@ -167,24 +167,35 @@ namespace BizHawk.MultiClient
|
|||
private int IsDuplicate(string filename)
|
||||
{
|
||||
for (int x = 0; x < MovieList.Count; x++)
|
||||
{
|
||||
if (MovieList[x].Filename == filename)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void PreLoadMovieFile(HawkFile path, bool force)
|
||||
{
|
||||
Movie m = new Movie(path.CanonicalFullPath, MOVIEMODE.INACTIVE);
|
||||
Movie m = new Movie(path.CanonicalFullPath);
|
||||
m.PreLoadText();
|
||||
if (path.Extension == ".FM2")
|
||||
{
|
||||
m.Header.SetHeaderLine(MovieHeader.PLATFORM, "NES");
|
||||
}
|
||||
else if (path.Extension == ".MC2")
|
||||
{
|
||||
m.Header.SetHeaderLine(MovieHeader.PLATFORM, "PCE");
|
||||
}
|
||||
//Don't do this from browse
|
||||
if (m.Header.GetHeaderLine(MovieHeader.GAMENAME) == Global.Game.Name ||
|
||||
Global.Config.PlayMovie_MatchGameName == false || force)
|
||||
{
|
||||
MovieList.Add(m);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateList()
|
||||
{
|
||||
|
|
|
@ -57,7 +57,8 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
|
||||
|
||||
MovieToRecord = new Movie(path, MOVIEMODE.RECORD);
|
||||
MovieToRecord = new Movie(path);
|
||||
MovieToRecord.Record();
|
||||
|
||||
//Header
|
||||
MovieToRecord.Header.SetHeaderLine(MovieHeader.AUTHOR, AuthorBox.Text);
|
||||
|
@ -75,7 +76,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
if (StartFromCombo.SelectedItem.ToString() == "Now")
|
||||
{
|
||||
MovieToRecord.FlagStartsFromSavestate();
|
||||
MovieToRecord.StartsFromSavestate = true;
|
||||
var temppath = path + ".tmp";
|
||||
var writer = new StreamWriter(temppath);
|
||||
Global.Emulator.SaveStateText(writer);
|
||||
|
|
|
@ -163,7 +163,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
for (int i = 0; i < frames; i++)
|
||||
{
|
||||
if (RewindBuf.Count == 0 || (true == Global.MovieSession.Movie.Loaded && 0 == Global.MovieSession.Movie.TotalFrames))
|
||||
if (RewindBuf.Count == 0 || (true == Global.MovieSession.Movie.Loaded && 0 == Global.MovieSession.Movie.Frames))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -290,7 +290,7 @@ namespace BizHawk.MultiClient
|
|||
public static string SaveRamPath(GameInfo game)
|
||||
{
|
||||
string name = FilesystemSafeName(game);
|
||||
if (Global.MainForm.MovieActive())
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
|
||||
name += "." + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename);
|
||||
|
@ -335,8 +335,12 @@ namespace BizHawk.MultiClient
|
|||
public static string SaveStatePrefix(GameInfo game)
|
||||
{
|
||||
string name = FilesystemSafeName(game);
|
||||
if (Global.Config.BindSavestatesToMovies && Global.MainForm.MovieActive())
|
||||
|
||||
if (Global.Config.BindSavestatesToMovies && Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
name += "." + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename);
|
||||
}
|
||||
|
||||
switch (game.System)
|
||||
{
|
||||
case "A26": return Path.Combine(MakeAbsolutePath(Global.Config.PathAtariSavestates, "A26"), name);
|
||||
|
|
|
@ -9,20 +9,19 @@ using System.Globalization;
|
|||
|
||||
namespace BizHawk.MultiClient
|
||||
{
|
||||
public enum MOVIEMODE { INACTIVE, PLAY, RECORD, FINISHED };
|
||||
public class Movie
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
public Movie(string filename, MOVIEMODE m)
|
||||
public Movie(string filename)
|
||||
{
|
||||
Mode = m;
|
||||
Mode = MOVIEMODE.INACTIVE;
|
||||
lastlog = 0;
|
||||
Rerecords = 0;
|
||||
this.Filename = filename;
|
||||
IsText = true;
|
||||
frames = 0;
|
||||
RerecordCounting = true;
|
||||
preload_framecount = 0;
|
||||
IsCountingRerecords = true;
|
||||
StartsFromSavestate = false;
|
||||
if (filename.Length > 0)
|
||||
Loaded = true;
|
||||
|
@ -33,27 +32,37 @@ namespace BizHawk.MultiClient
|
|||
Filename = "";
|
||||
Mode = MOVIEMODE.INACTIVE;
|
||||
IsText = true;
|
||||
frames = 0;
|
||||
preload_framecount = 0;
|
||||
StartsFromSavestate = false;
|
||||
Loaded = false;
|
||||
RerecordCounting = true;
|
||||
IsCountingRerecords = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public MovieHeader Header = new MovieHeader();
|
||||
public SubtitleList Subtitles = new SubtitleList();
|
||||
|
||||
public bool MakeBackup = true; //make backup before altering movie
|
||||
public bool TastudioOn = false; //Remove this once the memory mangement issues with save states for tastudio has been solved.
|
||||
public bool IsText { get; private set; }
|
||||
public string Filename { get; private set; }
|
||||
public MOVIEMODE Mode { get; set; }
|
||||
public int Rerecords { get; private set; }
|
||||
public bool RerecordCounting { get; set; }
|
||||
public bool StartsFromSavestate { get; private set; }
|
||||
public string Filename;
|
||||
public bool IsCountingRerecords;
|
||||
|
||||
public bool Loaded { get; private set; }
|
||||
public bool IsText { get; private set; }
|
||||
|
||||
public int Rerecords
|
||||
{
|
||||
get
|
||||
{
|
||||
return rerecords;
|
||||
}
|
||||
set
|
||||
{
|
||||
rerecords = value;
|
||||
Header.SetHeaderLine(MovieHeader.RERECORDS, Rerecords.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public string SysID
|
||||
{
|
||||
|
@ -79,7 +88,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
public int TotalFrames
|
||||
public int Frames
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -89,7 +98,27 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
else
|
||||
{
|
||||
return frames;
|
||||
return preload_framecount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool StartsFromSavestate
|
||||
{
|
||||
get
|
||||
{
|
||||
return startsfromsavestate;
|
||||
}
|
||||
set
|
||||
{
|
||||
startsfromsavestate = value;
|
||||
if (value == true)
|
||||
{
|
||||
Header.AddHeaderLine(MovieHeader.STARTSFROMSAVESTATE, "1");
|
||||
}
|
||||
else
|
||||
{
|
||||
Header.RemoveHeaderLine(MovieHeader.STARTSFROMSAVESTATE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -110,16 +139,132 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void UpdateFileName(string filename)
|
||||
public bool StateCapturing
|
||||
{
|
||||
this.Filename = filename;
|
||||
get
|
||||
{
|
||||
return statecapturing;
|
||||
}
|
||||
set
|
||||
{
|
||||
Log.ClearStates();
|
||||
statecapturing = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void StopMovie()
|
||||
#endregion
|
||||
|
||||
#region Public Mode Methods
|
||||
|
||||
public bool IsPlaying
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Mode == MOVIEMODE.PLAY || Mode == MOVIEMODE.FINISHED)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsRecording
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Mode == MOVIEMODE.RECORD)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsActive
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Mode == MOVIEMODE.INACTIVE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsFinished
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Mode == MOVIEMODE.FINISHED)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: merge this with record? or better distinguish between the two events
|
||||
/// <summary>
|
||||
/// Tells the movie to start recording from the beginning, this will clear sram, and the movie log
|
||||
/// </summary>
|
||||
/// <param name="truncate"></param>
|
||||
public void StartNewRecording(bool truncate = true)
|
||||
{
|
||||
Global.MainForm.ClearSaveRAM();
|
||||
Mode = MOVIEMODE.RECORD;
|
||||
if (Global.Config.EnableBackupMovies && MakeBackup && Log.MovieLength() > 0)
|
||||
{
|
||||
WriteBackup();
|
||||
MakeBackup = false;
|
||||
}
|
||||
if (truncate)
|
||||
{
|
||||
Log.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: merge this with Play, play vs resume play?
|
||||
public void StartPlayback()
|
||||
{
|
||||
Global.MainForm.ClearSaveRAM();
|
||||
Mode = MOVIEMODE.PLAY;
|
||||
Global.MainForm.StopOnFrame = Frames; //TODO: Get rid of this stuff
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tells the movie to recording mode
|
||||
/// </summary>
|
||||
public void Record()
|
||||
{
|
||||
Mode = MOVIEMODE.RECORD;
|
||||
}
|
||||
|
||||
//TODO: all the constructors for a movie that call this or record after, need to be rethought, what about clearing sram??
|
||||
/// <summary>
|
||||
/// Tells the movie to go into playback mode
|
||||
/// </summary>
|
||||
public void Play()
|
||||
{
|
||||
//TODO: determine if movie finished is correct here
|
||||
//Also, consider the management of the read-only flag
|
||||
//Really this hsouldn't be a method, it should be a consequence of other factors that should be managed
|
||||
Mode = MOVIEMODE.PLAY;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
if (Mode == MOVIEMODE.RECORD)
|
||||
{
|
||||
|
@ -129,20 +274,184 @@ namespace BizHawk.MultiClient
|
|||
Mode = MOVIEMODE.INACTIVE;
|
||||
}
|
||||
|
||||
public void Finish()
|
||||
{
|
||||
if (Mode == MOVIEMODE.PLAY)
|
||||
{
|
||||
Mode = MOVIEMODE.FINISHED;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public File Handling
|
||||
|
||||
public void WriteMovie()
|
||||
{
|
||||
if (!Loaded) return;
|
||||
if (Filename == "") return;
|
||||
Directory.CreateDirectory(new FileInfo(Filename).Directory.FullName);
|
||||
if (IsText)
|
||||
WriteText(Filename);
|
||||
else
|
||||
WriteBinary(Filename);
|
||||
}
|
||||
|
||||
public void WriteBackup()
|
||||
{
|
||||
if (!Loaded) return;
|
||||
if (Filename == "") return;
|
||||
Directory.CreateDirectory(new FileInfo(Filename).Directory.FullName);
|
||||
string BackupName = Filename;
|
||||
BackupName = BackupName.Insert(Filename.LastIndexOf("."), String.Format(".{0:yyyy-MM-dd HH.mm.ss}", DateTime.Now));
|
||||
Global.OSD.AddMessage("Backup movie saved to " + BackupName);
|
||||
if (IsText)
|
||||
{
|
||||
WriteText(BackupName);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteBinary(BackupName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load Header information only for displaying file information in dialogs such as play movie
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool PreLoadText()
|
||||
{
|
||||
Loaded = false;
|
||||
var file = new FileInfo(Filename);
|
||||
|
||||
if (file.Exists == false)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
Header.Clear();
|
||||
Log.Clear();
|
||||
}
|
||||
|
||||
using (StreamReader sr = file.OpenText())
|
||||
{
|
||||
string str = "";
|
||||
while ((str = sr.ReadLine()) != null)
|
||||
{
|
||||
if (str == "" || Header.AddHeaderFromLine(str))
|
||||
continue;
|
||||
if (str.StartsWith("subtitle") || str.StartsWith("sub"))
|
||||
Subtitles.AddSubtitle(str);
|
||||
else if (str[0] == '|')
|
||||
{
|
||||
string frames = sr.ReadToEnd();
|
||||
int length = str.Length;
|
||||
// Account for line breaks of either size.
|
||||
if (frames.IndexOf("\r\n") != -1)
|
||||
length++;
|
||||
length++;
|
||||
// Count the remaining frames and the current one.
|
||||
this.preload_framecount = (frames.Length / length) + 1;
|
||||
break;
|
||||
}
|
||||
else
|
||||
Header.Comments.Add(str);
|
||||
}
|
||||
sr.Close();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool LoadMovie()
|
||||
{
|
||||
var file = new FileInfo(Filename);
|
||||
if (file.Exists == false)
|
||||
{
|
||||
Loaded = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return LoadText();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Log Editing
|
||||
|
||||
public string GetInput(int frame)
|
||||
{
|
||||
lastlog = frame;
|
||||
if (frame < Log.MovieLength())
|
||||
{
|
||||
return Log.GetFrame(frame);
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public void ModifyFrame(string record, int frame)
|
||||
{
|
||||
Log.SetFrameAt(frame, record);
|
||||
}
|
||||
|
||||
public void ClearFrame(int frame)
|
||||
{
|
||||
MnemonicsGenerator mg = new MnemonicsGenerator();
|
||||
Log.SetFrameAt(frame, mg.GetEmptyMnemonic());
|
||||
}
|
||||
|
||||
public void AppendFrame(string record)
|
||||
{
|
||||
Log.AddFrame(record);
|
||||
}
|
||||
|
||||
public void InsertFrame(string record, int frame)
|
||||
{
|
||||
Log.AddFrameAt(record, frame);
|
||||
}
|
||||
|
||||
public void InsertBlankFrame(int frame)
|
||||
{
|
||||
MnemonicsGenerator mg = new MnemonicsGenerator();
|
||||
Log.AddFrameAt(mg.GetEmptyMnemonic(), frame);
|
||||
}
|
||||
|
||||
public void DeleteFrame(int frame)
|
||||
{
|
||||
if (frame <= StateLastIndex)
|
||||
{
|
||||
if (frame <= StateFirstIndex)
|
||||
{
|
||||
RewindToFrame(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
RewindToFrame(frame);
|
||||
}
|
||||
}
|
||||
Log.DeleteFrame(frame);
|
||||
}
|
||||
|
||||
public void TruncateMovie(int frame)
|
||||
{
|
||||
Log.TruncateMovie(frame);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Misc Methods
|
||||
|
||||
public void CaptureState()
|
||||
{
|
||||
if (TastudioOn == true)
|
||||
if (StateCapturing == true)
|
||||
{
|
||||
byte[] state = Global.Emulator.SaveStateBinary();
|
||||
Log.AddState(state);
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearStates()
|
||||
{
|
||||
Log.ClearStates();
|
||||
}
|
||||
|
||||
public void RewindToFrame(int frame)
|
||||
{
|
||||
if (Mode == MOVIEMODE.INACTIVE || Mode == MOVIEMODE.FINISHED)
|
||||
|
@ -189,55 +498,6 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
public void DeleteFrame(int frame)
|
||||
{
|
||||
if (frame <= StateLastIndex)
|
||||
{
|
||||
if (frame <= StateFirstIndex)
|
||||
{
|
||||
RewindToFrame(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
RewindToFrame(frame);
|
||||
}
|
||||
}
|
||||
Log.DeleteFrame(frame);
|
||||
}
|
||||
|
||||
public void ClearSaveRAM()
|
||||
{
|
||||
string x = PathManager.SaveRamPath(Global.Game);
|
||||
|
||||
var file = new FileInfo(PathManager.SaveRamPath(Global.Game));
|
||||
if (file.Exists) file.Delete();
|
||||
}
|
||||
|
||||
public void StartNewRecording() { StartNewRecording(true); }
|
||||
public void StartNewRecording(bool truncate)
|
||||
{
|
||||
ClearSaveRAM();
|
||||
Mode = MOVIEMODE.RECORD;
|
||||
if (Global.Config.EnableBackupMovies && MakeBackup && Log.MovieLength() > 0)
|
||||
{
|
||||
WriteBackup();
|
||||
MakeBackup = false;
|
||||
}
|
||||
if (truncate) Log.Clear();
|
||||
}
|
||||
|
||||
public void StartPlayback()
|
||||
{
|
||||
ClearSaveRAM();
|
||||
Mode = MOVIEMODE.PLAY;
|
||||
Global.MainForm.StopOnFrame = TotalFrames;
|
||||
}
|
||||
|
||||
public void ResumeRecording()
|
||||
{
|
||||
Mode = MOVIEMODE.RECORD;
|
||||
}
|
||||
|
||||
public void CommitFrame(int frameNum, IController source)
|
||||
{
|
||||
//if (Global.Emulator.Frame < Log.Length())
|
||||
|
@ -256,127 +516,6 @@ namespace BizHawk.MultiClient
|
|||
Log.SetFrameAt(frameNum, mg.GetControllersAsMnemonic());
|
||||
}
|
||||
|
||||
public string GetInputFrame(int frame)
|
||||
{
|
||||
lastlog = frame;
|
||||
if (frame < Log.MovieLength())
|
||||
return Log.GetFrame(frame);
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
public void ModifyFrame(string record, int frame)
|
||||
{
|
||||
Log.SetFrameAt(frame, record);
|
||||
}
|
||||
|
||||
public void ClearFrame(int frame)
|
||||
{
|
||||
MnemonicsGenerator mg = new MnemonicsGenerator();
|
||||
Log.SetFrameAt(frame, mg.GetEmptyMnemonic());
|
||||
}
|
||||
|
||||
public void AppendFrame(string record)
|
||||
{
|
||||
Log.AddFrame(record);
|
||||
}
|
||||
|
||||
public void InsertFrame(string record, int frame)
|
||||
{
|
||||
Log.AddFrameAt(record, frame);
|
||||
}
|
||||
|
||||
public void InsertBlankFrame(int frame)
|
||||
{
|
||||
MnemonicsGenerator mg = new MnemonicsGenerator();
|
||||
Log.AddFrameAt(mg.GetEmptyMnemonic(), frame);
|
||||
}
|
||||
|
||||
public void WriteMovie()
|
||||
{
|
||||
if (!Loaded) return;
|
||||
if (Filename == "") return;
|
||||
Directory.CreateDirectory(new FileInfo(Filename).Directory.FullName);
|
||||
if (IsText)
|
||||
WriteText(Filename);
|
||||
else
|
||||
WriteBinary(Filename);
|
||||
}
|
||||
|
||||
public void WriteBackup()
|
||||
{
|
||||
if (!Loaded) return;
|
||||
if (Filename == "") return;
|
||||
Directory.CreateDirectory(new FileInfo(Filename).Directory.FullName);
|
||||
string BackupName = Filename;
|
||||
BackupName = BackupName.Insert(Filename.LastIndexOf("."), String.Format(".{0:yyyy-MM-dd HH.mm.ss}", DateTime.Now));
|
||||
Global.OSD.AddMessage("Backup movie saved to " + BackupName);
|
||||
if (IsText)
|
||||
WriteText(BackupName);
|
||||
else
|
||||
WriteBinary(BackupName);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load Header information only for displaying file information in dialogs such as play movie
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool PreLoadText()
|
||||
{
|
||||
Loaded = false;
|
||||
var file = new FileInfo(Filename);
|
||||
|
||||
if (file.Exists == false)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
Header.Clear();
|
||||
Log.Clear();
|
||||
}
|
||||
|
||||
using (StreamReader sr = file.OpenText())
|
||||
{
|
||||
string str = "";
|
||||
while ((str = sr.ReadLine()) != null)
|
||||
{
|
||||
if (str == "" || Header.AddHeaderFromLine(str))
|
||||
continue;
|
||||
if (str.StartsWith("subtitle") || str.StartsWith("sub"))
|
||||
Subtitles.AddSubtitle(str);
|
||||
else if (str[0] == '|')
|
||||
{
|
||||
string frames = sr.ReadToEnd();
|
||||
int length = str.Length;
|
||||
// Account for line breaks of either size.
|
||||
if (frames.IndexOf("\r\n") != -1)
|
||||
length++;
|
||||
length++;
|
||||
// Count the remaining frames and the current one.
|
||||
this.frames = (frames.Length / length) + 1;
|
||||
break;
|
||||
}
|
||||
else
|
||||
Header.Comments.Add(str);
|
||||
}
|
||||
sr.Close();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool LoadMovie()
|
||||
{
|
||||
var file = new FileInfo(Filename);
|
||||
if (file.Exists == false)
|
||||
{
|
||||
Loaded = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return LoadText();
|
||||
}
|
||||
|
||||
public void DumpLogIntoSavestateText(TextWriter writer)
|
||||
{
|
||||
writer.WriteLine("[Input]");
|
||||
|
@ -475,31 +614,8 @@ namespace BizHawk.MultiClient
|
|||
Log.TruncateStates(stateFrame);
|
||||
Log.TruncateMovie(stateFrame);
|
||||
}
|
||||
IncrementRerecords();
|
||||
reader.Close();
|
||||
}
|
||||
|
||||
public void IncrementRerecords()
|
||||
{
|
||||
if (RerecordCounting)
|
||||
{
|
||||
Rerecords++;
|
||||
Header.UpdateRerecordCount(Rerecords);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetRerecords(int value)
|
||||
{
|
||||
Rerecords = value;
|
||||
Header.SetHeaderLine(MovieHeader.RERECORDS, Rerecords.ToString());
|
||||
}
|
||||
|
||||
public void SetMovieFinished()
|
||||
{
|
||||
if (Mode == MOVIEMODE.PLAY)
|
||||
{
|
||||
Mode = MOVIEMODE.FINISHED;
|
||||
}
|
||||
reader.Close();
|
||||
}
|
||||
|
||||
public string GetTime(bool preLoad)
|
||||
|
@ -509,7 +625,7 @@ namespace BizHawk.MultiClient
|
|||
double seconds;
|
||||
if (preLoad)
|
||||
{
|
||||
seconds = GetSeconds(frames);
|
||||
seconds = GetSeconds(preload_framecount);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -643,30 +759,22 @@ namespace BizHawk.MultiClient
|
|||
return true;
|
||||
}
|
||||
|
||||
public void FlagStartsFromSavestate()
|
||||
{
|
||||
StartsFromSavestate = true;
|
||||
Header.AddHeaderLine(MovieHeader.STARTSFROMSAVESTATE, "1");
|
||||
}
|
||||
|
||||
public void TruncateMovie(int frame)
|
||||
{
|
||||
Log.TruncateMovie(frame);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private int frames; //Not a a reliable number, used for preloading (when no log has yet been loaded), this is only for quick stat compilation for dialogs such as play movie
|
||||
private int preload_framecount; //Not a a reliable number, used for preloading (when no log has yet been loaded), this is only for quick stat compilation for dialogs such as play movie
|
||||
private MovieLog Log = new MovieLog();
|
||||
private int lastlog;
|
||||
private int rerecords;
|
||||
private bool statecapturing;
|
||||
private bool startsfromsavestate;
|
||||
private enum MOVIEMODE { INACTIVE, PLAY, RECORD, FINISHED };
|
||||
private MOVIEMODE Mode = MOVIEMODE.INACTIVE;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
|
||||
#region Helpers
|
||||
|
||||
private void WriteText(string file)
|
||||
{
|
||||
|
@ -956,16 +1064,22 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private int CompareLength(Movie Other)
|
||||
{
|
||||
int otherLength = Other.frames;
|
||||
int thisLength = this.frames;
|
||||
int otherLength = Other.preload_framecount;
|
||||
int thisLength = this.preload_framecount;
|
||||
|
||||
if (thisLength < otherLength)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if (thisLength > otherLength)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace BizHawk.MultiClient
|
|||
case '1':
|
||||
break;
|
||||
case '2':
|
||||
if (m.TotalFrames != 0)
|
||||
if (m.Frames != 0)
|
||||
warningMsg = "hard reset";
|
||||
break;
|
||||
case '4':
|
||||
|
@ -196,7 +196,8 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
errorMsg = "";
|
||||
warningMsg = "";
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension, MOVIEMODE.PLAY);
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension);
|
||||
m.Play();
|
||||
FileInfo file = new FileInfo(path);
|
||||
StreamReader sr = file.OpenText();
|
||||
string emulator = "";
|
||||
|
@ -264,7 +265,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
rerecordCount = 0;
|
||||
}
|
||||
m.SetRerecords(rerecordCount);
|
||||
m.Rerecords = rerecordCount;
|
||||
}
|
||||
else if (line.ToLower().StartsWith("guid"))
|
||||
m.Header.SetHeaderLine(MovieHeader.GUID, ParseHeader(line, "guid"));
|
||||
|
@ -346,7 +347,8 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
errorMsg = "";
|
||||
warningMsg = "";
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension, MOVIEMODE.PLAY);
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension);
|
||||
m.Play();
|
||||
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
BinaryReader r = new BinaryReader(fs);
|
||||
// 000 4-byte signature: 46 43 4D 1A "FCM\x1A"
|
||||
|
@ -406,7 +408,7 @@ namespace BizHawk.MultiClient
|
|||
uint frameCount = r.ReadUInt32();
|
||||
// 010 4-byte little-endian unsigned int: rerecord count
|
||||
uint rerecordCount = r.ReadUInt32();
|
||||
m.SetRerecords((int)rerecordCount);
|
||||
m.Rerecords = (int)rerecordCount;
|
||||
// 014 4-byte little-endian unsigned int: length of controller data in bytes
|
||||
uint movieDataSize = r.ReadUInt32();
|
||||
/*
|
||||
|
@ -601,7 +603,8 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
errorMsg = "";
|
||||
warningMsg = "";
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension, MOVIEMODE.PLAY);
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension);
|
||||
m.Play();
|
||||
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
BinaryReader r = new BinaryReader(fs);
|
||||
// 000 4-byte signature: 46 4D 56 1A "FMV\x1A"
|
||||
|
@ -652,7 +655,7 @@ namespace BizHawk.MultiClient
|
|||
loaded, the number is 0. Famtasia however displays "1" in such case. It always adds 1 to the number found in
|
||||
the file.
|
||||
*/
|
||||
m.SetRerecords(((int)rerecordCount) + 1);
|
||||
m.Rerecords = ((int)rerecordCount) + 1;
|
||||
// 00E 2-byte little-endian unsigned int: unknown, set to 0000
|
||||
r.ReadInt16();
|
||||
// 010 64-byte zero-terminated emulator identifier string
|
||||
|
@ -731,7 +734,8 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
errorMsg = "";
|
||||
warningMsg = "";
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension, MOVIEMODE.PLAY);
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension);
|
||||
m.Play();
|
||||
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
BinaryReader r = new BinaryReader(fs);
|
||||
// 000 16-byte signature and format version: "Gens Movie TEST9"
|
||||
|
@ -749,7 +753,7 @@ namespace BizHawk.MultiClient
|
|||
m.Header.Comments.Add(EMULATIONORIGIN + " Gens");
|
||||
// 010 4-byte little-endian unsigned int: rerecord count
|
||||
uint rerecordCount = r.ReadUInt32();
|
||||
m.SetRerecords((int)rerecordCount);
|
||||
m.Rerecords = (int)rerecordCount;
|
||||
// 014 ASCII-encoded controller config for player 1. '3' or '6'.
|
||||
string player1Config = r.ReadStringFixedAscii(1);
|
||||
// 015 ASCII-encoded controller config for player 2. '3' or '6'.
|
||||
|
@ -845,7 +849,8 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
errorMsg = "";
|
||||
warningMsg = "";
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension, MOVIEMODE.PLAY);
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension);
|
||||
m.Play();
|
||||
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
BinaryReader r = new BinaryReader(fs);
|
||||
// 000 8-byte "MDFNMOVI" signature
|
||||
|
@ -873,7 +878,7 @@ namespace BizHawk.MultiClient
|
|||
m.Header.SetHeaderLine(MovieHeader.GAMENAME, gameName);
|
||||
// 070 uint32 Re-record Count
|
||||
uint rerecordCount = r.ReadUInt32();
|
||||
m.SetRerecords((int)rerecordCount);
|
||||
m.Rerecords = (int)rerecordCount;
|
||||
// 074 5-byte Console indicator (pce, ngp, pcfx, wswan)
|
||||
string platform = RemoveNull(r.ReadStringFixedAscii(5));
|
||||
Dictionary<string, Dictionary<string, object>> platforms = new Dictionary<string, Dictionary<string, object>>()
|
||||
|
@ -968,7 +973,8 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
errorMsg = "";
|
||||
warningMsg = "";
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension, MOVIEMODE.PLAY);
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension);
|
||||
m.Play();
|
||||
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
BinaryReader r = new BinaryReader(fs);
|
||||
// 0000: 4-byte signature: "MMV\0"
|
||||
|
@ -988,7 +994,7 @@ namespace BizHawk.MultiClient
|
|||
uint frameCount = r.ReadUInt32();
|
||||
// 000c: 4-byte little endian unsigned int: rerecord count
|
||||
uint rerecordCount = r.ReadUInt32();
|
||||
m.SetRerecords((int)rerecordCount);
|
||||
m.Rerecords = (int)rerecordCount;
|
||||
// 0010: 4-byte little endian flag: begin from reset?
|
||||
uint reset = r.ReadUInt32();
|
||||
if (reset == 0)
|
||||
|
@ -1083,7 +1089,8 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
errorMsg = "";
|
||||
warningMsg = "";
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension, MOVIEMODE.PLAY);
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension);
|
||||
m.Play();
|
||||
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
BinaryReader r = new BinaryReader(fs);
|
||||
// 000 4-byte signature: 4E 53 53 1A "NSS\x1A"
|
||||
|
@ -1240,7 +1247,7 @@ namespace BizHawk.MultiClient
|
|||
m.Header.SetHeaderLine("PAL", pal.ToString());
|
||||
// 004 4-byte little-endian unsigned int: rerecord count
|
||||
uint rerecordCount = r.ReadUInt32();
|
||||
m.SetRerecords((int)rerecordCount);
|
||||
m.Rerecords = (int)rerecordCount;
|
||||
/*
|
||||
008 4-byte little-endian unsigned int: length of movie description
|
||||
00C (variable) null-terminated UTF-8 text, movie description (currently not implemented)
|
||||
|
@ -1332,10 +1339,11 @@ namespace BizHawk.MultiClient
|
|||
// SMV 1.43 file format: http://code.google.com/p/snes9x-rr/wiki/SMV143
|
||||
private static Movie ImportSMV143(BinaryReader r, string path)
|
||||
{
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension, MOVIEMODE.PLAY);
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension);
|
||||
m.Play();
|
||||
uint GUID = r.ReadUInt32();
|
||||
m.Header.SetHeaderLine(MovieHeader.GUID, GUID.ToString()); //TODO: format to hex string
|
||||
m.SetRerecords((int)r.ReadUInt32());
|
||||
m.Rerecords = (int)r.ReadUInt32();
|
||||
|
||||
uint frameCount = r.ReadUInt32();
|
||||
byte ControllerFlags = r.ReadByte();
|
||||
|
@ -1387,7 +1395,8 @@ namespace BizHawk.MultiClient
|
|||
// SMV 1.51 file format: http://code.google.com/p/snes9x-rr/wiki/SMV151
|
||||
private static Movie ImportSMV151(BinaryReader r, string path)
|
||||
{
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension, MOVIEMODE.PLAY);
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension);
|
||||
m.Play();
|
||||
m.Header.Comments.Add(EMULATIONORIGIN + " Snes9x version 1.51");
|
||||
m.Header.Comments.Add(MOVIEORIGIN + " .SMV");
|
||||
return m;
|
||||
|
@ -1395,7 +1404,8 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private static Movie ImportSMV152(BinaryReader r, string path)
|
||||
{
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension, MOVIEMODE.PLAY);
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension);
|
||||
m.Play();
|
||||
uint GUID = r.ReadUInt32();
|
||||
m.Header.Comments.Add(EMULATIONORIGIN + " Snes9x version 1.52");
|
||||
m.Header.Comments.Add(MOVIEORIGIN + " .SMV");
|
||||
|
@ -1407,7 +1417,8 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
errorMsg = "";
|
||||
warningMsg = "";
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension, MOVIEMODE.PLAY);
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension);
|
||||
m.Play();
|
||||
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
BinaryReader r = new BinaryReader(fs);
|
||||
// 000 4-byte signature: 56 42 4D 1A "VBM\x1A"
|
||||
|
@ -1438,7 +1449,7 @@ namespace BizHawk.MultiClient
|
|||
uint frameCount = r.ReadUInt32();
|
||||
// 010 4-byte little-endian unsigned int: rerecord count
|
||||
uint rerecordCount = r.ReadUInt32();
|
||||
m.SetRerecords((int)rerecordCount);
|
||||
m.Rerecords = (int)rerecordCount;
|
||||
// 014 1-byte flags: (movie start flags)
|
||||
byte flags = r.ReadByte();
|
||||
// bit 0: if "1", movie starts from an embedded "quicksave" snapshot
|
||||
|
@ -1633,7 +1644,8 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
errorMsg = "";
|
||||
warningMsg = "";
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension, MOVIEMODE.PLAY);
|
||||
Movie m = new Movie(path + "." + Global.Config.MovieExtension);
|
||||
m.Play();
|
||||
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
BinaryReader r = new BinaryReader(fs);
|
||||
// 000 12-byte signature: "VirtuaNES MV"
|
||||
|
@ -1688,7 +1700,7 @@ namespace BizHawk.MultiClient
|
|||
r.ReadUInt64();
|
||||
// 01C 4-byte little-endian integer: rerecord count
|
||||
uint rerecordCount = r.ReadUInt32();
|
||||
m.SetRerecords((int)rerecordCount);
|
||||
m.Rerecords = (int)rerecordCount;
|
||||
/*
|
||||
020 BYTE RenderMethod
|
||||
0=POST_ALL,1=PRE_ALL
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace BizHawk.MultiClient
|
|||
/// </summary>
|
||||
public void LatchInputFromLog()
|
||||
{
|
||||
string loggedFrame = Movie.GetInputFrame(Global.Emulator.Frame);
|
||||
string loggedFrame = Movie.GetInput(Global.Emulator.Frame);
|
||||
MovieControllerAdapter.SetControllersAsMnemonic(loggedFrame);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,11 +18,8 @@
|
|||
components.Dispose();
|
||||
}
|
||||
|
||||
//Todo remove once save state log memory issues are fixed
|
||||
Global.MovieSession.Movie.TastudioOn = false;
|
||||
Global.MovieSession.Movie.ClearStates();
|
||||
|
||||
Global.MainForm.StopOnFrame = Global.MovieSession.Movie.TotalFrames;
|
||||
Global.MovieSession.Movie.StateCapturing = false;
|
||||
Global.MainForm.StopOnFrame = Global.MovieSession.Movie.Frames; //TODO: remove this StopOnFrame stuff
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
|
|
@ -63,14 +63,18 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
if (!this.IsHandleCreated || this.IsDisposed) return;
|
||||
TASView.BlazingFast = true;
|
||||
if (Global.MovieSession.Movie.Mode == MOVIEMODE.INACTIVE)
|
||||
TASView.ItemCount = 0;
|
||||
else
|
||||
DisplayList();
|
||||
|
||||
if (Global.MovieSession.Movie.Mode == MOVIEMODE.PLAY)
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
string str = Global.MovieSession.Movie.GetInputFrame(Global.Emulator.Frame);
|
||||
DisplayList();
|
||||
}
|
||||
else
|
||||
{
|
||||
TASView.ItemCount = 0;
|
||||
}
|
||||
|
||||
if (Global.MovieSession.Movie.IsPlaying && !Global.MovieSession.Movie.IsFinished)
|
||||
{
|
||||
string str = Global.MovieSession.Movie.GetInput(Global.Emulator.Frame);
|
||||
if (Global.Config.TASUpdatePads == true && str != "")
|
||||
{
|
||||
switch (Global.Emulator.SystemId)
|
||||
|
@ -126,9 +130,9 @@ namespace BizHawk.MultiClient
|
|||
color = Color.LightGreen; //special case for frame 0. Normally we need to go back an extra frame, but for frame 0 we can reload the rom.
|
||||
if (index > Global.MovieSession.Movie.StateFirstIndex && index <= Global.MovieSession.Movie.StateLastIndex)
|
||||
color = Color.LightGreen;
|
||||
if ("" != Global.MovieSession.Movie.GetInputFrame(index) &&
|
||||
if ("" != Global.MovieSession.Movie.GetInput(index) &&
|
||||
Global.COMMANDS[Global.MovieInputSourceAdapter.Type.Name].ContainsKey("Lag") &&
|
||||
Global.MovieSession.Movie.GetInputFrame(index)[1] == Global.COMMANDS[Global.MovieInputSourceAdapter.Type.Name]["Lag"][0])
|
||||
Global.MovieSession.Movie.GetInput(index)[1] == Global.COMMANDS[Global.MovieInputSourceAdapter.Type.Name]["Lag"][0])
|
||||
color = Color.Pink;
|
||||
if (index == Global.Emulator.Frame)
|
||||
{
|
||||
|
@ -141,19 +145,19 @@ namespace BizHawk.MultiClient
|
|||
text = "";
|
||||
|
||||
//If this is just for an actual frame and not just the list view cursor at the end
|
||||
if (Global.MovieSession.Movie.TotalFrames != index)
|
||||
if (Global.MovieSession.Movie.Frames != index)
|
||||
{
|
||||
if (column == 0)
|
||||
text = String.Format("{0:#,##0}", index);
|
||||
if (column == 1)
|
||||
text = Global.MovieSession.Movie.GetInputFrame(index);
|
||||
text = Global.MovieSession.Movie.GetInput(index);
|
||||
}
|
||||
}
|
||||
|
||||
private void DisplayList()
|
||||
{
|
||||
TASView.ItemCount = Global.MovieSession.Movie.TotalFrames;
|
||||
if (Global.MovieSession.Movie.TotalFrames == Global.Emulator.Frame && Global.MovieSession.Movie.StateLastIndex == Global.Emulator.Frame - 1)
|
||||
TASView.ItemCount = Global.MovieSession.Movie.Frames;
|
||||
if (Global.MovieSession.Movie.Frames == Global.Emulator.Frame && Global.MovieSession.Movie.StateLastIndex == Global.Emulator.Frame - 1)
|
||||
{
|
||||
//If we're at the end of the movie add one to show the cursor as a blank frame
|
||||
TASView.ItemCount++;
|
||||
|
@ -178,9 +182,9 @@ namespace BizHawk.MultiClient
|
|||
Global.MainForm.PauseEmulator();
|
||||
Engaged = true;
|
||||
Global.OSD.AddMessage("TAStudio engaged");
|
||||
if (Global.MovieSession.Movie.Mode != MOVIEMODE.INACTIVE)
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
Global.MovieSession.Movie.TastudioOn = true;
|
||||
Global.MovieSession.Movie.StateCapturing = true;
|
||||
Global.MainForm.StopOnFrame = -1;
|
||||
ReadOnlyCheckBox.Checked = Global.MainForm.ReadOnly;
|
||||
}
|
||||
|
@ -357,10 +361,10 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void RewindButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Global.MovieSession.Movie.Mode == MOVIEMODE.FINISHED || Global.MovieSession.Movie.Mode == MOVIEMODE.INACTIVE)
|
||||
if (Global.MovieSession.Movie.IsFinished || !Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
Global.MainForm.Rewind(1);
|
||||
if (Global.Emulator.Frame <= Global.MovieSession.Movie.TotalFrames)
|
||||
if (Global.Emulator.Frame <= Global.MovieSession.Movie.Frames)
|
||||
{
|
||||
Global.MovieSession.Movie.StartPlayback();
|
||||
}
|
||||
|
@ -389,9 +393,9 @@ namespace BizHawk.MultiClient
|
|||
Global.MainForm.SetReadOnly(true);
|
||||
ReadOnlyCheckBox.BackColor = System.Drawing.SystemColors.Control;
|
||||
|
||||
if (Global.MovieSession.Movie.Mode != MOVIEMODE.INACTIVE)
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
Global.MovieSession.Movie.Mode = MOVIEMODE.PLAY;
|
||||
Global.MovieSession.Movie.Play();
|
||||
toolTip1.SetToolTip(this.ReadOnlyCheckBox, "Currently Read-Only Mode");
|
||||
}
|
||||
}
|
||||
|
@ -399,9 +403,9 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
Global.MainForm.SetReadOnly(false);
|
||||
ReadOnlyCheckBox.BackColor = Color.LightCoral;
|
||||
if (Global.MovieSession.Movie.Mode != MOVIEMODE.INACTIVE)
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
Global.MovieSession.Movie.Mode = MOVIEMODE.RECORD;
|
||||
Global.MovieSession.Movie.Record();
|
||||
toolTip1.SetToolTip(this.ReadOnlyCheckBox, "Currently Read+Write Mode");
|
||||
}
|
||||
}
|
||||
|
@ -421,7 +425,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
else
|
||||
{
|
||||
Global.MainForm.StopOnFrame = Global.MovieSession.Movie.TotalFrames;
|
||||
Global.MainForm.StopOnFrame = Global.MovieSession.Movie.Frames;
|
||||
}
|
||||
|
||||
this.FastFowardToEnd.Checked ^= true;
|
||||
|
@ -495,7 +499,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
if ("" != fileName)
|
||||
{
|
||||
Global.MovieSession.Movie.UpdateFileName(fileName);
|
||||
Global.MovieSession.Movie.Filename = fileName;
|
||||
Global.MovieSession.Movie.WriteMovie();
|
||||
}
|
||||
}
|
||||
|
@ -668,7 +672,7 @@ namespace BizHawk.MultiClient
|
|||
ListView.SelectedIndexCollection list = TASView.SelectedIndices;
|
||||
for (int index = 0; index < list.Count; index++)
|
||||
{
|
||||
Global.MovieSession.Movie.InsertFrame(Global.MovieSession.Movie.GetInputFrame(list[index]), list[index]);
|
||||
Global.MovieSession.Movie.InsertFrame(Global.MovieSession.Movie.GetInput(list[index]), list[index]);
|
||||
}
|
||||
|
||||
UpdateValues();
|
||||
|
@ -769,7 +773,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
ClipboardEntry entry = new ClipboardEntry();
|
||||
entry.frame = list[i];
|
||||
entry.inputstr = Global.MovieSession.Movie.GetInputFrame(list[i]);
|
||||
entry.inputstr = Global.MovieSession.Movie.GetInput(list[i]);
|
||||
Clipboard.Add(entry);
|
||||
}
|
||||
UpdateSlicerDisplay();
|
||||
|
@ -853,7 +857,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
ClipboardEntry entry = new ClipboardEntry();
|
||||
entry.frame = list[i];
|
||||
entry.inputstr = Global.MovieSession.Movie.GetInputFrame(list[i]);
|
||||
entry.inputstr = Global.MovieSession.Movie.GetInput(list[i]);
|
||||
Clipboard.Add(entry);
|
||||
Global.MovieSession.Movie.DeleteFrame(list[0]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue