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

Contents of /trunk/RomCheater.Core/Docking/MemorySearch/PatchAdder.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 892 - (show annotations) (download)
Wed Sep 17 05:56:41 2014 UTC (6 years, 10 months ago) by william
File size: 3968 byte(s)
+ alot of dang work to force an icon to be shown on the docked panels
  ** when it was as simple as setting: DockPanel.ShowDocumentIcon to true

1 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 using System.Diagnostics;
10 using RomCheater.Interfaces;
11
12 namespace RomCheater.Core.Docking.MemorySearch
13 {
14 public partial class PatchAdder : Form,
15 IAcceptsPlugin<IConfigPlugin>,
16 IAcceptsProcess<Process>,
17 IAcceptsProcessAndConfig
18 {
19 #region IAcceptsProcess<Process> Members
20 public Process AcceptedProcess { get; set; }
21 #endregion
22 #region IAcceptsPlugin<IConfigPlugin> Members
23 public IConfigPlugin AcceptedPlugin { get; set; }
24 #endregion
25 //PCSX2MemoryProvider provider;
26 SearchDataTypes DataType;
27 bool Unsigned = false;
28 public PatchAdder(IAcceptsProcessAndConfig pconfig)
29 {
30 InitializeComponent();
31 this.AcceptedPlugin = pconfig.AcceptedPlugin;
32 this.AcceptedProcess = pconfig.AcceptedProcess;
33 //provider = new PCSX2MemoryProvider(_pid, log_control);
34 Unsigned = true;
35 DataType = SearchDataTypes._8bits;
36 txtAddress.Text = string.Format("0x{0:x8}", 0);
37 this.AddedPatchValue = null;
38 txtAddress.MaxLength = sizeof(uint) * 2 + 2;
39 }
40
41 private void SearchPatcher_Load(object sender, EventArgs e)
42 {
43 foreach (int val in Enum.GetValues(typeof(SearchDataTypes)))
44 {
45 comboDataBitSize.Items.Add(val);
46 }
47 comboDataBitSize.SelectedIndex = 0;
48 comboDataBitSize.Text = comboDataBitSize.Items[comboDataBitSize.SelectedIndex].ToString();
49 txtAddress.ReadOnly = false;
50 txtAddress.Text = "";
51 }
52 private void btnCancel_Click(object sender, EventArgs e)
53 {
54 this.Close();
55 }
56 private void btnOK_Click(object sender, EventArgs e)
57 {
58 uint Address = txtAddress.ToUInt32();
59
60 //if (!(ramdumper.VTLB_VADDR_MIN <= Address && Address < ramdumper.VTLB_VADDR_MAX))
61 //{
62 // 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);
63 // txtAddress.Text = "";
64 // return;
65 //}
66
67 ResultItemState _result_state = new ResultItemState(string.Format("0x{0:x8}", txtAddress.ToUInt32()), DataType, Unsigned, (IAcceptsProcessAndConfig)this);
68 ResultDataType _result = _result_state;
69 this.AddedPatchValue = _result;
70 this.Close();
71 }
72
73 public bool WasAPatchAdded
74 {
75 get { return (this.AddedPatchValue != null); }
76 }
77 private ResultDataType _AddedPatchValue;
78 public ResultDataType AddedPatchValue
79 {
80 get { return _AddedPatchValue; }
81 private set { _AddedPatchValue = value; }
82 }
83
84 private void comboDataBitSize_SelectedIndexChanged(object sender, EventArgs e)
85 {
86 int selected_index = comboDataBitSize.SelectedIndex;
87 int bit_size = -1;
88
89 bit_size = Convert.ToInt32(comboDataBitSize.Items[comboDataBitSize.SelectedIndex]);
90 txtAddress.CreateTypeSize<ulong>();
91 this.DataType = (SearchDataTypes)bit_size;
92 }
93
94 private void chkIsUnsigned_CheckedChanged(object sender, EventArgs e)
95 {
96 if (chkIsUnsigned.Checked) { this.Unsigned = true; }
97 else { this.Unsigned = false; }
98 }
99
100 private void PatchAdder_KeyDown(object sender, KeyEventArgs e)
101 {
102 if (e.KeyCode == Keys.Enter) btnOK.PerformClick();
103 }
104 }
105 }

  ViewVC Help
Powered by ViewVC 1.1.22