Exemple #1
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            int start = 3 + (FileSelectorPanel.Controls.Count * 43);

            var groupBox = new GroupBox
            {
                Text     = "",
                Location = UIHelper.Scale(new Point(6, start)),
                Size     = new Size(FileSelectorPanel.ClientSize.Width - UIHelper.ScaleX(12), UIHelper.ScaleY(41)),
                Anchor   = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top
            };

            var mdf = new MultiDiskFileSelector
            {
                Location = UIHelper.Scale(new Point(7, 12)),
                Width    = groupBox.ClientSize.Width - UIHelper.ScaleX(13),
                Anchor   = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top
            };

            mdf.NameChanged += FileSelector_NameChanged;
            mdf.SystemString = SystemDropDown.SelectedText;


            groupBox.Controls.Add(mdf);

            FileSelectorPanel.Controls.Add(groupBox);
        }
Exemple #2
0
            static bool PromptToSwitchCore(string currentCore, string recommendedCore, Action disableCurrentCore)
            {
                using var box = new MsgBox(
                          $"While the {currentCore} core is faster, it is not nearly as accurate as {recommendedCore}.{Environment.NewLine}It is recommended that you switch to the {recommendedCore} core for movie recording.{Environment.NewLine}Switch to {recommendedCore}?",
                          "Accuracy Warning",
                          MessageBoxIcon.Warning);

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

                box.MaximumSize = UIHelper.Scale(new Size(575, 175));
                box.SetMessageToAutoSize();

                var result = box.ShowDialog();

                if (result != DialogResult.Yes)
                {
                    return(false);
                }

                disableCurrentCore();
                GlobalWin.MainForm.RebootCore();
                return(true);
            }
        private void PlatformChooser_Load(object sender, EventArgs e)
        {
            if (RomGame.RomData.Length > 10 * 1024 * 1024)             // If 10mb, show in megabytes
            {
                RomSizeLabel.Text = string.Format("{0:n0}", (RomGame.RomData.Length / 1024 / 1024)) + "mb";
            }
            else
            {
                RomSizeLabel.Text = string.Format("{0:n0}", (RomGame.RomData.Length / 1024)) + "kb";
            }

            ExtensionLabel.Text = RomGame.Extension.ToLower();
            HashBox.Text        = RomGame.GameInfo.Hash;
            int count   = 0;
            int spacing = 25;

            foreach (var platform in AvailableSystems)
            {
                var radio = new RadioButton
                {
                    Text     = platform.FullName,
                    Location = UIHelper.Scale(new Point(15, 15 + (count * spacing))),
                    Size     = UIHelper.Scale(new Size(200, 23))
                };

                PlatformsGroupBox.Controls.Add(radio);
                count++;
            }

            PlatformsGroupBox.Controls
            .OfType <RadioButton>()
            .First()
            .Select();
        }
Exemple #4
0
        private void PlatformChooser_Load(object sender, EventArgs e)
        {
            RomSizeLabel.Text = RomGame.RomData.Length > 10 * 1024 * 1024
                                ? $"{RomGame.RomData.Length / 1024 / 1024:n0}mb"
                                : $"{RomGame.RomData.Length / 1024:n0}kb";

            ExtensionLabel.Text = RomGame.Extension.ToLower();
            HashBox.Text        = RomGame.GameInfo.Hash;
            int count   = 0;
            int spacing = 25;

            foreach (var platform in _availableSystems)
            {
                var radio = new RadioButton
                {
                    Text     = platform.FullName,
                    Location = UIHelper.Scale(new Point(15, 15 + (count * spacing))),
                    Size     = UIHelper.Scale(new Size(200, 23))
                };

                PlatformsGroupBox.Controls.Add(radio);
                count++;
            }

            PlatformsGroupBox.Controls
            .OfType <RadioButton>()
            .First()
            .Select();
        }
Exemple #5
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 = UIHelper.Scale(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 = UIHelper.Scale(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);
        }
        private void VirtualPadControl_Load(object sender, EventArgs e)
        {
            Size        = UIHelper.Scale(_schema.DefaultSize);
            MaximumSize = UIHelper.Scale(_schema.MaxSize ?? _schema.DefaultSize);
            PadBox.Text = _schema.DisplayName;
            foreach (var button in _schema.Buttons)
            {
                switch (button.Type)
                {
                case PadSchema.PadInputType.Boolean:
                    var buttonControl = new VirtualPadButton
                    {
                        Name     = button.Name,
                        Text     = button.DisplayName,
                        Location = UIHelper.Scale(button.Location),
                        Image    = button.Icon,
                    };
                    if (button.Icon != null && UIHelper.AutoScaleFactorX > 1F && UIHelper.AutoScaleFactorY > 1F)
                    {
                        // When scaling up, unfortunately the icon will look too small, but at least we can make the rest of the button bigger
                        buttonControl.AutoSize = false;
                        buttonControl.Size     = UIHelper.Scale(button.Icon.Size) + new Size(6, 6);
                    }
                    PadBox.Controls.Add(buttonControl);
                    break;

                case PadSchema.PadInputType.AnalogStick:
                    PadBox.Controls.Add(new VirtualPadAnalogStick
                    {
                        Name     = button.Name,
                        Location = UIHelper.Scale(button.Location),
                        Size     = UIHelper.Scale(new Size(button.MaxValue + 79, button.MaxValue + 9)), // TODO: don't use hardcoded values here, at least make them defaults in the AnalogStick object itself
                        RangeX   = button.MaxValue,
                        RangeY   = button.MaxValue                                                      // TODO ability to pass in a different Y max
                    });
                    break;

                case PadSchema.PadInputType.TargetedPair:
                    PadBox.Controls.Add(new VirtualPadTargetScreen
                    {
                        Name       = button.Name,
                        Location   = UIHelper.Scale(button.Location),
                        TargetSize = button.TargetSize,
                        XName      = button.Name,
                        YName      = button.SecondaryNames[0],
                        RangeX     = button.MaxValue,
                        RangeY     = button.MaxValue                             // TODO: ability to have a different Y than X
                    });
                    break;

                case PadSchema.PadInputType.FloatSingle:
                    PadBox.Controls.Add(new VirtualPadAnalogButton
                    {
                        Name        = button.Name,
                        DisplayName = button.DisplayName,
                        Location    = UIHelper.Scale(button.Location),
                        Size        = UIHelper.Scale(button.TargetSize),
                        MinValue    = button.MinValue,
                        MaxValue    = button.MaxValue
                    });
                    break;

                case PadSchema.PadInputType.DiscManager:
                    PadBox.Controls.Add(new VirtualPadDiscManager(button.SecondaryNames)
                    {
                        Name = button.Name,
                        //DisplayName = button.DisplayName,
                        Location      = UIHelper.Scale(button.Location),
                        Size          = UIHelper.Scale(button.TargetSize),
                        OwnerEmulator = button.OwnerEmulator
                    });
                    break;
                }
            }
        }