private bool InitializeOnLoad() { MainForm.PauseOnFrame = null; MainForm.PauseEmulator(); // Start Scenario 0: core needs a nag // But do not nag if auto-loading if (!CanAutoload && !EmuHawkUtil.EnsureCoreIsAccurate(Emulator)) { // Inaccurate core but allow the user to continue anyway } // Start Scenario 1: A regular movie is active if (Global.MovieSession.Movie.IsActive() && !(Global.MovieSession.Movie is TasMovie)) { var result = MessageBox.Show("In order to use Tastudio, a new project must be created from the current movie\nThe current movie will be saved and closed, and a new project file will be created\nProceed?", "Convert movie", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { ConvertCurrentMovieToTasproj(); StartNewMovieWrapper(false); SetUpColumns(); } else { return(false); } } // Start Scenario 2: A tasproj is already active else if (Global.MovieSession.Movie.IsActive() && Global.MovieSession.Movie is TasMovie) { bool result = LoadFile(new FileInfo(CurrentTasMovie.Filename), gotoFrame: Emulator.Frame); if (!result) { TasView.AllColumns.Clear(); StartNewTasMovie(); } } // Start Scenario 3: No movie, but user wants to autoload their last project else if (CanAutoload) { bool result = LoadFile(new FileInfo(Settings.RecentTas.MostRecent)); if (!result) { TasView.AllColumns.Clear(); StartNewTasMovie(); } } // Start Scenario 4: No movie, default behavior of engaging tastudio with a new default project else { StartNewTasMovie(); } if (Emulator.IsNull()) { DisengageTastudio(); return(false); } EngageTastudio(); return(true); }
private bool Engage() { MainForm.PauseOnFrame = null; MainForm.PauseEmulator(); // Nag if inaccurate core, but not if auto-loading or movie is already loaded if (!CanAutoload && MovieSession.Movie.NotActive()) { // Nag but allow the user to continue anyway, so ignore the return value EmuHawkUtil.EnsureCoreIsAccurate(Emulator); } // Start Scenario 1: A regular movie is active if (MovieSession.Movie.IsActive() && !(MovieSession.Movie is ITasMovie)) { var result = MessageBox.Show("In order to use Tastudio, a new project must be created from the current movie\nThe current movie will be saved and closed, and a new project file will be created\nProceed?", "Convert movie", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result.IsOk()) { ConvertCurrentMovieToTasproj(); StartNewMovieWrapper(CurrentTasMovie); SetUpColumns(); } else { return(false); } } // Start Scenario 2: A tasproj is already active else if (MovieSession.Movie.IsActive() && MovieSession.Movie is ITasMovie) { bool result = LoadFile(new FileInfo(CurrentTasMovie.Filename), gotoFrame: Emulator.Frame); if (!result) { TasView.AllColumns.Clear(); StartNewTasMovie(); } } // Start Scenario 3: No movie, but user wants to autoload their last project else if (CanAutoload) { bool result = LoadFile(new FileInfo(Settings.RecentTas.MostRecent)); if (!result) { TasView.AllColumns.Clear(); StartNewTasMovie(); } } // Start Scenario 4: No movie, default behavior of engaging tastudio with a new default project else { StartNewTasMovie(); } // Attempts to load failed, abort if (Emulator.IsNull()) { Disengage(); return(false); } MainForm.AddOnScreenMessage("TAStudio engaged"); SetTasMovieCallbacks(CurrentTasMovie); SetTextProperty(); MainForm.RelinquishControl(this); _originalEndAction = Config.MovieEndAction; MainForm.ClearRewindData(); Config.MovieEndAction = MovieEndAction.Record; MainForm.SetMainformMovieInfo(); MovieSession.ReadOnly = true; SetSplicer(); SetupBoolPatterns(); return(true); }