aboutsummaryrefslogtreecommitdiff
path: root/parse-brlan.py
diff options
context:
space:
mode:
Diffstat (limited to 'parse-brlan.py')
-rw-r--r--parse-brlan.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/parse-brlan.py b/parse-brlan.py
index 03d8133..eeea240 100644
--- a/parse-brlan.py
+++ b/parse-brlan.py
@@ -25,6 +25,7 @@ assert len(ch) == nel
for typ, chunk in ch:
assert typ == 'pai1'
framesize, flags, _, num_timgs, num_anims, anim_offset = struct.unpack('>hbbhhI', chunk[:0xc])
+ print 'Framesize: %x\nFlags: %x' % (framesize, flags)
for n in xrange(num_timgs):
pos = 0x10 + 4*n
offs = struct.unpack('>I', chunk[pos:pos+4])
@@ -32,11 +33,13 @@ for typ, chunk in ch:
for n in xrange(num_anims):
pos = anim_offset - 8 + 4*n
offs = struct.unpack('>I', chunk[pos:pos+4])[0] - 8
- name = chunk[offs:offs + 20].rstrip('\0')
+
+ name = chunk[offs:offs + 0x14].rstrip('\0')
aunk, aoffs = struct.unpack('>II', chunk[offs + 0x14:offs + 0x1c])
aoffs += offs
atyp = chunk[aoffs:aoffs+4]
#print hex(aoffs), hex(offs), name
+
num_aents = ord(chunk[aoffs + 4])
print atyp, name, hex(aunk)
@@ -44,11 +47,10 @@ for typ, chunk in ch:
boffs = aoffs + 8 + 4*m
coffs, = struct.unpack('>I', chunk[boffs:boffs + 4])
coffs += aoffs
- if atyp in ('RLMC', 'RLVC', 'RLPA', 'RLTP', 'RLIM', 'RLTS'): # doesn't cover RLTS, RLVI
- byte1 = ord(chunk[coffs+1])
- byte2 = ord(chunk[coffs+2])
- num_cookies, pad, cookies_offs = struct.unpack('>HHI', chunk[coffs+4:coffs+0xc])
- print hex(byte1), hex(byte2), num_cookies
+ if atyp in ('RLMC', 'RLVC', 'RLPA', 'RLTP', 'RLIM', 'RLTS'): # doesn't cover RLVI
+ byte0, byte1, byte2, byte3, num_cookies, pad, cookies_offs = struct.unpack('>BBBBHHI', chunk[coffs:coffs+0xc])
+ #print 'cookies_offs: %x' % cookies_offs
+ print hex(byte0), hex(byte1), hex(byte2), hex(byte3), num_cookies
for o in xrange(num_cookies):
cookie_offs = coffs + cookies_offs + 0xc*o
coords = struct.unpack('>fff', chunk[cookie_offs:cookie_offs + 0xc])