5 |
using RomCheater.PluginFramework.Core; |
using RomCheater.PluginFramework.Core; |
6 |
using System.IO; |
using System.IO; |
7 |
using System.Diagnostics; |
using System.Diagnostics; |
8 |
|
using RomCheater.Logging; |
9 |
|
|
10 |
namespace RomCheater.CorePlugins.Config |
namespace RomCheater.CorePlugins.Config |
11 |
{ |
{ |
27 |
{ |
{ |
28 |
bool isDebug = false; |
bool isDebug = false; |
29 |
uint VTLB_RELEASE_OFFSET = 0; |
uint VTLB_RELEASE_OFFSET = 0; |
30 |
return !IsValidPSX2Process(p.ProcessInfo.Id, out isDebug, out VTLB_RELEASE_OFFSET); |
bool notvalid = !IsValidPSX2Process(p.ProcessInfo.Id, out isDebug, out VTLB_RELEASE_OFFSET); |
31 |
|
if (notvalid) |
32 |
|
{ |
33 |
|
logger.Debug.WriteLine(" Not Allowing process {0} to be added because it was filterd out", p.Name); |
34 |
|
} |
35 |
|
else |
36 |
|
{ |
37 |
|
logger.Debug.WriteLine(" Allowing process {0} to be added", p.Name); |
38 |
|
} |
39 |
|
return notvalid; |
40 |
} |
} |
41 |
#region IPluginBase Members |
#region IPluginBase Members |
42 |
public override Guid ID |
public override Guid ID |
86 |
r.Close(); |
r.Close(); |
87 |
if (!isExe) |
if (!isExe) |
88 |
{ |
{ |
89 |
|
logger.Debug.WriteLine(" Process: {0} is not a valid executable file", filename); |
90 |
isValid = false; |
isValid = false; |
91 |
} |
} |
92 |
else |
else |
98 |
if (found_string.ToLower().Contains(PCXS2_LOOKUP_MAGIC_001.ToLower()) && found_string.ToLower().Contains(PCXS2_LOOKUP_MAGIC_002.ToLower())) |
if (found_string.ToLower().Contains(PCXS2_LOOKUP_MAGIC_001.ToLower()) && found_string.ToLower().Contains(PCXS2_LOOKUP_MAGIC_002.ToLower())) |
99 |
{ |
{ |
100 |
isValid = true; |
isValid = true; |
101 |
|
logger.Debug.WriteLine(" Process: {0} found MAGIC LOOKUP {1} and {2}", filename, PCXS2_LOOKUP_MAGIC_001.ToLower(), PCXS2_LOOKUP_MAGIC_002.ToLower()); |
102 |
} |
} |
103 |
sr.Close(); |
sr.Close(); |
104 |
|
|
110 |
if (found_string.ToLower().Contains("DebugBreak".ToLower())) |
if (found_string.ToLower().Contains("DebugBreak".ToLower())) |
111 |
{ |
{ |
112 |
isDebug = true; |
isDebug = true; |
113 |
|
logger.Debug.WriteLine(" Process: {0} found DebugBreak", filename); |
114 |
} |
} |
115 |
sr.Close(); |
sr.Close(); |
116 |
} |
} |
134 |
byte[] check_data = reader.ReadProcessMemory((IntPtr)VTLB_VADDR_OFFSET_DEBUG, (uint)entrypoint_data.Length, out bytesReadSize); |
byte[] check_data = reader.ReadProcessMemory((IntPtr)VTLB_VADDR_OFFSET_DEBUG, (uint)entrypoint_data.Length, out bytesReadSize); |
135 |
|
|
136 |
isDebug = check_data.SequenceEqual(entrypoint_data); |
isDebug = check_data.SequenceEqual(entrypoint_data); |
137 |
|
logger.Debug.WriteLine(" Process: {0} isDebug: {1}", filename, isDebug.ToString()); |
138 |
//List<uint> addresses = new List<uint>(); |
//List<uint> addresses = new List<uint>(); |
139 |
if (!isDebug) |
if (!isDebug) |
140 |
{ |
{ |
150 |
{ |
{ |
151 |
//addresses.Add(t); |
//addresses.Add(t); |
152 |
VTLB_RELEASE_OFFSET = t; |
VTLB_RELEASE_OFFSET = t; |
153 |
|
logger.Debug.WriteLine(" Process: {0} found release build entrypoint at 0x{1:x8}", filename, t); |
154 |
break; //use only the first valid value |
break; //use only the first valid value |
155 |
} |
} |
156 |
} |
} |