diff options
| author | comex <comexk@gmail.com> | 2009-01-29 17:21:54 -0500 |
|---|---|---|
| committer | comex <comexk@gmail.com> | 2009-01-29 17:21:54 -0500 |
| commit | f173c743d3d435fb96a6e12c83b45726c1beeae9 (patch) | |
| tree | b7677dea348249f626bce3d185cf590713071ced /parse-brlan.py | |
| parent | 4e5b7768da295c06d1751fd0a728a7d09ffa8c15 (diff) | |
nasty hack
Diffstat (limited to 'parse-brlan.py')
| -rw-r--r-- | parse-brlan.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/parse-brlan.py b/parse-brlan.py new file mode 100644 index 0000000..72152bb --- /dev/null +++ b/parse-brlan.py @@ -0,0 +1,47 @@ +import sys, struct, re +from ethyl import * + +f = open(sys.argv[1], 'rb') +rlan = f.read() +f.close() + +assert rlan[0:4] in ( 'RLAN', 'RLTP', 'RLMC', 'RLVC', 'RLPA', 'RLTS', 'RLVI') +assert rlan[4:8] == '\xfe\xff\x00\x08' +offs, nel = struct.unpack('>hh', rlan[0xc:0x10]) +ch = iff_to_chunks(rlan[offs:]) + +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]) + for n in xrange(num_timgs): + pos = 0x10 + 4*n + offs = struct.unpack('>I', chunk[pos:pos+4]) + print 'timg: %s' % nullterm(chunk[pos - 8:]) + 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') # ignored by code + aoffs = offs + struct.unpack('>I', chunk[offs + 0x18:offs + 0x1c])[0] + atyp = chunk[aoffs:aoffs+4] + num_aents = ord(chunk[aoffs + 4]) + print atyp + for m in xrange(num_aents): + boffs = aoffs + 8 + 4*m + coffs, = struct.unpack('>I', chunk[boffs:boffs + 4]) + coffs += aoffs + if atyp == 'RLMC': + alpha_maybe = ord(chunk[coffs]) + num_cookies, pad, cookies_offs = struct.unpack('>HHI', chunk[coffs+4:coffs+0xc]) + print 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]) + print ' ', coords + print ' ', '---' + + #print repr(name) + #unk, anim_header_len = struct.unpack('>II', chunk[offs + 20:offs + 28]) + #atyp = chunk[offs + 28:offs + 32] +
\ No newline at end of file |
