Beispiel #1
0
 private void RefreshDataGrid()
 {
     wantedAddresses.Rows.Clear();
     ResultingCodes.ForEach((sc) =>
     {
         int RowIndex = wantedAddresses.Rows.Add();
         wantedAddresses[0, RowIndex].Value = sc.address;
         wantedAddresses[1, RowIndex].Value = sc.title;
         wantedAddresses[2, RowIndex].Value = DataTypeExactTool.GetKey(sc.type);
     });
     wantedAddresses.Refresh();
 }
Beispiel #2
0
        private void LoadButton_Click(object sender, EventArgs e)
        {
            String[] parts_ = Processes.Text.Split('|');
            if (parts_.Length < 2)
            {
                return;
            }

            SaveManager sm = SaveManager.LoadFromJson(parts_[1]);

            if (sm.TitleId != parts_[1])
            {
                MessageBox.Show(@"Filename/TitleID Mismatch.");
            }
            else
            {
                if (sm.LastUsedStartAddress != 0 && sm.LastUsedRangeSize != 0)
                {
                    MemoryRange.SelectedIndex = MemoryRange.Items.Count - 1; //last index should always be Custom
                    MemoryStart.Text          = sm.LastUsedStartAddress.ToString("x2").PadLeft(8, '0');
                    MemorySize.Text           = sm.LastUsedRangeSize.ToString("x2").PadLeft(8, '0');
                }
                foreach (SaveCode code in sm.Codes)
                {
                    int rIdx = GetIndexOfAddress(code.address);
                    if (rIdx == -1)
                    {
                        rIdx = ValuesGrid.Rows.Add();
                    }

                    ValuesGrid[0, rIdx].Value = null;
                    ValuesGrid[4, rIdx].Value = DataTypeExactTool.GetKey(code.type);

                    ValuesGrid[2, rIdx].Value = code.title;
                    ValuesGrid[1, rIdx].Value = code.address;
                    RefreshMemory(rIdx);
                }
                // Read the memory
            }
            foreach (GateShark code in sm.GateSharkCodes)
            {
                if (GetIndexOfAddress(code.ToString()) == -1)
                {
                    int RowIndex = ValuesGrid.Rows.Add();
                    ValuesGrid[0, RowIndex].Value = null;
                    ValuesGrid[3, RowIndex].Value = DataTypeExact.Raw;
                    ValuesGrid[1, RowIndex].Value = code;
                }
            }
        }
Beispiel #3
0
        private void LoadButton_Click(object sender, EventArgs e)
        {
            String[] parts_ = Processes.Text.Split('|');
            if (parts_.Length < 2)
            {
                return;
            }
            String      game = Config.ConfigFileDirectory + Path.DirectorySeparatorChar + parts_[1] + @".xml";
            SaveManager sm   = SaveManager.LoadFromXml(game);

            if (sm.titleId != parts_[1])
            {
                MessageBox.Show(@"Filename/TitleID Mismatch.");
            }
            else
            {
                foreach (SaveCode code in sm.codes)
                {
                    if (!IsInValues(code.address))
                    {
                        int RowIndex = ValuesGrid.Rows.Add();
                        ValuesGrid[0, RowIndex].Value = null;
                        ValuesGrid[3, RowIndex].Value = DataTypeExactTool.GetKey(code.type);
                        ValuesGrid[1, RowIndex].Value = code.address;

                        // Read the memory
                        RefreshMemory(RowIndex);
                    }
                }
                foreach (GateShark code in sm.gscodes)
                {
                    if (!IsInValues(code.ToString()))
                    {
                        int RowIndex = ValuesGrid.Rows.Add();
                        ValuesGrid[0, RowIndex].Value = null;
                        ValuesGrid[3, RowIndex].Value = DataTypeExact.Raw;
                        ValuesGrid[1, RowIndex].Value = code;
                    }
                }
            }
        }
Beispiel #4
0
        private void ValuesGridContextMenuStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            switch (e.ClickedItem.Name)
            {
            case "ValuesGridCopyResolvedAddress":
                foreach (DataGridViewCell Cell in ValuesGrid.SelectedCells)
                {
                    Clipboard.SetText(Cell.OwningRow.Cells[1].ToolTipText);
                    break;
                }
                break;

            case "ValuesGridPointerSearch":
                foreach (DataGridViewCell Cell in ValuesGrid.SelectedCells)
                {
                    PointerSearchRow = Cell.OwningRow.Index;
                    ThreadEventDispatcher.CurrentSelectedProcess = Processes.Text.Split('|')[0];
                    ThreadEventDispatcher.DispatchPointerSearch  = (string)Cell.OwningRow.Cells[1].Value;
                    break;
                }
                break;

            case "ValuesGridDeleteItem":
                foreach (DataGridViewCell Cell in ValuesGrid.SelectedCells)
                {
                    ValuesGrid.Rows.Remove(Cell.OwningRow);
                }
                break;

            case "ValuesGridAddItem":
                ValuesGrid.Rows.Add();
                break;

            case "ValuesGridConvertCode":
                foreach (DataGridViewCell Cell in ValuesGrid.SelectedCells)
                {
                    Cell.OwningRow.Cells[1].Value = ConvertCode((string)Cell.OwningRow.Cells[1].Value);
                }
                break;

            case "ValuesGridRefreshItem":
                foreach (DataGridViewCell Cell in ValuesGrid.SelectedCells)
                {
                    RefreshMemory(Cell.RowIndex);
                }
                break;

            case "ValuesGridShowMemoryView":
                if (ValuesGrid.SelectedCells.Count > 0)
                {
                    MemoryViewer viewer = new MemoryViewer(ThreadEventDispatcher, ValuesGrid.SelectedCells[0].OwningRow.Cells[1].Value.ToString());
                    viewer.OnLiveMemoryEdit += (uint addr, byte val) => SetMemory(addr.ToString("x2").PadLeft(8, '0'), val.ToString(), DataTypeExact.Bytes1, -1);

                    viewer.ShowDialog();
                    viewer.ResultingCodes.ForEach(newCode =>
                    {
                        int RowIndex = ValuesGrid.Rows.Add();
                        ValuesGrid[0, RowIndex].Value = null;
                        ValuesGrid[4, RowIndex].Value = DataTypeExactTool.GetKey(newCode.type);
                        ValuesGrid[1, RowIndex].Value = newCode.address;
                        ValuesGrid[2, RowIndex].Value = newCode.title;
                        RefreshMemory(RowIndex);
                    });

                    /*uint s =  0x09070950+2;
                     * uint en = 0x090709e2;
                     * for(uint i = s; i < en; i = i + 4)
                     * {
                     *  SaveCode newCode = new SaveCode(DataTypeExact.Bytes2, i.ToString("x2").PadLeft(8,'0'), "");
                     *  int RowIndex = ValuesGrid.Rows.Add();
                     *  ValuesGrid[0, RowIndex].Value = null;
                     *  ValuesGrid[4, RowIndex].Value = DataTypeExactTool.GetKey(newCode.type);
                     *  ValuesGrid[1, RowIndex].Value = newCode.address;
                     *  ValuesGrid[2, RowIndex].Value = newCode.title;
                     * }
                     * ;*/
                }
                break;
            }
        }