band-aid fix bk2 to tasproj conversions in tastudio

This commit is contained in:
adelikat 2020-06-04 20:06:20 -05:00
parent 5319aba113
commit 89789b4358
3 changed files with 11 additions and 7 deletions

View File

@ -331,7 +331,7 @@ namespace BizHawk.Client.Common
public void ConvertToTasProj()
{
Movie.Save();
Movie = Movie.ToTasMovie();
Movie = Movie.ToTasMovie(this);
Movie.Save();
Movie.SwitchToPlay();
}

View File

@ -15,12 +15,15 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
{
public static class MovieConversionExtensions
{
public static ITasMovie ToTasMovie(this IMovie old)
public static ITasMovie ToTasMovie(this IMovie old, IMovieSession session)
{
string newFilename = GetNewFileName(old.Filename);
var tas = (ITasMovie)MovieService.Get(newFilename);
// TODO: this relies on the fact that the emulator core here will be the same as when it is load
// so this specifically only works in the scenario of a running bk2 converted to tasproj in tastudio
// need to untangle and not be so dependent on core loading behavior
tas.Attach(session, old.Emulator);
for (var i = 0; i < old.InputLogLength; i++)
{
var input = old.GetInputState(i);

View File

@ -46,10 +46,11 @@ namespace BizHawk.Client.Common
public void Attach(IEmulator emulator)
{
if (!_emulator.IsNull())
{
throw new InvalidOperationException("A core has already been attached!");
}
// TODO: we aren't ready for this, attach is called when converting a bk2 to tasproj and again to officially load the emulator
//if (!_emulator.IsNull())
//{
// throw new InvalidOperationException("A core has already been attached!");
//}
if (!emulator.HasSavestates())
{