diff options
Diffstat (limited to '')
| -rw-r--r-- | ethyl.py | 4 | ||||
| -rw-r--r-- | parse-brlan.py | 10 | ||||
| -rw-r--r-- | parse-brlyt.py | 3 | ||||
| -rw-r--r-- | testrlyt.py | 23 | ||||
| -rw-r--r-- | write-brlyt.py | 4 |
5 files changed, 26 insertions, 18 deletions
@@ -22,7 +22,7 @@ formats = { u16 len1 // 4c u16 len2 // 4e u16 mat_off // 50 - u16 unk3 // 52 + u16 font_idx // 52; into fnl1 u8 unk4 // 54 u8 pad[3] = [0, 0, 0]// 55 u32 name_offs // 58 @@ -138,7 +138,7 @@ def unnullterm(var, size): raise Exception('unnullterm: "%s" too long' % var) return var.ljust(size, '\0') def untv(name): - assert '\0' not in name + #assert '\0' not in name lex = len(name) + 16 lex -= lex % 16 return name.ljust(lex, '\0') diff --git a/parse-brlan.py b/parse-brlan.py index 8004d3d..13c2101 100644 --- a/parse-brlan.py +++ b/parse-brlan.py @@ -12,6 +12,16 @@ ch = iff_to_chunks(rlan[offs:]) assert len(ch) == nel +# Holy indirection +# rlan +# pai1 +# timg +# anim +# anim body +# aent +# aent body +# + for typ, chunk in ch: assert typ == 'pai1' framesize, flags, _, num_timgs, num_anims, anim_offset = struct.unpack('>hbbhhI', chunk[:0xc]) diff --git a/parse-brlyt.py b/parse-brlyt.py index ea998ca..9ba2cd4 100644 --- a/parse-brlyt.py +++ b/parse-brlyt.py @@ -48,6 +48,7 @@ for typ, chunk in ch: vars, pos = parse_data(chunk, 'numoffs') vars[things] = [] pos += vars['offs'] + bpos = pos del vars['offs'] # unneeded for n in xrange(vars['num']): if typ == 'mat1': @@ -57,7 +58,7 @@ for typ, chunk in ch: offset, unk = struct.unpack('>II', chunk[pos:pos+8]) pos += 8 - name = nullterm(chunk[offset - 8:]) + name = nullterm(chunk[(-8 if typ == 'mat1' else bpos) + offset:]) vars[things].append(name if typ == 'mat1' else {'name': name, 'unk': unk}) if typ == 'mat1': materials = vars['materials'] diff --git a/testrlyt.py b/testrlyt.py index 2e40708..32c53c5 100644 --- a/testrlyt.py +++ b/testrlyt.py @@ -6,15 +6,13 @@ }), ('txl1', { 'textures': [ - {'unk': 0, 'name': ''}, - {'unk': 1, 'name': 'foo1'}, - {'unk': 0, 'name': 'foo2'}, - {'unk': 0, 'name': 'foo3'}, + {'unk': 0, 'name': 'spam12345'}, + {'unk': 1, 'name': 'spamnonexist'}, ] }), ('fnl1', { 'files': [ - {'unk': 0, 'name': 'your mom'} + {'unk': 0, 'name': 'wbf1.brfna'}, ] }), ('mat1', { @@ -40,8 +38,8 @@ 'alpha': 0xff, 'alpha_2': 0x0, 'angle': 0, - 'flags_1': 5, - 'flags_2': 4, + 'flags_1': 1, + 'flags_2': 0, 'height': 38, 'name': 'textbox', 'width': 400, @@ -52,11 +50,10 @@ 'z': 0, '~text.material': 'textmat', '~text.text': 'Some Text', - '~text.unk3': 0, - '~text.unk4': 4, - - '~text.unk6': 0xffffff, - '~text.unk7': 0x80ff, + '~text.font_idx': 0, + '~text.unk4': 0, + '~text.unk6': 0xffffffff, + '~text.unk7': 0xffffffff, '~text.font_size_x': 32.0, '~text.font_size_y': 38.0, '~text.char_space': -1.0, @@ -88,7 +85,7 @@ 'grs1', ('grp1', { 'name': 'ENG', - 'subs': ['textbox', 'pic'], + 'subs': ['pic'],#'textbox', 'unk': 0 }), 'gre1', diff --git a/write-brlyt.py b/write-brlyt.py index b73b23a..a424e11 100644 --- a/write-brlyt.py +++ b/write-brlyt.py @@ -35,7 +35,7 @@ for c in chunks: offss.append(len(strings)) strings += name for n, thing in enumerate(ls): - chunk += struct.pack('>I', offss[n] + 12 + (4 if typ == 'mat1' else 8) * len(ls)) + chunk += struct.pack('>I', offss[n] + (12 if typ == 'mat1' else 0) + (4 if typ == 'mat1' else 8) * len(ls)) if typ != 'mat1': chunk += struct.pack('>I', thing['unk']) chunk += strings @@ -46,7 +46,7 @@ for c in chunks: if typ == 'txt1': vars['~text.name_offs'] = 0x74 vars['~text.mat_off'] = materials.index(vars['~text.material']) - blob = unicode(vars['~text.text']).encode('utf_16_be') + blob = untv(unicode(vars['~text.text']).encode('utf_16_be')) vars['~text.len1'] = vars['~text.len2'] = len(blob) chunk += unparse_data(vars, 'text', prefix='~text') chunk += blob |
