ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/RomCheater/trunk/RomCheater/Docking/MemorySearch/SearchRangePatcher.cs
(Generate patch)

Comparing trunk/RomCheater/Docking/MemorySearch/SearchRangePatcher.cs (file contents):
Revision 239 by william, Sat Jun 2 19:12:20 2012 UTC vs.
Revision 240 by william, Sun Jun 3 12:54:18 2012 UTC

--- trunk/RomCheater/Docking/MemorySearch/SearchRangePatcher.cs	2012/06/03 12:51:40	239
+++ trunk/RomCheater/Docking/MemorySearch/SearchRangePatcher.cs	2012/06/03 12:54:18	240
@@ -7,6 +7,7 @@ using System.Text;
 using System.Windows.Forms;
 using RomCheater.Logging;
 using System.Diagnostics;
+using Sojaner.MemoryScanner.MemoryProviers;
 
 
 namespace RomCheater.Docking.MemorySearch
@@ -52,29 +53,26 @@ namespace RomCheater.Docking.MemorySearc
         }
         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;
                 }
             }