Skip to content

Commit cb74eb5

Browse files
committed
Restored old functionality.
1 parent e968a29 commit cb74eb5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

ReClass.NET/AddressParser/DynamicCompiler.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,15 @@ private static Expression GenerateMethodBody(IExpression expression, Expression
102102
{
103103
var addressParameter = GenerateMethodBody(readMemoryExpression.Expression, processParameter);
104104

105-
var readRemoteIntPtrFn = typeof(IRemoteMemoryReaderExtension).GetRuntimeMethod(nameof(IRemoteMemoryReaderExtension.ReadRemoteIntPtr), new[] { typeof(IRemoteMemoryReader), typeof(IntPtr) });
105+
var functionName = readMemoryExpression.ByteCount == 4 ? nameof(IRemoteMemoryReaderExtension.ReadRemoteInt32) : nameof(IRemoteMemoryReaderExtension.ReadRemoteInt64);
106+
var readRemoteIntPtrFn = typeof(IRemoteMemoryReaderExtension).GetRuntimeMethod(functionName, new[] { typeof(IRemoteMemoryReader), typeof(IntPtr) });
106107

107-
return Expression.Call(null, readRemoteIntPtrFn, processParameter, addressParameter);
108+
var callExpression = Expression.Call(null, readRemoteIntPtrFn, processParameter, addressParameter);
109+
110+
var paramType = readMemoryExpression.ByteCount == 4 ? typeof(int) : typeof(long);
111+
var convertFn = typeof(IntPtrExtension).GetRuntimeMethod(nameof(IntPtrExtension.From), new[] { paramType });
112+
113+
return Expression.Call(null, convertFn, callExpression);
108114
}
109115
}
110116

0 commit comments

Comments
 (0)