From 3f79bbfd565c53e5c6f89b33990f60900a8a0066 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 1 Dec 2013 22:29:38 +0000 Subject: [PATCH] TAStudio - create a TasMovie object on load, start implementing some tasmovie things, if there is a move active, warn them that they will lose their work when they open tastudio. Swap global movie back to a regular movie on tastudio close --- BizHawk.Client.Common/movie/TasMovie.cs | 33 +++++++++---------- .../tools/TAStudio/TAStudio.cs | 18 ++++++++-- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/BizHawk.Client.Common/movie/TasMovie.cs b/BizHawk.Client.Common/movie/TasMovie.cs index 96e5cfea2f..9bdb327568 100644 --- a/BizHawk.Client.Common/movie/TasMovie.cs +++ b/BizHawk.Client.Common/movie/TasMovie.cs @@ -8,6 +8,22 @@ namespace BizHawk.Client.Common { public class TasMovie : IMovie { + public TasMovie(string filename, bool startsFromSavestate = false) + : this(startsFromSavestate) + { + Filename = filename; + } + + public TasMovie(bool startsFromSavestate = false) + { + Filename = String.Empty; + Header = new MovieHeader(); + Header.StartsFromSavestate = startsFromSavestate; + } + + public string Filename { get; set; } + + public IMovieHeader Header { get; private set; } public bool IsCountingRerecords { @@ -73,23 +89,6 @@ namespace BizHawk.Client.Common } } - public IMovieHeader Header - { - get { throw new NotImplementedException(); } - } - - public string Filename - { - get - { - throw new NotImplementedException(); - } - set - { - throw new NotImplementedException(); - } - } - public bool Load() { throw new NotImplementedException(); diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index a8786e257a..174031d68a 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -27,13 +27,16 @@ namespace BizHawk.Client.EmuHawk if (AskSave()) { SaveConfigSettings(); + GlobalWin.OSD.AddMessage("TAStudio Disengaged"); + if (Global.MovieSession.Movie is TasMovie) + { + Global.MovieSession.Movie = new Movie(); + } } else { e.Cancel = true; } - - GlobalWin.OSD.AddMessage("TAStudio Disengaged"); }; TopMost = Global.Config.TAStudioTopMost; @@ -74,7 +77,18 @@ namespace BizHawk.Client.EmuHawk private void TAStudio_Load(object sender, EventArgs e) { + if (Global.MovieSession.Movie.IsActive) + { + var result = MessageBox.Show("Warning, Tastudio doesn't support .bkm movie files at this time, opening this will cause you to lose your work, proceed? If you have unsaved changes you should cancel this, and savebefore opening TAStudio", "Unsupported movie", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); + if (result != DialogResult.Yes) + { + Close(); + return; + } + } + GlobalWin.OSD.AddMessage("TAStudio engaged"); + Global.MovieSession.Movie = new TasMovie(); LoadConfigSettings(); }