move Bk2 -> TasMovie conversion logic from Tastudio to MovieSession, fix crashing when loading .bk2 movies from the tastudio menu
This commit is contained in:
parent
d946aa6145
commit
4e3aa0eb15
|
@ -1,7 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using BizHawk.Client.Common.MovieConversionExtensions;
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
|
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
|
||||||
|
|
||||||
|
@ -355,6 +355,14 @@ namespace BizHawk.Client.Common
|
||||||
Movie = MovieService.DefaultInstance;
|
Movie = MovieService.DefaultInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ConvertToTasProj()
|
||||||
|
{
|
||||||
|
Movie.Save();
|
||||||
|
Movie = Movie.ToTasMovie();
|
||||||
|
Movie.Save();
|
||||||
|
Movie.SwitchToPlay();
|
||||||
|
}
|
||||||
|
|
||||||
private void ClearFrame()
|
private void ClearFrame()
|
||||||
{
|
{
|
||||||
if (Movie.IsPlaying())
|
if (Movie.IsPlaying())
|
||||||
|
|
|
@ -64,5 +64,10 @@ namespace BizHawk.Client.Common
|
||||||
void ToggleMultitrack();
|
void ToggleMultitrack();
|
||||||
|
|
||||||
void StopMovie(bool saveChanges = true);
|
void StopMovie(bool saveChanges = true);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If a movie is active, it will be converted to a <see cref="TasMovie" />
|
||||||
|
/// </summary>
|
||||||
|
void ConvertToTasProj();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Windows.Forms;
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using BizHawk.Client.Common;
|
using BizHawk.Client.Common;
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
|
@ -9,6 +10,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public bool StartNewMovie(IMovie movie, bool record)
|
public bool StartNewMovie(IMovie movie, bool record)
|
||||||
{
|
{
|
||||||
|
if (movie == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException($"{nameof(movie)} cannot be null.");
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MovieSession.QueueNewMovie(movie, record, Emulator);
|
MovieSession.QueueNewMovie(movie, record, Emulator);
|
||||||
|
|
|
@ -121,10 +121,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
else if (ofd.FileName.EndsWith(Bk2Movie.Extension))
|
else if (ofd.FileName.EndsWith(Bk2Movie.Extension))
|
||||||
{
|
{
|
||||||
var result1 = MessageBox.Show("This is a regular movie, a new project must be created from it, in order to use in TAStudio\nProceed?", "Convert movie", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
var result1 = MessageBox.Show("This is a regular movie, a new project must be created from it, in order to use in TAStudio\nProceed?", "Convert movie", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
||||||
if (result1 == DialogResult.OK)
|
if (result1.IsOk())
|
||||||
{
|
{
|
||||||
|
_initializing = true; // Starting a new movie causes a core reboot
|
||||||
MainForm.StartNewMovie(MovieService.Get(ofd.FileName), false);
|
MainForm.StartNewMovie(MovieService.Get(ofd.FileName), false);
|
||||||
ConvertCurrentMovieToTasproj();
|
ConvertCurrentMovieToTasproj();
|
||||||
|
_initialized = false;
|
||||||
StartNewMovieWrapper(false);
|
StartNewMovieWrapper(false);
|
||||||
SetUpColumns();
|
SetUpColumns();
|
||||||
SetTextProperty();
|
SetTextProperty();
|
||||||
|
|
|
@ -615,11 +615,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void ConvertCurrentMovieToTasproj()
|
private void ConvertCurrentMovieToTasproj()
|
||||||
{
|
{
|
||||||
MovieSession.Movie.Save();
|
MovieSession.ConvertToTasProj();
|
||||||
MovieSession.Movie = MovieSession.Movie.ToTasMovie();
|
|
||||||
MovieSession.Movie.Save();
|
|
||||||
MovieSession.Movie.SwitchToPlay();
|
|
||||||
Settings.RecentTas.Add(MovieSession.Movie.Filename);
|
Settings.RecentTas.Add(MovieSession.Movie.Filename);
|
||||||
|
MainForm.SetMainformMovieInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool LoadFile(FileInfo file, bool startsFromSavestate = false, int gotoFrame = 0)
|
private bool LoadFile(FileInfo file, bool startsFromSavestate = false, int gotoFrame = 0)
|
||||||
|
|
Loading…
Reference in New Issue