示例#1
0
        private static void Move_Memory(bool rightwards)
        {
            Config.Stream.Suspend();
            int multiplicity = KeyboardUtilities.GetCurrentlyInputtedNumber() ?? 1;
            List <List <uint> > processGroups = GetProcessGroups();
            Dictionary <uint, ObjectSnapshot> objectSnapshots = new Dictionary <uint, ObjectSnapshot>();
            List <uint> selectedAddresses = Config.ObjectSlotsManager.SelectedObjects.ConvertAll(obj => obj.Address);

            for (int i = 0; i < multiplicity; i++)
            {
                List <uint> newSelectedAddresses = new List <uint>();
                selectedAddresses.Sort((uint objAddress1, uint objAddress2) =>
                {
                    int multiplier = rightwards ? -1 : +1;
                    int diff       = objAddress1.CompareTo(objAddress2);
                    return(multiplier * diff);
                });
                foreach (uint address in selectedAddresses)
                {
                    Move_Memory(address, rightwards, processGroups, objectSnapshots, newSelectedAddresses);
                }
                selectedAddresses.Clear();
                selectedAddresses.AddRange(newSelectedAddresses);
            }
            ApplyProcessGroups(processGroups);
            foreach (uint address in objectSnapshots.Keys)
            {
                ObjectSnapshot objectSnapshot = objectSnapshots[address];
                objectSnapshot.Apply(address, false);
            }
            Config.ObjectSlotsManager.SelectAddresses(selectedAddresses);
            Config.Stream.Resume();
        }
示例#2
0
        public static void Move_ProcessGroups(bool rightwards)
        {
            Config.Stream.Suspend();
            List <ObjectDataModel> selectedObjects   = Config.ObjectSlotsManager.SelectedObjects;
            List <uint>            selectedAddresses = selectedObjects.ConvertAll(obj => obj.Address);

            selectedAddresses.Sort((uint objAddress1, uint objAddress2) =>
            {
                int multiplier = rightwards ? -1 : +1;
                int diff       = GetProcessedIndex(objAddress1) - GetProcessedIndex(objAddress2);
                return(multiplier * diff);
            });
            int multiplicity = KeyboardUtilities.GetCurrentlyInputtedNumber() ?? 1;
            List <List <uint> > processGroups = GetProcessGroups();

            for (int i = 0; i < multiplicity; i++)
            {
                foreach (uint address in selectedAddresses)
                {
                    processGroups = Move_ProcessGroups(address, rightwards, processGroups);
                }
            }
            ApplyProcessGroups(processGroups);
            Config.Stream.Resume();
        }
示例#3
0
        public static Color GetColorForVariable()
        {
            int?inputtedNumber = KeyboardUtilities.GetCurrentlyInputtedNumber();

            if (inputtedNumber.HasValue &&
                inputtedNumber.Value > 0 &&
                inputtedNumber.Value <= ColorList.Count)
            {
                return(ColorList[inputtedNumber.Value - 1]);
            }
            return(SystemColors.Control);
        }
示例#4
0
        public static SplitContainer GetDescendantSplitContainer(Control control, Orientation orientation, int?indexNullable = null)
        {
            int index = indexNullable ?? (KeyboardUtilities.GetCurrentlyInputtedNumber() - 1) ?? 0;
            List <SplitContainer> splitContainerList = GetAllDescendantSplitContainers(control);

            splitContainerList = splitContainerList.FindAll(
                splitContainer => splitContainer.Visible);
            splitContainerList = splitContainerList.FindAll(
                splitContainer => splitContainer.Orientation == orientation);
            if (index < 0 || index >= splitContainerList.Count)
            {
                return(null);
            }
            return(splitContainerList[index]);
        }
示例#5
0
        public static Color GetColorForVariable()
        {
            int?inputtedNumber = KeyboardUtilities.GetCurrentlyInputtedNumber();

            if (inputtedNumber == 0)
            {
                return(SystemColors.Control);
            }

            if (inputtedNumber.HasValue &&
                inputtedNumber.Value > 0 &&
                inputtedNumber.Value <= ColorToParamsDictionary.Count)
            {
                int    index       = inputtedNumber.Value - 1;
                string colorString = ColorToParamsDictionary.ToList()[index].Value;
                return(ColorTranslator.FromHtml(colorString));
            }
            return(SystemColors.Control);
        }
示例#6
0
        public static Color?GetColorForHighlight()
        {
            int?inputtedNumber = KeyboardUtilities.GetCurrentlyInputtedNumber();

            switch (inputtedNumber)
            {
            case 1:
                return(Color.Red);

            case 2:
                return(Color.Orange);

            case 3:
                return(Color.Yellow);

            case 4:
                return(Color.Green);

            case 5:
                return(Color.Blue);

            case 6:
                return(Color.Purple);

            case 7:
                return(Color.Pink);

            case 8:
                return(Color.Brown);

            case 9:
                return(Color.Black);

            case 0:
                return(Color.White);

            default:
                return(null);
            }
        }
示例#7
0
        public static void CopyForCode(List <WatchVariableControl> controls, string dialogString = null)
        {
            if (controls.Count == 0)
            {
                return;
            }
            Func <string, string> varNameFunc;

            if (dialogString != null || KeyboardUtilities.IsCtrlHeld())
            {
                string template = dialogString ?? DialogUtilities.GetStringFromDialog("$");
                if (template == null)
                {
                    return;
                }
                varNameFunc = varName => template.Replace("$", varName);
            }
            else
            {
                varNameFunc = varName => varName;
            }
            List <string> lines = new List <string>();

            foreach (WatchVariableControl watchVar in controls)
            {
                Type   type = watchVar.GetMemoryType();
                string line = string.Format(
                    "{0} {1} = {2}{3};",
                    type != null ? TypeUtilities.TypeToString[type] : "double",
                    varNameFunc(watchVar.VarName.Replace(" ", "")),
                    watchVar.GetValue(false),
                    type == typeof(float) ? "f" : "");
                lines.Add(line);
            }
            if (lines.Count > 0)
            {
                Clipboard.SetText(string.Join("\r\n", lines));
                controls.ForEach(control => control.FlashColor(WatchVariableControl.COPY_COLOR));
            }
        }
示例#8
0
        public static void AddGraphicsTriangleVerticesToTriangleTab()
        {
            int numVertices = 3;

            if (KeyboardUtilities.IsCtrlHeld())
            {
                numVertices = 4;
            }
            if (KeyboardUtilities.IsNumberHeld())
            {
                numVertices = KeyboardUtilities.GetCurrentlyInputtedNumber().Value;
            }

            uint triangleAddress = Config.TriangleManager.TriangleAddress;

            if (triangleAddress == 0)
            {
                return;
            }
            TriangleDataModel    triangle         = new TriangleDataModel(triangleAddress);
            List <List <short> > triangleVertices = new List <List <short> >()
            {
                new List <short>()
                {
                    triangle.X1, triangle.Y1, triangle.Z1
                },
                new List <short>()
                {
                    triangle.X2, triangle.Y2, triangle.Z2
                },
                new List <short>()
                {
                    triangle.X3, triangle.Y3, triangle.Z3
                },
            };

            int  structSize = numVertices * 0x10;
            uint ramStart   = 0x80000000;

            for (uint baseAddress = ramStart; baseAddress < ramStart + Config.RamSize - structSize; baseAddress += 2)
            {
                List <uint>          addresses = new List <uint>();
                List <string>        names     = new List <string>();
                List <List <short> > vertices  = new List <List <short> >();

                for (int i = 0; i < numVertices; i++)
                {
                    List <short> vertex = new List <short>();
                    for (int j = 0; j < 3; j++)
                    {
                        uint   offset    = (uint)(i * 0x10 + j * 0x02);
                        uint   address   = baseAddress + offset;
                        short  value     = Config.Stream.GetInt16(address);
                        string component = j == 0 ? "x" : j == 1 ? "y" : "z";
                        string name      = "v" + (i + 1) + component;

                        addresses.Add(address);
                        names.Add(name);
                        vertex.Add(value);
                    }
                    vertices.Add(vertex);
                }

                List <List <List <short> > > vertexSubsets = ControlUtilities.GetSubsets(vertices, 3);
                foreach (List <List <short> > vertexSubset in vertexSubsets)
                {
                    if (AreVerticesEqual(triangleVertices, vertexSubset))
                    {
                        List <WatchVariableControlPrecursor> precursors = new List <WatchVariableControlPrecursor>();
                        for (int i = 0; i < addresses.Count; i++)
                        {
                            WatchVariable watchVar = new WatchVariable(
                                memoryTypeName: "short",
                                specialType: null,
                                baseAddressType: BaseAddressTypeEnum.Relative,
                                offsetUS: null,
                                offsetJP: null,
                                offsetPAL: null,
                                offsetDefault: addresses[i],
                                mask: null,
                                shift: null);
                            WatchVariableControlPrecursor precursor = new WatchVariableControlPrecursor(
                                name: names[i],
                                watchVar: watchVar,
                                subclass: WatchVariableSubclass.Number,
                                backgroundColor: null,
                                displayType: null,
                                roundingLimit: null,
                                useHex: null,
                                invertBool: null,
                                isYaw: null,
                                coordinate: null,
                                groupList: new List <VariableGroup>()
                            {
                                VariableGroup.Custom
                            });
                            precursors.Add(precursor);
                        }

                        Config.TriangleManager.AddVariables(
                            precursors.ConvertAll(precursor => precursor.CreateWatchVariableControl()));
                    }
                }
            }
        }