diff options
Diffstat (limited to '')
| -rw-r--r-- | parse-brlan.py | 13 | ||||
| -rw-r--r-- | testrlan.py | 1 | ||||
| -rw-r--r-- | testrlyt.py | 96 | ||||
| -rw-r--r-- | write-brlan.py | 18 |
4 files changed, 122 insertions, 6 deletions
diff --git a/parse-brlan.py b/parse-brlan.py index 72152bb..8004d3d 100644 --- a/parse-brlan.py +++ b/parse-brlan.py @@ -22,19 +22,20 @@ 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') # ignored by code - aoffs = offs + struct.unpack('>I', chunk[offs + 0x18:offs + 0x1c])[0] + name = chunk[offs:offs + 20].rstrip('\0') + aunk, aoffs = struct.unpack('>II', chunk[offs + 0x14:offs + 0x1c]) + aoffs += offs atyp = chunk[aoffs:aoffs+4] num_aents = ord(chunk[aoffs + 4]) - print atyp + print atyp, name, hex(aunk) 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]) + if atyp in ('RLMC', 'RLVC', 'RLPA', 'RLTP', 'RLIM'): # doesn't cover RLTS, RLVI + alpha_maybe = ord(chunk[coffs+1]) num_cookies, pad, cookies_offs = struct.unpack('>HHI', chunk[coffs+4:coffs+0xc]) - print num_cookies + print hex(alpha_maybe), 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]) diff --git a/testrlan.py b/testrlan.py new file mode 100644 index 0000000..dd626a0 --- /dev/null +++ b/testrlan.py @@ -0,0 +1 @@ +()
\ No newline at end of file diff --git a/testrlyt.py b/testrlyt.py new file mode 100644 index 0000000..2e40708 --- /dev/null +++ b/testrlyt.py @@ -0,0 +1,96 @@ +[ + ('lyt1', { + 'a': 1, + 'width': 608.0, + 'height': 456.0 + }), + ('txl1', { + 'textures': [ + {'unk': 0, 'name': ''}, + {'unk': 1, 'name': 'foo1'}, + {'unk': 0, 'name': 'foo2'}, + {'unk': 0, 'name': 'foo3'}, + ] + }), + ('fnl1', { + 'files': [ + {'unk': 0, 'name': 'your mom'} + ] + }), + ('mat1', { + 'materials': ['textmat'] + }), + ('pan1', { + 'alpha': 0xff, + 'alpha_2': 0x0, + 'angle': 0, + 'flags_1': 1, + 'flags_2': 4, + 'width': 608, + 'height': 456, + 'name': 'RootPane', + 'x': 0, + 'y': 0, + 'xmag': 1, + 'ymag': 1, + 'z': 0 + }), + 'pas1', + ('txt1', { + 'alpha': 0xff, + 'alpha_2': 0x0, + 'angle': 0, + 'flags_1': 5, + 'flags_2': 4, + 'height': 38, + 'name': 'textbox', + 'width': 400, + 'x': 0, + 'y': 50, + 'xmag': 1, + 'ymag': 2, + 'z': 0, + '~text.material': 'textmat', + '~text.text': 'Some Text', + '~text.unk3': 0, + '~text.unk4': 4, + + '~text.unk6': 0xffffff, + '~text.unk7': 0x80ff, + '~text.font_size_x': 32.0, + '~text.font_size_y': 38.0, + '~text.char_space': -1.0, + '~text.line_space': -1.0, + }), + ('pic1', { + 'alpha': 0xff, + 'alpha_2': 0x0, + 'angle': 0, + 'flags_1': 5, + 'flags_2': 4, + 'height': 38, + 'name': 'pic', + 'width': 400, + 'x': 200, + 'y': 50, + 'xmag': 1, + 'ymag': 2, + 'z': 0, + '~pic.material': 'textmat', + '~pic.texcoords': [(0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0)], + }), + 'pae1', + ('grp1', { + 'name': 'RootGroup', + 'subs': [], + 'unk': 0 + }), + 'grs1', + ('grp1', { + 'name': 'ENG', + 'subs': ['textbox', 'pic'], + 'unk': 0 + }), + 'gre1', + +]
\ No newline at end of file diff --git a/write-brlan.py b/write-brlan.py new file mode 100644 index 0000000..a79bcc6 --- /dev/null +++ b/write-brlan.py @@ -0,0 +1,18 @@ +import sys, struct, re +from ethyl import * + +f = open(sys.argv[1], 'r') +chunks = eval(f.read()) +f.close() + +assert len(chunks) == 0 # :/ + +rlan = 'RLAN\xfe\xff\x00\x08\x00\x00\x00\x00' # size later +rlan += struct.pack('>hh', 0x10, len(chunks)) + +rlan = rlan[:8] + struct.pack('>I', len(rlan)) + rlan[0xc:] + + +g = open(sys.argv[2], 'wb') +g.write(rlan) +g.close()
\ No newline at end of file |
