Movies - Add all current valid movie file extensions to drag & drop, Hook up movie finished mode to frame loop & frame counter display, clean up some logic regarding the toggling of InputLog and UserMovie

This commit is contained in:
andres.delikat 2011-05-13 17:03:05 +00:00
parent 6825c9f84c
commit fe0363d80b
4 changed files with 59 additions and 16 deletions

View File

@ -451,10 +451,24 @@ namespace BizHawk.MultiClient
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
}
private bool IsValidMovieExtension(string ext)
{
switch (ext.ToUpper())
{
case ".TAS": //Bizhawk
case ".FM2": //FCUEX
case ".MC2": //PCEjin
case ".STATE": //Savestates
return true;
default:
return false;
}
}
private void FormDragDrop(object sender, DragEventArgs e)
{
string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
if (Path.GetExtension(filePaths[0]) == ".tas")
if (IsValidMovieExtension(Path.GetExtension(filePaths[0])))
{
Movie m = new Movie(filePaths[0], MOVIEMODE.PLAY);
StartNewMovie(m);
@ -645,14 +659,8 @@ namespace BizHawk.MultiClient
new BizHawk.Emulation.Consoles.Gameboy.Debugger(Global.Emulator as Gameboy).Show();
}
//Remove this block once movie selection is more polished, input log should only be playback through the same mechanism as any other movie file
if (InputLog.GetMovieMode() == MOVIEMODE.PLAY)
{
InputLog.LoadMovie(); //TODO: Debug
InputLog.StartPlayback(); //TODO: Debug
}
else
InputLog.StartNewRecording(); //(Keep this line)
//TODO: autoload movie logic goes here
InputLog.StartNewRecording(); //(Keep this line)
//setup the throttle based on platform's specifications
//(one day later for some systems we will need to modify it at runtime as the display mode changes)
@ -986,16 +994,21 @@ namespace BizHawk.MultiClient
genSound = true;
//TODO: clean up this movie code, use a function or an object to manage the togglign of two movies
if (UserMovie.GetMovieMode() == MOVIEMODE.PLAY)
Global.ActiveController.SetControllersAsMnemonic(UserMovie.GetInputFrame(Global.Emulator.Frame) + 1);
else if (InputLog.GetMovieMode() == MOVIEMODE.PLAY)
Global.ActiveController.SetControllersAsMnemonic(InputLog.GetInputFrame(Global.Emulator.Frame) + 1);
if (MovieActive())
{
Movie m = GetActiveMovie();
if (m.GetMovieLength() == Global.Emulator.Frame && m.GetMovieMode() == MOVIEMODE.PLAY)
m.SetMovieFinished();
if (m.GetMovieMode() == MOVIEMODE.PLAY)
Global.ActiveController.SetControllersAsMnemonic(m.GetInputFrame(Global.Emulator.Frame) + 1);
}
Global.Emulator.FrameAdvance(!throttle.skipnextframe);
RamWatch1.UpdateValues();
RamSearch1.UpdateValues();
HexEditor1.UpdateValues();
NESNameTableViewer1.UpdateValues();
NESPPU1.UpdateValues();
if (UserMovie.GetMovieMode() == MOVIEMODE.RECORD)
UserMovie.GetMnemonic();
else if (InputLog.GetMovieMode() == MOVIEMODE.RECORD)
@ -1730,5 +1743,25 @@ namespace BizHawk.MultiClient
UserMovie.LoadMovie();
UserMovie.StartPlayback();
}
public Movie GetActiveMovie()
{
if (UserMovie.GetMovieMode() != MOVIEMODE.INACTIVE)
return UserMovie;
else if (InputLog.GetMovieMode() != MOVIEMODE.INACTIVE)
return InputLog;
else
return null;
}
public bool MovieActive()
{
if (UserMovie.GetMovieMode() != MOVIEMODE.INACTIVE)
return true;
else if (InputLog.GetMovieMode() != MOVIEMODE.INACTIVE)
return true;
else
return false;
}
}
}

View File

@ -16,7 +16,6 @@ namespace BizHawk.MultiClient
//Upon open file dialog? that's weird, record movie? more often people will use play movie first
//Never? then the path default must be .\ not .\movies
//TODO: after browse & update, focus on the movie just added
//Make MovieView not allow multiselect
//This is a modal dialog, implement it as modeless
// In order to do this, this dialog will have to restart the rom

View File

@ -304,7 +304,12 @@ namespace BizHawk.MultiClient
private string MakeFrameCounter()
{
//TODO: remove rerecord count code and make it its own display option
if (Global.MainForm.UserMovie.GetMovieMode() == MOVIEMODE.PLAY)
if (Global.MainForm.UserMovie.GetMovieMode() == MOVIEMODE.FINISHED)
{
return Global.Emulator.Frame.ToString() + " " + Global.Emulator.Frame.ToString()
+ "/" + Global.MainForm.UserMovie.GetMovieLength().ToString() + " (Finished)";
}
else if (Global.MainForm.UserMovie.GetMovieMode() == MOVIEMODE.PLAY)
{
return Global.Emulator.Frame.ToString() + " " + Global.MainForm.UserMovie.lastLog.ToString()
+ "/" + Global.MainForm.UserMovie.GetMovieLength().ToString() + " Rerecord count: " + Global.MainForm.UserMovie.GetRerecordCount();
@ -312,7 +317,7 @@ namespace BizHawk.MultiClient
else if (Global.MainForm.UserMovie.GetMovieMode() != MOVIEMODE.INACTIVE)
return Global.Emulator.Frame.ToString() + " " + Global.MainForm.UserMovie.lastLog.ToString()
+ "/" + Global.MainForm.UserMovie.GetMovieLength().ToString() + " Rerecord count: " + Global.MainForm.UserMovie.GetRerecordCount();
else
else
{
return Global.Emulator.Frame.ToString();
}

View File

@ -324,5 +324,11 @@ namespace BizHawk.MultiClient
{
return Header.HeaderParams;
}
public void SetMovieFinished()
{
if (MovieMode == MOVIEMODE.PLAY)
MovieMode = MOVIEMODE.FINISHED;
}
}
}