Beispiel #1
0
        public async void OnStartAsync(string url)
        {
            try
            {
                DownloaderClient client = new DownloaderClient();
                await client.Create_joblistAsync(url);

                _jobs = client.getJobs();
                statusgroup.setLengthPlaylist(_jobs.Count);
                statusgroup.UpdateThreadText(_threadStatus[0]);

                if (_jobs.Count == 0)
                {
                    await client.Create_joblistAsync(url);

                    statusgroup.UpdateThreadText(_threadStatus[0]);
                }
                if (statusgroup.getProgressCounter() > 0)
                {
                    statusgroup.resetProgressCounter();
                }

                while (true)
                {
                    if (_jobs.Count > 0)
                    {
                        statusgroup.UpdateThreadText(_threadStatus[1]);
                        var job = _jobs[0];
                        _jobs.RemoveAt(0);
                        await client.start_downloadAsync(job.Id);

                        statusgroup.Updatelbl(_jobs.Count, job.Title);
                        statusgroup.addProgressCounter();
                        statusgroup.UpdateUI();
                        Thread.Sleep(1000);
                    }
                    else
                    {
                        Thread.Sleep(1000);
                    }
                    if (_jobs.Count == 0)
                    {
                        statusgroup.UpdateThreadText(_threadStatus[2]);
                        _Downloader.Abort();
                    }
                }
            }
            catch (Exception ex)
            {
                Mainform main = new Mainform();
                lbl_invoke.Invoke(new UpdateMbox(UpdateMboxes), ex.Message);
            }
        }
Beispiel #2
0
 private void DisengageTastudio()
 {
     Mainform.PauseOnFrame = null;
     GlobalWin.OSD.AddMessage("TAStudio disengaged");
     Global.MovieSession.Movie = MovieService.DefaultInstance;
     Mainform.TakeBackControl();
     Global.Config.MovieEndAction = _originalEndAction;
     Mainform.SetMainformMovieInfo();
     // Do not keep TAStudio's disk save states.
     //if (Directory.Exists(statesPath)) Directory.Delete(statesPath, true);
     //TODO - do we need to dispose something here instead?
 }
Beispiel #3
0
 private void EngageTastudio()
 {
     GlobalWin.OSD.AddMessage("TAStudio engaged");
     SetTasMovieCallbacks();
     SetTextProperty();
     Mainform.RelinquishControl(this);
     _originalEndAction = Global.Config.MovieEndAction;
     Mainform.ClearRewindData();
     Global.Config.MovieEndAction = MovieEndAction.Record;
     Mainform.SetMainformMovieInfo();
     Global.MovieSession.ReadOnly = true;
 }
Beispiel #4
0
        private bool InitializeOnLoad()
        {
            Mainform.PauseOnFrame = null;
            Mainform.PauseEmulator();

            // 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 autload their last project
            else if (Settings.RecentTas.AutoLoad && !string.IsNullOrEmpty(Settings.RecentTas.MostRecent))
            {
                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();
            }

            EngageTastudio();
            return(true);
        }
        private void StartNewProjectFromNowMenuItem_Click(object sender, EventArgs e)
        {
            if (AskSaveChanges())
            {
                int index = Emulator.Frame;

                TasMovie newProject = CurrentTasMovie.ConvertToSavestateAnchoredMovie(
                    index, (byte[])StatableEmulator.SaveStateBinary().Clone());

                Mainform.PauseEmulator();
                LoadFile(new FileInfo(newProject.Filename), true);
            }
        }
Beispiel #6
0
        public enterRoomCheck(Mainform m, string s)
        {
            InitializeComponent();
            string enterRoomID = s;

            mainform = m;
            initFont();
            this.Text            = enterRoomID + " 방 로그인";
            num                  = enterRoomID;
            contextMenuStripForm = mainform.contextMenuStripForm;
            contextMenuStripForm.enterRoomcheck = this;
            contextMenuStripForm.IconVisibletrue();
        }
Beispiel #7
0
        public SearchStartingAt(TVBrowserControll con, Mainform main)
        {
            this.con  = con;
            this.main = main;
            InitializeComponent();
            this.refreshLanguage();
            this.ControlBox = true;
            Rectangle screen = Screen.PrimaryScreen.Bounds;

            this.Location = new Point((screen.Width - this.Width) / 2, (screen.Height - this.Height) / 2);
            this.init();
            this.broadcasts = new ArrayList();
        }
        private void StartANewProjectFromSaveRamMenuItem_Click(object sender, EventArgs e)
        {
            if (AskSaveChanges())
            {
                int index = TasView.SelectedRows.First();
                GoToFrame(index);

                TasMovie newProject = CurrentTasMovie.ConvertToSaveRamAnchoredMovie(
                    SaveRamEmulator.CloneSaveRam());

                Mainform.PauseEmulator();
                LoadFile(new FileInfo(newProject.Filename), true);
            }
        }
Beispiel #9
0
 public static void ResetAllControls(Mainform form)
 {
     foreach (Mainform control in form.Controls)
     {
         if (form is ComboBox)
         {
             ComboBox comboBox = (ComboBox)control;
             if (comboBox.Items.Count > 0)
             {
                 comboBox.SelectedIndex = 0;
             }
         }
     }
 }
Beispiel #10
0
        public static CraigsListAccountForm Instance(Mainform frmMain)
        {
            if (sForm == null)
            {
                sForm = new CraigsListAccountForm(frmMain);
            }

            else
            {
                sForm.Close();
                sForm = new CraigsListAccountForm(frmMain);
            }

            return(sForm);
        }
Beispiel #11
0
        public static TimerForm Instance(Mainform frmMain)
        {
            if (sForm == null)
            {
                sForm = new TimerForm(frmMain);
            }

            else
            {
                sForm.Close();
                sForm = new TimerForm(frmMain);
            }

            return(sForm);
        }
Beispiel #12
0
        private bool StartNewMovieWrapper(bool record, IMovie movie = null)
        {
            _initializing = true;
            if (movie == null)
            {
                movie = CurrentTasMovie;
            }
            SetTasMovieCallbacks(movie as TasMovie);
            bool result = Mainform.StartNewMovie(movie, record);

            TastudioPlayMode();
            _initializing = false;

            return(result);
        }
Beispiel #13
0
        private void OpenTasMenuItem_Click(object sender, EventArgs e)
        {
            if (AskSaveChanges())
            {
                var filename = CurrentTasMovie.Filename;
                if (string.IsNullOrWhiteSpace(filename) || filename == DefaultTasProjName())
                {
                    filename = "";
                }

                // need to be fancy here, so call the ofd constructor directly instead of helper
                var all = "*." + string.Join(";*.", MovieService.MovieExtensions.Reverse());
                var ofd = new OpenFileDialog
                {
                    FileName         = filename,
                    InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null),
                    Filter           = string.Format(
                        "All Available Files ({0})|{0}|TAS Project Files (*.{1})|*.{1}|Movie Files (*.{2})|*.{2}|All Files|*.*",
                        all, TasMovie.Extension, MovieService.DefaultExtension)
                };

                var result = ofd.ShowHawkDialog();
                if (result == DialogResult.OK)
                {
                    if (ofd.FileName.EndsWith(TasMovie.Extension))
                    {
                        LoadFile(new FileInfo(ofd.FileName));
                    }
                    else if (ofd.FileName.EndsWith(".bkm") || ofd.FileName.EndsWith(".bk2"))                     // todo: proper extention iteration
                    {
                        Mainform.StartNewMovie(MovieService.Get(ofd.FileName), false);

                        var result1 = MessageBox.Show("This is a regular movie, a new project must be created from it, in order to use in TAStudio\nProceed?", "Convert movie", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                        if (result1 == DialogResult.OK)
                        {
                            ConvertCurrentMovieToTasproj();
                            StartNewMovieWrapper(false);
                            SetUpColumns();
                            SetTextProperty();
                        }
                    }
                    else
                    {
                        MessageBox.Show("This is not a BizHawk movie!", "Movie load error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Beispiel #14
0
        public static SettingForm Instance(Mainform frmMain)
        {
            if (sForm == null)
            {
                sForm = new SettingForm(frmMain);
            }

            else
            {
                sForm.Close();
                sForm = null;
                sForm = new SettingForm(frmMain);
            }

            return(sForm);
        }
Beispiel #15
0
        private void StartSeeking(int?frame)
        {
            if (!frame.HasValue)
            {
                return;
            }

            _seekStartFrame       = Emulator.Frame;
            Mainform.PauseOnFrame = frame.Value;
            int?diff = Mainform.PauseOnFrame - _seekStartFrame;

            Mainform.UnpauseEmulator();

            if (!_seekBackgroundWorker.IsBusy && diff.Value > TasView.VisibleRows)
            {
                _seekBackgroundWorker.RunWorkerAsync();
            }
        }
Beispiel #16
0
        // SuuperW: I changed this to public so that it could be used by MarkerControl.cs
        public void GoToFrame(int frame, bool fromLua = false, bool fromRewinding = false)
        {
            // If seeking to a frame before or at the end of the movie, use StartAtNearestFrameAndEmulate
            // Otherwise, load the latest state (if not already there) and seek while recording.

            WasRecording = CurrentTasMovie.IsRecording || WasRecording;

            if (frame <= CurrentTasMovie.InputLogLength)
            {
                // Get as close as we can then emulate there
                StartAtNearestFrameAndEmulate(frame, fromLua, fromRewinding);

                MaybeFollowCursor();
            }
            else                                 // Emulate to a future frame
            {
                if (frame == Emulator.Frame + 1) // We are at the end of the movie and advancing one frame, therefore we are recording, simply emulate a frame
                {
                    bool wasPaused = Mainform.EmulatorPaused;
                    Mainform.FrameAdvance();
                    if (!wasPaused)
                    {
                        Mainform.UnpauseEmulator();
                    }
                }
                else
                {
                    TastudioPlayMode();

                    // Simply getting the last state doesn't work if that state is the frame.
                    // display isn't saved in the state, need to emulate to frame
                    var lastState = CurrentTasMovie.TasStateManager.GetStateClosestToFrame(frame);
                    if (lastState.Key > Emulator.Frame)
                    {
                        LoadState(lastState);
                    }

                    StartSeeking(frame);
                }
            }

            RefreshDialog();
            UpdateOtherTools();
        }
Beispiel #17
0
 public lambdaSerial(Mainform mf)//mainform object passed to lambddaSerial object
 {
     lambdaRS232 = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
     //Util = new lambdaUtils();
     try { lambdaUSB = new FTDI_USB(); }
     catch { lambdaUSB = null; }
     byteCom      = new byteCommands();
     myLPT        = new lambdaParallel();
     this.mf      = mf;                     //set reference of comport child to serial parrent
     vf5          = new vf5Functions(this); //pass the com port object to VF5 object to use parent methods
     lbX          = new lbXFunctions(this); //pass the com port object to lbX object to use parent methods
     txtBoxDialog = mf.txtBoxDialog;
     txtComOutput = mf.txtCom;
     stop         = mf.checkBoxStop;
     //App = mf.Application;
     mode      = "USB";
     LPTadress = 888;
     baudRate  = 128000;
 }
Beispiel #18
0
        private bool StartNewMovieWrapper(bool record, IMovie movie = null)
        {
            _initializing = true;
            if (movie == null)
            {
                movie = CurrentTasMovie;
            }
            SetTasMovieCallbacks(movie as TasMovie);
            bool result = Mainform.StartNewMovie(movie, record);

            if (result)
            {
                CurrentTasMovie.TasStateManager.Capture();                 // Capture frame 0 always.
            }
            TastudioPlayMode();
            _initializing = false;

            return(result);
        }
Beispiel #19
0
        public void DoAutoRestore()
        {
            if (Settings.AutoRestoreLastPosition && LastPositionFrame != -1)
            {
                if (LastPositionFrame > Emulator.Frame)                 // Don't unpause if we are already on the desired frame, else runaway seek
                {
                    StartSeeking(LastPositionFrame);
                }
            }
            else
            {
                if (_autoRestorePaused.HasValue && !_autoRestorePaused.Value)
                {
                    // this happens when we're holding the left button while unpaused - view scrolls down, new input gets drawn, seek pauses
                    Mainform.UnpauseEmulator();
                }

                _autoRestorePaused = null;
            }
        }
Beispiel #20
0
 public bool Rewind()
 {
     // copypasted from TasView_MouseWheel(), just without notch logic
     if (Mainform.IsSeeking)
     {
         Mainform.PauseOnFrame--;
         // that's a weird condition here, but for whatever reason it works best
         if (Emulator.Frame >= Mainform.PauseOnFrame)
         {
             Mainform.PauseEmulator();
             Mainform.PauseOnFrame = null;
             StopSeeking();
             GoToPreviousFrame();
         }
         RefreshDialog();
     }
     else
     {
         GoToPreviousFrame();
     }
     return(true);
 }
Beispiel #21
0
        private void StateHistoryIntegrityCheckMenuItem_Click(object sender, EventArgs e)
        {
            if (!Emulator.DeterministicEmulation)
            {
                if (MessageBox.Show("The emulator is not deterministic. It might fail even if the difference isn't enough to cause a desync.\nContinue with check?", "Not Deterministic", MessageBoxButtons.YesNo)
                    == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }
            }

            GoToFrame(0);
            int lastState = 0;
            int goToFrame = CurrentTasMovie.TasStateManager.LastEmulatedFrame;

            do
            {
                Mainform.FrameAdvance();

                if (CurrentTasMovie.TasStateManager.HasState(Emulator.Frame))
                {
                    byte[] state     = (byte[])StatableEmulator.SaveStateBinary().Clone();                 // Why is this cloning it?
                    byte[] greenzone = CurrentTasMovie.TasStateManager[Emulator.Frame].Value;

                    if (!state.SequenceEqual(greenzone))
                    {
                        MessageBox.Show("Bad data between frames " + lastState + " and " + Emulator.Frame);
                        return;
                    }

                    lastState = Emulator.Frame;
                }
            } while (Emulator.Frame < goToFrame);

            MessageBox.Show("Integrity Check passed");
        }
Beispiel #22
0
        private void StartAtNearestFrameAndEmulate(int frame, bool fromLua, bool fromRewinding)
        {
            if (frame == Emulator.Frame)
            {
                return;
            }

            _unpauseAfterSeeking = (fromRewinding || WasRecording) && !Mainform.EmulatorPaused;
            TastudioPlayMode();
            var closestState = CurrentTasMovie.TasStateManager.GetStateClosestToFrame(frame);

            if (closestState.Value.Length > 0 && (frame < Emulator.Frame || closestState.Key > Emulator.Frame))
            {
                LoadState(closestState);
            }

            if (fromLua)
            {
                bool wasPaused = Mainform.EmulatorPaused;

                // why not use this? because I'm not letting the form freely run. it all has to be under this loop.
                // i could use this and then poll StepRunLoop_Core() repeatedly, but.. that's basically what I'm doing
                // PauseOnFrame = frame;

                // can't re-enter lua while doing this
                Mainform.SuppressLua = true;
                while (Emulator.Frame != frame)
                {
                    Mainform.SeekFrameAdvance();
                }

                Mainform.SuppressLua = false;

                if (!wasPaused)
                {
                    Mainform.UnpauseEmulator();
                }

                // lua botting users will want to re-activate record mode automatically -- it should be like nothing ever happened
                if (WasRecording)
                {
                    TastudioRecordMode();
                }

                // now the next section won't happen since we're at the right spot
            }

            // frame == Emulator.Frame when frame == 0
            if (frame > Emulator.Frame)
            {
                // make seek frame keep up with emulation on fast scrolls
                if (Mainform.EmulatorPaused || Mainform.IsSeeking || fromRewinding || WasRecording)
                {
                    StartSeeking(frame);
                }
                else
                {
                    // GUI users may want to be protected from clobbering their video when skipping around...
                    // well, users who are rewinding arent. (that gets done through the seeking system in the call above)
                    // users who are clicking around.. I dont know.
                }
            }
        }
Beispiel #23
0
 private void TastudioStopMovie()
 {
     Global.MovieSession.StopMovie(false);
     Mainform.SetMainformMovieInfo();
 }
Beispiel #24
0
        private bool InitializeOnLoad()
        {
            Mainform.PauseOnFrame = null;
            Mainform.PauseEmulator();

            // Start Scenario 0: snes9x needs a nag (copied from RecordMovieMenuItem_Click())
            if (Emulator is Snes9x)
            {
                var box = new CustomControls.MsgBox(
                    "While the Snes9x core is faster, it is not nearly as accurate as bsnes. \nIt is recommended that you switch to the bsnes core for movie recording\nSwitch to bsnes?",
                    "Accuracy Warning",
                    MessageBoxIcon.Warning);

                box.SetButtons(
                    new[] { "Switch", "Continue" },
                    new[] { DialogResult.Yes, DialogResult.Cancel });

                box.MaximumSize = new Size(475, 350);
                box.SetMessageToAutoSize();
                var result = box.ShowDialog();

                if (result == DialogResult.Yes)
                {
                    Global.Config.SNES_InSnes9x = false;
                    Mainform.RebootCore();
                }
                else if (result == DialogResult.Cancel)
                {
                    //return false;
                }
            }
            else if (Emulator is QuickNES)             // Copy pasta of unsustainable logic, even better
            {
                var box = new CustomControls.MsgBox(
                    "While the QuickNes core is faster, it is not nearly as accurate as NesHawk. \nIt is recommended that you switch to the NesHawk core for movie recording\nSwitch to NesHawk?",
                    "Accuracy Warning",
                    MessageBoxIcon.Warning);

                box.SetButtons(
                    new[] { "Switch", "Continue" },
                    new[] { DialogResult.Yes, DialogResult.Cancel });

                box.MaximumSize = new Size(475, 350);
                box.SetMessageToAutoSize();
                var result = box.ShowDialog();

                if (result == DialogResult.Yes)
                {
                    Global.Config.NES_InQuickNES = false;
                    Mainform.RebootCore();
                }
                else if (result == DialogResult.Cancel)
                {
                    //return false;
                }
            }

            // 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 (Settings.RecentTas.AutoLoad && !string.IsNullOrEmpty(Settings.RecentTas.MostRecent))
            {
                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 (Global.Emulator is NullEmulator)
            {
                DisengageTastudio();
                return(false);
            }

            EngageTastudio();
            return(true);
        }
Beispiel #25
0
 public void TogglePause()
 {
     Mainform.TogglePause();
 }
Beispiel #26
0
        private void TasView_MouseDown(object sender, MouseEventArgs e)
        {
            // Clicking with left while right is held or vice versa does weird stuff
            if (mouseButtonHeld)
            {
                return;
            }

            if (e.Button == MouseButtons.Middle)
            {
                if (Mainform.EmulatorPaused)
                {
                    TasMovieRecord record = CurrentTasMovie[LastPositionFrame];
                    if (!record.Lagged.HasValue && LastPositionFrame > Global.Emulator.Frame)
                    {
                        StartSeeking(LastPositionFrame);
                    }
                    else
                    {
                        Mainform.UnpauseEmulator();
                    }
                }
                else
                {
                    Mainform.PauseEmulator();
                }
                return;
            }

            // SuuperW: Moved these.
            if (TasView.CurrentCell == null || !TasView.CurrentCell.RowIndex.HasValue || TasView.CurrentCell.Column == null)
            {
                return;
            }

            int    frame      = TasView.CurrentCell.RowIndex.Value;
            string buttonName = TasView.CurrentCell.Column.Name;


            if (e.Button == MouseButtons.Left)
            {
                bool wasHeld = _leftButtonHeld;
                _leftButtonHeld = true;
                // SuuperW: Exit float editing mode, or re-enter mouse editing
                if (_floatEditRow != -1)
                {
                    if (_floatEditColumn != buttonName || _floatEditRow != frame)
                    {
                        floatEditRow = -1;
                        RefreshTasView();
                    }
                    else
                    {
                        _floatEditYPos      = e.Y;
                        _floatPaintState    = CurrentTasMovie.GetFloatState(frame, buttonName);
                        _triggerAutoRestore = true;
                        JumpToGreenzone();
                        return;
                    }
                }

                if (TasView.CurrentCell.Column.Name == CursorColumnName)
                {
                    _startCursorDrag = true;
                    GoToFrame(TasView.CurrentCell.RowIndex.Value);
                }
                else if (TasView.CurrentCell.Column.Name == FrameColumnName)
                {
                    if (Control.ModifierKeys == Keys.Alt && CurrentTasMovie.Markers.IsMarker(frame))
                    {
                        // TODO
                        TasView.DragCurrentCell();
                    }
                    else
                    {
                        _startSelectionDrag = true;
                        _selectionDragState = TasView.SelectedRows.Contains(frame);
                    }
                }
                else                 // User changed input
                {
                    bool wasPaused = Mainform.EmulatorPaused;

                    if (Emulator.Frame > frame || CurrentTasMovie.LastValidFrame > frame)
                    {
                        if (wasPaused && !Mainform.IsSeeking && !CurrentTasMovie.LastPositionStable)
                        {
                            LastPositionFrame = Emulator.Frame;
                            CurrentTasMovie.LastPositionStable = true;                             // until new frame is emulated
                        }
                    }

                    if (Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.Contains(buttonName))
                    {
                        CurrentTasMovie.ChangeLog.BeginNewBatch("Paint Bool " + buttonName + " from frame " + frame);

                        CurrentTasMovie.ToggleBoolState(TasView.CurrentCell.RowIndex.Value, buttonName);
                        _triggerAutoRestore = true;
                        JumpToGreenzone();
                        RefreshDialog();

                        _startBoolDrawColumn = buttonName;

                        _boolPaintState = CurrentTasMovie.BoolIsPressed(frame, buttonName);
                        if (applyPatternToPaintedInputToolStripMenuItem.Checked &&
                            (!onlyOnAutoFireColumnsToolStripMenuItem.Checked || TasView.CurrentCell.Column.Emphasis))
                        {
                            BoolPatterns[controllerType.BoolButtons.IndexOf(buttonName)].Reset();
                            BoolPatterns[controllerType.BoolButtons.IndexOf(buttonName)].GetNextValue();
                            _patternPaint = true;
                        }
                        else
                        {
                            _patternPaint = false;
                        }

                        if (!Settings.AutoRestoreOnMouseUpOnly)
                        {
                            DoTriggeredAutoRestoreIfNeeded();
                        }
                    }
                    else
                    {
                        if (frame >= CurrentTasMovie.InputLogLength)
                        {
                            CurrentTasMovie.SetFloatState(frame, buttonName, 0);
                            RefreshDialog();
                        }

                        JumpToGreenzone();

                        _floatPaintState = CurrentTasMovie.GetFloatState(frame, buttonName);
                        if (applyPatternToPaintedInputToolStripMenuItem.Checked &&
                            (!onlyOnAutoFireColumnsToolStripMenuItem.Checked || TasView.CurrentCell.Column.Emphasis))
                        {
                            FloatPatterns[controllerType.FloatControls.IndexOf(buttonName)].Reset();
                            CurrentTasMovie.SetFloatState(frame, buttonName,
                                                          FloatPatterns[controllerType.FloatControls.IndexOf(buttonName)].GetNextValue());
                            _patternPaint = true;
                        }
                        else
                        {
                            _patternPaint = false;
                        }


                        if (e.Clicks != 2)
                        {
                            CurrentTasMovie.ChangeLog.BeginNewBatch("Paint Float " + buttonName + " from frame " + frame);
                            _startFloatDrawColumn = buttonName;
                        }
                        else                         // Double-click enters float editing mode
                        {
                            if (_floatEditColumn == buttonName && _floatEditRow == frame)
                            {
                                floatEditRow = -1;
                            }
                            else
                            {
                                CurrentTasMovie.ChangeLog.BeginNewBatch("Float Edit: " + frame);
                                _floatEditColumn    = buttonName;
                                floatEditRow        = frame;
                                _floatTypedValue    = "";
                                _floatEditYPos      = e.Y;
                                _triggerAutoRestore = true;
                                JumpToGreenzone();
                            }
                            RefreshDialog();
                        }
                    }

                    // taseditor behavior
                    if (!wasPaused)
                    {
                        Mainform.UnpauseEmulator();
                    }
                }
            }
            else if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                if (TasView.CurrentCell.Column.Name == FrameColumnName && frame < CurrentTasMovie.InputLogLength)
                {
                    _rightClickControl = (Control.ModifierKeys | Keys.Control) == Control.ModifierKeys;
                    _rightClickShift   = (Control.ModifierKeys | Keys.Shift) == Control.ModifierKeys;
                    _rightClickAlt     = (Control.ModifierKeys | Keys.Alt) == Control.ModifierKeys;
                    if (TasView.SelectedRows.Contains(frame))
                    {
                        _rightClickInput = new string[TasView.SelectedRows.Count()];
                        _rightClickFrame = TasView.FirstSelectedIndex.Value;
                        CurrentTasMovie.GetLogEntries().CopyTo(_rightClickFrame, _rightClickInput, 0, TasView.SelectedRows.Count());
                        if (_rightClickControl && _rightClickShift)
                        {
                            _rightClickFrame += _rightClickInput.Length;
                        }
                    }
                    else
                    {
                        _rightClickInput    = new string[1];
                        _rightClickInput[0] = CurrentTasMovie.GetLogEntries()[frame];
                        _rightClickFrame    = frame;
                    }
                    _rightClickLastFrame = -1;

                    if (_rightClickAlt || _rightClickControl || _rightClickShift)
                    {
                        JumpToGreenzone();
                        // TODO: Turn off ChangeLog.IsRecording and handle the GeneralUndo here.
                        string undoStepName = "Right-Click Edit:";
                        if (_rightClickShift)
                        {
                            undoStepName += " Extend Input";
                            if (_rightClickControl)
                            {
                                undoStepName += ", Insert";
                            }
                        }
                        else
                        {
                            if (_rightClickControl)
                            {
                                undoStepName += " Copy";
                            }
                            else                             // _rightClickAlt
                            {
                                undoStepName += " Move";
                            }
                        }
                        CurrentTasMovie.ChangeLog.BeginNewBatch(undoStepName);
                    }
                }
            }
        }
Beispiel #27
0
 public Software(Mainform main) : base(main)
 {
     InitializeComponent();
 }
 public void SetPicture(Image pic, Mainform form)
 {
     MyPicture = pic;
     MyForm = form;
 }
Beispiel #29
0
 public ScrapBook(Mainform mainform)
 {
     this._mainform = mainform;
 }
 public MyMapContext(Mainform parent)
 {
     InitializeComponent();
     InitGui();
     _mainFrm = parent;
 }
Beispiel #31
0
        private bool InitializeOnLoad()
        {
            Mainform.PauseOnFrame = null;
            Mainform.PauseEmulator();

            // Start Scenario 0: bsnes in performance mode (copied from RecordMovieMenuItem_Click())
            if (Emulator is BizHawk.Emulation.Cores.Nintendo.SNES.LibsnesCore)
            {
                var snes = (BizHawk.Emulation.Cores.Nintendo.SNES.LibsnesCore)Emulator;
                if (snes.CurrentProfile == "Performance")
                {
                    var box = new CustomControls.MsgBox(
                        "While the performance core is faster, it is not stable enough for movie recording\n\nSwitch to Compatibility?",
                        "Stability Warning",
                        MessageBoxIcon.Warning);

                    box.SetButtons(
                        new[] { "Switch", "Cancel" },
                        new[] { DialogResult.Yes, DialogResult.Cancel });

                    box.MaximumSize = new Size(450, 350);
                    box.SetMessageToAutoSize();
                    var result = box.ShowDialog();

                    if (result == DialogResult.Yes)
                    {
                        var ss = snes.GetSyncSettings();
                        ss.Profile = "Compatibility";
                        snes.PutSyncSettings(ss);
                        Mainform.RebootCore();
                    }
                    else if (result == DialogResult.Cancel)
                    {
                        return(false);
                    }
                }
            }

            // 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 autload their last project
            else if (Settings.RecentTas.AutoLoad && !string.IsNullOrEmpty(Settings.RecentTas.MostRecent))
            {
                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();
            }

            EngageTastudio();
            return(true);
        }