############################
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
