Skip to content

Commit cc68401

Browse files
committed
Fixed #15.
1 parent 29f4abf commit cc68401

File tree

7 files changed

+28
-19
lines changed

7 files changed

+28
-19
lines changed

ReClass.NET/Nodes/BaseMatrixNode.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ namespace ReClassNET.Nodes
66
{
77
public abstract class BaseMatrixNode : BaseNode
88
{
9+
/// <summary>Size of the value type in bytes.</summary>
10+
public abstract int ValueTypeSize { get; }
11+
912
protected BaseMatrixNode()
1013
{
1114
levelsOpen.DefaultValue = true;
@@ -128,7 +131,7 @@ public void Update(HotSpot spot, int max)
128131
{
129132
if (float.TryParse(spot.Text, out var val))
130133
{
131-
spot.Memory.Process.WriteRemoteMemory(spot.Address, val);
134+
spot.Memory.Process.WriteRemoteMemory(spot.Address + spot.Id * ValueTypeSize, val);
132135
}
133136
}
134137
}

ReClass.NET/Nodes/Matrix3x3Node.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace ReClassNET.Nodes
88
public class Matrix3x3Node : BaseMatrixNode
99
{
1010
[StructLayout(LayoutKind.Explicit)]
11-
struct Matrix3x3Data
11+
private struct Matrix3x3Data
1212
{
1313
[FieldOffset(0)]
1414
public readonly float _11;
@@ -30,8 +30,9 @@ struct Matrix3x3Data
3030
public readonly float _33;
3131
}
3232

33-
/// <summary>Size of the node in bytes.</summary>
34-
public override int MemorySize => 9 * 4;
33+
public override int ValueTypeSize => sizeof(float);
34+
35+
public override int MemorySize => 9 * ValueTypeSize;
3536

3637
/// <summary>Draws this node.</summary>
3738
/// <param name="view">The view information.</param>

ReClass.NET/Nodes/Matrix3x4Node.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace ReClassNET.Nodes
88
public class Matrix3x4Node : BaseMatrixNode
99
{
1010
[StructLayout(LayoutKind.Explicit)]
11-
struct Matrix3x4Data
11+
private struct Matrix3x4Data
1212
{
1313
[FieldOffset(0)]
1414
public readonly float _11;
@@ -36,8 +36,9 @@ struct Matrix3x4Data
3636
public readonly float _34;
3737
}
3838

39-
/// <summary>Size of the node in bytes.</summary>
40-
public override int MemorySize => 12 * 4;
39+
public override int ValueTypeSize => sizeof(float);
40+
41+
public override int MemorySize => 12 * ValueTypeSize;
4142

4243
/// <summary>Draws this node.</summary>
4344
/// <param name="view">The view information.</param>

ReClass.NET/Nodes/Matrix4x4Node.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace ReClassNET.Nodes
88
public class Matrix4x4Node : BaseMatrixNode
99
{
1010
[StructLayout(LayoutKind.Explicit)]
11-
struct Matrix4x4Data
11+
private struct Matrix4x4Data
1212
{
1313
[FieldOffset(0)]
1414
public readonly float _11;
@@ -44,8 +44,9 @@ struct Matrix4x4Data
4444
public readonly float _44;
4545
}
4646

47-
/// <summary>Size of the node in bytes.</summary>
48-
public override int MemorySize => 16 * 4;
47+
public override int ValueTypeSize => sizeof(float);
48+
49+
public override int MemorySize => 16 * ValueTypeSize;
4950

5051
/// <summary>Draws this node.</summary>
5152
/// <param name="view">The view information.</param>

ReClass.NET/Nodes/Vector2Node.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@ namespace ReClassNET.Nodes
77
public class Vector2Node : BaseMatrixNode
88
{
99
[StructLayout(LayoutKind.Explicit)]
10-
struct Vector2Data
10+
private struct Vector2Data
1111
{
1212
[FieldOffset(0)]
1313
public readonly float X;
1414
[FieldOffset(4)]
1515
public readonly float Y;
1616
}
1717

18-
/// <summary>Size of the node in bytes.</summary>
19-
public override int MemorySize => 2 * 4;
18+
public override int ValueTypeSize => sizeof(float);
19+
20+
public override int MemorySize => 2 * ValueTypeSize;
2021

2122
/// <summary>Draws this node.</summary>
2223
/// <param name="view">The view information.</param>

ReClass.NET/Nodes/Vector3Node.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace ReClassNET.Nodes
77
public class Vector3Node : BaseMatrixNode
88
{
99
[StructLayout(LayoutKind.Explicit)]
10-
struct Vector3Data
10+
private struct Vector3Data
1111
{
1212
[FieldOffset(0)]
1313
public readonly float X;
@@ -17,8 +17,9 @@ struct Vector3Data
1717
public readonly float Z;
1818
}
1919

20-
/// <summary>Size of the node in bytes.</summary>
21-
public override int MemorySize => 3 * 4;
20+
public override int ValueTypeSize => sizeof(float);
21+
22+
public override int MemorySize => 3 * ValueTypeSize;
2223

2324
/// <summary>Draws this node.</summary>
2425
/// <param name="view">The view information.</param>

ReClass.NET/Nodes/Vector4Node.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace ReClassNET.Nodes
77
public class Vector4Node : BaseMatrixNode
88
{
99
[StructLayout(LayoutKind.Explicit)]
10-
struct Vector4Data
10+
private struct Vector4Data
1111
{
1212
[FieldOffset(0)]
1313
public readonly float X;
@@ -19,8 +19,9 @@ struct Vector4Data
1919
public readonly float W;
2020
}
2121

22-
/// <summary>Size of the node in bytes.</summary>
23-
public override int MemorySize => 4 * 4;
22+
public override int ValueTypeSize => sizeof(float);
23+
24+
public override int MemorySize => 4 * ValueTypeSize;
2425

2526
/// <summary>Draws this node.</summary>
2627
/// <param name="view">The view information.</param>

0 commit comments

Comments
 (0)