Skip to content

Commit 4d3ac22

Browse files
committed
Moved ReadFromBuffer to MemoryBuffer where it belongs, and it's now usable from different nodes. Changed VTable node so it always displays the RTTI information if available.
1 parent e3660a7 commit 4d3ac22

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

ReClass.NET/Memory/MemoryBuffer.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,5 +366,12 @@ public bool HasChanged(int offset, int length)
366366

367367
return false;
368368
}
369+
370+
371+
public UInt64FloatDoubleData ReadFromBuffer(int offset) => new UInt64FloatDoubleData
372+
{
373+
Raw1 = ReadInt32(offset),
374+
Raw2 = ReadInt32(offset + sizeof(int))
375+
};
369376
}
370377
}

ReClass.NET/Nodes/Hex64Node.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public override void GetUserInterfaceInfo(out string name, out Image icon)
1818

1919
public override bool UseMemoryPreviewToolTip(HotSpot spot, out IntPtr address)
2020
{
21-
var value = ReadFromBuffer(spot.Memory, Offset);
21+
var value = spot.Memory.ReadFromBuffer(Offset);
2222

2323
address = value.IntPtr;
2424

@@ -27,7 +27,7 @@ public override bool UseMemoryPreviewToolTip(HotSpot spot, out IntPtr address)
2727

2828
public override string GetToolTipText(HotSpot spot)
2929
{
30-
var value = ReadFromBuffer(spot.Memory, Offset);
30+
var value = spot.Memory.ReadFromBuffer(Offset);
3131

3232
return $"Int64: {value.LongValue}\nUInt64: 0x{value.ULongValue:X016}\nFloat: {value.FloatValue:0.000}\nDouble: {value.DoubleValue:0.000}";
3333
}
@@ -46,17 +46,11 @@ protected override int AddComment(DrawContext context, int x, int y)
4646
{
4747
x = base.AddComment(context, x, y);
4848

49-
var value = ReadFromBuffer(context.Memory, Offset);
49+
var value = context.Memory.ReadFromBuffer(Offset);
5050

5151
x = AddComment(context, x, y, value.FloatValue, value.IntPtr, value.UIntPtr);
5252

5353
return x;
5454
}
55-
56-
private static UInt64FloatDoubleData ReadFromBuffer(MemoryBuffer memory, int offset) => new UInt64FloatDoubleData
57-
{
58-
Raw1 = memory.ReadInt32(offset),
59-
Raw2 = memory.ReadInt32(offset + sizeof(int))
60-
};
6155
}
6256
}

ReClass.NET/Nodes/VirtualMethodTableNode.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,25 @@ public override void Initialize()
3434
}
3535
}
3636

37+
38+
protected override int AddComment(DrawContext context, int x, int y)
39+
{
40+
x = base.AddComment(context, x, y);
41+
42+
if (context.Settings.ShowCommentRtti)
43+
{
44+
var addressFirstVTableFunction = context.Memory.ReadFromBuffer(Offset).IntPtr;
45+
var rtti = context.Process.ReadRemoteRuntimeTypeInformation(addressFirstVTableFunction);
46+
if (!string.IsNullOrEmpty(rtti))
47+
{
48+
x = AddText(context, x, y, context.Settings.OffsetColor, HotSpot.ReadOnlyId, rtti) + context.Font.Width;
49+
}
50+
}
51+
52+
return x;
53+
}
54+
55+
3756
public override Size Draw(DrawContext context, int x, int y)
3857
{
3958
if (IsHidden && !IsWrapped)

0 commit comments

Comments
 (0)