uint32 and 3ds Max 2010

Sooda

Diversity enchants
Reaction score
318
I have this HEX stream: F0 EE 01 00. When doing hex2int (base10) I get:
Code:
F0 = 240
EE = 238
01 = 1
00 = 0
uint32 stands for unsigned integer 32 bits. Consider byte order is reversed, so 00 is the start and F0 is the end.
3ds Max 2010 is using mxs (maxscript) native functions to read that uint32 as a integer.
For more info check this: How 3ds Max Maxscript (MXS) reads binary
What could be integer representation of this HEX stream? 240 + 238 + 1 = 479?
Someone is writing exporter script for 3ds Max 2010 :D
 

s3rius

Linux is only free if your time is worthless.
Reaction score
130
You mean 240 + 238 + 1 = 479 in 32bit hex?
Or F0EE0100 as int?
 

Sooda

Diversity enchants
Reaction score
318
I checked answer with function made by another person and it shows 678.
EDIT: It is python struct module which interprets that HEX stream with format L (long) as a 678.
Code:
class hdr:
    fmt = '4sLL'

    def __init__(self, file):
        _s = file.read(struct.calcsize(self.fmt))
        self.magic, self.ofsTag, self.nTag = struct.unpack(self.fmt, _s)
        #self.MODLref = ref(file)
        print('DEBUG BIGTIME:' + str(self.ofsTag))
That HEX stream would be first L in 4sLL, I kinda got my answer. My own made function was akward (like usual :D)
 

s3rius

Linux is only free if your time is worthless.
Reaction score
130
You mean if F0EE0100 is really 479 or not?

0 * 16^7 = 0
0 * 16^6 = 0
0 * 16^5 = 0
1 * 16^4 = 65536
E * 16^3 = 57344
E * 16^2 = 3584
F * 16^1 = 240
0 * 16^0 = 0

= 65536 + 57344 + 3584 +240
= 126704

You forgot the power to 16 in your calculation.

It's like saying that you have the decimal number 1234 and you'd calculate it's worth like this:
1 = 1
2 = 2
3 = 3
4 = 4
1+2+3+4 = 10


0001EEF0 (in the "right" order, isn't it?) can't possibly be something as low as 678. A 4-digit hex number will be at least a 5-digit decimal number.
 

Sooda

Diversity enchants
Reaction score
318
You solved my problem. You know very well hex and mathematics. I am total beginner on that field. Thanks for help.
My bigger plan is to port 3ds Max Starcraft 2 exporter script into python. Currently verifying that my writen code reads correct bytes and interprets them correctly. Though luckily that work is done by python struct module on background for me. Still it is great challange.

EDIT: Advice to others, when reading binary make sure file pointer is in correct place. I was comparing 497 (read from wrong place) with my desired reading place (126704) value. In python binaryfilename.tell() returns file pointer current location, great for debugging and alike, cheers!
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top