7 |
using System.Diagnostics; |
using System.Diagnostics; |
8 |
using RomCheater.Logging; |
using RomCheater.Logging; |
9 |
using Sojaner.MemoryScanner.MemoryProviers; |
using Sojaner.MemoryScanner.MemoryProviers; |
10 |
|
using RomCheater.PluginFramework.Interfaces; |
11 |
|
|
12 |
namespace RomCheater.Docking.MemorySearch |
namespace RomCheater.Docking.MemorySearch |
13 |
{ |
{ |
14 |
[Serializable] |
[Serializable] |
15 |
public class ResultItemState |
public class ResultItemState : |
16 |
|
IAcceptsPlugin<IConfigPlugin>, |
17 |
|
IAcceptsProcess<Process>, |
18 |
|
IAcceptsProcessAndConfig |
19 |
{ |
{ |
20 |
#region Implicit Conversion |
#region Implicit Conversion |
21 |
public static implicit operator ResultDataType(ResultItemState state) |
public static implicit operator ResultDataType(ResultItemState state) |
51 |
return _result; |
return _result; |
52 |
} |
} |
53 |
#endregion |
#endregion |
54 |
|
#region IAcceptsProcess<Process> Members |
55 |
public ResultItemState() |
public Process AcceptedProcess { get; set; } |
56 |
|
#endregion |
57 |
|
#region IAcceptsPlugin<IConfigPlugin> Members |
58 |
|
public IConfigPlugin AcceptedPlugin { get; set; } |
59 |
|
#endregion |
60 |
|
public ResultItemState() : this(null) { } |
61 |
|
public ResultItemState(IAcceptsProcessAndConfig pconfig) |
62 |
{ |
{ |
63 |
this.IconKey = ""; |
this.IconKey = ""; |
64 |
this.Address = (0).ToString("x8"); |
this.Address = (0).ToString("x8"); |
66 |
this.Frozen = false.ToString(); |
this.Frozen = false.ToString(); |
67 |
this.ValueType = SearchDataTypes._32bits; |
this.ValueType = SearchDataTypes._32bits; |
68 |
this.IsUnsigned = true; |
this.IsUnsigned = true; |
69 |
|
|
70 |
|
this.AcceptedPlugin = pconfig.AcceptedPlugin; |
71 |
|
this.AcceptedProcess = pconfig.AcceptedProcess; |
72 |
} |
} |
73 |
public ResultItemState(string address, SearchDataTypes bitsize, bool IsUnsigned, int pid) |
public ResultItemState(string address, SearchDataTypes bitsize, bool IsUnsigned, IAcceptsProcessAndConfig pconfig) |
74 |
: this(AVPIconKeys.NOTFROZEN, address, "", false.ToString(), bitsize, IsUnsigned) |
: this(AVPIconKeys.NOTFROZEN, address, "", false.ToString(), bitsize, IsUnsigned, pconfig) |
75 |
{ |
{ |
76 |
uint Address = 0; |
uint Address = 0; |
77 |
Address = Convert.ToUInt32(this.Address, 16); |
Address = Convert.ToUInt32(this.Address, 16); |
78 |
GenericMemoryProvider provider = new GenericMemoryProvider(null, Process.GetProcessById(pid)); |
GenericMemoryProvider provider = new GenericMemoryProvider(pconfig); |
79 |
|
provider.OpenProvider(); |
80 |
int bytesReadSize; |
int bytesReadSize; |
81 |
byte[] data; |
byte[] data; |
82 |
uint bytesToRead=0; |
uint bytesToRead=0; |
121 |
else { this.Value = string.Format("0x{0:x16}", r_ms.ReadInt64()); } |
else { this.Value = string.Format("0x{0:x16}", r_ms.ReadInt64()); } |
122 |
break; |
break; |
123 |
} |
} |
124 |
|
provider.CloseProvider(); |
125 |
} |
} |
126 |
//public ResultItemState(string address, SearchDataTypes bitsize, bool IsUnsigned) |
public ResultItemState(string IconKey, string address, string value, string frozen, SearchDataTypes bitsize, bool IsUnsigned, IAcceptsProcessAndConfig pconfig) |
127 |
// : this(AVPIconKeys.NOTFROZEN, address, "", false.ToString(), bitsize, IsUnsigned) |
: this(pconfig) |
|
//{ |
|
|
// //PCSX2MemoryProvider provider = new PCSX2MemoryProvider(pcsx2_pid, null); |
|
|
// //byte[] buffered_mem = provider.GetMemory(); |
|
|
// //MemoryStream ms = new MemoryStream(buffered_mem); |
|
|
// //BinaryReader r_ms = new BinaryReader(ms); |
|
|
// uint Address = 0; |
|
|
// Address = Convert.ToUInt32(this.Address, 16); |
|
|
// //r_ms.BaseStream.Seek(Address, SeekOrigin.Begin); |
|
|
// int val = 0; |
|
|
// switch (bitsize) |
|
|
// { |
|
|
// case SearchDataTypes._8bits: |
|
|
// if (IsUnsigned) { this.Value = string.Format("0x{0:x2}", val); } |
|
|
// else { this.Value = string.Format("0x{0:x2}", val); } |
|
|
// break; |
|
|
// case SearchDataTypes._16bits: |
|
|
// if (IsUnsigned) { this.Value = string.Format("0x{0:x4}", val); } |
|
|
// else { this.Value = string.Format("0x{0:x4}", val); } |
|
|
// break; |
|
|
// case SearchDataTypes._32bits: |
|
|
// if (IsUnsigned) { this.Value = string.Format("0x{0:x8}", val); } |
|
|
// else { this.Value = string.Format("0x{0:x8}", val); } |
|
|
// break; |
|
|
// case SearchDataTypes._64bits: |
|
|
// if (IsUnsigned) { this.Value = string.Format("0x{0:x16}", val); } |
|
|
// else { this.Value = string.Format("0x{0:x16}", val); } |
|
|
// break; |
|
|
// } |
|
|
//} |
|
|
public ResultItemState(string IconKey, string address, string value, string frozen, SearchDataTypes bitsize, bool IsUnsigned) |
|
128 |
{ |
{ |
129 |
this.IconKey = IconKey; |
this.IconKey = IconKey; |
130 |
this.Address = address; |
this.Address = address; |