I have a game file described here: http://iesdp.gibberlings3.net/ieformats/itm_v1.htm and I'm trying to read all the data:
############################
plik = open('bow08.itm', 'rb')
try:
        tekst = plik.read()
finally:
        plik.close()

# char array - works
print tekst[0x0004:0x0004+4]
# resref - works
print tekst[0x003a:0x003a+8]

#dword - binary something, doesn't work
print tekst[0x004c:0x004c+4]
##############################
The dword and many other variables are binary code and I don't know how to convert them into "normal" data. NearInfinity, app written in Java converts dword and friends in this way:
##############################
public static int convertInt(byte buffer[], int offset)
  {
    int value = 0;
    for (int i = 3; i >= 0; i--)
      value = (value << 8) | (buffer[offset + i] & 0xFF);
    return value;
  }
##############################
How to pythonize this code, or make something in python to read the data from Baldurs Gate files ? :)

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to