loldevs / leaguespec

community crafted knowledge base around Riot Games observer system
Other
149 stars 18 forks source link

Question about hex decoding #6

Closed Divi closed 10 years ago

Divi commented 10 years ago

Hello,

I'm not familiar with the hex to decimal process. I know how to obtain a string or int value, but for a float, i'm a little bit lost.

For example, in the keyframe spec, on this unknown data bloc (https://github.com/loldevs/leaguespec/wiki/Keyframe-Specification#wiki-unknown-data-3) there are some float values, but I just don't know how you can get these values.

So if someone can explain to me, it would be great !

Thanks :)

tyscorp commented 10 years ago

You either do it programmatically with a function like "readFloatLE" (or pack/unpack in some scripting languages like ruby/php) or just use a website to do it.

Remember to put it in reverse byte order if using a website. (e.g. 93 85 30 43 -> 0x43308593)

Divi commented 10 years ago

Thanks @tyscorp, this is why I can't find the right value with my calculator :( Last question : how can you find the right value type (int, float, string, etc) ? We have to guess it ?

tyscorp commented 10 years ago

Yep. I just copy+paste a portion of data into my text editor and add spaces/newlines at different points until patterns emerge and it starts to make sense. If I see XX 00 00 00 or XX XX 00 00 I usually think it's an int. If it's like groups of 4 quite different values with the last (first, I guess) byte being a 4X you can assume it's a float.

Zykloide commented 10 years ago

By the way the line "Note: everything is in little endian." in https://github.com/loldevs/leaguespec/wiki/Keyframe-Specification#wiki-general-structure tells you that it's stored in reversed order. For more information: http://en.wikipedia.org/wiki/Endianness :)

Divi commented 10 years ago

Thanks :)