|
1 | 1 | using System;
|
2 | 2 | using System.Collections.Generic;
|
3 | 3 | using System.Diagnostics.Contracts;
|
| 4 | +using System.Linq; |
4 | 5 | using ReClassNET.Nodes;
|
5 | 6 | using ReClassNET.Util;
|
6 | 7 |
|
@@ -42,11 +43,11 @@ public static Type GuessType(BaseHexNode node, MemoryBuffer memory)
|
42 | 43 | var data32 = memory.ReadObject<UInt32FloatData>(offset);
|
43 | 44 |
|
44 | 45 | var raw = memory.ReadBytes(offset, node.MemorySize);
|
45 |
| - if (raw.InterpretAsUTF8().IsPrintableData()) |
| 46 | + if (raw.InterpretAsUTF8().IsLikelyPrintableData() >= 0.5f) |
46 | 47 | {
|
47 | 48 | return typeof(UTF8TextNode);
|
48 | 49 | }
|
49 |
| - else if (raw.InterpretAsUTF16().IsPrintableData()) |
| 50 | + else if (raw.InterpretAsUTF16().IsLikelyPrintableData() >= 0.5f) |
50 | 51 | {
|
51 | 52 | return typeof(UTF16TextNode);
|
52 | 53 | }
|
@@ -138,12 +139,12 @@ private static Type GuessPointerType(IntPtr address, MemoryBuffer memory)
|
138 | 139 | }
|
139 | 140 |
|
140 | 141 | // Check if it is a string.
|
141 |
| - var data = memory.Process.ReadRemoteMemory(address, IntPtr.Size); |
142 |
| - if (data.InterpretAsUTF8().IsPrintableData()) |
| 142 | + var data = memory.Process.ReadRemoteMemory(address, IntPtr.Size * 2); |
| 143 | + if (data.Take(IntPtr.Size).InterpretAsUTF8().IsLikelyPrintableData() >= 0.5f) |
143 | 144 | {
|
144 | 145 | return typeof(UTF8TextPtrNode);
|
145 | 146 | }
|
146 |
| - else if (data.InterpretAsUTF16().IsPrintableData()) |
| 147 | + else if (data.InterpretAsUTF16().IsLikelyPrintableData() >= 0.5f) |
147 | 148 | {
|
148 | 149 | return typeof(UTF16TextPtrNode);
|
149 | 150 | }
|
|
0 commit comments