--- trunk/RomCheater/Docking/MemorySearch/SearchPatcher.cs 2012/06/03 13:04:02 242 +++ trunk/RomCheater/Docking/MemorySearch/SearchPatcher.cs 2012/06/03 13:21:51 243 @@ -9,77 +9,87 @@ using System.Diagnostics; using RomCheater.Logging; using Sojaner.MemoryScanner.MemoryProviers; +using RomCheater.PluginFramework.Interfaces; namespace RomCheater.Docking.MemorySearch { - public partial class SearchPatcher : Form + public partial class SearchPatcher : Form, + IAcceptsPlugin, + IAcceptsProcess, + IAcceptsProcessAndConfig { + #region IAcceptsProcess Members + public Process AcceptedProcess { get; set; } + #endregion + #region IAcceptsPlugin Members + public IConfigPlugin AcceptedPlugin { get; set; } + #endregion //PCSX2MemoryProvider provider; - private int pid = -1; SearchDataTypes DataType; bool Unsigned = false; - public SearchPatcher(int pid, uint Address) + public SearchPatcher(IAcceptsProcessAndConfig pconfig, uint Address) { InitializeComponent(); - this.pid = pid; + this.AcceptedPlugin = pconfig.AcceptedPlugin; + this.AcceptedProcess = pconfig.AcceptedProcess; txtAddress.Text = string.Format("0x{0:x8}", Address); } - public SearchPatcher(int pid, uint Address, byte Value) - : this(pid, Address) + public SearchPatcher(IAcceptsProcessAndConfig pconfig, uint Address, byte Value) + : this(pconfig, Address) { Unsigned = true; DataType = SearchDataTypes._8bits; txtValue.CreateTypeSize(); txtValue.Text = string.Format("0x{0:x2}", Value); } - public SearchPatcher(int pid, uint Address, sbyte Value) - : this(pid, Address) + public SearchPatcher(IAcceptsProcessAndConfig pconfig, uint Address, sbyte Value) + : this(pconfig, Address) { DataType = SearchDataTypes._8bits; txtValue.CreateTypeSize(); txtValue.Text = string.Format("0x{0:x2}", Value); } - public SearchPatcher(int pid, uint Address, ushort Value) - : this(pid, Address) + public SearchPatcher(IAcceptsProcessAndConfig pconfig, uint Address, ushort Value) + : this(pconfig, Address) { Unsigned = true; DataType = SearchDataTypes._16bits; txtValue.CreateTypeSize(); txtValue.Text = string.Format("0x{0:x4}", Value); } - public SearchPatcher(int pid, uint Address, short Value) - : this(pid, Address) + public SearchPatcher(IAcceptsProcessAndConfig pconfig, uint Address, short Value) + : this(pconfig, Address) { DataType = SearchDataTypes._16bits; txtValue.CreateTypeSize(); txtValue.Text = string.Format("0x{0:x4}", Value); } - public SearchPatcher(int pid, uint Address, uint Value) - : this(pid, Address) + public SearchPatcher(IAcceptsProcessAndConfig pconfig, uint Address, uint Value) + : this(pconfig, Address) { Unsigned = true; DataType = SearchDataTypes._32bits; txtValue.CreateTypeSize(); txtValue.Text = string.Format("0x{0:x8}", Value); } - public SearchPatcher(int pid, uint Address, int Value) - : this(pid, Address) + public SearchPatcher(IAcceptsProcessAndConfig pconfig, uint Address, int Value) + : this(pconfig, Address) { DataType = SearchDataTypes._32bits; txtValue.CreateTypeSize(); txtValue.Text = string.Format("0x{0:x8}", Value); } - public SearchPatcher(int pid, uint Address, ulong Value) - : this(pid, Address) + public SearchPatcher(IAcceptsProcessAndConfig pconfig, uint Address, ulong Value) + : this(pconfig, Address) { Unsigned = true; DataType = SearchDataTypes._64bits; txtValue.CreateTypeSize(); txtValue.Text = string.Format("0x{0:x16}", Value); } - public SearchPatcher(int pid, uint Address, long Value) - : this(pid, Address) + public SearchPatcher(IAcceptsProcessAndConfig pconfig, uint Address, long Value) + : this(pconfig, Address) { DataType = SearchDataTypes._64bits; txtValue.CreateTypeSize(); @@ -98,7 +108,7 @@ { uint Address = txtAddress.ToUInt32(); - GenericMemoryProvider provider = new GenericMemoryProvider(null, Process.GetProcessById(pid)); + GenericMemoryProvider provider = new GenericMemoryProvider((IAcceptsProcessAndConfig)this); switch (DataType) { case SearchDataTypes._8bits: