private void StartNewTasMovie() { if (AskSaveChanges()) { Global.MovieSession.Movie = new TasMovie(); CurrentTasMovie.BindMarkersToInput = Settings.BindMarkersToInput; var stateManager = ((TasMovie)Global.MovieSession.Movie).TasStateManager; stateManager.InvalidateCallback = GreenzoneInvalidated; BookMarkControl.LoadedCallback = BranchLoaded; BookMarkControl.SavedCallback = BranchSaved; BookMarkControl.RemovedCallback = BranchRemoved; CurrentTasMovie.PropertyChanged += TasMovie_OnPropertyChanged; CurrentTasMovie.Filename = DefaultTasProjName(); // TODO don't do this, take over any mainform actions that can crash without a filename CurrentTasMovie.PopulateWithDefaultHeaderValues(); SetTasMovieCallbacks(); CurrentTasMovie.ClearChanges(); // Don't ask to save changes here. if (HandleMovieLoadStuff()) { CurrentTasMovie.TasStateManager.Capture(); // Capture frame 0 always. } // clear all selections TasView.DeselectAll(); BookMarkControl.Restart(); MarkerControl.Restart(); SetUpColumns(); RefreshDialog(); } }
private bool LoadFile(FileInfo file, bool startsFromSavestate = false, int gotoFrame = 0) { if (!file.Exists) { Settings.RecentTas.HandleLoadError(file.FullName); return(false); } TasMovie newMovie = new TasMovie(startsFromSavestate: startsFromSavestate); newMovie.TasStateManager.InvalidateCallback = GreenzoneInvalidated; newMovie.Filename = file.FullName; newMovie.BindMarkersToInput = Settings.BindMarkersToInput; BookMarkControl.LoadedCallback = BranchLoaded; BookMarkControl.SavedCallback = BranchSaved; BookMarkControl.RemovedCallback = BranchRemoved; if (!HandleMovieLoadStuff(newMovie)) { return(false); } Settings.RecentTas.Add(newMovie.Filename); // only add if it did load if (startsFromSavestate) { GoToFrame(0); } else if (gotoFrame > 0) { GoToFrame(gotoFrame); } else { GoToFrame(CurrentTasMovie.Session.CurrentFrame); } // If we are loading an existing non-default movie, we will already have columns generated // Only set up columns if needed if (!TasView.AllColumns.Any()) { SetUpColumns(); } SetUpToolStripColumns(); CurrentTasMovie.PropertyChanged += TasMovie_OnPropertyChanged; CurrentTasMovie.CurrentBranch = CurrentTasMovie.Session.CurrentBranch; BookMarkControl.UpdateTextColumnWidth(); MarkerControl.UpdateTextColumnWidth(); // clear all selections TasView.DeselectAll(); BookMarkControl.Restart(); MarkerControl.Restart(); RefreshDialog(); return(true); }
private bool LoadFile(FileInfo file, bool startsFromSavestate = false, int gotoFrame = 0) { if (!file.Exists) { Settings.RecentTas.HandleLoadError(file.FullName); return(false); } TasMovie newMovie = new TasMovie(startsFromSavestate, _seekBackgroundWorker); newMovie.TasStateManager.InvalidateCallback = GreenzoneInvalidated; newMovie.Filename = file.FullName; BookMarkControl.LoadedCallback = BranchLoaded; BookMarkControl.SavedCallback = BranchSaved; BookMarkControl.RemovedCallback = BranchRemoved; if (!HandleMovieLoadStuff(newMovie)) { return(false); } Settings.RecentTas.Add(newMovie.Filename); // only add if it did load if (startsFromSavestate) { GoToFrame(0); } else if (gotoFrame > 0) { GoToFrame(gotoFrame); } else { GoToFrame(CurrentTasMovie.Session.CurrentFrame); } if (TasView.AllColumns.Count == 0 || file.Extension != $".{TasMovie.Extension}") { SetUpColumns(); } else { SetUpToolStripColumns(); } CurrentTasMovie.PropertyChanged += TasMovie_OnPropertyChanged; CurrentTasMovie.CurrentBranch = CurrentTasMovie.Session.CurrentBranch; BookMarkControl.UpdateTextColumnWidth(); // clear all selections TasView.DeselectAll(); BookMarkControl.Restart(); MarkerControl.Restart(); RefreshDialog(); return(true); }
private bool LoadFile(FileInfo file, bool startsFromSavestate = false) { if (!file.Exists) { Settings.RecentTas.HandleLoadError(file.FullName); return(false); } TasMovie newMovie = new TasMovie(startsFromSavestate, _saveBackgroundWorker); newMovie.TasStateManager.InvalidateCallback = GreenzoneInvalidated; newMovie.Filename = file.FullName; if (!HandleMovieLoadStuff(newMovie)) { return(false); } Settings.RecentTas.Add(newMovie.Filename); // only add if it did load if (TasView.AllColumns.Count() == 0 || file.Extension != "." + TasMovie.Extension) { SetUpColumns(); } if (startsFromSavestate) { GoToFrame(0); } else { GoToFrame(CurrentTasMovie.Session.CurrentFrame); } CurrentTasMovie.PropertyChanged += new PropertyChangedEventHandler(this.TasMovie_OnPropertyChanged); CurrentTasMovie.CurrentBranch = CurrentTasMovie.Session.CurrentBranch; // clear all selections TasView.DeselectAll(); BookMarkControl.Restart(); MarkerControl.Restart(); RefreshDialog(); return(true); }
private void StartNewTasMovie() { if (!AskSaveChanges()) { return; } var filename = DefaultTasProjName(); // TODO don't do this, take over any mainform actions that can crash without a filename var tasMovie = (ITasMovie)MovieService.Get(filename); tasMovie.BindMarkersToInput = Settings.BindMarkersToInput; tasMovie.TasStateManager.InvalidateCallback = GreenzoneInvalidated; tasMovie.PropertyChanged += TasMovie_OnPropertyChanged; tasMovie.PopulateWithDefaultHeaderValues( Emulator, Global.Game, Global.FirmwareManager, Config.DefaultAuthor); SetTasMovieCallbacks(tasMovie); tasMovie.ClearChanges(); // Don't ask to save changes here. tasMovie.Save(); if (HandleMovieLoadStuff(tasMovie)) { CurrentTasMovie.TasStateManager.Capture(); // Capture frame 0 always. } // clear all selections TasView.DeselectAll(); BookMarkControl.Restart(); MarkerControl.Restart(); SetUpColumns(); RefreshDialog(); TasView.Refresh(); }
private void StartNewTasMovie() { if (!AskSaveChanges()) { return; } var filename = DefaultTasProjName(); // TODO don't do this, take over any mainform actions that can crash without a filename var tasMovie = (ITasMovie)MovieSession.Get(filename); tasMovie.BindMarkersToInput = Settings.BindMarkersToInput; tasMovie.GreenzoneInvalidated = GreenzoneInvalidated; tasMovie.PropertyChanged += TasMovie_OnPropertyChanged; tasMovie.PopulateWithDefaultHeaderValues( Emulator, ((MainForm)MainForm).GetSettingsAdapterForLoadedCoreUntyped(), //HACK Game, MainForm.FirmwareManager, Config.DefaultAuthor); SetTasMovieCallbacks(tasMovie); tasMovie.ClearChanges(); // Don't ask to save changes here. tasMovie.Save(); if (HandleMovieLoadStuff(tasMovie)) { } // clear all selections TasView.DeselectAll(); BookMarkControl.Restart(); MarkerControl.Restart(); SetUpColumns(); RefreshDialog(); TasView.Refresh(); }
private void StartNewTasMovie() { if (AskSaveChanges()) { Global.MovieSession.Movie = new TasMovie(false, _seekBackgroundWorker); var stateManager = (Global.MovieSession.Movie as TasMovie).TasStateManager; stateManager.MountWriteAccess(); stateManager.InvalidateCallback = GreenzoneInvalidated; CurrentTasMovie.PropertyChanged += new PropertyChangedEventHandler(this.TasMovie_OnPropertyChanged); CurrentTasMovie.Filename = DefaultTasProjName(); // TODO don't do this, take over any mainform actions that can crash without a filename CurrentTasMovie.PopulateWithDefaultHeaderValues(); SetTasMovieCallbacks(); CurrentTasMovie.ClearChanges(); // Don't ask to save changes here. HandleMovieLoadStuff(); CurrentTasMovie.TasStateManager.Capture(); // Capture frame 0 always. // clear all selections TasView.DeselectAll(); BookMarkControl.Restart(); MarkerControl.Restart(); SetUpColumns(); RefreshDialog(); } }