7 |
using System.Windows.Forms; |
using System.Windows.Forms; |
8 |
using RomCheater.Logging; |
using RomCheater.Logging; |
9 |
using System.Diagnostics; |
using System.Diagnostics; |
10 |
|
using Sojaner.MemoryScanner.MemoryProviers; |
11 |
|
|
12 |
|
|
13 |
namespace RomCheater.Docking.MemorySearch |
namespace RomCheater.Docking.MemorySearch |
53 |
} |
} |
54 |
private void btnOK_Click(object sender, EventArgs e) |
private void btnOK_Click(object sender, EventArgs e) |
55 |
{ |
{ |
56 |
|
GenericMemoryProvider provider = new GenericMemoryProvider(null, Process.GetProcessById(pid)); |
|
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; } |
|
57 |
foreach(ResultDataType patch in PatchList) |
foreach(ResultDataType patch in PatchList) |
58 |
{ |
{ |
59 |
switch (patch.ValueType) |
switch (patch.ValueType) |
60 |
{ |
{ |
61 |
case SearchDataTypes._8bits: |
case SearchDataTypes._8bits: |
62 |
if (patch.IsUnsigned) { reader.PatchMemory(patch.Address, (byte)txtValue.Value); } |
if (patch.IsUnsigned) { provider.PatchMemory(patch.Address, (byte)txtValue.Value); } |
63 |
else { reader.PatchMemory(patch.Address, (sbyte)txtValue.Value); } |
else { provider.PatchMemory(patch.Address, (sbyte)txtValue.Value); } |
64 |
break; |
break; |
65 |
case SearchDataTypes._16bits: |
case SearchDataTypes._16bits: |
66 |
if (patch.IsUnsigned) { reader.PatchMemory(patch.Address, (ushort)txtValue.Value); } |
if (patch.IsUnsigned) { provider.PatchMemory(patch.Address, (ushort)txtValue.Value); } |
67 |
else { reader.PatchMemory(patch.Address, (short)txtValue.Value); } |
else { provider.PatchMemory(patch.Address, (short)txtValue.Value); } |
68 |
break; |
break; |
69 |
case SearchDataTypes._32bits: |
case SearchDataTypes._32bits: |
70 |
if (patch.IsUnsigned) { reader.PatchMemory(patch.Address, (uint)txtValue.Value); } |
if (patch.IsUnsigned) { provider.PatchMemory(patch.Address, (uint)txtValue.Value); } |
71 |
else { reader.PatchMemory(patch.Address, (int)txtValue.Value); } |
else { provider.PatchMemory(patch.Address, (int)txtValue.Value); } |
72 |
break; |
break; |
73 |
case SearchDataTypes._64bits: |
case SearchDataTypes._64bits: |
74 |
if (patch.IsUnsigned) { reader.PatchMemory(patch.Address, (ulong)txtValue.Value); } |
if (patch.IsUnsigned) { provider.PatchMemory(patch.Address, (ulong)txtValue.Value); } |
75 |
else { reader.PatchMemory(patch.Address, (long)txtValue.Value); } |
else { provider.PatchMemory(patch.Address, (long)txtValue.Value); } |
76 |
break; |
break; |
77 |
} |
} |
78 |
} |
} |