/[RomCheater]/trunk/RomCheater/Docking/MemorySearch/PatchAdder.cs
ViewVC logotype

Annotation of /trunk/RomCheater/Docking/MemorySearch/PatchAdder.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 229 - (hide annotations) (download)
Sat Jun 2 18:31:40 2012 UTC (8 years, 8 months ago) by william
File size: 3359 byte(s)

1 william 229 using System;
2     using System.Collections.Generic;
3     using System.ComponentModel;
4     using System.Data;
5     using System.Drawing;
6     using System.Text;
7     using System.Windows.Forms;
8    
9     namespace RomCheater.Docking.MemorySearch
10     {
11     public partial class PatchAdder : Form
12     {
13     //PCSX2MemoryProvider provider;
14     SearchDataTypes DataType;
15     bool Unsigned = false;
16     int _pid = -1;
17     public PatchAdder(int pid)
18     {
19     InitializeComponent();
20     _pid = pid;
21     //provider = new PCSX2MemoryProvider(_pid, log_control);
22     Unsigned = true;
23     DataType = SearchDataTypes._8bits;
24     txtAddress.Text = string.Format("0x{0:x8}", 0);
25     this.AddedPatchValue = null;
26     txtAddress.MaxLength = sizeof(uint) * 2 + 2;
27     }
28    
29     private void SearchPatcher_Load(object sender, EventArgs e)
30     {
31     foreach (int val in Enum.GetValues(typeof(SearchDataTypes)))
32     {
33     comboDataBitSize.Items.Add(val);
34     }
35     comboDataBitSize.SelectedIndex = 0;
36     comboDataBitSize.Text = comboDataBitSize.Items[comboDataBitSize.SelectedIndex].ToString();
37     txtAddress.ReadOnly = false;
38     txtAddress.Text = "";
39     }
40     private void btnCancel_Click(object sender, EventArgs e)
41     {
42     this.Close();
43     }
44     private void btnOK_Click(object sender, EventArgs e)
45     {
46     uint Address = txtAddress.ToUInt32();
47    
48     //if (!(ramdumper.VTLB_VADDR_MIN <= Address && Address < ramdumper.VTLB_VADDR_MAX))
49     //{
50     // MessageBox.Show(string.Format("EE Ram requires the Address to be between: 0x{0:x8} and 0x{1:x8}", ramdumper.VTLB_VADDR_MIN, ramdumper.VTLB_VADDR_MAX), "Address Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
51     // txtAddress.Text = "";
52     // return;
53     //}
54    
55     ResultItemState _result_state = new ResultItemState(string.Format("0x{0:x8}",txtAddress.ToUInt32()), DataType, Unsigned, _pid);
56     ResultDataType _result = _result_state;
57     this.AddedPatchValue = _result;
58     this.Close();
59     }
60    
61     public bool WasAPatchAdded
62     {
63     get { return (this.AddedPatchValue != null); }
64     }
65     private ResultDataType _AddedPatchValue;
66     public ResultDataType AddedPatchValue
67     {
68     get { return _AddedPatchValue; }
69     private set { _AddedPatchValue = value; }
70     }
71    
72     private void comboDataBitSize_SelectedIndexChanged(object sender, EventArgs e)
73     {
74     int selected_index = comboDataBitSize.SelectedIndex;
75     int bit_size = -1;
76    
77     bit_size = Convert.ToInt32(comboDataBitSize.Items[comboDataBitSize.SelectedIndex]);
78     this.DataType = (SearchDataTypes)bit_size;
79     }
80    
81     private void chkIsUnsigned_CheckedChanged(object sender, EventArgs e)
82     {
83     if (chkIsUnsigned.Checked) { this.Unsigned = true; }
84     else { this.Unsigned = false; }
85     }
86    
87     private void PatchAdder_KeyDown(object sender, KeyEventArgs e)
88     {
89     if (e.KeyCode == Keys.Enter) btnOK.PerformClick();
90     }
91     }
92     }

  ViewVC Help
Powered by ViewVC 1.1.22