Searching for non-integer values

Started by Arudo, March 06, 2011, 11:24:33 PM

Previous topic - Next topic

Arudo

I noted something in The Last Story that one particular stat value is denoted in decimals as in 0.1, 1.0, 14.2 etc.

How would I go about searching for those in the RAM seeing as they aren't whole numbers?
-Crazy Hacker Hates You All (definitely)-

ノಠ益ಠ)ノ彡â"»â"â"»

Do NOT PM me about Code Requests

Pro-tip: Hit the Applaud Button

Oh? Failed to read the rules? You're already dead.

strakn

#1
you need to convert the decimal value to floating point then search for that value

0.1  = 3DCCCCCD

1.0  = 3F800000

14.2 = 41633333


I use the converter here http://babbage.cs.qc.edu/IEEE-754/Decimal.html

dcx2

Use Gecko.NET.  Change the Search tab's Data Type to "Single".  You should probably also change the Search tab's View Mode to "Single" as well.

Also, if you enter a hex, float, or decimal number into a Value type textbox, and you right-click, the context menu can convert to the other data types for you.

dcx2

On second thought...

I think what you mean to say is, sure 0.1 = 3DCCCCCD, but what if it's 0.11, or 0.15, and all you can do is estimate when doing your code search?

This is what the Search Groups were made for.  If you know that it's probably 0.1, but your estimate may have an error of +/- 0.05, then you can do a search for all values > 0.05 and all values < 0.15 at the same time.

Set the first Search Condition that you want (Specific Value, Greater than, 0.05 right-click convert to float to hex).  Then go to the Search Groups next to it and click the Add button.  Go back to the Search Condition box again and enter the condition (Specific, Less than, 0.15).  Click the up and down arrows to make sure the two conditions are set right.  Then click search.

strakn

Excellent point

In fact most floats cannot be precisely represented as a finite binary/hex number

even the value given for 0.1 which was 3DCCCCCD is a rounded value
as 3DCCCCCD is actual .0099999994 which of course rounds up to 0.1





Arudo

I haven't tried yet, but the increment value is just in tenths, so it doesn't get smaller.

You gain +0.1, +0.2, +0.5, +1.0 and +2.0 in upgrades for the weapon. I haven't tried searching yet as I was playing with weapon values in New Game+.
-Crazy Hacker Hates You All (definitely)-

ノಠ益ಠ)ノ彡â"»â"â"»

Do NOT PM me about Code Requests

Pro-tip: Hit the Applaud Button

Oh? Failed to read the rules? You're already dead.