Skip to content

Commit 1e92aba

Browse files
committed
Increased valid float range.
Make invalid floats distinguishable.
1 parent cb1851c commit 1e92aba

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

ReClass.NET/Memory/NodeDissector.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Linq;
55
using ReClassNET.Extensions;
66
using ReClassNET.Nodes;
7-
using ReClassNET.Util;
87

98
namespace ReClassNET.Memory
109
{
@@ -78,12 +77,12 @@ public static Type GuessType(BaseHexNode node, MemoryBuffer memory)
7877
if (data32.IntValue != 0)
7978
{
8079
// If the data represents a reasonable range, it could be a float.
81-
if (-99999.0f <= data32.FloatValue && data32.FloatValue <= 99999.0f && !data32.FloatValue.IsNearlyEqual(0.0f, 0.001f))
80+
if (-999999.0f <= data32.FloatValue && data32.FloatValue <= 999999.0f && !data32.FloatValue.IsNearlyEqual(0.0f, 0.001f))
8281
{
8382
return typeof(FloatNode);
8483
}
8584

86-
if (-99999 <= data32.IntValue && data32.IntValue <= 99999)
85+
if (-999999 <= data32.IntValue && data32.IntValue <= 999999)
8786
{
8887
return typeof(Int32Node);
8988
}
@@ -95,7 +94,7 @@ public static Type GuessType(BaseHexNode node, MemoryBuffer memory)
9594
if (data64.LongValue != 0)
9695
{
9796
// If the data represents a reasonable range, it could be a double.
98-
if (-99999.0 <= data64.DoubleValue && data64.DoubleValue <= 99999.0 && !data64.DoubleValue.IsNearlyEqual(0.0, 0.001))
97+
if (-999999.0 <= data64.DoubleValue && data64.DoubleValue <= 999999.0 && !data64.DoubleValue.IsNearlyEqual(0.0, 0.001))
9998
{
10099
return typeof(DoubleNode);
101100
}

ReClass.NET/Nodes/BaseHexCommentNode.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Text;
55
using ReClassNET.Extensions;
66
using ReClassNET.UI;
7-
using ReClassNET.Util;
87

98
namespace ReClassNET.Nodes
109
{
@@ -16,7 +15,7 @@ protected int AddComment(ViewInfo view, int x, int y, float fvalue, IntPtr ivalu
1615

1716
if (view.Settings.ShowCommentFloat)
1817
{
19-
x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.ReadOnlyId, $"{(fvalue > -99999.0f && fvalue < 99999.0f ? fvalue : 0.0f):0.000}") + view.Font.Width;
18+
x = AddText(view, x, y, view.Settings.ValueColor, HotSpot.ReadOnlyId, fvalue > -999999.0f && fvalue < 999999.0f ? fvalue.ToString("0.000") : "#####") + view.Font.Width;
2019
}
2120
if (view.Settings.ShowCommentInteger)
2221
{

0 commit comments

Comments
 (0)