Example #1
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            SaveManager sm = new SaveManager();

            sm.Init();
            // Get a list of all saved addresses
            foreach (DataGridViewRow row in ValuesGrid.Rows)
            {
                if (row.Cells[1].Value is GateSharkCode)
                {
                    // @TODO This will be different.
                }
                else if (row.Cells[1].Value is GateShark)
                {
                    sm.gscodes.Add((GateShark)row.Cells[1].Value);
                }
                else
                {
                    sm.codes.Add(new SaveCode(DataTypeExactTool.GetValue(row.Cells[3].Value.ToString()), row.Cells[1].Value.ToString()));
                }
            }

            // Set the values
            String[] parts_ = Processes.Text.Split('|');
            if (parts_.Length < 2)
            {
                return;
            }
            String game = Config.ConfigFileDirectory + Path.DirectorySeparatorChar + parts_[1] + @".xml";

            sm.titleId = parts_[1];
            SaveManager.SaveToXml(game, sm);
            MessageBox.Show(@"Saved selected addresses to '" + game + "'");
        }
Example #2
0
        internal void SetMemory(int RowIndex)
        {
            string        TextAddress = (string)ValuesGrid[1, RowIndex].Value;
            string        valString   = (string)ValuesGrid[3, RowIndex].Value;
            DataTypeExact type        = DataTypeExactTool.GetValue((string)ValuesGrid[4, RowIndex].Value);

            SetMemory(TextAddress, valString, type, RowIndex);
        }
Example #3
0
        private void RefreshMemory(int RowIndex)
        {
            ThreadEventDispatcher.CurrentSelectedProcess = Processes.Text.Split('|')[0];
            MemoryDispatch MemoryDispatch = new MemoryDispatch();

            MemoryDispatch.Row         = RowIndex;
            MemoryDispatch.TextAddress = (string)ValuesGrid[1, RowIndex].Value;
            MemoryDispatch.Type        = DataTypeExactTool.GetValue((string)ValuesGrid[4, RowIndex].Value);
            ThreadEventDispatcher.RefreshValueAddresses.Enqueue(MemoryDispatch);
        }
Example #4
0
        private void SetMemory(int RowIndex)
        {
            string TextAddress = (string)ValuesGrid[1, RowIndex].Value;

            MemoryDispatch MemoryDispatch = new MemoryDispatch();

            MemoryDispatch.Row         = RowIndex;
            MemoryDispatch.TextAddress = TextAddress;
            MemoryDispatch.Type        = DataTypeExactTool.GetValue((string)ValuesGrid[3, RowIndex].Value);
            MemoryDispatch.Value       = GetByteArrayForDataType(MemoryDispatch.Type, (string)ValuesGrid[2, RowIndex].Value);

            ThreadEventDispatcher.WriteAddress.Enqueue(MemoryDispatch);
        }
Example #5
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            MemoryStart.Text = MemoryStart.Text.PadLeft(8, '0');
            MemorySize.Text  = MemorySize.Text.PadLeft(8, '0');
            uint StartAddress = BitConverter.ToUInt32(Utilities.GetByteArrayFromByteString(MemoryStart.Text).Reverse().ToArray(), 0);
            uint EndAddress   = BitConverter.ToUInt32(Utilities.GetByteArrayFromByteString(TextEndAddress.Text).Reverse().ToArray(), 0);

            if (!MemoryRange.Text.Equals("All") && (!IsValidMemoryAddress(StartAddress) || !IsValidMemoryAddress(EndAddress)))
            {
                NTRConnection.SetCurrentOperationText = "Invalid start address or size!";
                return;
            }
            SearchButton.Enabled = ControlEnabledSearchButton = ControlEnabledDataType = ControlEnabledMemoryRange = false;
            ThreadEventDispatcher.CurrentSelectedDataType   = DataTypeExactTool.GetValue(ComboDataType.SelectedItem.ToString());
            ThreadEventDispatcher.CurrentSelectedSearchType = SearchTypeBaseTool.GetValue(ComboSearchType.SelectedItem.ToString());
            ThreadEventDispatcher.CurrentMemoryRange        = this.MemoryRange.Text;
            ThreadEventDispatcher.DispatchSearch            = true;
        }
Example #6
0
        private void ComboDataType_SelectedValueChanged(object sender, EventArgs e)
        {
            string CurrentSearchType = ComboSearchType.SelectedItem == null ? null : ComboSearchType.SelectedItem.ToString();

            if (LastSearchCriteria == null)
            {
                ComboSearchType.Items.Clear();
                ComboSearchType.Items.AddRange(SearchTypeInitialTool.GetValues());
            }
            else
            {
                switch (DataTypeExactTool.GetValue(ComboDataType.SelectedItem.ToString()))
                {
                case DataTypeExact.Bytes1:
                case DataTypeExact.Bytes2:
                case DataTypeExact.Bytes4:
                case DataTypeExact.Bytes8:
                case DataTypeExact.Float:
                case DataTypeExact.Double:
                    ComboSearchType.Items.Clear();
                    ComboSearchType.Items.AddRange(SearchTypeNumericTool.GetValues());
                    break;

                case DataTypeExact.Raw:
                case DataTypeExact.Text:
                    ComboSearchType.Items.Clear();
                    ComboSearchType.Items.AddRange(SearchTypeTextTool.GetValues());
                    break;
                }
            }
            if (CurrentSearchType != null && ComboSearchType.Items.Contains(CurrentSearchType))
            {
                ComboSearchType.SelectedIndex = ComboSearchType.Items.IndexOf(CurrentSearchType);
                ComboSearchType.SelectedItem  = ComboSearchType.SelectedValue = CurrentSearchType;
            }
            else
            {
                ComboSearchType.SelectedIndex = 0;
                ComboSearchType.SelectedItem  = ComboSearchType.SelectedValue = ComboSearchType.Items[0];
            }
        }
Example #7
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            SaveManager sm = new SaveManager();

            try
            {
                sm.LastUsedStartAddress = uint.Parse(MemoryStart.Text, NumberStyles.HexNumber);
                sm.LastUsedRangeSize    = uint.Parse(MemorySize.Text, NumberStyles.HexNumber);
            }
            catch
            {
                sm.LastUsedStartAddress = sm.LastUsedRangeSize = 0;
            }

            // Get a list of all saved addresses
            foreach (DataGridViewRow row in ValuesGrid.Rows)
            {
                if (row.Cells[1].Value is GateSharkCode)
                {
                    // @TODO This will be different.
                }
                else if (row.Cells[1].Value is GateShark)
                {
                    sm.GateSharkCodes.Add((GateShark)row.Cells[1].Value);
                }
                else
                {
                    sm.Codes.Add(new SaveCode(DataTypeExactTool.GetValue(row.Cells[4].Value.ToString()), row.Cells[1].Value.ToString(), (row.Cells[2].Value != null ? row.Cells[2].Value.ToString() : "")));
                }
            }

            // Set the values
            String[] parts_ = Processes.Text.Split('|');
            if (parts_.Length < 2)
            {
                return;
            }
            sm.TitleId = parts_[1];
            sm.SaveToJson();
            MessageBox.Show(@"Saved selected addresses to '" + sm.Filename + "'");
        }
Example #8
0
        private void btnAddSelected_Click(object sender, EventArgs e)
        {
            DataTypeExact addrType = DataTypeExactTool.GetValue(comboSelType.Text);

            if (addrType == DataTypeExact.INVALID)
            {
                return;
            }
            String addrStr            = selectedAddress.ToString("x2").PadLeft(8, '0');
            int    existingAddressIdx = ResultingCodes.FindIndex(c => c.address == addrStr);

            if (existingAddressIdx != -1)
            {
                ResultingCodes[existingAddressIdx] = new SaveCode(addrType, addrStr, txtSelTitle.Text);
            }
            else
            {
                ResultingCodes.Add(new SaveCode(DataTypeExactTool.GetValue(comboSelType.Text), addrStr, txtSelTitle.Text));
            }
            RefreshDataGrid();
        }