Skip to content

Commit 40ab333

Browse files
committed
Implemented #53.
1 parent 88f6dcd commit 40ab333

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

ReClass.NET/Nodes/ClassPtrNode.cs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
using System;
22
using System.Drawing;
3+
using System.Globalization;
34
using ReClassNET.Memory;
45
using ReClassNET.UI;
6+
using ReClassNET.Util;
57

68
namespace ReClassNET.Nodes
79
{
@@ -46,6 +48,11 @@ public override Size Draw(ViewInfo view, int x, int y)
4648
x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.NoneId, $"<{InnerNode.Name}>") + view.Font.Width;
4749
x = AddIcon(view, x, y, Icons.Change, 4, HotSpotType.ChangeType) + view.Font.Width;
4850

51+
var ptr = view.Memory.ReadIntPtr(Offset);
52+
53+
x = AddText(view, x, y, view.Settings.OffsetColor, HotSpot.NoneId, "->") + view.Font.Width;
54+
x = AddText(view, x, y, view.Settings.ValueColor, 0, "0x" + ptr.ToString(Constants.AddressHexFormat)) + view.Font.Width;
55+
4956
x = AddComment(view, x, y);
5057

5158
AddTypeDrop(view, y);
@@ -57,8 +64,6 @@ public override Size Draw(ViewInfo view, int x, int y)
5764

5865
if (levelsOpen[view.Level])
5966
{
60-
var ptr = view.Memory.ReadIntPtr(Offset);
61-
6267
memory.Size = InnerNode.MemorySize;
6368
memory.Process = view.Memory.Process;
6469
memory.Update(ptr);
@@ -90,5 +95,24 @@ public override int CalculateDrawnHeight(ViewInfo view)
9095
}
9196
return height;
9297
}
98+
99+
public override void Update(HotSpot spot)
100+
{
101+
base.Update(spot);
102+
103+
if (spot.Id == 0)
104+
{
105+
if (spot.Text.TryGetHexString(out var hexValue) && long.TryParse(hexValue, NumberStyles.HexNumber, null, out var val))
106+
{
107+
#if RECLASSNET64
108+
var address = (IntPtr)val;
109+
#else
110+
var address = (IntPtr)unchecked((int)val);
111+
#endif
112+
113+
spot.Memory.Process.WriteRemoteMemory(spot.Address, address);
114+
}
115+
}
116+
}
93117
}
94118
}

0 commit comments

Comments
 (0)