public override void Restart()
        {
            if (!IsHandleCreated || IsDisposed)
            {
                return;
            }

            if (_initializing)
            {
                return;
            }

            if (CurrentTasMovie != null)
            {
                if (Game.Hash != CurrentTasMovie.Hash)
                {
                    TastudioStopMovie();
                    TasView.AllColumns.Clear();
                    StartNewTasMovie();
                    SetUpColumns();
                    TasView.Refresh();
                }
                else
                {
                    TastudioStopMovie();
                    LoadMostRecentOrStartNew();
                }
            }
        }
Beispiel #2
0
        public void Restart()
        {
            if (!IsHandleCreated || IsDisposed)
            {
                return;
            }

            if (_initializing)
            {
                return;
            }

            if (CurrentTasMovie != null)
            {
                if (Global.Game.Hash != CurrentTasMovie.Hash)
                {
                    TastudioStopMovie();
                    TasView.AllColumns.Clear();
                    StartNewTasMovie();
                    SetUpColumns();
                    TasView.Refresh();
                }
                else
                {
                    RefreshDialog();
                }
            }
        }
Beispiel #3
0
        // Slow but guarantees the entire dialog refreshes
        private void FullRefresh()
        {
            SetTasViewRowCount();
            TasView.Refresh();             // An extra refresh potentially but we need to guarantee
            MarkerControl.UpdateValues();
            BookMarkControl.UpdateValues();

            if (_undoForm != null && !_undoForm.IsDisposed)
            {
                _undoForm.UpdateValues();
            }
        }
Beispiel #4
0
 private void SetFontMenuItem_Click(object sender, EventArgs e)
 {
     using var fontDialog = new FontDialog
           {
               ShowColor = false,
               Font      = TasView.Font
           };
     if (fontDialog.ShowDialog() != DialogResult.Cancel)
     {
         TasView.Font = TasViewFont = fontDialog.Font;
         TasView.Refresh();
     }
 }
Beispiel #5
0
        private void RefreshTasView()
        {
            CurrentTasMovie.UseInputCache = true;
            if (TasView.RowCount != CurrentTasMovie.InputLogLength + 1)
            {
                TasView.RowCount = CurrentTasMovie.InputLogLength + 1;
            }
            TasView.Refresh();

            CurrentTasMovie.FlushInputCache();
            CurrentTasMovie.UseInputCache = false;

            lastRefresh = Emulator.Frame;
        }
Beispiel #6
0
        private void TasView_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Middle)
            {
                TogglePause();
                return;
            }

            if (TasView.PointedCell.Row.HasValue && !string.IsNullOrEmpty(TasView.PointedCell.Column))
            {
                if (e.Button == MouseButtons.Left)
                {
                    if (TasView.PointedCell.Column == MarkerColumnName)
                    {
                        _startMarkerDrag = true;
                        GoToFrame(TasView.PointedCell.Row.Value - 1);
                    }
                    else if (TasView.PointedCell.Column == FrameColumnName)
                    {
                        _startFrameDrag = true;
                    }
                    else
                    {
                        var frame      = TasView.PointedCell.Row.Value;
                        var buttonName = TasView.PointedCell.Column;

                        if (Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.Contains(buttonName))
                        {
                            ToggleBoolState(TasView.PointedCell.Row.Value, TasView.PointedCell.Column);
                            GoToLastEmulatedFrameIfNecessary(TasView.PointedCell.Row.Value);
                            TasView.Refresh();

                            _startBoolDrawColumn = TasView.PointedCell.Column;
                            _boolPaintState      = _tas.BoolIsPressed(frame, buttonName);
                        }
                        else
                        {
                            _startFloatDrawColumn = TasView.PointedCell.Column;
                            _floatPaintState      = _tas.GetFloatValue(frame, buttonName);
                        }
                    }
                }
            }
        }
Beispiel #7
0
        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();
        }
Beispiel #8
0
        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();
        }
Beispiel #9
0
        private void TasView_PointedCellChanged(object sender, TasListView.CellEventArgs e)
        {
            int startVal, endVal;

            if (e.OldCell.Row.Value < e.NewCell.Row.Value)
            {
                startVal = e.OldCell.Row.Value;
                endVal   = e.NewCell.Row.Value;
            }
            else
            {
                startVal = e.NewCell.Row.Value;
                endVal   = e.OldCell.Row.Value;
            }

            if (_startMarkerDrag)
            {
                if (e.NewCell.Row.HasValue)
                {
                    GoToFrame(e.NewCell.Row.Value);
                }
            }
            else if (_startFrameDrag)
            {
                if (e.OldCell.Row.HasValue && e.NewCell.Row.HasValue)
                {
                    for (var i = startVal + 1; i <= endVal; i++)
                    {
                        TasView.SelectItem(i, true);
                    }
                }
            }
            else if (TasView.IsPaintDown && e.NewCell.Row.HasValue && !string.IsNullOrEmpty(_startBoolDrawColumn))
            {
                if (e.OldCell.Row.HasValue && e.NewCell.Row.HasValue)
                {
                    for (var i = startVal; i < endVal; i++)
                    {
                        SetBoolState(i, _startBoolDrawColumn, _boolPaintState);                         // Notice it uses new row, old column, you can only paint across a single column
                        GoToLastEmulatedFrameIfNecessary(TasView.PointedCell.Row.Value);
                    }

                    TasView.Refresh();
                }
            }
            else if (TasView.IsPaintDown && e.NewCell.Row.HasValue && !string.IsNullOrEmpty(_startFloatDrawColumn))
            {
                if (e.OldCell.Row.HasValue && e.NewCell.Row.HasValue)
                {
                    for (var i = startVal; i < endVal; i++)
                    {
                        if (i < _tas.InputLogLength)                                        // TODO: how do we really want to handle the user setting the float state of the pending frame?
                        {
                            _tas.SetFloatState(i, _startFloatDrawColumn, _floatPaintState); // Notice it uses new row, old column, you can only paint across a single column
                            GoToLastEmulatedFrameIfNecessary(TasView.PointedCell.Row.Value);
                        }
                    }

                    TasView.Refresh();
                }
            }
        }