Exemple #1
0
        private void StroopMainForm_Load(object sender, EventArgs e)
        {
            Config.Stream.OnUpdate        += OnUpdate;
            Config.Stream.OnDisconnect    += _sm64Stream_OnDisconnect;
            Config.Stream.WarnReadonlyOff += _sm64Stream_WarnReadonlyOff;

            comboBoxRomVersion.DataSource    = Enum.GetValues(typeof(RomVersionSelection));
            comboBoxReadWriteMode.DataSource = Enum.GetValues(typeof(ReadWriteMode));

            SetUpContextMenuStrips();

            Config.TabControlMain = tabControlMain;
            Config.DebugText      = labelDebugText;

            SavedSettingsConfig.StoreRecommendedTabOrder();
            SavedSettingsConfig.InvokeInitiallySavedTabOrder();
            Config.TabControlMain.SelectedIndex = 0;
            InitializeTabRemoval();
            SavedSettingsConfig.InvokeInitiallySavedRemovedTabs();

            labelVersionNumber.Text = _version;

            // Collect garbage, we are fully loaded now!
            GC.Collect();
            GC.WaitForPendingFinalizers();

            // Load process
            buttonRefresh_Click(this, new EventArgs());
            panelConnect.Location = new Point();
            panelConnect.Size     = this.Size;
        }
Exemple #2
0
        private void MoveTab(bool rightwards)
        {
            TabPage currentTab   = tabControlMain.SelectedTab;
            int     currentIndex = tabControlMain.TabPages.IndexOf(currentTab);
            int     indexDiff    = rightwards ? +1 : -1;
            int     newIndex     = currentIndex + indexDiff;

            if (newIndex < 0 || newIndex >= tabControlMain.TabCount)
            {
                return;
            }

            TabPage adjacentTab = tabControlMain.TabPages[newIndex];

            tabControlMain.TabPages.Remove(adjacentTab);
            tabControlMain.TabPages.Insert(currentIndex, adjacentTab);

            SavedSettingsConfig.Save();
        }
Exemple #3
0
        public void AddCogContextMenu(Control cogControl)
        {
            cogControl.ContextMenuStrip = new ContextMenuStrip();
            cogControl.Click           += (sender, e) => cogControl.ContextMenuStrip.Show(Cursor.Position);

            _savedSettingsItemList.ForEach(item => cogControl.ContextMenuStrip.Items.Add(item));
            cogControl.ContextMenuStrip.Items.Add(new ToolStripSeparator());


            ToolStripMenuItem resetSavedSettingsItem = new ToolStripMenuItem(buttonOptionsResetSavedSettings.Text);

            resetSavedSettingsItem.Click += (sender, e) => SavedSettingsConfig.ResetSavedSettings();

            ToolStripMenuItem goToOptionsTabItem = new ToolStripMenuItem("Go to Options Tab");

            goToOptionsTabItem.Click += (sender, e) => Config.TabControlMain.SelectedTab = Tab;

            cogControl.ContextMenuStrip.Items.Add(resetSavedSettingsItem);
            cogControl.ContextMenuStrip.Items.Add(goToOptionsTabItem);
        }
Exemple #4
0
        private void InitializeTabRemoval()
        {
            tabControlMain.Click += (se, ev) =>
            {
                if (KeyboardUtilities.IsCtrlHeld())
                {
                    SavedSettingsConfig.RemoveTab(tabControlMain.SelectedTab);
                }
            };

            buttonTabAdd.ContextMenuStrip          = new ContextMenuStrip();
            buttonTabAdd.ContextMenuStrip.Opening += (se, ev) =>
            {
                buttonTabAdd.ContextMenuStrip.Items.Clear();
                SavedSettingsConfig.GetRemovedTabItems().ForEach(
                    item => buttonTabAdd.ContextMenuStrip.Items.Add(item));
            };

            SavedSettingsConfig.InvokeInitiallySavedRemovedTabs();
        }
Exemple #5
0
        private void SetUpContextMenuStrips()
        {
            ControlUtilities.AddContextMenuStripFunctions(
                labelVersionNumber,
                new List <string>()
            {
                "Open Mapping",
                "Clear Mapping",
                "Inject Hitbox View Code",
                "Free Movement Action",
                "Everything in File",
                "Go to Closest Floor Vertex",
                "Save as Savestate",
                "Show MHS Vars",
                "Download Latest STROOP Release",
                "Documentation",
                "Show All Helpful Hints",
                "Enable TASer Settings",
                "Show Image Form",
                "Show Coin Ring Display Form",
                "Format Subtitles",
            },
                new List <Action>()
            {
                () => MappingConfig.OpenMapping(),
                () => MappingConfig.ClearMapping(),
                () => gfxTab.InjectHitboxViewCode(),
                () => Config.Stream.SetValue(MarioConfig.FreeMovementAction, MarioConfig.StructAddress + MarioConfig.ActionOffset),
                () => fileTab.DoEverything(),
                () => trianglesTab.GoToClosestVertex(),
                () => saveAsSavestate(),
                () =>
                {
                    string varFilePath = @"Config/MhsData.xml";
                    List <WatchVariableControlPrecursor> precursors =
                        XmlConfigParser.OpenWatchVariableControlPrecursors(varFilePath);
                    List <WatchVariableControl> controls = precursors.ConvertAll(
                        precursor => precursor.CreateWatchVariableControl());
                    VariablePopOutForm form = new VariablePopOutForm();
                    form.Initialize(controls);
                    form.ShowForm();
                },
                () => Process.Start("https://github.com/SM64-TAS-ABC/STROOP/releases/download/vDev/STROOP.zip"),
                () => Process.Start("https://ukikipedia.net/wiki/STROOP"),
                () => HelpfulHintUtilities.ShowAllHelpfulHints(),
                () =>
                {
                    tasTab.EnableTASerSettings();
                    tabControlMain.SelectedTab = tabPageTas;
                },
                () =>
                {
                    ImageForm imageForm = new ImageForm();
                    imageForm.Show();
                },
                () =>
                {
                    CoinRingDisplayForm form = new CoinRingDisplayForm();
                    form.Show();
                },
                () => SubtitleUtilities.FormatSubtitlesFromClipboard(),
            });

            ControlUtilities.AddCheckableContextMenuStripFunctions(
                labelVersionNumber,
                new List <string>()
            {
                "Update Cam Hack Angle",
                "Update Floor Tri",
            },
                new List <Func <bool> >()
            {
                () =>
                {
                    TestingConfig.UpdateCamHackAngle = !TestingConfig.UpdateCamHackAngle;
                    return(TestingConfig.UpdateCamHackAngle);
                },
                () =>
                {
                    TestingConfig.UpdateFloorTri = !TestingConfig.UpdateFloorTri;
                    return(TestingConfig.UpdateFloorTri);
                },
            });

            ControlUtilities.AddContextMenuStripFunctions(
                buttonMoveTabLeft,
                new List <string>()
            {
                "Restore Recommended Tab Order"
            },
                new List <Action>()
            {
                () => SavedSettingsConfig.InvokeRecommendedTabOrder()
            });

            ControlUtilities.AddContextMenuStripFunctions(
                buttonMoveTabRight,
                new List <string>()
            {
                "Restore Recommended Tab Order"
            },
                new List <Action>()
            {
                () => SavedSettingsConfig.InvokeRecommendedTabOrder()
            });

            ControlUtilities.AddContextMenuStripFunctions(
                trackBarObjSlotSize,
                new List <string>()
            {
                "Reset to Default Object Slot Size"
            },
                new List <Action>()
            {
                () =>
                {
                    trackBarObjSlotSize.Value = ObjectSlotsManager.DefaultSlotSize;
                    ChangeObjectSlotSize(ObjectSlotsManager.DefaultSlotSize);
                }
            });
        }
Exemple #6
0
        public OptionsManager(TabPage tabControl, Control cogControl)
        {
            _savedSettingsTextList = new List <string>()
            {
                "Display Yaw Angles as Unsigned",
                "Variable Values Flush Right",
                "Start Slot Index From 1",
                "Offset Goto/Retrieve Functions",
                "PU Controller Moves Camera",
                "Scale Diagonal Position Controller Buttons",
                "Exclude Dust for Closest Object",
                "Use Misalignment Offset For Distance To Line",
                "Don't Round Values to 0",
                "Display as Hex Uses Memory",
                "Neutralize Triangles with 0x15",
                "Cloning Updates Holp Type",
                "Use In-Game Trig for Angle Logic",
            };

            _savedSettingsGetterList = new List <Func <bool> >()
            {
                () => SavedSettingsConfig.DisplayYawAnglesAsUnsigned,
                () => SavedSettingsConfig.VariableValuesFlushRight,
                () => SavedSettingsConfig.StartSlotIndexsFromOne,
                () => SavedSettingsConfig.OffsetGotoRetrieveFunctions,
                () => SavedSettingsConfig.MoveCameraWithPu,
                () => SavedSettingsConfig.ScaleDiagonalPositionControllerButtons,
                () => SavedSettingsConfig.ExcludeDustForClosestObject,
                () => SavedSettingsConfig.UseMisalignmentOffsetForDistanceToLine,
                () => SavedSettingsConfig.DontRoundValuesToZero,
                () => SavedSettingsConfig.DisplayAsHexUsesMemory,
                () => SavedSettingsConfig.NeutralizeTrianglesWith0x15,
                () => SavedSettingsConfig.CloningUpdatesHolpType,
                () => SavedSettingsConfig.UseInGameTrigForAngleLogic,
            };

            _savedSettingsSetterList = new List <Action <bool> >()
            {
                (bool value) => SavedSettingsConfig.DisplayYawAnglesAsUnsigned             = value,
                (bool value) => SavedSettingsConfig.VariableValuesFlushRight               = value,
                (bool value) => SavedSettingsConfig.StartSlotIndexsFromOne                 = value,
                (bool value) => SavedSettingsConfig.OffsetGotoRetrieveFunctions            = value,
                (bool value) => SavedSettingsConfig.MoveCameraWithPu                       = value,
                (bool value) => SavedSettingsConfig.ScaleDiagonalPositionControllerButtons = value,
                (bool value) => SavedSettingsConfig.ExcludeDustForClosestObject            = value,
                (bool value) => SavedSettingsConfig.UseMisalignmentOffsetForDistanceToLine = value,
                (bool value) => SavedSettingsConfig.DontRoundValuesToZero                  = value,
                (bool value) => SavedSettingsConfig.DisplayAsHexUsesMemory                 = value,
                (bool value) => SavedSettingsConfig.NeutralizeTrianglesWith0x15            = value,
                (bool value) => SavedSettingsConfig.CloningUpdatesHolpType                 = value,
                (bool value) => SavedSettingsConfig.UseInGameTrigForAngleLogic             = value,
            };

            _savedSettingsCheckedListBox = tabControl.Controls["checkedListBoxSavedSettings"] as CheckedListBox;
            for (int i = 0; i < _savedSettingsTextList.Count; i++)
            {
                _savedSettingsCheckedListBox.Items.Add(_savedSettingsTextList[i], _savedSettingsGetterList[i]());
            }
            _savedSettingsCheckedListBox.ItemCheck += (sender, e) =>
            {
                _savedSettingsSetterList[e.Index](e.NewValue == CheckState.Checked);
            };

            Button buttonOptionsResetSavedSettings = tabControl.Controls["buttonOptionsResetSavedSettings"] as Button;

            buttonOptionsResetSavedSettings.Click += (sender, e) => SavedSettingsConfig.ResetSavedSettings();

            _savedSettingsItemList = _savedSettingsTextList.ConvertAll(text => new ToolStripMenuItem(text));
            for (int i = 0; i < _savedSettingsItemList.Count; i++)
            {
                ToolStripMenuItem item   = _savedSettingsItemList[i];
                Action <bool>     setter = _savedSettingsSetterList[i];
                Func <bool>       getter = _savedSettingsGetterList[i];
                item.Click += (sender, e) =>
                {
                    bool newValue = !getter();
                    setter(newValue);
                    item.Checked = newValue;
                };
                item.Checked = getter();
            }

            ToolStripMenuItem resetSavedSettingsItem = new ToolStripMenuItem(buttonOptionsResetSavedSettings.Text);

            resetSavedSettingsItem.Click += (sender, e) => SavedSettingsConfig.ResetSavedSettings();

            ToolStripMenuItem goToOptionsTabItem = new ToolStripMenuItem("Go to Options Tab");

            goToOptionsTabItem.Click += (sender, e) =>
                                        Config.TabControlMain.SelectedTab = Config.TabControlMain.TabPages["tabPageOptions"];

            cogControl.ContextMenuStrip = new ContextMenuStrip();
            cogControl.Click           += (sender, e) => cogControl.ContextMenuStrip.Show(Cursor.Position);

            _savedSettingsItemList.ForEach(item => cogControl.ContextMenuStrip.Items.Add(item));
            cogControl.ContextMenuStrip.Items.Add(new ToolStripSeparator());
            cogControl.ContextMenuStrip.Items.Add(resetSavedSettingsItem);
            cogControl.ContextMenuStrip.Items.Add(goToOptionsTabItem);

            // goto/retrieve offsets
            GroupBox      groupBoxGotoRetrieveOffsets = tabControl.Controls["groupBoxGotoRetrieveOffsets"] as GroupBox;
            BetterTextbox textBoxGotoAbove            = groupBoxGotoRetrieveOffsets.Controls["textBoxGotoAbove"] as BetterTextbox;

            textBoxGotoAbove.LostFocus += (sender, e) => textBoxGotoRetrieve_LostFocus(
                sender, ref GotoRetrieveConfig.GotoAboveOffset, GotoRetrieveConfig.GotoAboveDefault);
            BetterTextbox textBoxGotoInfront = groupBoxGotoRetrieveOffsets.Controls["textBoxGotoInfront"] as BetterTextbox;

            textBoxGotoInfront.LostFocus += (sender, e) => textBoxGotoRetrieve_LostFocus(
                sender, ref GotoRetrieveConfig.GotoInfrontOffset, GotoRetrieveConfig.GotoInfrontDefault);
            BetterTextbox textBoxRetrieveAbove = groupBoxGotoRetrieveOffsets.Controls["textBoxRetrieveAbove"] as BetterTextbox;

            textBoxRetrieveAbove.LostFocus += (sender, e) => textBoxGotoRetrieve_LostFocus(
                sender, ref GotoRetrieveConfig.RetrieveAboveOffset, GotoRetrieveConfig.RetrieveAboveDefault);
            BetterTextbox textBoxRetrieveInfront = groupBoxGotoRetrieveOffsets.Controls["textBoxRetrieveInfront"] as BetterTextbox;

            textBoxRetrieveInfront.LostFocus += (sender, e) => textBoxGotoRetrieve_LostFocus(
                sender, ref GotoRetrieveConfig.RetrieveInfrontOffset, GotoRetrieveConfig.RetrieveInfrontDefault);

            // position controller relative angle
            GroupBox    groupBoxPositionControllerRelativeAngle = tabControl.Controls["groupBoxPositionControllerRelativeAngle"] as GroupBox;
            RadioButton radioButtonPositionControllerRelativeAngleRecommended =
                groupBoxPositionControllerRelativeAngle.Controls["radioButtonPositionControllerRelativeAngleRecommended"] as RadioButton;

            radioButtonPositionControllerRelativeAngleRecommended.Click += (sender, e) =>
                                                                           PositionControllerRelativityConfig.Relativity = PositionControllerRelativity.Recommended;
            RadioButton radioButtonPositionControllerRelativeAngleMario =
                groupBoxPositionControllerRelativeAngle.Controls["radioButtonPositionControllerRelativeAngleMario"] as RadioButton;

            radioButtonPositionControllerRelativeAngleMario.Click += (sender, e) =>
                                                                     PositionControllerRelativityConfig.Relativity = PositionControllerRelativity.Mario;
            RadioButton radioButtonPositionControllerRelativeAngleCustom =
                groupBoxPositionControllerRelativeAngle.Controls["radioButtonPositionControllerRelativeAngleCustom"] as RadioButton;

            radioButtonPositionControllerRelativeAngleCustom.Click += (sender, e) =>
                                                                      PositionControllerRelativityConfig.Relativity = PositionControllerRelativity.Custom;
            BetterTextbox textBoxPositionControllerRelativeAngleCustom =
                groupBoxPositionControllerRelativeAngle.Controls["textBoxPositionControllerRelativeAngleCustom"] as BetterTextbox;

            textBoxPositionControllerRelativeAngleCustom.LostFocus += (sender, e) =>
            {
                double value;
                if (double.TryParse((sender as TextBox).Text, out value))
                {
                    PositionControllerRelativityConfig.CustomAngle = value;
                }
                else
                {
                    (sender as TextBox).Text = PositionControllerRelativityConfig.CustomAngle.ToString();
                }
            };

            // object slot overlays
            List <string> objectSlotOverlayTextList = new List <string>()
            {
                "Held Object",
                "Stood On Object",
                "Ridden Object",
                "Interaction Object",
                "Used Object",
                "Closest Object",
                "Camera Object",
                "Camera Hack Object",
                "Floor Object",
                "Wall Object",
                "Ceiling Object",
                "Collision Object",
                "Parent Object",
                "Child Object",
            };

            List <Func <bool> > objectSlotOverlayGetterList = new List <Func <bool> >()
            {
                () => OverlayConfig.ShowOverlayHeldObject,
                () => OverlayConfig.ShowOverlayStoodOnObject,
                () => OverlayConfig.ShowOverlayRiddenObject,
                () => OverlayConfig.ShowOverlayInteractionObject,
                () => OverlayConfig.ShowOverlayUsedObject,
                () => OverlayConfig.ShowOverlayClosestObject,
                () => OverlayConfig.ShowOverlayCameraObject,
                () => OverlayConfig.ShowOverlayCameraHackObject,
                () => OverlayConfig.ShowOverlayFloorObject,
                () => OverlayConfig.ShowOverlayWallObject,
                () => OverlayConfig.ShowOverlayCeilingObject,
                () => OverlayConfig.ShowOverlayCollisionObject,
                () => OverlayConfig.ShowOverlayParentObject,
                () => OverlayConfig.ShowOverlayChildObject,
            };

            List <Action <bool> > objectSlotOverlaySetterList = new List <Action <bool> >()
            {
                (bool value) => OverlayConfig.ShowOverlayHeldObject        = value,
                (bool value) => OverlayConfig.ShowOverlayStoodOnObject     = value,
                (bool value) => OverlayConfig.ShowOverlayRiddenObject      = value,
                (bool value) => OverlayConfig.ShowOverlayInteractionObject = value,
                (bool value) => OverlayConfig.ShowOverlayUsedObject        = value,
                (bool value) => OverlayConfig.ShowOverlayClosestObject     = value,
                (bool value) => OverlayConfig.ShowOverlayCameraObject      = value,
                (bool value) => OverlayConfig.ShowOverlayCameraHackObject  = value,
                (bool value) => OverlayConfig.ShowOverlayFloorObject       = value,
                (bool value) => OverlayConfig.ShowOverlayWallObject        = value,
                (bool value) => OverlayConfig.ShowOverlayCeilingObject     = value,
                (bool value) => OverlayConfig.ShowOverlayCollisionObject   = value,
                (bool value) => OverlayConfig.ShowOverlayParentObject      = value,
                (bool value) => OverlayConfig.ShowOverlayChildObject       = value,
            };

            CheckedListBox checkedListBoxObjectSlotOverlaysToShow = tabControl.Controls["checkedListBoxObjectSlotOverlaysToShow"] as CheckedListBox;

            for (int i = 0; i < objectSlotOverlayTextList.Count; i++)
            {
                checkedListBoxObjectSlotOverlaysToShow.Items.Add(objectSlotOverlayTextList[i], objectSlotOverlayGetterList[i]());
            }
            checkedListBoxObjectSlotOverlaysToShow.ItemCheck += (sender, e) =>
            {
                objectSlotOverlaySetterList[e.Index](e.NewValue == CheckState.Checked);
            };

            Action <bool> setAllObjectSlotOverlays = (bool value) =>
            {
                int specialCount = 2;
                int totalCount   = checkedListBoxObjectSlotOverlaysToShow.Items.Count;
                for (int i = 0; i < totalCount - specialCount; i++)
                {
                    checkedListBoxObjectSlotOverlaysToShow.SetItemChecked(i, value);
                }
            };

            ControlUtilities.AddContextMenuStripFunctions(
                checkedListBoxObjectSlotOverlaysToShow,
                new List <string>()
            {
                "Set All On", "Set All Off"
            },
                new List <Action>()
            {
                () => setAllObjectSlotOverlays(true),
                () => setAllObjectSlotOverlays(false),
            });

            // FPS
            GroupBox      groupBoxFPS      = tabControl.Controls["groupBoxFPS"] as GroupBox;
            BetterTextbox betterTextboxFPS = groupBoxFPS.Controls["betterTextboxFPS"] as BetterTextbox;

            betterTextboxFPS.AddLostFocusAction(
                () =>
            {
                uint value;
                if (uint.TryParse(betterTextboxFPS.Text, out value))
                {
                    RefreshRateConfig.RefreshRateFreq = value;
                }
                else
                {
                    betterTextboxFPS.Text = RefreshRateConfig.RefreshRateFreq.ToString();
                }
            });
        }
Exemple #7
0
        public OptionsManager(string varFilePath, TabPage tabControl, WatchVariableFlowLayoutPanel variableTable, Control cogControl)
            : base(varFilePath, variableTable)
        {
            _savedSettingsTextList = new List <string>()
            {
                "Use Night Mode",
                "Display Yaw Angles as Unsigned",
                "Variable Values Flush Right",
                "Start Slot Index From 1",
                "Offset Goto/Retrieve Functions",
                "PU Controller Moves Camera",
                "Scale Diagonal Position Controller Buttons",
                "Exclude Dust for Closest Object",
                "Use Misalignment Offset For Distance To Line",
                "Don't Round Values to 0",
                "Display as Hex Uses Memory",
                "Neutralize Triangles with 0x15",
                "Cloning Updates Holp Type",
                "Use In-Game Trig for Angle Logic",
                "Use Extended Level Boundaries",
                "Use Expanded Ram Size",
                "Do Quick Startup",
            };

            _savedSettingsGetterList = new List <Func <bool> >()
            {
                () => SavedSettingsConfig.UseNightMode,
                () => SavedSettingsConfig.DisplayYawAnglesAsUnsigned,
                () => SavedSettingsConfig.VariableValuesFlushRight,
                () => SavedSettingsConfig.StartSlotIndexsFromOne,
                () => SavedSettingsConfig.OffsetGotoRetrieveFunctions,
                () => SavedSettingsConfig.MoveCameraWithPu,
                () => SavedSettingsConfig.ScaleDiagonalPositionControllerButtons,
                () => SavedSettingsConfig.ExcludeDustForClosestObject,
                () => SavedSettingsConfig.UseMisalignmentOffsetForDistanceToLine,
                () => SavedSettingsConfig.DontRoundValuesToZero,
                () => SavedSettingsConfig.DisplayAsHexUsesMemory,
                () => SavedSettingsConfig.NeutralizeTrianglesWith0x15,
                () => SavedSettingsConfig.CloningUpdatesHolpType,
                () => SavedSettingsConfig.UseInGameTrigForAngleLogic,
                () => SavedSettingsConfig.UseExtendedLevelBoundaries,
                () => SavedSettingsConfig.UseExpandedRamSize,
                () => SavedSettingsConfig.DoQuickStartup,
            };

            _savedSettingsSetterList = new List <Action <bool> >()
            {
                (bool value) => SavedSettingsConfig.UseNightMode = value,
                (bool value) => SavedSettingsConfig.DisplayYawAnglesAsUnsigned             = value,
                (bool value) => SavedSettingsConfig.VariableValuesFlushRight               = value,
                (bool value) => SavedSettingsConfig.StartSlotIndexsFromOne                 = value,
                (bool value) => SavedSettingsConfig.OffsetGotoRetrieveFunctions            = value,
                (bool value) => SavedSettingsConfig.MoveCameraWithPu                       = value,
                (bool value) => SavedSettingsConfig.ScaleDiagonalPositionControllerButtons = value,
                (bool value) => SavedSettingsConfig.ExcludeDustForClosestObject            = value,
                (bool value) => SavedSettingsConfig.UseMisalignmentOffsetForDistanceToLine = value,
                (bool value) => SavedSettingsConfig.DontRoundValuesToZero                  = value,
                (bool value) => SavedSettingsConfig.DisplayAsHexUsesMemory                 = value,
                (bool value) => SavedSettingsConfig.NeutralizeTrianglesWith0x15            = value,
                (bool value) => SavedSettingsConfig.CloningUpdatesHolpType                 = value,
                (bool value) => SavedSettingsConfig.UseInGameTrigForAngleLogic             = value,
                (bool value) => SavedSettingsConfig.UseExtendedLevelBoundaries             = value,
                (bool value) => SavedSettingsConfig.UseExpandedRamSize                     = value,
                (bool value) => SavedSettingsConfig.DoQuickStartup = value,
            };

            SplitContainer splitContainerOptions = tabControl.Controls["splitContainerOptions"] as SplitContainer;

            _savedSettingsCheckedListBox = splitContainerOptions.Panel1.Controls["checkedListBoxSavedSettings"] as CheckedListBox;
            for (int i = 0; i < _savedSettingsTextList.Count; i++)
            {
                _savedSettingsCheckedListBox.Items.Add(_savedSettingsTextList[i], _savedSettingsGetterList[i]());
            }
            _savedSettingsCheckedListBox.ItemCheck += (sender, e) =>
            {
                _savedSettingsSetterList[e.Index](e.NewValue == CheckState.Checked);
            };

            Button buttonOptionsResetSavedSettings = splitContainerOptions.Panel1.Controls["buttonOptionsResetSavedSettings"] as Button;

            buttonOptionsResetSavedSettings.Click += (sender, e) => SavedSettingsConfig.ResetSavedSettings();

            _savedSettingsItemList = _savedSettingsTextList.ConvertAll(text => new ToolStripMenuItem(text));
            for (int i = 0; i < _savedSettingsItemList.Count; i++)
            {
                ToolStripMenuItem item   = _savedSettingsItemList[i];
                Action <bool>     setter = _savedSettingsSetterList[i];
                Func <bool>       getter = _savedSettingsGetterList[i];
                item.Click += (sender, e) =>
                {
                    bool newValue = !getter();
                    setter(newValue);
                    item.Checked = newValue;
                };
                item.Checked = getter();
            }

            ToolStripMenuItem resetSavedSettingsItem = new ToolStripMenuItem(buttonOptionsResetSavedSettings.Text);

            resetSavedSettingsItem.Click += (sender, e) => SavedSettingsConfig.ResetSavedSettings();

            ToolStripMenuItem goToOptionsTabItem = new ToolStripMenuItem("Go to Options Tab");

            goToOptionsTabItem.Click += (sender, e) =>
                                        Config.TabControlMain.SelectedTab = Config.TabControlMain.TabPages["tabPageOptions"];

            cogControl.ContextMenuStrip = new ContextMenuStrip();
            cogControl.Click           += (sender, e) => cogControl.ContextMenuStrip.Show(Cursor.Position);

            _savedSettingsItemList.ForEach(item => cogControl.ContextMenuStrip.Items.Add(item));
            cogControl.ContextMenuStrip.Items.Add(new ToolStripSeparator());
            cogControl.ContextMenuStrip.Items.Add(resetSavedSettingsItem);
            cogControl.ContextMenuStrip.Items.Add(goToOptionsTabItem);

            // object slot overlays
            List <string> objectSlotOverlayTextList = new List <string>()
            {
                "Held Object",
                "Stood On Object",
                "Ridden Object",
                "Interaction Object",
                "Used Object",
                "Closest Object",
                "Camera Object",
                "Camera Hack Object",
                "Floor Object",
                "Wall Object",
                "Ceiling Object",
                "Collision Object",
                "Hitbox Overlap Object",
                "Parent Object",
                "Child Object",
            };

            List <Func <bool> > objectSlotOverlayGetterList = new List <Func <bool> >()
            {
                () => OverlayConfig.ShowOverlayHeldObject,
                () => OverlayConfig.ShowOverlayStoodOnObject,
                () => OverlayConfig.ShowOverlayRiddenObject,
                () => OverlayConfig.ShowOverlayInteractionObject,
                () => OverlayConfig.ShowOverlayUsedObject,
                () => OverlayConfig.ShowOverlayClosestObject,
                () => OverlayConfig.ShowOverlayCameraObject,
                () => OverlayConfig.ShowOverlayCameraHackObject,
                () => OverlayConfig.ShowOverlayFloorObject,
                () => OverlayConfig.ShowOverlayWallObject,
                () => OverlayConfig.ShowOverlayCeilingObject,
                () => OverlayConfig.ShowOverlayCollisionObject,
                () => OverlayConfig.ShowOverlayHitboxOverlapObject,
                () => OverlayConfig.ShowOverlayParentObject,
                () => OverlayConfig.ShowOverlayChildObject,
            };

            List <Action <bool> > objectSlotOverlaySetterList = new List <Action <bool> >()
            {
                (bool value) => OverlayConfig.ShowOverlayHeldObject          = value,
                (bool value) => OverlayConfig.ShowOverlayStoodOnObject       = value,
                (bool value) => OverlayConfig.ShowOverlayRiddenObject        = value,
                (bool value) => OverlayConfig.ShowOverlayInteractionObject   = value,
                (bool value) => OverlayConfig.ShowOverlayUsedObject          = value,
                (bool value) => OverlayConfig.ShowOverlayClosestObject       = value,
                (bool value) => OverlayConfig.ShowOverlayCameraObject        = value,
                (bool value) => OverlayConfig.ShowOverlayCameraHackObject    = value,
                (bool value) => OverlayConfig.ShowOverlayFloorObject         = value,
                (bool value) => OverlayConfig.ShowOverlayWallObject          = value,
                (bool value) => OverlayConfig.ShowOverlayCeilingObject       = value,
                (bool value) => OverlayConfig.ShowOverlayCollisionObject     = value,
                (bool value) => OverlayConfig.ShowOverlayHitboxOverlapObject = value,
                (bool value) => OverlayConfig.ShowOverlayParentObject        = value,
                (bool value) => OverlayConfig.ShowOverlayChildObject         = value,
            };

            CheckedListBox checkedListBoxObjectSlotOverlaysToShow = splitContainerOptions.Panel1.Controls["checkedListBoxObjectSlotOverlaysToShow"] as CheckedListBox;

            for (int i = 0; i < objectSlotOverlayTextList.Count; i++)
            {
                checkedListBoxObjectSlotOverlaysToShow.Items.Add(objectSlotOverlayTextList[i], objectSlotOverlayGetterList[i]());
            }
            checkedListBoxObjectSlotOverlaysToShow.ItemCheck += (sender, e) =>
            {
                objectSlotOverlaySetterList[e.Index](e.NewValue == CheckState.Checked);
            };

            Action <bool> setAllObjectSlotOverlays = (bool value) =>
            {
                int specialCount = 3;
                int totalCount   = checkedListBoxObjectSlotOverlaysToShow.Items.Count;
                for (int i = 0; i < totalCount - specialCount; i++)
                {
                    checkedListBoxObjectSlotOverlaysToShow.SetItemChecked(i, value);
                }
            };

            ControlUtilities.AddContextMenuStripFunctions(
                checkedListBoxObjectSlotOverlaysToShow,
                new List <string>()
            {
                "Set All On", "Set All Off"
            },
                new List <Action>()
            {
                () => setAllObjectSlotOverlays(true),
                () => setAllObjectSlotOverlays(false),
            });
        }
Exemple #8
0
        public OptionsTab()
        {
            InitializeComponent();

            if (Program.IsVisualStudioHostProcess())
            {
                return;
            }

            _savedSettingsTextList = new List <string>()
            {
                "Display Yaw Angles as Unsigned",
                "Variable Values Flush Right",
                "Start Slot Index From 1",
                "Offset Goto/Retrieve Functions",
                "PU Controller Moves Camera",
                "Scale Diagonal Position Controller Buttons",
                "Exclude Dust for Closest Object",
                "Use Misalignment Offset For Distance To Line",
                "Don't Round Values to 0",
                "Display as Hex Uses Memory",
                "Neutralize Triangles with 0x15",
                "Cloning Updates Holp Type",
                "Use In-Game Trig for Angle Logic",
                "Use Extended Level Boundaries",
                "Use Expanded Ram Size",
            };

            _savedSettingsGetterList = new List <Func <bool> >()
            {
                () => SavedSettingsConfig.DisplayYawAnglesAsUnsigned,
                () => SavedSettingsConfig.VariableValuesFlushRight,
                () => SavedSettingsConfig.StartSlotIndexsFromOne,
                () => SavedSettingsConfig.OffsetGotoRetrieveFunctions,
                () => SavedSettingsConfig.MoveCameraWithPu,
                () => SavedSettingsConfig.ScaleDiagonalPositionControllerButtons,
                () => SavedSettingsConfig.ExcludeDustForClosestObject,
                () => SavedSettingsConfig.UseMisalignmentOffsetForDistanceToLine,
                () => SavedSettingsConfig.DontRoundValuesToZero,
                () => SavedSettingsConfig.DisplayAsHexUsesMemory,
                () => SavedSettingsConfig.NeutralizeTrianglesWith0x15,
                () => SavedSettingsConfig.CloningUpdatesHolpType,
                () => SavedSettingsConfig.UseInGameTrigForAngleLogic,
                () => SavedSettingsConfig.UseExtendedLevelBoundaries,
                () => SavedSettingsConfig.UseExpandedRamSize,
            };

            _savedSettingsSetterList = new List <Action <bool> >()
            {
                (bool value) => SavedSettingsConfig.DisplayYawAnglesAsUnsigned             = value,
                (bool value) => SavedSettingsConfig.VariableValuesFlushRight               = value,
                (bool value) => SavedSettingsConfig.StartSlotIndexsFromOne                 = value,
                (bool value) => SavedSettingsConfig.OffsetGotoRetrieveFunctions            = value,
                (bool value) => SavedSettingsConfig.MoveCameraWithPu                       = value,
                (bool value) => SavedSettingsConfig.ScaleDiagonalPositionControllerButtons = value,
                (bool value) => SavedSettingsConfig.ExcludeDustForClosestObject            = value,
                (bool value) => SavedSettingsConfig.UseMisalignmentOffsetForDistanceToLine = value,
                (bool value) => SavedSettingsConfig.DontRoundValuesToZero                  = value,
                (bool value) => SavedSettingsConfig.DisplayAsHexUsesMemory                 = value,
                (bool value) => SavedSettingsConfig.NeutralizeTrianglesWith0x15            = value,
                (bool value) => SavedSettingsConfig.CloningUpdatesHolpType                 = value,
                (bool value) => SavedSettingsConfig.UseInGameTrigForAngleLogic             = value,
                (bool value) => { SavedSettingsConfig.UseExtendedLevelBoundaries = value; AccessScope <StroopMainForm> .content?.mapTab.RequireGeometryUpdate(); },
                (bool value) => SavedSettingsConfig.UseExpandedRamSize = value,
            };


            for (int i = 0; i < _savedSettingsTextList.Count; i++)
            {
                checkedListBoxSavedSettings.Items.Add(_savedSettingsTextList[i], _savedSettingsGetterList[i]());
            }
            checkedListBoxSavedSettings.ItemCheck += (sender, e) =>
            {
                _savedSettingsSetterList[e.Index](e.NewValue == CheckState.Checked);
            };

            buttonOptionsResetSavedSettings.Click += (sender, e) => SavedSettingsConfig.ResetSavedSettings();

            _savedSettingsItemList = _savedSettingsTextList.ConvertAll(text => new ToolStripMenuItem(text));
            for (int i = 0; i < _savedSettingsItemList.Count; i++)
            {
                ToolStripMenuItem item   = _savedSettingsItemList[i];
                Action <bool>     setter = _savedSettingsSetterList[i];
                Func <bool>       getter = _savedSettingsGetterList[i];
                item.Click += (sender, e) =>
                {
                    bool newValue = !getter();
                    setter(newValue);
                    item.Checked = newValue;
                };
                item.Checked = getter();
            }

            // object slot overlays
            List <string> objectSlotOverlayTextList = new List <string>()
            {
                "Held Object",
                "Stood On Object",
                "Ridden Object",
                "Interaction Object",
                "Used Object",
                "Closest Object",
                "Camera Object",
                "Camera Hack Object",
                "Floor Object",
                "Wall Object",
                "Ceiling Object",
                "Collision Object",
                "Parent Object",
                "Child Object",
            };

            List <Func <bool> > objectSlotOverlayGetterList = new List <Func <bool> >()
            {
                () => OverlayConfig.ShowOverlayHeldObject,
                () => OverlayConfig.ShowOverlayStoodOnObject,
                () => OverlayConfig.ShowOverlayRiddenObject,
                () => OverlayConfig.ShowOverlayInteractionObject,
                () => OverlayConfig.ShowOverlayUsedObject,
                () => OverlayConfig.ShowOverlayClosestObject,
                () => OverlayConfig.ShowOverlayCameraObject,
                () => OverlayConfig.ShowOverlayCameraHackObject,
                () => OverlayConfig.ShowOverlayFloorObject,
                () => OverlayConfig.ShowOverlayWallObject,
                () => OverlayConfig.ShowOverlayCeilingObject,
                () => OverlayConfig.ShowOverlayCollisionObject,
                () => OverlayConfig.ShowOverlayParentObject,
                () => OverlayConfig.ShowOverlayChildObject,
            };

            List <Action <bool> > objectSlotOverlaySetterList = new List <Action <bool> >()
            {
                (bool value) => OverlayConfig.ShowOverlayHeldObject        = value,
                (bool value) => OverlayConfig.ShowOverlayStoodOnObject     = value,
                (bool value) => OverlayConfig.ShowOverlayRiddenObject      = value,
                (bool value) => OverlayConfig.ShowOverlayInteractionObject = value,
                (bool value) => OverlayConfig.ShowOverlayUsedObject        = value,
                (bool value) => OverlayConfig.ShowOverlayClosestObject     = value,
                (bool value) => OverlayConfig.ShowOverlayCameraObject      = value,
                (bool value) => OverlayConfig.ShowOverlayCameraHackObject  = value,
                (bool value) => OverlayConfig.ShowOverlayFloorObject       = value,
                (bool value) => OverlayConfig.ShowOverlayWallObject        = value,
                (bool value) => OverlayConfig.ShowOverlayCeilingObject     = value,
                (bool value) => OverlayConfig.ShowOverlayCollisionObject   = value,
                (bool value) => OverlayConfig.ShowOverlayParentObject      = value,
                (bool value) => OverlayConfig.ShowOverlayChildObject       = value,
            };

            for (int i = 0; i < objectSlotOverlayTextList.Count; i++)
            {
                checkedListBoxObjectSlotOverlaysToShow.Items.Add(objectSlotOverlayTextList[i], objectSlotOverlayGetterList[i]());
            }
            checkedListBoxObjectSlotOverlaysToShow.ItemCheck += (sender, e) =>
            {
                objectSlotOverlaySetterList[e.Index](e.NewValue == CheckState.Checked);
            };

            Action <bool> setAllObjectSlotOverlays = (bool value) =>
            {
                int specialCount = 2;
                int totalCount   = checkedListBoxObjectSlotOverlaysToShow.Items.Count;
                for (int i = 0; i < totalCount - specialCount; i++)
                {
                    checkedListBoxObjectSlotOverlaysToShow.SetItemChecked(i, value);
                }
            };

            ControlUtilities.AddContextMenuStripFunctions(
                checkedListBoxObjectSlotOverlaysToShow,
                new List <string>()
            {
                "Set All On", "Set All Off"
            },
                new List <Action>()
            {
                () => setAllObjectSlotOverlays(true),
                () => setAllObjectSlotOverlays(false),
            });
        }
Exemple #9
0
        private void SetUpContextMenuStrips()
        {
            ControlUtilities.AddContextMenuStripFunctions(
                labelVersionNumber,
                new List <string>()
            {
                "Enable TASer Settings",
                "Show MHS Vars",
                "Download Latest STROOP Release",
                "Show All Helpful Hints",
                "Add Gfx Vertices",
                "Test Something",
            },
                new List <Action>()
            {
                () =>
                {
                    Config.RamSize                    = 0x800000;
                    checkBoxUseRomHack.Checked        = true;
                    splitContainerTas.Panel1Collapsed = true;
                    splitContainerTas.Panel2Collapsed = false;
                    Config.TasManager.ShowTaserVariables();
                    tabControlMain.SelectedTab = tabPageTas;
                },
                () =>
                {
                    string varFilePath = @"Config/MhsData.xml";
                    List <WatchVariableControlPrecursor> precursors =
                        XmlConfigParser.OpenWatchVariableControlPrecursors(varFilePath);
                    List <WatchVariableControl> controls = precursors.ConvertAll(
                        precursor => precursor.CreateWatchVariableControl());
                    VariablePopOutForm form = new VariablePopOutForm();
                    form.Initialize(controls);
                    form.ShowForm();
                },
                () => Process.Start("https://github.com/SM64-TAS-ABC/STROOP/releases/download/vDev/STROOP.zip"),
                () => HelpfulHintUtilities.ShowAllHelpfulHints(),
                () => TestUtilities.AddGraphicsTriangleVerticesToTriangleTab(),
                () => TestUtilities.TestSomething(),
            });

            ControlUtilities.AddCheckableContextMenuStripFunctions(
                labelVersionNumber,
                new List <string>()
            {
                "Disable Locking",
                "Show Invisible Objects as Signs",
                "Show Cog Tris",
                "Show Shapes",
            },
                new List <Func <bool> >()
            {
                () =>
                {
                    LockConfig.LockingDisabled = !LockConfig.LockingDisabled;
                    return(LockConfig.LockingDisabled);
                },
                () =>
                {
                    TestingConfig.ShowInvisibleObjectsAsSigns = !TestingConfig.ShowInvisibleObjectsAsSigns;
                    return(TestingConfig.ShowInvisibleObjectsAsSigns);
                },
                () =>
                {
                    TestingConfig.ShowCogTris = !TestingConfig.ShowCogTris;
                    return(TestingConfig.ShowCogTris);
                },
                () =>
                {
                    TestingConfig.ShowShapes = !TestingConfig.ShowShapes;
                    return(TestingConfig.ShowShapes);
                },
            });

            ControlUtilities.AddContextMenuStripFunctions(
                buttonMoveTabLeft,
                new List <string>()
            {
                "Restore Recommended Tab Order"
            },
                new List <Action>()
            {
                () => SavedSettingsConfig.InvokeRecommendedTabOrder()
            });

            ControlUtilities.AddContextMenuStripFunctions(
                buttonMoveTabRight,
                new List <string>()
            {
                "Restore Recommended Tab Order"
            },
                new List <Action>()
            {
                () => SavedSettingsConfig.InvokeRecommendedTabOrder()
            });
        }