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

Diff of /trunk/RomCheater/Docking/MemorySearch/SearchRangePatcher.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/RomCheater/Docking/MemorySearch/SearchRangePatcher.cs	2012/06/02 19:12:20	230
+++ trunk/RomCheater/Docking/MemorySearch/SearchRangePatcher.cs	2012/06/03 12:54:18	240
@@ -7,6 +7,7 @@
 using System.Windows.Forms;
 using RomCheater.Logging;
 using System.Diagnostics;
+using Sojaner.MemoryScanner.MemoryProviers;
 
 
 namespace RomCheater.Docking.MemorySearch
@@ -52,29 +53,26 @@
         }
         private void btnOK_Click(object sender, EventArgs e)
         {
-
-            Sojaner.MemoryScanner.ProcessMemoryReader reader = new Sojaner.MemoryScanner.ProcessMemoryReader();
-            reader.ReadProcess = Process.GetProcessById(pid);
-            if (reader.ReadProcess == null) { logger.Error.WriteLine("Could not attach to process: {0}", pid); return; }
+            GenericMemoryProvider provider = new GenericMemoryProvider(null, Process.GetProcessById(pid));
             foreach(ResultDataType patch in PatchList)
             {
                 switch (patch.ValueType)
                 {
                     case SearchDataTypes._8bits:
-                        if (patch.IsUnsigned) { reader.PatchMemory(patch.Address, (byte)txtValue.Value); }
-                        else { reader.PatchMemory(patch.Address, (sbyte)txtValue.Value); }
+                        if (patch.IsUnsigned) { provider.PatchMemory(patch.Address, (byte)txtValue.Value); }
+                        else { provider.PatchMemory(patch.Address, (sbyte)txtValue.Value); }
                         break;
                     case SearchDataTypes._16bits:
-                        if (patch.IsUnsigned) { reader.PatchMemory(patch.Address, (ushort)txtValue.Value); }
-                        else { reader.PatchMemory(patch.Address, (short)txtValue.Value); }
+                        if (patch.IsUnsigned) { provider.PatchMemory(patch.Address, (ushort)txtValue.Value); }
+                        else { provider.PatchMemory(patch.Address, (short)txtValue.Value); }
                         break;
                     case SearchDataTypes._32bits:
-                        if (patch.IsUnsigned) { reader.PatchMemory(patch.Address, (uint)txtValue.Value); }
-                        else { reader.PatchMemory(patch.Address, (int)txtValue.Value); }
+                        if (patch.IsUnsigned) { provider.PatchMemory(patch.Address, (uint)txtValue.Value); }
+                        else { provider.PatchMemory(patch.Address, (int)txtValue.Value); }
                         break;
                     case SearchDataTypes._64bits:
-                        if (patch.IsUnsigned) { reader.PatchMemory(patch.Address, (ulong)txtValue.Value); }
-                        else { reader.PatchMemory(patch.Address, (long)txtValue.Value); }
+                        if (patch.IsUnsigned) { provider.PatchMemory(patch.Address, (ulong)txtValue.Value); }
+                        else { provider.PatchMemory(patch.Address, (long)txtValue.Value); }
                         break;
                 }
             }

 

  ViewVC Help
Powered by ViewVC 1.1.22