diff --git a/src/BizHawk.Client.Common/movie/MovieSession.cs b/src/BizHawk.Client.Common/movie/MovieSession.cs index ad6d1e8c51..52560dee49 100644 --- a/src/BizHawk.Client.Common/movie/MovieSession.cs +++ b/src/BizHawk.Client.Common/movie/MovieSession.cs @@ -62,6 +62,11 @@ namespace BizHawk.Client.Common return new Bk2Controller("", definition ?? MovieController.Definition); } + public void SetMovieController(ControllerDefinition definition) + { + MovieController = GenerateMovieController(definition); + } + public void HandleFrameBefore() { if (Movie.NotActive()) diff --git a/src/BizHawk.Client.Common/movie/interfaces/IMovieSession.cs b/src/BizHawk.Client.Common/movie/interfaces/IMovieSession.cs index 7b375733fc..1d8fc1f174 100644 --- a/src/BizHawk.Client.Common/movie/interfaces/IMovieSession.cs +++ b/src/BizHawk.Client.Common/movie/interfaces/IMovieSession.cs @@ -54,6 +54,17 @@ namespace BizHawk.Client.Common /// IMovieController GenerateMovieController(ControllerDefinition definition = null); + /// + /// Hack only used for TAStudio when starting a new movie + /// This is due to needing to save a "dummy" default.tasproj + /// This dummy file's initial save bypasses the normal queue/run + /// new movie code (which normally sets the controller), although + /// once it saves it goes through the normal queue/run code anyway. + /// TODO: Stop relying on this dummy file so we do not need this ugly hack + /// + /// current IEmulator ControllerDefinition + void SetMovieController(ControllerDefinition definition); + void HandleFrameBefore(); void HandleFrameAfter(); void HandleSaveState(TextWriter writer); diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index f91c5544b4..1e397190b7 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -602,11 +602,16 @@ namespace BizHawk.Client.EmuHawk Config.DefaultAuthor); SetTasMovieCallbacks(tasMovie); + MovieSession.SetMovieController(Emulator.ControllerDefinition); // hack, see interface comment tasMovie.ClearChanges(); // Don't ask to save changes here. tasMovie.Save(); if (HandleMovieLoadStuff(tasMovie)) { } + // let's not keep this longer than we actually need + // the user will be prompted to enter a proper name + // when they want to save + File.Delete(tasMovie.Filename); // clear all selections TasView.DeselectAll(); @@ -780,11 +785,16 @@ namespace BizHawk.Client.EmuHawk filename = SuggestedTasProjName(); } - var file = SaveFileDialog( - currentFile: filename, - path: Config!.PathEntries.MovieAbsolutePath(), - TAStudioProjectsFSFilterSet, - this); + FileInfo file; + do + { + file = SaveFileDialog( + currentFile: filename, + path: Config!.PathEntries.MovieAbsolutePath(), + TAStudioProjectsFSFilterSet, + this); + } + while (file?.FullName == DefaultTasProjName()); // disallow saving as this reserved filename if (file != null) {