using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace RomCheater.Docking.MemorySearch { public partial class PatchAdder : Form { //PCSX2MemoryProvider provider; SearchDataTypes DataType; bool Unsigned = false; int _pid = -1; public PatchAdder(int pid) { InitializeComponent(); _pid = pid; //provider = new PCSX2MemoryProvider(_pid, log_control); Unsigned = true; DataType = SearchDataTypes._8bits; txtAddress.Text = string.Format("0x{0:x8}", 0); this.AddedPatchValue = null; txtAddress.MaxLength = sizeof(uint) * 2 + 2; } private void SearchPatcher_Load(object sender, EventArgs e) { foreach (int val in Enum.GetValues(typeof(SearchDataTypes))) { comboDataBitSize.Items.Add(val); } comboDataBitSize.SelectedIndex = 0; comboDataBitSize.Text = comboDataBitSize.Items[comboDataBitSize.SelectedIndex].ToString(); txtAddress.ReadOnly = false; txtAddress.Text = ""; } private void btnCancel_Click(object sender, EventArgs e) { this.Close(); } private void btnOK_Click(object sender, EventArgs e) { uint Address = txtAddress.ToUInt32(); //if (!(ramdumper.VTLB_VADDR_MIN <= Address && Address < ramdumper.VTLB_VADDR_MAX)) //{ // 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); // txtAddress.Text = ""; // return; //} ResultItemState _result_state = new ResultItemState(string.Format("0x{0:x8}",txtAddress.ToUInt32()), DataType, Unsigned, _pid); ResultDataType _result = _result_state; this.AddedPatchValue = _result; this.Close(); } public bool WasAPatchAdded { get { return (this.AddedPatchValue != null); } } private ResultDataType _AddedPatchValue; public ResultDataType AddedPatchValue { get { return _AddedPatchValue; } private set { _AddedPatchValue = value; } } private void comboDataBitSize_SelectedIndexChanged(object sender, EventArgs e) { int selected_index = comboDataBitSize.SelectedIndex; int bit_size = -1; bit_size = Convert.ToInt32(comboDataBitSize.Items[comboDataBitSize.SelectedIndex]); this.DataType = (SearchDataTypes)bit_size; } private void chkIsUnsigned_CheckedChanged(object sender, EventArgs e) { if (chkIsUnsigned.Checked) { this.Unsigned = true; } else { this.Unsigned = false; } } private void PatchAdder_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) btnOK.PerformClick(); } } }