Esempio n. 1
0
        public ValueForm(
            string textBoxText = "",
            string labelText   = "Enter Value:",
            string buttonText  = "OK")
        {
            InitializeComponent();
            textBox1.Text = textBoxText;
            label1.Text   = labelText;
            button1.Text  = buttonText;

            Action <string> okAction = (string stringValue) =>
            {
                StringValue  = stringValue;
                DialogResult = DialogResult.OK;
                Close();
            };

            button1.Click += (sender, e) => okAction(textBox1.Text);
            textBox1.AddEnterAction(() => okAction(textBox1.Text));

            ControlUtilities.AddContextMenuStripFunctions(
                button1,
                new List <string>()
            {
                "Use Clipboard",
            },
                new List <Action>()
            {
                () => okAction(Clipboard.GetText()),
            });
        }
Esempio n. 2
0
        private void MapTracker_Load(object sender, EventArgs e)
        {
            tableLayoutPanel.BorderWidth = 2;
            tableLayoutPanel.ShowBorder  = true;

            comboBoxVisibilityType.DataSource   = Enum.GetValues(typeof(MapTrackerVisibilityType));
            comboBoxVisibilityType.SelectedItem = MapTrackerVisibilityType.VisibleWhenLoaded;

            comboBoxOrderType.DataSource   = Enum.GetValues(typeof(MapTrackerOrderType));
            comboBoxOrderType.SelectedItem = MapTrackerOrderType.OrderByDepth;

            comboBoxDisplayType.DataSource = Enum.GetValues(typeof(MapTrackerDisplayType));

            ControlUtilities.AddContextMenuStripFunctions(
                pictureBoxCog,
                new List <string>()
            {
                "Hitbox Cylinder",
                "Tangibility Radius",
                "Draw Distance Radius",
            },
                new List <Action>()
            {
                () => { },
                () => { },
                () => { },
            });
            pictureBoxCog.Click += (se, ev) => pictureBoxCog.ContextMenuStrip.Show(Cursor.Position);
        }
Esempio n. 3
0
 public MainLoadingForm()
 {
     InitializeComponent();
     textBoxLoadingHelpfulHint.Text = HelpfulHintUtilities.GetRandomHelpfulHint();
     ControlUtilities.AddContextMenuStripFunctions(
         textBoxLoadingHelpfulHint,
         new List <string>()
     {
         "Show All Helpful Hints"
     },
         new List <Action>()
     {
         () => HelpfulHintUtilities.ShowAllHelpfulHints()
     });
 }
Esempio n. 4
0
        public ValueSplitForm(
            string textBoxText = "",
            string labelText   = "Enter Value:",
            string button1Text = "OK",
            string button2Text = "OK")
        {
            InitializeComponent();
            textBox1.Text = textBoxText;
            label1.Text   = labelText;
            button1.Text  = button1Text;
            button2.Text  = button2Text;

            Action <string, bool> okAction = (string stringValue, bool rightButtonClicked) =>
            {
                StringValue        = stringValue;
                RightButtonClicked = rightButtonClicked;
                DialogResult       = DialogResult.OK;
                Close();
            };

            button1.Click += (sender, e) => okAction(textBox1.Text, false);
            button2.Click += (sender, e) => okAction(textBox1.Text, true);

            ControlUtilities.AddContextMenuStripFunctions(
                button1,
                new List <string>()
            {
                "Use Clipboard",
            },
                new List <Action>()
            {
                () => okAction(Clipboard.GetText(), false),
            });
            ControlUtilities.AddContextMenuStripFunctions(
                button2,
                new List <string>()
            {
                "Use Clipboard",
            },
                new List <Action>()
            {
                () => okAction(Clipboard.GetText(), true),
            });
        }
Esempio n. 5
0
        public ActionsManager(string varFilePath, WatchVariableFlowLayoutPanel variableTable, Control actionsControl)
            : base(varFilePath, variableTable)
        {
            textBoxActionDescription    = actionsControl.Controls["textBoxActionDescription"] as BetterTextbox;
            textBoxAnimationDescription = actionsControl.Controls["textBoxAnimationDescription"] as BetterTextbox;

            textBoxActionDescription.DoubleClick    += (sender, e) => SelectionForm.ShowActionDescriptionSelectionForm();
            textBoxAnimationDescription.DoubleClick += (sender, e) => SelectionForm.ShowAnimationDescriptionSelectionForm();

            ControlUtilities.AddContextMenuStripFunctions(
                textBoxActionDescription,
                new List <string>()
            {
                "Select Action", "Free Movement Action", "Open Action Form"
            },
                new List <Action>()
            {
                () => SelectionForm.ShowActionDescriptionSelectionForm(),
                () => Config.Stream.SetValue(MarioConfig.FreeMovementAction, MarioConfig.StructAddress + MarioConfig.ActionOffset),
                () => new ActionForm().Show(),
            });

            ControlUtilities.AddContextMenuStripFunctions(
                textBoxAnimationDescription,
                new List <string>()
            {
                "Select Animation", "Replace Animation"
            },
                new List <Action>()
            {
                () => SelectionForm.ShowAnimationDescriptionSelectionForm(),
                () =>
                {
                    int?animationToBeReplaced = SelectionForm.GetAnimation("Choose Animation to Be Replaced", "Select Animation");
                    int?animationToReplaceIt  = SelectionForm.GetAnimation("Choose Animation to Replace It", "Select Animation");
                    if (animationToBeReplaced == null || animationToReplaceIt == null)
                    {
                        return;
                    }
                    AnimationUtilities.ReplaceAnimation(animationToBeReplaced.Value, animationToReplaceIt.Value);
                },
            });
        }
Esempio n. 6
0
        public HudManager(string varFilePath, Control tabControl, WatchVariableFlowLayoutPanel watchVariablePanelHud)
            : base(varFilePath, watchVariablePanelHud)
        {
            _tabControl = tabControl;

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

            (splitContainerHud.Panel1.Controls["buttonFullHp"] as Button).Click      += (sender, e) => ButtonUtilities.FullHp();
            (splitContainerHud.Panel1.Controls["buttonDie"] as Button).Click         += (sender, e) => ButtonUtilities.Die();
            (splitContainerHud.Panel1.Controls["buttonGameOver"] as Button).Click    += (sender, e) => ButtonUtilities.GameOver();
            (splitContainerHud.Panel1.Controls["button99Coins"] as Button).Click     += (sender, e) => ButtonUtilities.Coins99();
            (splitContainerHud.Panel1.Controls["button100CoinStar"] as Button).Click += (sender, e) => ButtonUtilities.CoinStar100();
            (splitContainerHud.Panel1.Controls["button100Lives"] as Button).Click    += (sender, e) => ButtonUtilities.Lives100();
            (splitContainerHud.Panel1.Controls["buttonStandardHud"] as Button).Click += (sender, e) => ButtonUtilities.StandardHud();

            _turnOnOffHudButton = splitContainerHud.Panel1.Controls["buttonTurnOnOffHud"] as BinaryButton;
            _turnOnOffHudButton.Initialize(
                "Turn Off HUD",
                "Turn On HUD",
                () => ButtonUtilities.SetHudVisibility(false),
                () => ButtonUtilities.SetHudVisibility(true),
                () => (Config.Stream.GetByte(MarioConfig.StructAddress + HudConfig.VisibilityOffset) & HudConfig.VisibilityMask) == 0);

            ControlUtilities.AddContextMenuStripFunctions(
                _turnOnOffHudButton,
                new List <string>()
            {
                "Disable HUD by Changing Level Index",
                "Enable HUD by Changing Level Index",
                "Disable HUD by Removing Function",
                "Enable HUD by Removing Function",
            },
                new List <Action>()
            {
                () => ButtonUtilities.SetHudVisibility(false, true),
                () => ButtonUtilities.SetHudVisibility(true, true),
                () => ButtonUtilities.SetHudVisibility(false, false),
                () => ButtonUtilities.SetHudVisibility(true, false),
            });

            _checkBoxFullHP = splitContainerHud.Panel1.Controls["checkBoxFullHP"] as CheckBox;
        }
Esempio n. 7
0
        public TasManager(string varFilePath, TabPage tabControl, WatchVariableFlowLayoutPanel watchVariablePanel)
            : base(varFilePath, watchVariablePanel, ALL_VAR_GROUPS, VISIBLE_VAR_GROUPS)
        {
            SplitContainer splitContainerTas      = tabControl.Controls["splitContainerTas"] as SplitContainer;
            SplitContainer splitContainerTasTable = splitContainerTas.Panel1.Controls["splitContainerTasTable"] as SplitContainer;

            _dataGridViewTas            = splitContainerTasTable.Panel2.Controls["dataGridViewTas"] as DataGridView;
            _checkBoxTasRecordData      = splitContainerTasTable.Panel1.Controls["checkBoxTasRecordData"] as CheckBox;
            _buttonTasClearData         = splitContainerTasTable.Panel1.Controls["buttonTasClearData"] as Button;
            _buttonTasClearData.Click  += (sender, e) => ClearData();
            _richTextBoxTasInstructions = splitContainerTasTable.Panel1.Controls["richTextBoxTasInstructions"] as RichTextBox;

            Button buttonTasStoreMarioPosition = splitContainerTasTable.Panel1.Controls["buttonTasStoreMarioPosition"] as Button;

            buttonTasStoreMarioPosition.Click += (sender, e) => StoreMarioInfo(x: true, y: true, z: true);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTasStoreMarioPosition,
                new List <string>()
            {
                "Store Position", "Store Lateral Position", "Store X", "Store Y", "Store Z"
            },
                new List <Action>()
            {
                () => StoreMarioInfo(x: true, y: true, z: true),
                () => StoreMarioInfo(x: true, z: true),
                () => StoreMarioInfo(x: true),
                () => StoreMarioInfo(y: true),
                () => StoreMarioInfo(z: true),
            });

            Button buttonTasStoreMarioAngle = splitContainerTasTable.Panel1.Controls["buttonTasStoreMarioAngle"] as Button;

            buttonTasStoreMarioAngle.Click += (sender, e) => StoreMarioInfo(angle: true);

            _waitingGlobalTimer     = 0;
            _waitingDateTime        = DateTime.Now;
            _lastUpdatedGlobalTimer = 0;

            _dataDictionary = new Dictionary <uint, TasDataStruct>();
            _rowDictionary  = new Dictionary <uint, DataGridViewRow>();
        }
Esempio n. 8
0
        public override void InitializeTab()
        {
            base.InitializeTab();

            // Hud Image
            pictureBoxHud.Image      = Config.ObjectAssociations.HudImage.Value;
            panelHudBorder.BackColor = Config.ObjectAssociations.HudColor;
            pictureBoxHud.BackColor  = Config.ObjectAssociations.HudColor.Lighten(0.5);

            buttonFullHp.Click      += (sender, e) => ButtonUtilities.FullHp();
            buttonDie.Click         += (sender, e) => ButtonUtilities.Die();
            buttonGameOver.Click    += (sender, e) => ButtonUtilities.GameOver();
            button99Coins.Click     += (sender, e) => ButtonUtilities.Coins99();
            button100CoinStar.Click += (sender, e) => ButtonUtilities.CoinStar100();
            button100Lives.Click    += (sender, e) => ButtonUtilities.Lives100();
            buttonStandardHud.Click += (sender, e) => ButtonUtilities.StandardHud();

            buttonTurnOnOffHud.Initialize(
                "Turn Off HUD",
                "Turn On HUD",
                () => ButtonUtilities.SetHudVisibility(false),
                () => ButtonUtilities.SetHudVisibility(true),
                () => (Config.Stream.GetByte(MarioConfig.StructAddress + HudConfig.VisibilityOffset) & HudConfig.VisibilityMask) == 0);

            ControlUtilities.AddContextMenuStripFunctions(
                buttonTurnOnOffHud,
                new List <string>()
            {
                "Disable HUD by Changing Level Index",
                "Enable HUD by Changing Level Index",
                "Disable HUD by Removing Function",
                "Enable HUD by Removing Function",
            },
                new List <Action>()
            {
                () => ButtonUtilities.SetHudVisibility(false, true),
                () => ButtonUtilities.SetHudVisibility(true, true),
                () => ButtonUtilities.SetHudVisibility(false, false),
                () => ButtonUtilities.SetHudVisibility(true, false),
            });
        }
Esempio n. 9
0
        public override void InitializeTab()
        {
            base.InitializeTab();
            textBoxActionDescription.DoubleClick    += (sender, e) => SelectionForm.ShowActionDescriptionSelectionForm();
            textBoxAnimationDescription.DoubleClick += (sender, e) => SelectionForm.ShowAnimationDescriptionSelectionForm();

            ControlUtilities.AddContextMenuStripFunctions(
                textBoxActionDescription,
                new List <string>()
            {
                "Select Action", "Free Movement Action", "Open Action Form"
            },
                new List <Action>()
            {
                () => SelectionForm.ShowActionDescriptionSelectionForm(),
                () => Config.Stream.SetValue(MarioConfig.FreeMovementAction, MarioConfig.StructAddress + MarioConfig.ActionOffset),
                () => new ActionForm().Show(),
            });

            ControlUtilities.AddContextMenuStripFunctions(
                textBoxAnimationDescription,
                new List <string>()
            {
                "Select Animation", "Replace Animation"
            },
                new List <Action>()
            {
                () => SelectionForm.ShowAnimationDescriptionSelectionForm(),
                () =>
                {
                    int?animationToBeReplaced = SelectionForm.GetAnimation("Choose Animation to Be Replaced", "Select Animation");
                    int?animationToReplaceIt  = SelectionForm.GetAnimation("Choose Animation to Replace It", "Select Animation");
                    if (animationToBeReplaced == null || animationToReplaceIt == null)
                    {
                        return;
                    }
                    AnimationUtilities.ReplaceAnimation(animationToBeReplaced.Value, animationToReplaceIt.Value);
                },
            });
        }
Esempio n. 10
0
        public ActionsManager(string varFilePath, WatchVariableFlowLayoutPanel variableTable, Control actionsControl)
            : base(varFilePath, variableTable)
        {
            textBoxActionDescription    = actionsControl.Controls["textBoxActionDescription"] as BetterTextbox;
            textBoxAnimationDescription = actionsControl.Controls["textBoxAnimationDescription"] as BetterTextbox;

            textBoxActionDescription.DoubleClick    += (sender, e) => SelectionForm.ShowActionSelectionForm();
            textBoxAnimationDescription.DoubleClick += (sender, e) => SelectionForm.ShowAnimationSelectionForm();

            ControlUtilities.AddContextMenuStripFunctions(
                textBoxActionDescription,
                new List <string>()
            {
                "Select Action", "Free Movement Action", "Open Action Form"
            },
                new List <Action>()
            {
                () => SelectionForm.ShowActionSelectionForm(),
                () => Config.Stream.SetValue(MarioConfig.FreeMovementAction, MarioConfig.StructAddress + MarioConfig.ActionOffset),
                () => new ActionForm().Show(),
            });
        }
Esempio n. 11
0
        public ObjectManager(List <WatchVariableControlPrecursor> variables, Control objectControl, WatchVariablePanel variableTable)
            : base(variables, variableTable, ALL_VAR_GROUPS, VISIBLE_VAR_GROUPS)
        {
            SplitContainer splitContainerObject = objectControl.Controls["splitContainerObject"] as SplitContainer;

            _objAddressLabelValue    = splitContainerObject.Panel1.Controls["labelObjAddValue"] as Label;
            _objAddressLabel         = splitContainerObject.Panel1.Controls["labelObjAdd"] as Label;
            _objSlotIndexLabel       = splitContainerObject.Panel1.Controls["labelObjSlotIndValue"] as Label;
            _objSlotPositionLabel    = splitContainerObject.Panel1.Controls["labelObjSlotPosValue"] as Label;
            _objBehaviorLabel        = splitContainerObject.Panel1.Controls["labelObjBhvValue"] as Label;
            _objBehaviorLabel.Click += _objBehaviorLabel_Click;
            _objectNameTextBox       = splitContainerObject.Panel1.Controls["textBoxObjName"] as TextBox;
            _objectBorderPanel       = splitContainerObject.Panel1.Controls["panelObjectBorder"] as Panel;
            _objectImagePictureBox   = _objectBorderPanel.Controls["pictureBoxObject"] as IntPictureBox;

            _objAddressLabelValue.Click += ObjAddressLabel_Click;
            _objAddressLabel.Click      += ObjAddressLabel_Click;

            Panel objPanel = splitContainerObject.Panel1.Controls["panelObj"] as Panel;

            var goToButton = objPanel.Controls["buttonObjGoto"] as Button;

            goToButton.Click += (sender, e) => ButtonUtilities.GotoObjects(_currentAddresses);
            ControlUtilities.AddContextMenuStripFunctions(
                goToButton,
                new List <string>()
            {
                "Goto", "Goto Laterally", "Goto X", "Goto Y", "Goto Z"
            },
                new List <Action>()
            {
                () => ButtonUtilities.GotoObjects(_currentAddresses, (true, true, true)),
                () => ButtonUtilities.GotoObjects(_currentAddresses, (true, false, true)),
                () => ButtonUtilities.GotoObjects(_currentAddresses, (true, false, false)),
                () => ButtonUtilities.GotoObjects(_currentAddresses, (false, true, false)),
                () => ButtonUtilities.GotoObjects(_currentAddresses, (false, false, true)),
            });
Esempio n. 12
0
        public TasManager(string varFilePath, TabPage tabControl, WatchVariableFlowLayoutPanel watchVariablePanel)
            : base(varFilePath, watchVariablePanel, ALL_VAR_GROUPS, VISIBLE_VAR_GROUPS)
        {
            SplitContainer splitContainerTas = tabControl.Controls["splitContainerTas"] as SplitContainer;

            Button buttonTasStorePosition = splitContainerTas.Panel1.Controls["buttonTasStorePosition"] as Button;

            buttonTasStorePosition.Click += (sender, e) => StoreInfo(x: true, y: true, z: true);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTasStorePosition,
                new List <string>()
            {
                "Store Position",
                "Store Lateral Position",
                "Store X",
                "Store Y",
                "Store Z",
            },
                new List <Action>()
            {
                () => StoreInfo(x: true, y: true, z: true),
                () => StoreInfo(x: true, z: true),
                () => StoreInfo(x: true),
                () => StoreInfo(y: true),
                () => StoreInfo(z: true),
            });

            Button buttonTasStoreAngle = splitContainerTas.Panel1.Controls["buttonTasStoreAngle"] as Button;

            buttonTasStoreAngle.Click += (sender, e) => StoreInfo(angle: true);

            Button buttonTasTakePosition = splitContainerTas.Panel1.Controls["buttonTasTakePosition"] as Button;

            buttonTasTakePosition.Click += (sender, e) => TakeInfo(x: true, y: true, z: true);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTasTakePosition,
                new List <string>()
            {
                "Take Position",
                "Take Lateral Position",
                "Take X",
                "Take Y",
                "Take Z"
            },
                new List <Action>()
            {
                () => TakeInfo(x: true, y: true, z: true),
                () => TakeInfo(x: true, z: true),
                () => TakeInfo(x: true),
                () => TakeInfo(y: true),
                () => TakeInfo(z: true),
            });

            Button buttonTasTakeMarioAngle = splitContainerTas.Panel1.Controls["buttonTasTakeAngle"] as Button;

            buttonTasTakeMarioAngle.Click += (sender, e) => TakeInfo(angle: true);

            Button buttonTasGotoVertex = splitContainerTas.Panel1.Controls["buttonTasGotoVertex"] as Button;

            buttonTasGotoVertex.Click += (sender, e) =>
                                         ButtonUtilities.GotoTriangleVertexClosest(
                Config.Stream.GetUInt(MarioConfig.StructAddress + MarioConfig.FloorTriangleOffset),
                TriangleVertexOffset.NONE);

            Button buttonTasPasteSchedule = splitContainerTas.Panel1.Controls["buttonTasPasteSchedule"] as Button;

            buttonTasPasteSchedule.Click += (sender, e) => SetScheduler(Clipboard.GetText(), false);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTasPasteSchedule,
                new List <string>()
            {
                "Paste Schedule as Floats"
            },
                new List <Action>()
            {
                () => SetScheduler(Clipboard.GetText(), true)
            });

            GroupBox groupBoxTasSelf = splitContainerTas.Panel1.Controls["groupBoxTasSelf"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                groupBoxTasSelf,
                groupBoxTasSelf.Controls["buttonTasSelfXn"] as Button,
                groupBoxTasSelf.Controls["buttonTasSelfXp"] as Button,
                groupBoxTasSelf.Controls["buttonTasSelfZn"] as Button,
                groupBoxTasSelf.Controls["buttonTasSelfZp"] as Button,
                groupBoxTasSelf.Controls["buttonTasSelfXnZn"] as Button,
                groupBoxTasSelf.Controls["buttonTasSelfXnZp"] as Button,
                groupBoxTasSelf.Controls["buttonTasSelfXpZn"] as Button,
                groupBoxTasSelf.Controls["buttonTasSelfXpZp"] as Button,
                groupBoxTasSelf.Controls["buttonTasSelfYp"] as Button,
                groupBoxTasSelf.Controls["buttonTasSelfYn"] as Button,
                groupBoxTasSelf.Controls["textBoxTasSelfXZ"] as TextBox,
                groupBoxTasSelf.Controls["textBoxTasSelfY"] as TextBox,
                groupBoxTasSelf.Controls["checkBoxTasSelfRelative"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslatePosAngle(
                    new List <PositionAngle>()
                {
                    PositionAngle.Self
                },
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });

            GroupBox groupBoxTasPoint = splitContainerTas.Panel1.Controls["groupBoxTasPoint"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                groupBoxTasPoint,
                groupBoxTasPoint.Controls["buttonTasPointXn"] as Button,
                groupBoxTasPoint.Controls["buttonTasPointXp"] as Button,
                groupBoxTasPoint.Controls["buttonTasPointZn"] as Button,
                groupBoxTasPoint.Controls["buttonTasPointZp"] as Button,
                groupBoxTasPoint.Controls["buttonTasPointXnZn"] as Button,
                groupBoxTasPoint.Controls["buttonTasPointXnZp"] as Button,
                groupBoxTasPoint.Controls["buttonTasPointXpZn"] as Button,
                groupBoxTasPoint.Controls["buttonTasPointXpZp"] as Button,
                groupBoxTasPoint.Controls["buttonTasPointYp"] as Button,
                groupBoxTasPoint.Controls["buttonTasPointYn"] as Button,
                groupBoxTasPoint.Controls["textBoxTasPointXZ"] as TextBox,
                groupBoxTasPoint.Controls["textBoxTasPointY"] as TextBox,
                groupBoxTasPoint.Controls["checkBoxTasPointRelative"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslatePosAngle(
                    new List <PositionAngle>()
                {
                    PositionAngle.Point
                },
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });
        }
Esempio n. 13
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);
                }
            });
        }
Esempio n. 14
0
        public CamHackManager(string varFilePath, TabPage camHackControl, WatchVariableFlowLayoutPanel variableTable)
            : base(varFilePath, variableTable)
        {
            CurrentCamHackMode = CamHackMode.REGULAR;

            var splitContainer = camHackControl.Controls["splitContainerCamHack"] as SplitContainer;

            Label labelCamHackMode = splitContainer.Panel1.Controls["labelCamHackMode"] as Label;

            ControlUtilities.AddContextMenuStripFunctions(
                labelCamHackMode,
                new List <string>()
            {
                "Download Camera Hack ROM"
            },
                new List <Action>()
            {
                () => System.Diagnostics.Process.Start("http://download1436.mediafire.com/t3unklq170ag/hdd377v5794u319/Camera+Hack+ROM.z64"),
            });

            _mode0RadioButton = splitContainer.Panel1.Controls["radioButtonCamHackMode0"] as RadioButton;
            _mode1RadioButtonRelativeAngle = splitContainer.Panel1.Controls["radioButtonCamHackMode1RelativeAngle"] as RadioButton;
            _mode1RadioButtonAbsoluteAngle = splitContainer.Panel1.Controls["radioButtonCamHackMode1AbsoluteAngle"] as RadioButton;
            _mode2RadioButton = splitContainer.Panel1.Controls["radioButtonCamHackMode2"] as RadioButton;
            _mode3RadioButton = splitContainer.Panel1.Controls["radioButtonCamHackMode3"] as RadioButton;

            _mode0RadioButton.Click += (sender, e) => Config.Stream.SetValue(0, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);
            _mode1RadioButtonRelativeAngle.Click += (sender, e) =>
            {
                Config.Stream.SetValue(1, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);
                Config.Stream.SetValue((ushort)0, CamHackConfig.StructAddress + CamHackConfig.AbsoluteAngleOffset);
            };
            _mode1RadioButtonAbsoluteAngle.Click += (sender, e) =>
            {
                Config.Stream.SetValue(1, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);
                Config.Stream.SetValue((ushort)1, CamHackConfig.StructAddress + CamHackConfig.AbsoluteAngleOffset);
            };
            _mode2RadioButton.Click += (sender, e) => Config.Stream.SetValue(2, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);
            _mode3RadioButton.Click += (sender, e) => Config.Stream.SetValue(3, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);

            var cameraHackPosGroupBox = splitContainer.Panel1.Controls["groupBoxCameraHackPos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                cameraHackPosGroupBox,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosXn"] as Button,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosXp"] as Button,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosZn"] as Button,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosZp"] as Button,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosXnZn"] as Button,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosXnZp"] as Button,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosXpZn"] as Button,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosXpZp"] as Button,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosYp"] as Button,
                cameraHackPosGroupBox.Controls["buttonCameraHackPosYn"] as Button,
                cameraHackPosGroupBox.Controls["textBoxCameraHackPosXZ"] as TextBox,
                cameraHackPosGroupBox.Controls["textBoxCameraHackPosY"] as TextBox,
                cameraHackPosGroupBox.Controls["checkBoxCameraHackPosRelative"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslateCameraHack(
                    CurrentCamHackMode,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });

            var cameraHackSphericalPosGroupBox = splitContainer.Panel1.Controls["groupBoxCameraHackSphericalPos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Spherical,
                false,
                cameraHackSphericalPosGroupBox,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosTn"] as Button,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosTp"] as Button,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosPn"] as Button,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosPp"] as Button,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosTnPn"] as Button,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosTnPp"] as Button,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosTpPn"] as Button,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosTpPp"] as Button,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosRn"] as Button,
                cameraHackSphericalPosGroupBox.Controls["buttonCameraHackSphericalPosRp"] as Button,
                cameraHackSphericalPosGroupBox.Controls["textBoxCameraHackSphericalPosTP"] as TextBox,
                cameraHackSphericalPosGroupBox.Controls["textBoxCameraHackSphericalPosR"] as TextBox,
                null /* checkbox */,
                (float hOffset, float vOffset, float nOffset, bool _) =>
            {
                ButtonUtilities.TranslateCameraHackSpherically(
                    CurrentCamHackMode,
                    -1 * nOffset,
                    hOffset,
                    -1 * vOffset);
            });

            var cameraHackFocusPosGroupBox = splitContainer.Panel1.Controls["groupBoxCameraHackFocusPos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                cameraHackFocusPosGroupBox,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosXn"] as Button,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosXp"] as Button,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosZn"] as Button,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosZp"] as Button,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosXnZn"] as Button,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosXnZp"] as Button,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosXpZn"] as Button,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosXpZp"] as Button,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosYp"] as Button,
                cameraHackFocusPosGroupBox.Controls["buttonCameraHackFocusPosYn"] as Button,
                cameraHackFocusPosGroupBox.Controls["textBoxCameraHackFocusPosXZ"] as TextBox,
                cameraHackFocusPosGroupBox.Controls["textBoxCameraHackFocusPosY"] as TextBox,
                cameraHackFocusPosGroupBox.Controls["checkBoxCameraHackFocusPosRelative"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslateCameraHackFocus(
                    CurrentCamHackMode,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });

            var cameraHackSphericalFocusPosGroupBox = splitContainer.Panel1.Controls["groupBoxCameraHackSphericalFocusPos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Spherical,
                false,
                cameraHackSphericalFocusPosGroupBox,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosTn"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosTp"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosPn"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosPp"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosTnPn"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosTnPp"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosTpPn"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosTpPp"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosRp"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["buttonCameraHackSphericalFocusPosRn"] as Button,
                cameraHackSphericalFocusPosGroupBox.Controls["textBoxCameraHackSphericalFocusPosTP"] as TextBox,
                cameraHackSphericalFocusPosGroupBox.Controls["textBoxCameraHackSphericalFocusPosR"] as TextBox,
                null /* checkbox */,
                (float hOffset, float vOffset, float nOffset, bool _) =>
            {
                ButtonUtilities.TranslateCameraHackFocusSpherically(
                    CurrentCamHackMode,
                    nOffset,
                    hOffset,
                    -1 * vOffset);
            });

            var cameraHackBothPosGroupBox = splitContainer.Panel1.Controls["groupBoxCameraHackBothPos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                cameraHackBothPosGroupBox,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosXn"] as Button,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosXp"] as Button,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosZn"] as Button,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosZp"] as Button,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosXnZn"] as Button,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosXnZp"] as Button,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosXpZn"] as Button,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosXpZp"] as Button,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosYp"] as Button,
                cameraHackBothPosGroupBox.Controls["buttonCameraHackBothPosYn"] as Button,
                cameraHackBothPosGroupBox.Controls["textBoxCameraHackBothPosXZ"] as TextBox,
                cameraHackBothPosGroupBox.Controls["textBoxCameraHackBothPosY"] as TextBox,
                cameraHackBothPosGroupBox.Controls["checkBoxCameraHackBothPosRelative"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslateCameraHackBoth(
                    CurrentCamHackMode,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });
        }
Esempio n. 15
0
        public override void InitializeTab()
        {
            base.InitializeTab();
            CurrentCamHackMode = CamHackMode.REGULAR;

            ControlUtilities.AddContextMenuStripFunctions(
                labelCamHackMode,
                new List <string>()
            {
                "Download Camera Hack ROM"
            },
                new List <Action>()
            {
                () => System.Diagnostics.Process.Start("http://download1436.mediafire.com/t3unklq170ag/hdd377v5794u319/Camera+Hack+ROM.z64"),
            });


            radioButtonCamHackMode0.Click += (sender, e) => Config.Stream.SetValue(0, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);
            radioButtonCamHackMode1RelativeAngle.Click += (sender, e) =>
            {
                Config.Stream.SetValue(1, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);
                Config.Stream.SetValue((ushort)0, CamHackConfig.StructAddress + CamHackConfig.AbsoluteAngleOffset);
            };
            radioButtonCamHackMode1AbsoluteAngle.Click += (sender, e) =>
            {
                Config.Stream.SetValue(1, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);
                Config.Stream.SetValue((ushort)1, CamHackConfig.StructAddress + CamHackConfig.AbsoluteAngleOffset);
            };
            radioButtonCamHackMode2.Click += (sender, e) => Config.Stream.SetValue(2, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);
            radioButtonCamHackMode3.Click += (sender, e) => Config.Stream.SetValue(3, CamHackConfig.StructAddress + CamHackConfig.CameraModeOffset);

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                groupBoxCameraHackPos,
                buttonCameraHackPosXn,
                buttonCameraHackPosXp,
                buttonCameraHackPosZn,
                buttonCameraHackPosZp,
                buttonCameraHackPosXnZn,
                buttonCameraHackPosXnZp,
                buttonCameraHackPosXpZn,
                buttonCameraHackPosXpZp,
                buttonCameraHackPosYp,
                buttonCameraHackPosYn,
                textBoxCameraHackPosXZ,
                textBoxCameraHackPosY,
                checkBoxCameraHackPosRelative,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslateCameraHack(
                    CurrentCamHackMode,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Spherical,
                false,
                groupBoxCameraHackSphericalPos,
                buttonCameraHackSphericalPosTn,
                buttonCameraHackSphericalPosTp,
                buttonCameraHackSphericalPosPn,
                buttonCameraHackSphericalPosPp,
                buttonCameraHackSphericalPosTnPn,
                buttonCameraHackSphericalPosTnPp,
                buttonCameraHackSphericalPosTpPn,
                buttonCameraHackSphericalPosTpPp,
                buttonCameraHackSphericalPosRn,
                buttonCameraHackSphericalPosRp,
                textBoxCameraHackSphericalPosTP,
                textBoxCameraHackSphericalPosR,
                null /* checkbox */,
                (float hOffset, float vOffset, float nOffset, bool _) =>
            {
                ButtonUtilities.TranslateCameraHackSpherically(
                    CurrentCamHackMode,
                    -1 * nOffset,
                    hOffset,
                    vOffset);
            });

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                groupBoxCameraHackFocusPos,
                buttonCameraHackFocusPosXn,
                buttonCameraHackFocusPosXp,
                buttonCameraHackFocusPosZn,
                buttonCameraHackFocusPosZp,
                buttonCameraHackFocusPosXnZn,
                buttonCameraHackFocusPosXnZp,
                buttonCameraHackFocusPosXpZn,
                buttonCameraHackFocusPosXpZp,
                buttonCameraHackFocusPosYp,
                buttonCameraHackFocusPosYn,
                textBoxCameraHackFocusPosXZ,
                textBoxCameraHackFocusPosY,
                checkBoxCameraHackFocusPosRelative,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslateCameraHackFocus(
                    CurrentCamHackMode,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Spherical,
                false,
                groupBoxCameraHackSphericalFocusPos,
                buttonCameraHackSphericalFocusPosTn,
                buttonCameraHackSphericalFocusPosTp,
                buttonCameraHackSphericalFocusPosPp,
                buttonCameraHackSphericalFocusPosPn,
                buttonCameraHackSphericalFocusPosTnPp,
                buttonCameraHackSphericalFocusPosTnPn,
                buttonCameraHackSphericalFocusPosTpPp,
                buttonCameraHackSphericalFocusPosTpPn,
                buttonCameraHackSphericalFocusPosRp,
                buttonCameraHackSphericalFocusPosRn,
                textBoxCameraHackSphericalFocusPosTP,
                textBoxCameraHackSphericalFocusPosR,
                null /* checkbox */,
                (float hOffset, float vOffset, float nOffset, bool _) =>
            {
                ButtonUtilities.TranslateCameraHackFocusSpherically(
                    CurrentCamHackMode,
                    nOffset,
                    hOffset,
                    vOffset);
            });

            var cameraHackBothPosGroupBox = splitContainerCamHack.Panel1.Controls["groupBoxCameraHackBothPos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                cameraHackBothPosGroupBox,
                buttonCameraHackBothPosXn,
                buttonCameraHackBothPosXp,
                buttonCameraHackBothPosZn,
                buttonCameraHackBothPosZp,
                buttonCameraHackBothPosXnZn,
                buttonCameraHackBothPosXnZp,
                buttonCameraHackBothPosXpZn,
                buttonCameraHackBothPosXpZp,
                buttonCameraHackBothPosYp,
                buttonCameraHackBothPosYn,
                textBoxCameraHackBothPosXZ,
                textBoxCameraHackBothPosY,
                checkBoxCameraHackBothPosRelative,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslateCameraHackBoth(
                    CurrentCamHackMode,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });
        }
Esempio n. 16
0
        public TasManager(string varFilePath, TabPage tabControl, WatchVariableFlowLayoutPanel watchVariablePanel)
            : base(varFilePath, watchVariablePanel, ALL_VAR_GROUPS, VISIBLE_VAR_GROUPS)
        {
            SplitContainer splitContainerTas = tabControl.Controls["splitContainerTas"] as SplitContainer;

            Button buttonTasStorePosition = splitContainerTas.Panel1.Controls["buttonTasStorePosition"] as Button;

            buttonTasStorePosition.Click += (sender, e) => StoreInfo(x: true, y: true, z: true);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTasStorePosition,
                new List <string>()
            {
                "Store Position",
                "Store Lateral Position",
                "Store X",
                "Store Y",
                "Store Z",
                "Go to Closest Floor Vertex",
                "Go to Closest Floor Vertex Misalignment",
            },
                new List <Action>()
            {
                () => StoreInfo(x: true, y: true, z: true),
                () => StoreInfo(x: true, z: true),
                () => StoreInfo(x: true),
                () => StoreInfo(y: true),
                () => StoreInfo(z: true),
                () => ButtonUtilities.GotoTriangleVertexClosest(Config.Stream.GetUInt32(MarioConfig.StructAddress + MarioConfig.FloorTriangleOffset), false),
                () => ButtonUtilities.GotoTriangleVertexClosest(Config.Stream.GetUInt32(MarioConfig.StructAddress + MarioConfig.FloorTriangleOffset), true),
            });

            Button buttonTasStoreAngle = splitContainerTas.Panel1.Controls["buttonTasStoreAngle"] as Button;

            buttonTasStoreAngle.Click += (sender, e) => StoreInfo(angle: true);

            Button buttonTasTakePosition = splitContainerTas.Panel1.Controls["buttonTasTakePosition"] as Button;

            buttonTasTakePosition.Click += (sender, e) => TakeInfo(x: true, y: true, z: true);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTasTakePosition,
                new List <string>()
            {
                "Take Position",
                "Take Lateral Position",
                "Take X",
                "Take Y",
                "Take Z"
            },
                new List <Action>()
            {
                () => TakeInfo(x: true, y: true, z: true),
                () => TakeInfo(x: true, z: true),
                () => TakeInfo(x: true),
                () => TakeInfo(y: true),
                () => TakeInfo(z: true),
            });

            Button buttonTasTakeMarioAngle = splitContainerTas.Panel1.Controls["buttonTasTakeAngle"] as Button;

            buttonTasTakeMarioAngle.Click += (sender, e) => TakeInfo(angle: true);

            Button buttonTasPasteSchedule = splitContainerTas.Panel1.Controls["buttonTasPasteSchedule"] as Button;

            buttonTasPasteSchedule.Click += (sender, e) => SetScheduler(Clipboard.GetText(), false);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTasPasteSchedule,
                new List <string>()
            {
                "Paste Schedule as Floats"
            },
                new List <Action>()
            {
                () => SetScheduler(Clipboard.GetText(), true)
            });
        }
Esempio n. 17
0
        public MarioManager(List <WatchVariableControlPrecursor> variables, Control marioControl, WatchVariablePanel variableTable)
            : base(variables, variableTable, ALL_VAR_GROUPS, VISIBLE_VAR_GROUPS)
        {
            SplitContainer splitContainerMario = marioControl.Controls["splitContainerMario"] as SplitContainer;

            Button toggleHandsfree = splitContainerMario.Panel1.Controls["buttonMarioToggleHandsfree"] as Button;

            toggleHandsfree.Click += (sender, e) => ButtonUtilities.ToggleHandsfree();

            Button toggleVisibility = splitContainerMario.Panel1.Controls["buttonMarioVisibility"] as Button;

            toggleVisibility.Click += (sender, e) => ButtonUtilities.ToggleVisibility();

            var marioPosGroupBox = splitContainerMario.Panel1.Controls["groupBoxMarioPos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                marioPosGroupBox,
                marioPosGroupBox.Controls["buttonMarioPosXn"] as Button,
                marioPosGroupBox.Controls["buttonMarioPosXp"] as Button,
                marioPosGroupBox.Controls["buttonMarioPosZn"] as Button,
                marioPosGroupBox.Controls["buttonMarioPosZp"] as Button,
                marioPosGroupBox.Controls["buttonMarioPosXnZn"] as Button,
                marioPosGroupBox.Controls["buttonMarioPosXnZp"] as Button,
                marioPosGroupBox.Controls["buttonMarioPosXpZn"] as Button,
                marioPosGroupBox.Controls["buttonMarioPosXpZp"] as Button,
                marioPosGroupBox.Controls["buttonMarioPosYp"] as Button,
                marioPosGroupBox.Controls["buttonMarioPosYn"] as Button,
                marioPosGroupBox.Controls["textBoxMarioPosXZ"] as TextBox,
                marioPosGroupBox.Controls["textBoxMarioPosY"] as TextBox,
                marioPosGroupBox.Controls["checkBoxMarioPosRelative"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslateMario(
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });

            var marioStatsGroupBox = splitContainerMario.Panel1.Controls["groupBoxMarioStats"] as GroupBox;

            ControlUtilities.InitializeScalarController(
                marioStatsGroupBox.Controls["buttonMarioStatsYawN"] as Button,
                marioStatsGroupBox.Controls["buttonMarioStatsYawP"] as Button,
                marioStatsGroupBox.Controls["textBoxMarioStatsYaw"] as TextBox,
                (float value) =>
            {
                ButtonUtilities.MarioChangeYaw((int)Math.Round(value));
            });
            ControlUtilities.InitializeScalarController(
                marioStatsGroupBox.Controls["buttonMarioStatsHspdN"] as Button,
                marioStatsGroupBox.Controls["buttonMarioStatsHspdP"] as Button,
                marioStatsGroupBox.Controls["textBoxMarioStatsHspd"] as TextBox,
                (float value) =>
            {
                ButtonUtilities.MarioChangeHspd(value);
            });
            ControlUtilities.InitializeScalarController(
                marioStatsGroupBox.Controls["buttonMarioStatsVspdN"] as Button,
                marioStatsGroupBox.Controls["buttonMarioStatsVspdP"] as Button,
                marioStatsGroupBox.Controls["textBoxMarioStatsVspd"] as TextBox,
                (float value) =>
            {
                ButtonUtilities.MarioChangeVspd(value);
            });

            var marioSlidingSpeedGroupBox = splitContainerMario.Panel1.Controls["groupBoxMarioSlidingSpeed"] as GroupBox;

            ControlUtilities.InitializeScalarController(
                marioSlidingSpeedGroupBox.Controls["buttonMarioSlidingSpeedXn"] as Button,
                marioSlidingSpeedGroupBox.Controls["buttonMarioSlidingSpeedXp"] as Button,
                marioSlidingSpeedGroupBox.Controls["textBoxMarioSlidingSpeedX"] as TextBox,
                (float value) =>
            {
                ButtonUtilities.MarioChangeSlidingSpeedX(value);
            });
            ControlUtilities.InitializeScalarController(
                marioSlidingSpeedGroupBox.Controls["buttonMarioSlidingSpeedZn"] as Button,
                marioSlidingSpeedGroupBox.Controls["buttonMarioSlidingSpeedZp"] as Button,
                marioSlidingSpeedGroupBox.Controls["textBoxMarioSlidingSpeedZ"] as TextBox,
                (float value) =>
            {
                ButtonUtilities.MarioChangeSlidingSpeedZ(value);
            });
            ControlUtilities.InitializeScalarController(
                marioSlidingSpeedGroupBox.Controls["buttonMarioSlidingSpeedHn"] as Button,
                marioSlidingSpeedGroupBox.Controls["buttonMarioSlidingSpeedHp"] as Button,
                marioSlidingSpeedGroupBox.Controls["textBoxMarioSlidingSpeedH"] as TextBox,
                (float value) =>
            {
                ButtonUtilities.MarioChangeSlidingSpeedH(value);
            });
            ControlUtilities.InitializeScalarController(
                marioSlidingSpeedGroupBox.Controls["buttonMarioSlidingSpeedYawN"] as Button,
                marioSlidingSpeedGroupBox.Controls["buttonMarioSlidingSpeedYawP"] as Button,
                marioSlidingSpeedGroupBox.Controls["textBoxMarioSlidingSpeedYaw"] as TextBox,
                (float value) =>
            {
                ButtonUtilities.MarioChangeSlidingSpeedYaw(value);
            });

            Button buttonMarioHOLPGoto = splitContainerMario.Panel1.Controls["buttonMarioHOLPGoto"] as Button;

            buttonMarioHOLPGoto.Click += (sender, e) => ButtonUtilities.GotoHOLP();
            ControlUtilities.AddContextMenuStripFunctions(
                buttonMarioHOLPGoto,
                new List <string>()
            {
                "Goto HOLP", "Goto HOLP Laterally", "Goto HOLP X", "Goto HOLP Y", "Goto HOLP Z"
            },
                new List <Action>()
            {
                () => ButtonUtilities.GotoHOLP((true, true, true)),
                () => ButtonUtilities.GotoHOLP((true, false, true)),
                () => ButtonUtilities.GotoHOLP((true, false, false)),
                () => ButtonUtilities.GotoHOLP((false, true, false)),
                () => ButtonUtilities.GotoHOLP((false, false, true)),
            });
Esempio n. 18
0
        public CustomManager(string varFilePath, Control customControl, WatchVariableFlowLayoutPanel variableTable)
            : base(varFilePath, variableTable)
        {
            SplitContainer splitContainerCustom         = customControl.Controls["splitContainerCustom"] as SplitContainer;
            SplitContainer splitContainerCustomControls = splitContainerCustom.Panel1.Controls["splitContainerCustomControls"] as SplitContainer;

            // Panel 1 controls

            Button buttonOpenVars = splitContainerCustomControls.Panel1.Controls["buttonOpenVars"] as Button;

            buttonOpenVars.Click += (sender, e) => _variablePanel.OpenVariables();
            ControlUtilities.AddContextMenuStripFunctions(
                buttonOpenVars,
                new List <string>()
            {
                "Open Mario State Data",
            },
                new List <Action>()
            {
                () => _variablePanel.OpenVariables(@"Config/MarioStateData.xml"),
            });

            Button buttonSaveVars = splitContainerCustomControls.Panel1.Controls["buttonSaveVars"] as Button;

            buttonSaveVars.Click += (sender, e) => _variablePanel.SaveVariables();
            ControlUtilities.AddContextMenuStripFunctions(
                buttonSaveVars,
                new List <string>()
            {
                "Save Pop Outs"
            },
                new List <Action>()
            {
                () => FormManager.SavePopOuts()
            });

            Button buttonCopyVars = splitContainerCustomControls.Panel1.Controls["buttonCopyVars"] as Button;

            buttonCopyVars.Click           += (sender, e) => CopyUtilities.Copy(_variablePanel.GetCurrentVariableControls(), _copyType);
            buttonCopyVars.ContextMenuStrip = new ContextMenuStrip();
            CopyUtilities.AddContextMenuStripFunctions(
                buttonCopyVars, _variablePanel.GetCurrentVariableControls);
            buttonCopyVars.ContextMenuStrip.Items.Add(new ToolStripSeparator());
            ToolStripMenuItem itemSetDefaultCopyType = new ToolStripMenuItem("Set Default Copy Type");

            buttonCopyVars.ContextMenuStrip.Items.Add(itemSetDefaultCopyType);
            ControlUtilities.AddCheckableDropDownItems(
                itemSetDefaultCopyType,
                CopyUtilities.GetCopyNames(),
                EnumUtilities.GetEnumValues <CopyTypeEnum>(typeof(CopyTypeEnum)),
                copyType => _copyType = copyType,
                _copyType);

            Button buttonPasteVars = splitContainerCustomControls.Panel1.Controls["buttonPasteVars"] as Button;

            buttonPasteVars.Click += (sender, e) => PasteUtilities.Paste(_variablePanel.GetCurrentVariableControls());

            Button buttonClearVars = splitContainerCustomControls.Panel1.Controls["buttonClearVars"] as Button;

            buttonClearVars.Click += (sender, e) => _variablePanel.ClearVariables();
            ControlUtilities.AddContextMenuStripFunctions(
                buttonClearVars,
                new List <string>()
            {
                "Clear All Vars", "Clear Default Vars"
            },
                new List <Action>()
            {
                () => _variablePanel.ClearVariables(),
                () => _variablePanel.RemoveVariableGroup(VariableGroup.NoGroup),
            });

            _checkBoxCustomRecordValues        = splitContainerCustomControls.Panel1.Controls["checkBoxCustomRecordValues"] as CheckBox;
            _checkBoxCustomRecordValues.Click += (sender, e) => ToggleRecording();

            _labelRecordValuesCount = splitContainerCustomControls.Panel1.Controls["labelRecordValuesCount"] as Label;

            _buttonCustomShowValues        = splitContainerCustomControls.Panel1.Controls["buttonCustomShowValues"] as Button;
            _buttonCustomShowValues.Click += (sender, e) => ShowRecordedValues();

            _buttonCustomClearValues        = splitContainerCustomControls.Panel1.Controls["buttonCustomClearValues"] as Button;
            _buttonCustomClearValues.Click += (sender, e) => ClearRecordedValues();

            _checkBoxUseValueAtStartOfGlobalTimer = splitContainerCustomControls.Panel1.Controls["checkBoxUseValueAtStartOfGlobalTimer"] as CheckBox;

            _labelCustomRecordingFrequencyValue = splitContainerCustomControls.Panel1.Controls["labelCustomRecordingFrequencyValue"] as Label;

            _labelCustomRecordingGapsValue = splitContainerCustomControls.Panel1.Controls["labelCustomRecordingGapsValue"] as Label;

            _recordedValues = new Dictionary <int, List <object> >();
            _lastTimer      = null;
            _numGaps        = 0;
            _recordFreq     = 1;

            // Panel 2 controls

            Button buttonResetVariableSizeToDefault = splitContainerCustomControls.Panel2.Controls["buttonResetVariableSizeToDefault"] as Button;

            buttonResetVariableSizeToDefault.Click += (sender, e) =>
            {
                WatchVariableControl.VariableNameWidth  = WatchVariableControl.DEFAULT_VARIABLE_NAME_WIDTH;
                WatchVariableControl.VariableValueWidth = WatchVariableControl.DEFAULT_VARIABLE_VALUE_WIDTH;
                WatchVariableControl.VariableHeight     = WatchVariableControl.DEFAULT_VARIABLE_HEIGHT;
                WatchVariableControl.VariableTextSize   = WatchVariableControl.DEFAULT_VARIABLE_TEXT_SIZE;
                WatchVariableControl.VariableOffset     = WatchVariableControl.DEFAULT_VARIABLE_OFFSET;
            };

            GroupBox groupBoxVarNameWidth = splitContainerCustomControls.Panel2.Controls["groupBoxVarNameWidth"] as GroupBox;

            InitializeAddSubtractGetSetFuncionality(
                groupBoxVarNameWidth.Controls["buttonVarNameWidthSubtract"] as Button,
                groupBoxVarNameWidth.Controls["buttonVarNameWidthAdd"] as Button,
                groupBoxVarNameWidth.Controls["buttonVarNameWidthGet"] as Button,
                groupBoxVarNameWidth.Controls["buttonVarNameWidthSet"] as Button,
                groupBoxVarNameWidth.Controls["betterTextboxVarNameWidthAddSubtract"] as TextBox,
                groupBoxVarNameWidth.Controls["betterTextboxVarNameWidthGetSet"] as TextBox,
                (int value) => { WatchVariableControl.VariableNameWidth = value; },
                () => WatchVariableControl.VariableNameWidth);

            GroupBox groupBoxVarValueWidth = splitContainerCustomControls.Panel2.Controls["groupBoxVarValueWidth"] as GroupBox;

            InitializeAddSubtractGetSetFuncionality(
                groupBoxVarValueWidth.Controls["buttonVarValueWidthSubtract"] as Button,
                groupBoxVarValueWidth.Controls["buttonVarValueWidthAdd"] as Button,
                groupBoxVarValueWidth.Controls["buttonVarValueWidthGet"] as Button,
                groupBoxVarValueWidth.Controls["buttonVarValueWidthSet"] as Button,
                groupBoxVarValueWidth.Controls["betterTextboxVarValueWidthAddSubtract"] as TextBox,
                groupBoxVarValueWidth.Controls["betterTextboxVarValueWidthGetSet"] as TextBox,
                (int value) => { WatchVariableControl.VariableValueWidth = value; },
                () => WatchVariableControl.VariableValueWidth);

            GroupBox groupBoxVarHeight = splitContainerCustomControls.Panel2.Controls["groupBoxVarHeight"] as GroupBox;

            InitializeAddSubtractGetSetFuncionality(
                groupBoxVarHeight.Controls["buttonVarHeightSubtract"] as Button,
                groupBoxVarHeight.Controls["buttonVarHeightAdd"] as Button,
                groupBoxVarHeight.Controls["buttonVarHeightGet"] as Button,
                groupBoxVarHeight.Controls["buttonVarHeightSet"] as Button,
                groupBoxVarHeight.Controls["betterTextboxVarHeightAddSubtract"] as TextBox,
                groupBoxVarHeight.Controls["betterTextboxVarHeightGetSet"] as TextBox,
                (int value) => { WatchVariableControl.VariableHeight = value; },
                () => WatchVariableControl.VariableHeight);

            GroupBox groupBoxVarTextSize = splitContainerCustomControls.Panel2.Controls["groupBoxVarTextSize"] as GroupBox;

            InitializeAddSubtractGetSetFuncionality(
                groupBoxVarTextSize.Controls["buttonVarTextSizeSubtract"] as Button,
                groupBoxVarTextSize.Controls["buttonVarTextSizeAdd"] as Button,
                groupBoxVarTextSize.Controls["buttonVarTextSizeGet"] as Button,
                groupBoxVarTextSize.Controls["buttonVarTextSizeSet"] as Button,
                groupBoxVarTextSize.Controls["betterTextboxVarTextSizeAddSubtract"] as TextBox,
                groupBoxVarTextSize.Controls["betterTextboxVarTextSizeGetSet"] as TextBox,
                (int value) => { WatchVariableControl.VariableTextSize = value; },
                () => WatchVariableControl.VariableTextSize);

            GroupBox groupBoxVarOffset = splitContainerCustomControls.Panel2.Controls["groupBoxVarOffset"] as GroupBox;

            InitializeAddSubtractGetSetFuncionality(
                groupBoxVarOffset.Controls["buttonVarOffsetSubtract"] as Button,
                groupBoxVarOffset.Controls["buttonVarOffsetAdd"] as Button,
                groupBoxVarOffset.Controls["buttonVarOffsetGet"] as Button,
                groupBoxVarOffset.Controls["buttonVarOffsetSet"] as Button,
                groupBoxVarOffset.Controls["betterTextboxVarOffsetAddSubtract"] as TextBox,
                groupBoxVarOffset.Controls["betterTextboxVarOffsetGetSet"] as TextBox,
                (int value) => { WatchVariableControl.VariableOffset = value; },
                () => WatchVariableControl.VariableOffset);
        }
Esempio n. 19
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),
            });
        }
Esempio n. 20
0
        public override void InitializeTab()
        {
            base.InitializeTab();

            buttonVarHackAddNewVariable.Click +=
                (sender, e) => varHackPanel.AddNewControl();

            ControlUtilities.AddContextMenuStripFunctions(
                buttonVarHackAddNewVariable,
                new List <string>()
            {
                "RNG Index",
                "Floor YNorm",
                "Defacto Speed",
                "Sliding Speed",
                "Mario Action",
                "Mario Animation",
                "DYaw Intended - Facing",
                "DYaw Intended - Facing (HAU)",
            },
                new List <Action>()
            {
                () => AddVariable("RngIndex"),
                () => AddVariable("FloorYNorm"),
                () => AddVariable("DefactoSpeed"),
                () => AddVariable("SlidingSpeed"),
                () => AddVariable("MarioAction"),
                () => AddVariable("MarioAnimation"),
                () => AddVariable("DYawIntendFacing"),
                () => AddVariable("DYawIntendFacingHau"),
            });

            buttonVarHackOpenVars.Click +=
                (sender, e) => varHackPanel.OpenVariables();

            buttonVarHackSaveVars.Click +=
                (sender, e) => varHackPanel.SaveVariables();

            buttonVarHackClearVars.Click +=
                (sender, e) => varHackPanel.ClearVariables();

            buttonVarHackShowVariableBytesInLittleEndian.Click +=
                (sender, e) => varHackPanel.ShowVariableBytesInLittleEndian();

            buttonVarHackShowVariableBytesInBigEndian.Click +=
                (sender, e) => varHackPanel.ShowVariableBytesInBigEndian();


            buttonVarHackApplyVariablesToMemory.Click +=
                (sender, e) => varHackPanel.ApplyVariablesToMemory();

            buttonVarHackClearVariablesInMemory.Click +=
                (sender, e) => varHackPanel.ClearVariablesInMemory();

            buttonEnableDisableRomHack.Click += (sender, e) => VarHackConfig.ShowVarRomHack.LoadPayload();

            ControlUtilities.AddContextMenuStripFunctions(
                buttonEnableDisableRomHack,
                new List <string>()
            {
                "1f Delay Hack (Standard)", "0f Delay Hack (Experimental)"
            },
                new List <Action>()
            {
                () => VarHackConfig.ShowVarRomHack.LoadPayload(),
                () => VarHackConfig.ShowVarRomHack2.LoadPayload(),
            });

            // Middle buttons

            textBoxXPosValue.AddEnterAction(() => SetPositionsAndApplyVariablesToMemory());
            textBoxXPosValue.Text = VarHackConfig.DefaultXPos.ToString();
            InitializePositionControls(
                textBoxXPosValue,
                textBoxXPosChange,
                buttonXPosSubtract,
                buttonXPosAdd
                );

            textBoxYPosValue.AddEnterAction(() => SetPositionsAndApplyVariablesToMemory());
            textBoxYPosValue.Text = VarHackConfig.DefaultYPos.ToString();
            InitializePositionControls(
                textBoxYPosValue,
                textBoxYPosChange,
                buttonYPosSubtract,
                buttonYPosAdd
                );

            textBoxYDeltaValue.AddEnterAction(() => SetPositionsAndApplyVariablesToMemory());
            textBoxYDeltaValue.Text = VarHackConfig.DefaultYDelta.ToString();
            InitializePositionControls(
                textBoxYDeltaValue,
                textBoxYDeltaChange,
                buttonYDeltaSubtract,
                buttonYDeltaAdd
                );

            buttonSetPositionsAndApplyVariablesToMemory.Click +=
                (sender, e) => SetPositionsAndApplyVariablesToMemory();
        }
Esempio n. 21
0
        public override void InitializeTab()
        {
            base.InitializeTab();
            // Mario Image
            pictureBoxMario.Image      = Config.ObjectAssociations.MarioImage.Value;
            panelMarioBorder.BackColor = Config.ObjectAssociations.MarioColor;
            pictureBoxMario.BackColor  = Config.ObjectAssociations.MarioColor.Lighten(0.5);

            watchVariablePanelMario.SetGroups(ALL_VAR_GROUPS, VISIBLE_VAR_GROUPS);

            buttonMarioToggleHandsfree.Click += (sender, e) => ButtonUtilities.ToggleHandsfree();

            buttonMarioVisibility.Click += (sender, e) => ButtonUtilities.ToggleVisibility();

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                groupBoxMarioPos,
                "MarioPos",
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.TranslateMario(
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });

            ControlUtilities.InitializeScalarController(
                buttonMarioStatsYawN,
                buttonMarioStatsYawP,
                textBoxMarioStatsYaw,
                (float value) =>
            {
                ButtonUtilities.MarioChangeYaw((int)Math.Round(value));
            });
            ControlUtilities.InitializeScalarController(
                buttonMarioStatsHspdN,
                buttonMarioStatsHspdP,
                textBoxMarioStatsHspd,
                (float value) =>
            {
                ButtonUtilities.MarioChangeHspd(value);
            });
            ControlUtilities.InitializeScalarController(
                buttonMarioStatsVspdN,
                buttonMarioStatsVspdP,
                textBoxMarioStatsVspd,
                (float value) =>
            {
                ButtonUtilities.MarioChangeVspd(value);
            });

            var marioSlidingSpeedGroupBox = splitContainerMario.Panel1.Controls["groupBoxMarioSlidingSpeed"] as GroupBox;

            ControlUtilities.InitializeScalarController(
                buttonMarioSlidingSpeedXn,
                buttonMarioSlidingSpeedXp,
                textBoxMarioSlidingSpeedX,
                (float value) =>
            {
                ButtonUtilities.MarioChangeSlidingSpeedX(value);
            });
            ControlUtilities.InitializeScalarController(
                buttonMarioSlidingSpeedZn,
                buttonMarioSlidingSpeedZp,
                textBoxMarioSlidingSpeedZ,
                (float value) =>
            {
                ButtonUtilities.MarioChangeSlidingSpeedZ(value);
            });
            ControlUtilities.InitializeScalarController(
                buttonMarioSlidingSpeedHn,
                buttonMarioSlidingSpeedHp,
                textBoxMarioSlidingSpeedH,
                (float value) =>
            {
                ButtonUtilities.MarioChangeSlidingSpeedH(value);
            });
            ControlUtilities.InitializeScalarController(
                buttonMarioSlidingSpeedYawN,
                buttonMarioSlidingSpeedYawP,
                textBoxMarioSlidingSpeedYaw,
                (float value) =>
            {
                ButtonUtilities.MarioChangeSlidingSpeedYaw(value);
            });

            buttonMarioHOLPGoto.Click += (sender, e) => ButtonUtilities.GotoHOLP();
            ControlUtilities.AddContextMenuStripFunctions(
                buttonMarioHOLPGoto,
                new List <string>()
            {
                "Goto HOLP", "Goto HOLP Laterally", "Goto HOLP X", "Goto HOLP Y", "Goto HOLP Z"
            },
                new List <Action>()
            {
                () => ButtonUtilities.GotoHOLP((true, true, true)),
                () => ButtonUtilities.GotoHOLP((true, false, true)),
                () => ButtonUtilities.GotoHOLP((true, false, false)),
                () => ButtonUtilities.GotoHOLP((false, true, false)),
                () => ButtonUtilities.GotoHOLP((false, false, true)),
            });
Esempio n. 22
0
        public VarHackManager(Control varHackControlControl, VarHackPanel varHackPanel)
        {
            _varHackPanel = varHackPanel;

            // Top buttons

            SplitContainer splitContainerVarHack =
                varHackControlControl.Controls["splitContainerVarHack"] as SplitContainer;

            Button buttonVarHackAddNewVariable =
                splitContainerVarHack.Panel1.Controls["buttonVarHackAddNewVariable"] as Button;

            buttonVarHackAddNewVariable.Click +=
                (sender, e) => _varHackPanel.AddNewControl();

            ControlUtilities.AddContextMenuStripFunctions(
                buttonVarHackAddNewVariable,
                new List <string>()
            {
                "RNG Index",
                "Floor YNorm",
                "Defacto Speed",
                "Mario Action",
                "Mario Animation",
            },
                new List <Action>()
            {
                () => AddVariable(() => "Index " + RngIndexer.GetRngIndex()),
                () => AddVariable(() =>
                {
                    uint triFloorAddress = Config.Stream.GetUInt32(MarioConfig.StructAddress + MarioConfig.FloorTriangleOffset);
                    float yNorm          = Config.Stream.GetSingle(triFloorAddress + TriangleOffsetsConfig.NormY);
                    return("YNorm " + FormatDouble(yNorm, 4, true));
                }),
                () => AddVariable(() => "Defacto " + FormatInteger(WatchVariableSpecialUtilities.GetMarioDeFactoSpeed())),
                () => AddVariable(() => "Action " + TableConfig.MarioActions.GetActionName()),
                () => AddVariable(() => "Animation " + TableConfig.MarioAnimations.GetAnimationName()),
            });

            Button buttonVarHackClearVariables =
                splitContainerVarHack.Panel1.Controls["buttonVarHackClearVariables"] as Button;

            buttonVarHackClearVariables.Click +=
                (sender, e) => _varHackPanel.ClearControls();

            Button buttonVarHackShowVariableBytesInLittleEndian =
                splitContainerVarHack.Panel1.Controls["buttonVarHackShowVariableBytesInLittleEndian"] as Button;

            buttonVarHackShowVariableBytesInLittleEndian.Click +=
                (sender, e) => _varHackPanel.ShowVariableBytesInLittleEndian();

            Button buttonVarHackShowVariableBytesInBigEndian =
                splitContainerVarHack.Panel1.Controls["buttonVarHackShowVariableBytesInBigEndian"] as Button;

            buttonVarHackShowVariableBytesInBigEndian.Click +=
                (sender, e) => _varHackPanel.ShowVariableBytesInBigEndian();

            // Bottom buttons

            Button buttonVarHackApplyVariablesToMemory =
                splitContainerVarHack.Panel1.Controls["buttonVarHackApplyVariablesToMemory"] as Button;

            buttonVarHackApplyVariablesToMemory.Click +=
                (sender, e) => _varHackPanel.ApplyVariablesToMemory();

            Button buttonVarHackClearVariablesInMemory =
                splitContainerVarHack.Panel1.Controls["buttonVarHackClearVariablesInMemory"] as Button;

            buttonVarHackClearVariablesInMemory.Click +=
                (sender, e) => _varHackPanel.ClearVariablesInMemory();

            _buttonEnableDisableRomHack =
                splitContainerVarHack.Panel1.Controls["buttonEnableDisableRomHack"] as BinaryButton;
            _buttonEnableDisableRomHack.Initialize(
                "Enable ROM Hack",
                "Disable ROM Hack",
                () => VarHackConfig.ShowVarRomHack.LoadPayload(),
                () => VarHackConfig.ShowVarRomHack.ClearPayload(),
                () => VarHackConfig.ShowVarRomHack.Enabled);

            // Middle buttons

            _textBoxXPosValue = splitContainerVarHack.Panel1.Controls["textBoxXPosValue"] as BetterTextbox;
            _textBoxXPosValue.AddEnterAction(() => SetPositionsAndApplyVariablesToMemory());
            _textBoxXPosValue.Text = VarHackConfig.DefaultXPos.ToString();
            InitializePositionControls(
                _textBoxXPosValue,
                splitContainerVarHack.Panel1.Controls["textBoxXPosChange"] as TextBox,
                splitContainerVarHack.Panel1.Controls["buttonXPosSubtract"] as Button,
                splitContainerVarHack.Panel1.Controls["buttonXPosAdd"] as Button);

            _textBoxYPosValue = splitContainerVarHack.Panel1.Controls["textBoxYPosValue"] as BetterTextbox;
            _textBoxYPosValue.AddEnterAction(() => SetPositionsAndApplyVariablesToMemory());
            _textBoxYPosValue.Text = VarHackConfig.DefaultYPos.ToString();
            InitializePositionControls(
                _textBoxYPosValue,
                splitContainerVarHack.Panel1.Controls["textBoxYPosChange"] as TextBox,
                splitContainerVarHack.Panel1.Controls["buttonYPosSubtract"] as Button,
                splitContainerVarHack.Panel1.Controls["buttonYPosAdd"] as Button);

            _textBoxYDeltaValue = splitContainerVarHack.Panel1.Controls["textBoxYDeltaValue"] as BetterTextbox;
            _textBoxYDeltaValue.AddEnterAction(() => SetPositionsAndApplyVariablesToMemory());
            _textBoxYDeltaValue.Text = VarHackConfig.DefaultYDelta.ToString();
            InitializePositionControls(
                _textBoxYDeltaValue,
                splitContainerVarHack.Panel1.Controls["textBoxYDeltaChange"] as TextBox,
                splitContainerVarHack.Panel1.Controls["buttonYDeltaSubtract"] as Button,
                splitContainerVarHack.Panel1.Controls["buttonYDeltaAdd"] as Button);

            Button buttonSetPositionsAndApplyVariablesToMemory =
                splitContainerVarHack.Panel1.Controls["buttonSetPositionsAndApplyVariablesToMemory"] as Button;

            buttonSetPositionsAndApplyVariablesToMemory.Click +=
                (sender, e) => SetPositionsAndApplyVariablesToMemory();
        }
Esempio n. 23
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),
            });
        }
Esempio n. 24
0
        public TriangleManager(Control tabControl, string varFilePath, WatchVariableFlowLayoutPanel watchVariablePanel)
            : base(varFilePath, watchVariablePanel, ALL_VAR_GROUPS, VISIBLE_VAR_GROUPS)
        {
            _recordedTriangleAddresses = new List <uint>();

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

            _addressBox = splitContainerTriangles.Panel1.Controls["textBoxCustomTriangle"] as BetterTextbox;
            _useMisalignmentOffsetCheckbox = splitContainerTriangles.Panel1.Controls["checkBoxVertexMisalignment"] as CheckBox;

            _addressBox.AddEnterAction(() => AddressBoxEnter());

            _radioButtonTriFloor          = splitContainerTriangles.Panel1.Controls["radioButtonTriFloor"] as RadioButton;
            _radioButtonTriFloor.Click   += (sender, e) => Mode_Click(sender, e, TriangleMode.Floor);
            _radioButtonTriWall           = splitContainerTriangles.Panel1.Controls["radioButtonTriWall"] as RadioButton;
            _radioButtonTriWall.Click    += (sender, e) => Mode_Click(sender, e, TriangleMode.Wall);
            _radioButtonTriCeiling        = splitContainerTriangles.Panel1.Controls["radioButtonTriCeiling"] as RadioButton;
            _radioButtonTriCeiling.Click += (sender, e) => Mode_Click(sender, e, TriangleMode.Ceiling);
            _radioButtonTriCustom         = splitContainerTriangles.Panel1.Controls["radioButtonTriCustom"] as RadioButton;
            _radioButtonTriCustom.Click  += (sender, e) => Mode_Click(sender, e, TriangleMode.Custom);

            ControlUtilities.AddContextMenuStripFunctions(
                _radioButtonTriCustom,
                new List <string>()
            {
                "Paste Addresses",
            },
                new List <Action>()
            {
                () => EnterCustomText(Clipboard.GetText()),
            });

            Label labelTriangleSelection = splitContainerTriangles.Panel1.Controls["labelTriangleSelection"] as Label;

            ControlUtilities.AddContextMenuStripFunctions(
                labelTriangleSelection,
                new List <string>()
            {
                "Update Based on Coordinates",
                "Paste Triangles",
            },
                new List <Action>()
            {
                () => UpdateBasedOnCoordinates(),
                () => PasteTriangles(),
            });

            (splitContainerTriangles.Panel1.Controls["buttonGotoV1"] as Button).Click
                += (sender, e) => ButtonUtilities.GotoTriangleVertex(TriangleAddresses[0], 1, _useMisalignmentOffsetCheckbox.Checked);
            (splitContainerTriangles.Panel1.Controls["buttonGotoV2"] as Button).Click
                += (sender, e) => ButtonUtilities.GotoTriangleVertex(TriangleAddresses[0], 2, _useMisalignmentOffsetCheckbox.Checked);
            (splitContainerTriangles.Panel1.Controls["buttonGotoV3"] as Button).Click
                += (sender, e) => ButtonUtilities.GotoTriangleVertex(TriangleAddresses[0], 3, _useMisalignmentOffsetCheckbox.Checked);
            (splitContainerTriangles.Panel1.Controls["buttonGotoVClosest"] as Button).Click += (sender, e) =>
                                                                                               ButtonUtilities.GotoTriangleVertexClosest(TriangleAddresses[0], _useMisalignmentOffsetCheckbox.Checked);

            (splitContainerTriangles.Panel1.Controls["buttonRetrieveTriangle"] as Button).Click
                += (sender, e) => ButtonUtilities.RetrieveTriangle(TriangleAddresses);

            Button buttonNeutralizeTriangle = splitContainerTriangles.Panel1.Controls["buttonNeutralizeTriangle"] as Button;

            buttonNeutralizeTriangle.Click += (sender, e) => ButtonUtilities.NeutralizeTriangle(TriangleAddresses);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonNeutralizeTriangle,
                new List <string>()
            {
                "Neutralize", "Neutralize with 0", "Neutralize with 0x15"
            },
                new List <Action>()
            {
                () => ButtonUtilities.NeutralizeTriangle(TriangleAddresses),
                () => ButtonUtilities.NeutralizeTriangle(TriangleAddresses, false),
                () => ButtonUtilities.NeutralizeTriangle(TriangleAddresses, true),
            });

            Button buttonAnnihilateTriangle = splitContainerTriangles.Panel1.Controls["buttonAnnihilateTriangle"] as Button;

            buttonAnnihilateTriangle.Click += (sender, e) => ButtonUtilities.AnnihilateTriangle(TriangleAddresses);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonAnnihilateTriangle,
                new List <string>()
            {
                "Annihilate All Tri But Death Barriers",
                "Annihilate All Ceilings",
            },
                new List <Action>()
            {
                () => TriangleUtilities.AnnihilateAllTrianglesButDeathBarriers(),
                () => TriangleUtilities.AnnihilateAllCeilings(),
            });

            var trianglePosGroupBox = splitContainerTriangles.Panel1.Controls["groupBoxTrianglePos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                trianglePosGroupBox,
                trianglePosGroupBox.Controls["buttonTrianglePosXn"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosXp"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosZn"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosZp"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosXnZn"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosXnZp"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosXpZn"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosXpZp"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosYp"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosYn"] as Button,
                trianglePosGroupBox.Controls["textBoxTrianglePosXZ"] as TextBox,
                trianglePosGroupBox.Controls["textBoxTrianglePosY"] as TextBox,
                trianglePosGroupBox.Controls["checkBoxTrianglePosRelative"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.MoveTriangle(
                    TriangleAddresses,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });

            var triangleNormalGroupBox = splitContainerTriangles.Panel1.Controls["groupBoxTriangleNormal"] as GroupBox;

            ControlUtilities.InitializeScalarController(
                triangleNormalGroupBox.Controls["buttontriangleNormalN"] as Button,
                triangleNormalGroupBox.Controls["buttontriangleNormalP"] as Button,
                triangleNormalGroupBox.Controls["textBoxTriangleNormal"] as TextBox,
                (float normalValue) =>
            {
                ButtonUtilities.MoveTriangleNormal(TriangleAddresses, normalValue);
            });

            _checkBoxNeutralizeTriangle = splitContainerTriangles.Panel1.Controls["checkBoxNeutralizeTriangle"] as CheckBox;

            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowCoords"] as Button).Click
                += (sender, e) => ShowTriangleCoordinates();
            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowEquation"] as Button).Click
                += (sender, e) => ShowTriangleEquation();

            _recordTriangleDataCheckbox = splitContainerTriangles.Panel1.Controls["checkBoxRecordTriangleData"] as CheckBox;
            _recordTriangleCountLabel   = splitContainerTriangles.Panel1.Controls["labelRecordTriangleCount"] as Label;

            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowData"] as Button).Click
                += (sender, e) => ShowTriangleData();
            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowVertices"] as Button).Click
                += (sender, e) => ShowTriangleVertices();
            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowAddresses"] as Button).Click
                += (sender, e) => ShowTriangleAddresses();
            (splitContainerTriangles.Panel1.Controls["buttonTriangleClearData"] as Button).Click
                += (sender, e) => ClearTriangleData();

            _repeatFirstVertexCheckbox = splitContainerTriangles.Panel1.Controls["checkBoxRepeatFirstVertex"] as CheckBox;

            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowLevelTris"] as Button).Click
                += (sender, e) => TriangleUtilities.ShowTriangles(TriangleUtilities.GetLevelTriangles());

            Button buttonTriangleShowObjTris = splitContainerTriangles.Panel1.Controls["buttonTriangleShowObjTris"] as Button;

            buttonTriangleShowObjTris.Click += (sender, e) => TriangleUtilities.ShowTriangles(TriangleUtilities.GetObjectTriangles());
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTriangleShowObjTris,
                new List <string>()
            {
                "Show All Object Tris", "Show Selected Object Tris"
            },
                new List <Action>()
            {
                () => TriangleUtilities.ShowTriangles(TriangleUtilities.GetObjectTriangles()),
                () => TriangleUtilities.ShowTriangles(TriangleUtilities.GetSelectedObjectTriangles()),
            });

            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowAllTris"] as Button).Click
                += (sender, e) => TriangleUtilities.ShowTriangles(TriangleUtilities.GetAllTriangles());

            var buttonTriangleNeutralizeAllTriangles = splitContainerTriangles.Panel1.Controls["buttonTriangleNeutralizeAllTriangles"] as Button;

            buttonTriangleNeutralizeAllTriangles.Click += (sender, e) => TriangleUtilities.NeutralizeTriangles();

            ControlUtilities.AddContextMenuStripFunctions(
                buttonTriangleNeutralizeAllTriangles,
                new List <string>()
            {
                "Neutralize All Triangles",
                "Neutralize Wall Triangles",
                "Neutralize Floor Triangles",
                "Neutralize Ceiling Triangles",
                "Neutralize Death Barriers",
                "Neutralize Lava",
                "Neutralize Sleeping",
                "Neutralize Loading Zones"
            },
                new List <Action>()
            {
                () => TriangleUtilities.NeutralizeTriangles(),
                () => TriangleUtilities.NeutralizeTriangles(TriangleClassification.Wall),
                () => TriangleUtilities.NeutralizeTriangles(TriangleClassification.Floor),
                () => TriangleUtilities.NeutralizeTriangles(TriangleClassification.Ceiling),
                () => TriangleUtilities.NeutralizeTriangles(0x0A),
                () => TriangleUtilities.NeutralizeTriangles(0x01),
                () => TriangleUtilities.NeutralizeSleeping(),
                () => {
                    TriangleUtilities.NeutralizeTriangles(0x1B);
                    TriangleUtilities.NeutralizeTriangles(0x1C);
                    TriangleUtilities.NeutralizeTriangles(0x1D);
                    TriangleUtilities.NeutralizeTriangles(0x1E);
                },
            });

            var buttonTriangleDisableAllCamCollision = splitContainerTriangles.Panel1.Controls["buttonTriangleDisableAllCamCollision"] as Button;

            buttonTriangleDisableAllCamCollision.Click += (sender, e) => TriangleUtilities.DisableCamCollision();

            ControlUtilities.AddContextMenuStripFunctions(
                buttonTriangleDisableAllCamCollision,
                new List <string>()
            {
                "Disable Cam Collision for All Triangles",
                "Disable Cam Collision for Wall Triangles",
                "Disable Cam Collision for Floor Triangles",
                "Disable Cam Collision for Ceiling Triangles",
            },
                new List <Action>()
            {
                () => TriangleUtilities.DisableCamCollision(),
                () => TriangleUtilities.DisableCamCollision(TriangleClassification.Wall),
                () => TriangleUtilities.DisableCamCollision(TriangleClassification.Floor),
                () => TriangleUtilities.DisableCamCollision(TriangleClassification.Ceiling),
            });

            GroupBox groupBoxTriangleTypeConversion        = splitContainerTriangles.Panel1.Controls["groupBoxTriangleTypeConversion"] as GroupBox;
            ComboBox comboBoxTriangleTypeConversionConvert = groupBoxTriangleTypeConversion.Controls["comboBoxTriangleTypeConversionConvert"] as ComboBox;
            TextBox  textBoxTriangleTypeConversionFromType = groupBoxTriangleTypeConversion.Controls["textBoxTriangleTypeConversionFromType"] as TextBox;
            TextBox  textBoxTriangleTypeConversionToType   = groupBoxTriangleTypeConversion.Controls["textBoxTriangleTypeConversionToType"] as TextBox;
            Button   buttonTriangleTypeConversionConvert   = groupBoxTriangleTypeConversion.Controls["buttonTriangleTypeConversionConvert"] as Button;

            comboBoxTriangleTypeConversionConvert.DataSource = EnumUtilities.GetEnumValues <TriangleClassificationExtended>(typeof(TriangleClassificationExtended));

            buttonTriangleTypeConversionConvert.Click += (sender, e) =>
            {
                TriangleClassificationExtended classification = (TriangleClassificationExtended)comboBoxTriangleTypeConversionConvert.SelectedItem;
                short?fromType = (short?)ParsingUtilities.ParseHexNullable(textBoxTriangleTypeConversionFromType.Text);
                short?toType   = (short?)ParsingUtilities.ParseHexNullable(textBoxTriangleTypeConversionToType.Text);
                if (!fromType.HasValue || !toType.HasValue)
                {
                    return;
                }
                TriangleUtilities.ConvertSurfaceTypes(classification, fromType.Value, toType.Value);
            };
        }
Esempio n. 25
0
        public override void InitializeTab()
        {
            base.InitializeTab();
            buttonTasStorePosition.Click += (sender, e) => StoreInfo(x: true, y: true, z: true);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTasStorePosition,
                new List <string>()
            {
                "Store Position",
                "Store Lateral Position",
                "Store X",
                "Store Y",
                "Store Z",
                "Go to Closest Floor Vertex",
                "Go to Closest Floor Vertex Misalignment",
            },
                new List <Action>()
            {
                () => StoreInfo(x: true, y: true, z: true),
                () => StoreInfo(x: true, z: true),
                () => StoreInfo(x: true),
                () => StoreInfo(y: true),
                () => StoreInfo(z: true),
                () => ButtonUtilities.GotoTriangleVertexClosest(Config.Stream.GetUInt32(MarioConfig.StructAddress + MarioConfig.FloorTriangleOffset), false),
                () => ButtonUtilities.GotoTriangleVertexClosest(Config.Stream.GetUInt32(MarioConfig.StructAddress + MarioConfig.FloorTriangleOffset), true),
            });

            buttonTasStoreAngle.Click += (sender, e) => StoreInfo(angle: true);

            buttonTasTakePosition.Click += (sender, e) => TakeInfo(x: true, y: true, z: true);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTasTakePosition,
                new List <string>()
            {
                "Take Position",
                "Take Lateral Position",
                "Take X",
                "Take Y",
                "Take Z"
            },
                new List <Action>()
            {
                () => TakeInfo(x: true, y: true, z: true),
                () => TakeInfo(x: true, z: true),
                () => TakeInfo(x: true),
                () => TakeInfo(y: true),
                () => TakeInfo(z: true),
            });

            buttonTasTakeAngle.Click += (sender, e) => TakeInfo(angle: true);

            buttonTasPasteSchedule.Click += (sender, e) => SetScheduler(Clipboard.GetText(), false);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTasPasteSchedule,
                new List <string>()
            {
                "Paste Schedule as Floats"
            },
                new List <Action>()
            {
                () => SetScheduler(Clipboard.GetText(), true)
            });
        }
Esempio n. 26
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();
                }
            });
        }
Esempio n. 27
0
        public TriangleManager(Control tabControl, List <WatchVariableControlPrecursor> variables, WatchVariablePanel watchVariablePanel)
            : base(variables, watchVariablePanel, ALL_VAR_GROUPS, VISIBLE_VAR_GROUPS)
        {
            _triangleCache = new Dictionary <uint, TriangleStruct>();

            _triangleData = new List <short[]>();

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

            _addressBox = splitContainerTriangles.Panel1.Controls["maskedTextBoxOtherTriangle"] as MaskedTextBox;
            _useMisalignmentOffsetCheckbox = splitContainerTriangles.Panel1.Controls["checkBoxVertexMisalignment"] as CheckBox;

            _addressBox.KeyDown += AddressBox_KeyDown;
            (splitContainerTriangles.Panel1.Controls["radioButtonTriFloor"] as RadioButton).Click
                += (sender, e) => Mode_Click(sender, e, TriangleMode.Floor);
            (splitContainerTriangles.Panel1.Controls["radioButtonTriWall"] as RadioButton).Click
                += (sender, e) => Mode_Click(sender, e, TriangleMode.Wall);
            (splitContainerTriangles.Panel1.Controls["radioButtonTriCeiling"] as RadioButton).Click
                += (sender, e) => Mode_Click(sender, e, TriangleMode.Ceiling);
            (splitContainerTriangles.Panel1.Controls["radioButtonTriOther"] as RadioButton).Click
                += (sender, e) => Mode_Click(sender, e, TriangleMode.Other);

            (splitContainerTriangles.Panel1.Controls["labelTriangleSelection"] as Label).Click
                += (sender, e) => ShowTriangleCoordinates();

            (splitContainerTriangles.Panel1.Controls["buttonGotoV1"] as Button).Click
                += (sender, e) => ButtonUtilities.GotoTriangle(_triangleAddress, 1, _useMisalignmentOffsetCheckbox.Checked);
            (splitContainerTriangles.Panel1.Controls["buttonGotoV2"] as Button).Click
                += (sender, e) => ButtonUtilities.GotoTriangle(_triangleAddress, 2, _useMisalignmentOffsetCheckbox.Checked);
            (splitContainerTriangles.Panel1.Controls["buttonGotoV3"] as Button).Click
                += (sender, e) => ButtonUtilities.GotoTriangle(_triangleAddress, 3, _useMisalignmentOffsetCheckbox.Checked);
            (splitContainerTriangles.Panel1.Controls["buttonGotoVClosest"] as Button).Click += (sender, e) =>
            {
                int closestVertex = WatchVariableSpecialUtilities.GetClosestTriangleVertexIndex(_triangleAddress);
                ButtonUtilities.GotoTriangle(_triangleAddress, closestVertex, _useMisalignmentOffsetCheckbox.Checked);
            };

            (splitContainerTriangles.Panel1.Controls["buttonRetrieveTriangle"] as Button).Click
                += (sender, e) => ButtonUtilities.RetrieveTriangle(_triangleAddress);

            Button buttonNeutralizeTriangle = splitContainerTriangles.Panel1.Controls["buttonNeutralizeTriangle"] as Button;

            buttonNeutralizeTriangle.Click += (sender, e) => ButtonUtilities.NeutralizeTriangle(_triangleAddress);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonNeutralizeTriangle,
                new List <string>()
            {
                "Neutralize", "Neutralize with 0", "Neutralize with 21"
            },
                new List <Action>()
            {
                () => ButtonUtilities.NeutralizeTriangle(_triangleAddress),
                () => ButtonUtilities.NeutralizeTriangle(_triangleAddress, false),
                () => ButtonUtilities.NeutralizeTriangle(_triangleAddress, true),
            });

            (splitContainerTriangles.Panel1.Controls["buttonAnnihilateTriangle"] as Button).Click
                += (sender, e) => ButtonUtilities.AnnihilateTriangle(_triangleAddress);

            var trianglePosGroupBox = splitContainerTriangles.Panel1.Controls["groupBoxTrianglePos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                trianglePosGroupBox,
                trianglePosGroupBox.Controls["buttonTrianglePosXn"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosXp"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosZn"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosZp"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosXnZn"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosXnZp"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosXpZn"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosXpZp"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosYp"] as Button,
                trianglePosGroupBox.Controls["buttonTrianglePosYn"] as Button,
                trianglePosGroupBox.Controls["textBoxTrianglePosXZ"] as TextBox,
                trianglePosGroupBox.Controls["textBoxTrianglePosY"] as TextBox,
                trianglePosGroupBox.Controls["checkBoxTrianglePosRelative"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.MoveTriangle(
                    _triangleAddress,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });

            var triangleNormalGroupBox = splitContainerTriangles.Panel1.Controls["groupBoxTriangleNormal"] as GroupBox;

            ControlUtilities.InitializeScalarController(
                triangleNormalGroupBox.Controls["buttontriangleNormalN"] as Button,
                triangleNormalGroupBox.Controls["buttontriangleNormalP"] as Button,
                triangleNormalGroupBox.Controls["textBoxTriangleNormal"] as TextBox,
                (float normalValue) =>
            {
                ButtonUtilities.MoveTriangleNormal(_triangleAddress, normalValue);
            });

            _checkBoxNeutralizeTriangle = splitContainerTriangles.Panel1.Controls["checkBoxNeutralizeTriangle"] as CheckBox;

            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowCoords"] as Button).Click
                += (sender, e) => ShowTriangleCoordinates();
            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowEquation"] as Button).Click
                += (sender, e) => ShowTriangleEquation();

            _recordTriangleDataCheckbox = splitContainerTriangles.Panel1.Controls["checkBoxRecordTriangleData"] as CheckBox;
            _recordTriangleCountLabel   = splitContainerTriangles.Panel1.Controls["labelRecordTriangleCount"] as Label;

            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowData"] as Button).Click
                += (sender, e) => ShowTriangleData();
            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowVertices"] as Button).Click
                += (sender, e) => ShowTriangleVertices();
            (splitContainerTriangles.Panel1.Controls["buttonTriangleClearData"] as Button).Click
                += (sender, e) => ClearTriangleData();

            _repeatFirstVertexCheckbox = splitContainerTriangles.Panel1.Controls["checkBoxRepeatFirstVertex"] as CheckBox;

            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowLevelTris"] as Button).Click
                += (sender, e) => TriangleUtilities.ShowTriangles(TriangleUtilities.GetLevelTriangles());
            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowObjTris"] as Button).Click
                += (sender, e) => TriangleUtilities.ShowTriangles(TriangleUtilities.GetObjectTriangles());
            (splitContainerTriangles.Panel1.Controls["buttonTriangleShowAllTris"] as Button).Click
                += (sender, e) => TriangleUtilities.ShowTriangles(TriangleUtilities.GetAllTriangles());

            var buttonTriangleNeutralizeAllTriangles = splitContainerTriangles.Panel1.Controls["buttonTriangleNeutralizeAllTriangles"] as Button;

            buttonTriangleNeutralizeAllTriangles.Click += (sender, e) => TriangleUtilities.NeutralizeTriangles();

            ControlUtilities.AddContextMenuStripFunctions(
                buttonTriangleNeutralizeAllTriangles,
                new List <string>()
            {
                "Neutralize All Triangles",
                "Neutralize Wall Triangles",
                "Neutralize Floor Triangles",
                "Neutralize Ceiling Triangles",
            },
                new List <Action>()
            {
                () => TriangleUtilities.NeutralizeTriangles(),
                () => TriangleUtilities.NeutralizeTriangles(TriangleClassification.Wall),
                () => TriangleUtilities.NeutralizeTriangles(TriangleClassification.Floor),
                () => TriangleUtilities.NeutralizeTriangles(TriangleClassification.Ceiling),
            });

            var buttonTriangleDisableAllCamCollision = splitContainerTriangles.Panel1.Controls["buttonTriangleDisableAllCamCollision"] as Button;

            buttonTriangleDisableAllCamCollision.Click += (sender, e) => TriangleUtilities.DisableCamCollision();

            ControlUtilities.AddContextMenuStripFunctions(
                buttonTriangleDisableAllCamCollision,
                new List <string>()
            {
                "Disable Cam Collision for All Triangles",
                "Disable Cam Collision for Wall Triangles",
                "Disable Cam Collision for Floor Triangles",
                "Disable Cam Collision for Ceiling Triangles",
            },
                new List <Action>()
            {
                () => TriangleUtilities.DisableCamCollision(),
                () => TriangleUtilities.DisableCamCollision(TriangleClassification.Wall),
                () => TriangleUtilities.DisableCamCollision(TriangleClassification.Floor),
                () => TriangleUtilities.DisableCamCollision(TriangleClassification.Ceiling),
            });
        }
Esempio n. 28
0
        public VariableControllerForm(
            List <string> varNames, List <WatchVariableWrapper> watchVarWrappers, List <List <uint> > fixedAddressLists)
        {
            _varNames          = varNames;
            _watchVarWrappers  = watchVarWrappers;
            _fixedAddressLists = fixedAddressLists;

            _isDoingContinuousAdd      = false;
            _isDoingContinuousSubtract = false;

            InitializeComponent();
            FormManager.AddForm(this);
            FormClosing += (sender, e) => FormManager.RemoveForm(this);

            _textBoxVarName.Text = String.Join(",", _varNames);

            _addAction = (bool add, bool allowToggle) =>
            {
                List <string> values = ParsingUtilities.ParseStringList(_textBoxAddSubtract.Text);
                if (values.Count == 0)
                {
                    return;
                }
                for (int i = 0; i < _watchVarWrappers.Count; i++)
                {
                    _watchVarWrappers[i].AddValue(values[i % values.Count], add, allowToggle, _fixedAddressLists[i]);
                }
            };
            _buttonAdd.Click      += (s, e) => _addAction(true, true);
            _buttonSubtract.Click += (s, e) => _addAction(false, true);

            Timer addTimer = new Timer {
                Interval = 30
            };

            addTimer.Tick += (s, e) => { if (KeyboardUtilities.IsCtrlHeld())
                                         {
                                             _addAction(true, false);
                                         }
            };
            _buttonAdd.MouseDown += (sender, e) => addTimer.Start();
            _buttonAdd.MouseUp   += (sender, e) => addTimer.Stop();

            ControlUtilities.AddContextMenuStripFunctions(
                _buttonAdd,
                new List <string>()
            {
                "Start Continuous Add", "Stop Continuous Add"
            },
                new List <Action>()
            {
                () => _isDoingContinuousAdd = true, () => _isDoingContinuousAdd = false
            });

            Timer subtractTimer = new Timer {
                Interval = 30
            };

            subtractTimer.Tick += (s, e) => { if (KeyboardUtilities.IsCtrlHeld())
                                              {
                                                  _addAction(false, false);
                                              }
            };
            _buttonSubtract.MouseDown += (sender, e) => subtractTimer.Start();
            _buttonSubtract.MouseUp   += (sender, e) => subtractTimer.Stop();

            ControlUtilities.AddContextMenuStripFunctions(
                _buttonSubtract,
                new List <string>()
            {
                "Start Continuous Subtract", "Stop Continuous Subtract"
            },
                new List <Action>()
            {
                () => _isDoingContinuousSubtract = true, () => _isDoingContinuousSubtract = false
            });

            ToolStripMenuItem itemInvertedAdd      = new ToolStripMenuItem("Inverted");
            ToolStripMenuItem itemInvertedSubtract = new ToolStripMenuItem("Inverted");
            Action <bool>     setInverted          = (bool inverted) =>
            {
                tableLayoutPanel1.Controls.Remove(_buttonAdd);
                tableLayoutPanel1.Controls.Remove(_buttonSubtract);
                if (inverted)
                {
                    tableLayoutPanel1.Controls.Add(_buttonAdd, 0, 2);
                    tableLayoutPanel1.Controls.Add(_buttonSubtract, 2, 2);
                }
                else
                {
                    tableLayoutPanel1.Controls.Add(_buttonAdd, 2, 2);
                    tableLayoutPanel1.Controls.Add(_buttonSubtract, 0, 2);
                }
                itemInvertedAdd.Checked      = inverted;
                itemInvertedSubtract.Checked = inverted;
            };

            itemInvertedAdd.Click      += (sender, e) => setInverted(!itemInvertedAdd.Checked);
            itemInvertedSubtract.Click += (sender, e) => setInverted(!itemInvertedSubtract.Checked);
            _buttonAdd.ContextMenuStrip.Items.Add(new ToolStripSeparator());
            _buttonAdd.ContextMenuStrip.Items.Add(itemInvertedAdd);
            _buttonSubtract.ContextMenuStrip.Items.Add(new ToolStripSeparator());
            _buttonSubtract.ContextMenuStrip.Items.Add(itemInvertedSubtract);

            _buttonGet.Click += (s, e) => _textBoxGetSet.Text = GetValues();

            _buttonSet.Click += (s, e) => SetValues(true);
            _textBoxGetSet.AddEnterAction(() => SetValues(true));

            _checkBoxFixAddress.Click += (s, e) => ToggleFixedAddress();

            _checkBoxLock.Click += (s, e) =>
            {
                List <bool> lockedBools = new List <bool>();
                for (int i = 0; i < _watchVarWrappers.Count; i++)
                {
                    lockedBools.Add(_watchVarWrappers[i].GetLockedBool(_fixedAddressLists[i]));
                }
                bool anyLocked = lockedBools.Any(b => b);
                for (int i = 0; i < _watchVarWrappers.Count; i++)
                {
                    _watchVarWrappers[i].ToggleLocked(!anyLocked, _fixedAddressLists[i]);
                }
            };

            _checkBoxFixAddress.CheckState = BoolUtilities.GetCheckState(
                fixedAddressLists.ConvertAll(fixedAddressList => fixedAddressList != null));

            _textBoxCurrentValue.BackColor = GetColorForCheckState(BoolUtilities.GetCheckState(
                                                                       fixedAddressLists.ConvertAll(fixedAddressList => fixedAddressList != null)));
        }
Esempio n. 29
0
        public VarHackManager(Control varHackControlControl, VarHackFlowLayoutPanel varHackPanel)
        {
            _varHackPanel = varHackPanel;

            // Top buttons

            SplitContainer splitContainerVarHack =
                varHackControlControl.Controls["splitContainerVarHack"] as SplitContainer;

            Button buttonVarHackAddNewVariable =
                splitContainerVarHack.Panel1.Controls["buttonVarHackAddNewVariable"] as Button;

            buttonVarHackAddNewVariable.Click +=
                (sender, e) => _varHackPanel.AddNewControl();

            ControlUtilities.AddContextMenuStripFunctions(
                buttonVarHackAddNewVariable,
                new List <string>()
            {
                "RNG Index",
                "Floor YNorm",
                "Defacto Speed",
                "Sliding Speed",
                "Mario Action",
                "Mario Animation",
                "DYaw Intended - Facing",
                "DYaw Intended - Facing (HAU)",
            },
                new List <Action>()
            {
                () => AddVariable("RngIndex"),
                () => AddVariable("FloorYNorm"),
                () => AddVariable("DefactoSpeed"),
                () => AddVariable("SlidingSpeed"),
                () => AddVariable("MarioAction"),
                () => AddVariable("MarioAnimation"),
                () => AddVariable("DYawIntendFacing"),
                () => AddVariable("DYawIntendFacingHau"),
            });

            Button buttonVarHackOpenVars =
                splitContainerVarHack.Panel1.Controls["buttonVarHackOpenVars"] as Button;

            buttonVarHackOpenVars.Click +=
                (sender, e) => _varHackPanel.OpenVariables();

            Button buttonVarHackSaveVars =
                splitContainerVarHack.Panel1.Controls["buttonVarHackSaveVars"] as Button;

            buttonVarHackSaveVars.Click +=
                (sender, e) => _varHackPanel.SaveVariables();

            Button buttonVarHackClearVariables =
                splitContainerVarHack.Panel1.Controls["buttonVarHackClearVars"] as Button;

            buttonVarHackClearVariables.Click +=
                (sender, e) => _varHackPanel.ClearVariables();

            Button buttonVarHackShowVariableBytesInLittleEndian =
                splitContainerVarHack.Panel1.Controls["buttonVarHackShowVariableBytesInLittleEndian"] as Button;

            buttonVarHackShowVariableBytesInLittleEndian.Click +=
                (sender, e) => _varHackPanel.ShowVariableBytesInLittleEndian();

            Button buttonVarHackShowVariableBytesInBigEndian =
                splitContainerVarHack.Panel1.Controls["buttonVarHackShowVariableBytesInBigEndian"] as Button;

            buttonVarHackShowVariableBytesInBigEndian.Click +=
                (sender, e) => _varHackPanel.ShowVariableBytesInBigEndian();

            // Bottom buttons

            Button buttonVarHackApplyVariablesToMemory =
                splitContainerVarHack.Panel1.Controls["buttonVarHackApplyVariablesToMemory"] as Button;

            buttonVarHackApplyVariablesToMemory.Click +=
                (sender, e) => _varHackPanel.ApplyVariablesToMemory();

            Button buttonVarHackClearVariablesInMemory =
                splitContainerVarHack.Panel1.Controls["buttonVarHackClearVariablesInMemory"] as Button;

            buttonVarHackClearVariablesInMemory.Click +=
                (sender, e) => _varHackPanel.ClearVariablesInMemory();

            _buttonEnableDisableRomHack =
                splitContainerVarHack.Panel1.Controls["buttonEnableDisableRomHack"] as BinaryButton;
            _buttonEnableDisableRomHack.Initialize(
                "Enable ROM Hack",
                "Disable ROM Hack",
                () => VarHackConfig.ShowVarRomHack.LoadPayload(),
                () => VarHackConfig.ShowVarRomHack.ClearPayload(),
                () => VarHackConfig.ShowVarRomHack.Enabled);

            ControlUtilities.AddContextMenuStripFunctions(
                _buttonEnableDisableRomHack,
                new List <string>()
            {
                "1f Delay Hack (Standard)", "0f Delay Hack (Experimental)"
            },
                new List <Action>()
            {
                () => VarHackConfig.ShowVarRomHack.LoadPayload(),
                () => VarHackConfig.ShowVarRomHack2.LoadPayload(),
            });

            // Middle buttons

            _textBoxXPosValue = splitContainerVarHack.Panel1.Controls["textBoxXPosValue"] as BetterTextbox;
            _textBoxXPosValue.AddEnterAction(() => SetPositionsAndApplyVariablesToMemory());
            _textBoxXPosValue.Text = VarHackConfig.DefaultXPos.ToString();
            InitializePositionControls(
                _textBoxXPosValue,
                splitContainerVarHack.Panel1.Controls["textBoxXPosChange"] as TextBox,
                splitContainerVarHack.Panel1.Controls["buttonXPosSubtract"] as Button,
                splitContainerVarHack.Panel1.Controls["buttonXPosAdd"] as Button);

            _textBoxYPosValue = splitContainerVarHack.Panel1.Controls["textBoxYPosValue"] as BetterTextbox;
            _textBoxYPosValue.AddEnterAction(() => SetPositionsAndApplyVariablesToMemory());
            _textBoxYPosValue.Text = VarHackConfig.DefaultYPos.ToString();
            InitializePositionControls(
                _textBoxYPosValue,
                splitContainerVarHack.Panel1.Controls["textBoxYPosChange"] as TextBox,
                splitContainerVarHack.Panel1.Controls["buttonYPosSubtract"] as Button,
                splitContainerVarHack.Panel1.Controls["buttonYPosAdd"] as Button);

            _textBoxYDeltaValue = splitContainerVarHack.Panel1.Controls["textBoxYDeltaValue"] as BetterTextbox;
            _textBoxYDeltaValue.AddEnterAction(() => SetPositionsAndApplyVariablesToMemory());
            _textBoxYDeltaValue.Text = VarHackConfig.DefaultYDelta.ToString();
            InitializePositionControls(
                _textBoxYDeltaValue,
                splitContainerVarHack.Panel1.Controls["textBoxYDeltaChange"] as TextBox,
                splitContainerVarHack.Panel1.Controls["buttonYDeltaSubtract"] as Button,
                splitContainerVarHack.Panel1.Controls["buttonYDeltaAdd"] as Button);

            Button buttonSetPositionsAndApplyVariablesToMemory =
                splitContainerVarHack.Panel1.Controls["buttonSetPositionsAndApplyVariablesToMemory"] as Button;

            buttonSetPositionsAndApplyVariablesToMemory.Click +=
                (sender, e) => SetPositionsAndApplyVariablesToMemory();
        }
Esempio n. 30
0
        public override void InitializeTab()
        {
            base.InitializeTab();

            _recordedTriangleAddresses = new List <uint>();

            textBoxCustomTriangle.AddEnterAction(() => AddressBoxEnter());

            radioButtonTriFloor.Click   += (sender, e) => Mode_Click(sender, e, TriangleMode.Floor);
            radioButtonTriWall.Click    += (sender, e) => Mode_Click(sender, e, TriangleMode.Wall);
            radioButtonTriCeiling.Click += (sender, e) => Mode_Click(sender, e, TriangleMode.Ceiling);
            radioButtonTriCustom.Click  += (sender, e) => Mode_Click(sender, e, TriangleMode.Custom);

            ControlUtilities.AddContextMenuStripFunctions(
                radioButtonTriCustom,
                new List <string>()
            {
                "Paste Addresses",
            },
                new List <Action>()
            {
                () => EnterCustomText(Clipboard.GetText()),
            });

            Label labelTriangleSelection = splitContainerTriangles.Panel1.Controls["labelTriangleSelection"] as Label;

            ControlUtilities.AddContextMenuStripFunctions(
                labelTriangleSelection,
                new List <string>()
            {
                "Update Based on Coordinates",
                "Paste Triangles",
            },
                new List <Action>()
            {
                () => UpdateBasedOnCoordinates(),
                () => PasteTriangles(),
            });


            buttonGotoV1.Click
                += (sender, e) => ButtonUtilities.GotoTriangleVertex(TriangleAddresses[0], 1, checkBoxVertexMisalignment.Checked);
            buttonGotoV2.Click
                += (sender, e) => ButtonUtilities.GotoTriangleVertex(TriangleAddresses[0], 2, checkBoxVertexMisalignment.Checked);
            buttonGotoV3.Click
                += (sender, e) => ButtonUtilities.GotoTriangleVertex(TriangleAddresses[0], 3, checkBoxVertexMisalignment.Checked);
            buttonGotoVClosest.Click += (sender, e) =>
                                        ButtonUtilities.GotoTriangleVertexClosest(TriangleAddresses[0], checkBoxVertexMisalignment.Checked);

            buttonRetrieveTriangle.Click
                += (sender, e) => ButtonUtilities.RetrieveTriangle(TriangleAddresses);

            buttonNeutralizeTriangle.Click += (sender, e) => ButtonUtilities.NeutralizeTriangle(TriangleAddresses);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonNeutralizeTriangle,
                new List <string>()
            {
                "Neutralize", "Neutralize with 0", "Neutralize with 0x15"
            },
                new List <Action>()
            {
                () => ButtonUtilities.NeutralizeTriangle(TriangleAddresses),
                () => ButtonUtilities.NeutralizeTriangle(TriangleAddresses, false),
                () => ButtonUtilities.NeutralizeTriangle(TriangleAddresses, true),
            });

            buttonAnnihilateTriangle.Click += (sender, e) => ButtonUtilities.AnnihilateTriangle(TriangleAddresses);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonAnnihilateTriangle,
                new List <string>()
            {
                "Annihilate All Tri But Death Barriers",
                "Annihilate All Ceilings",
            },
                new List <Action>()
            {
                () => TriangleUtilities.AnnihilateAllTrianglesButDeathBarriers(),
                () => TriangleUtilities.AnnihilateAllCeilings(),
            });

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                groupBoxTrianglePos,
                buttonTrianglePosXn,
                buttonTrianglePosXp,
                buttonTrianglePosZn,
                buttonTrianglePosZp,
                buttonTrianglePosXnZn,
                buttonTrianglePosXnZp,
                buttonTrianglePosXpZn,
                buttonTrianglePosXpZp,
                buttonTrianglePosYp,
                buttonTrianglePosYn,
                textBoxTrianglePosXZ,
                textBoxTrianglePosY,
                checkBoxTrianglePosRelative,
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                ButtonUtilities.MoveTriangle(
                    TriangleAddresses,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative,
                    true);
            });

            ControlUtilities.InitializeScalarController(
                buttonTriangleNormalN,
                buttonTriangleNormalP,
                textBoxTriangleNormal,
                (float normalValue) =>
            {
                ButtonUtilities.MoveTriangleNormal(TriangleAddresses, normalValue);
            });


            buttonTriangleShowCoords.Click
                += (sender, e) => ShowTriangleCoordinates();
            buttonTriangleShowEquation.Click
                += (sender, e) => ShowTriangleEquation();


            buttonTriangleShowData.Click
                += (sender, e) => ShowTriangleData();
            buttonTriangleShowVertices.Click
                += (sender, e) => ShowTriangleVertices();
            buttonTriangleShowAddresses.Click
                += (sender, e) => ShowTriangleAddresses();
            buttonTriangleClearData.Click
                += (sender, e) => ClearTriangleData();

            buttonTriangleShowLevelTris.Click
                += (sender, e) => TriangleUtilities.ShowTriangles(TriangleUtilities.GetLevelTriangles());

            buttonTriangleShowObjTris.Click += (sender, e) => TriangleUtilities.ShowTriangles(TriangleUtilities.GetObjectTriangles());
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTriangleShowObjTris,
                new List <string>()
            {
                "Show All Object Tris", "Show Selected Object Tris"
            },
                new List <Action>()
            {
                () => TriangleUtilities.ShowTriangles(TriangleUtilities.GetObjectTriangles()),
                () => TriangleUtilities.ShowTriangles(TriangleUtilities.GetSelectedObjectTriangles()),
            });

            buttonTriangleShowAllTris.Click
                += (sender, e) => TriangleUtilities.ShowTriangles(TriangleUtilities.GetAllTriangles());

            buttonTriangleNeutralizeAllTriangles.Click += (sender, e) => TriangleUtilities.NeutralizeTriangles();

            ControlUtilities.AddContextMenuStripFunctions(
                buttonTriangleNeutralizeAllTriangles,
                new List <string>()
            {
                "Neutralize All Triangles",
                "Neutralize Wall Triangles",
                "Neutralize Floor Triangles",
                "Neutralize Ceiling Triangles",
                "Neutralize Death Barriers",
                "Neutralize Lava",
                "Neutralize Sleeping",
                "Neutralize Loading Zones"
            },
                new List <Action>()
            {
                () => TriangleUtilities.NeutralizeTriangles(),
                () => TriangleUtilities.NeutralizeTriangles(TriangleClassification.Wall),
                () => TriangleUtilities.NeutralizeTriangles(TriangleClassification.Floor),
                () => TriangleUtilities.NeutralizeTriangles(TriangleClassification.Ceiling),
                () => TriangleUtilities.NeutralizeTriangles(0x0A),
                () => TriangleUtilities.NeutralizeTriangles(0x01),
                () => TriangleUtilities.NeutralizeSleeping(),
                () => {
                    TriangleUtilities.NeutralizeTriangles(0x1B);
                    TriangleUtilities.NeutralizeTriangles(0x1C);
                    TriangleUtilities.NeutralizeTriangles(0x1D);
                    TriangleUtilities.NeutralizeTriangles(0x1E);
                },
            });

            var buttonTriangleDisableAllCamCollision = splitContainerTriangles.Panel1.Controls["buttonTriangleDisableAllCamCollision"] as Button;

            buttonTriangleDisableAllCamCollision.Click += (sender, e) => TriangleUtilities.DisableCamCollision();

            ControlUtilities.AddContextMenuStripFunctions(
                buttonTriangleDisableAllCamCollision,
                new List <string>()
            {
                "Disable Cam Collision for All Triangles",
                "Disable Cam Collision for Wall Triangles",
                "Disable Cam Collision for Floor Triangles",
                "Disable Cam Collision for Ceiling Triangles",
            },
                new List <Action>()
            {
                () => TriangleUtilities.DisableCamCollision(),
                () => TriangleUtilities.DisableCamCollision(TriangleClassification.Wall),
                () => TriangleUtilities.DisableCamCollision(TriangleClassification.Floor),
                () => TriangleUtilities.DisableCamCollision(TriangleClassification.Ceiling),
            });

            comboBoxTriangleTypeConversionConvert.DataSource = EnumUtilities.GetEnumValues <TriangleClassificationExtended>(typeof(TriangleClassificationExtended));

            buttonTriangleTypeConversionConvert.Click += (sender, e) =>
            {
                TriangleClassificationExtended classification = (TriangleClassificationExtended)comboBoxTriangleTypeConversionConvert.SelectedItem;
                short?fromType = (short?)ParsingUtilities.ParseHexNullable(textBoxTriangleTypeConversionFromType.Text);
                short?toType   = (short?)ParsingUtilities.ParseHexNullable(textBoxTriangleTypeConversionToType.Text);
                if (!fromType.HasValue || !toType.HasValue)
                {
                    return;
                }
                TriangleUtilities.ConvertSurfaceTypes(classification, fromType.Value, toType.Value);
            };
        }