aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcomex <comexk@gmail.com>2009-02-02 21:48:21 -0500
committercomex <comexk@gmail.com>2009-02-02 21:48:21 -0500
commit653eab5bfe95a42ebb2ebba7aa4a1249710f5ba0 (patch)
tree09111fcb3c86aa7b8ec190a8e7e03de0c5e666ae
parentebb936ebeed92d444b3e7989bc2a92964686e3b6 (diff)
fixes
Diffstat (limited to '')
-rw-r--r--ethyl.py2
-rw-r--r--parse-brlyt.py17
2 files changed, 17 insertions, 2 deletions
diff --git a/ethyl.py b/ethyl.py
index 57b9b3b..870c438 100644
--- a/ethyl.py
+++ b/ethyl.py
@@ -282,6 +282,8 @@ def get_array(chunk, startpos, array_size, item_size):
for n in xrange(array_size):
if item_size == 4:
ar.append(struct.unpack('>I', chunk[pos:pos+4])[0])
+ elif item_size == 1:
+ ar.append(struct.unpack('>B', chunk[pos:pos+4])[0])
elif item_size % 4 == 0:
ar.append(struct.unpack('>' + 'I'*(item_size/4), chunk[pos:pos+item_size]))
else:
diff --git a/parse-brlyt.py b/parse-brlyt.py
index a85c028..d79b382 100644
--- a/parse-brlyt.py
+++ b/parse-brlyt.py
@@ -105,9 +105,22 @@ for typ, chunk in ch:
mat['ua8'], mpos = get_array(chunk, mpos, bit_extract(flags, 14, 16), 4)
- # 4 * flags[8]
+ # 0x10 * flags[9-13]
- mat['ua9'], mpos = get_opt(chunk, mpos, bit_extract(flags, 8), 4)
+ mat['ua8'], mpos = get_array(chunk, mpos, bit_extract(flags, 9, 13), 0x10)
+
+ # 4 * flags[8], these are bytes btw
+
+ mat['uaa'], mpos = get_opt(chunk, mpos, bit_extract(flags, 8), 4)
+
+ # 4 * flags[7]
+
+ mat['uab'], mpos = get_opt(chunk, mpos, bit_extract(flags, 7), 4)
+
+ if n < vars['num'] - 1:
+ next_offset, = struct.unpack('>I', chunk[pos+4:pos+8])
+ if next_offset - 8 != mpos:
+ mat['~_insane'] = next_offset - 8 - mpos # Extra shit we didn't parse :(
vars['materials'].append(mat)
pos += 4