diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 3674f97ee4..b2ea285d2b 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -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; + } } } \ No newline at end of file diff --git a/BizHawk.MultiClient/PlayMovie.cs b/BizHawk.MultiClient/PlayMovie.cs index 4a3e5f8a8f..3b85f4bef8 100644 --- a/BizHawk.MultiClient/PlayMovie.cs +++ b/BizHawk.MultiClient/PlayMovie.cs @@ -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 diff --git a/BizHawk.MultiClient/RenderPanel.cs b/BizHawk.MultiClient/RenderPanel.cs index 8307b5f22e..a902fb4b27 100644 --- a/BizHawk.MultiClient/RenderPanel.cs +++ b/BizHawk.MultiClient/RenderPanel.cs @@ -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(); } diff --git a/BizHawk.MultiClient/movie/Movie.cs b/BizHawk.MultiClient/movie/Movie.cs index 3517a7a8e5..bcd69bdded 100644 --- a/BizHawk.MultiClient/movie/Movie.cs +++ b/BizHawk.MultiClient/movie/Movie.cs @@ -324,5 +324,11 @@ namespace BizHawk.MultiClient { return Header.HeaderParams; } + + public void SetMovieFinished() + { + if (MovieMode == MOVIEMODE.PLAY) + MovieMode = MOVIEMODE.FINISHED; + } } }