summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@bauklotz.fritz.box>2021-07-13 02:08:56 +0200
committerDirk Engling <erdgeist@bauklotz.fritz.box>2021-07-13 02:08:56 +0200
commit07a020d9dd72f758e4e0d0323a9c13a0ac5f1848 (patch)
treeccccfbd026e825b1f9006e6d4979714790fe31b0
parent1ff6d6d7a20ca924998374ee54cede1f86450d52 (diff)
Support more table definition layout versions found in test data and bigdump databses
-rw-r--r--crodump.py41
1 files changed, 37 insertions, 4 deletions
diff --git a/crodump.py b/crodump.py
index 1b2540f..d668915 100644
--- a/crodump.py
+++ b/crodump.py
@@ -226,6 +226,28 @@ def decode_field(data):
226 else: 226 else:
227 print("Type: %d %2d %d,%d - '%s'" % (typ, idx1, unk1, unk2, name)) 227 print("Type: %d %2d %d,%d - '%s'" % (typ, idx1, unk1, unk2, name))
228 228
229"""
230 2 Base000 - 000001 050001 000000000000000546696c657302464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f0010000000000000000010000000000000000
231 1 Base000 - 000001 050002 000000000000000546696c657302464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f001000000000000000000
232 1 Base000 - 000001 050007 000000000000000546696c657302464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f0010000000000000000020000000000000000ffffffff
233 1 Base000 - 00000200050001 000000000000000546696c657302464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f0010000000000000000020000000000000000ffffffff
2341859 Base000 - 00000300050001 000000000000000546696c657302464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f001000000000000000000000000020000000000000000ffffffff
235 37 Base000 - 00000300050002 000000000000000546696c657302464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f001000000000000000000000000020000000000000000ffffffff
236 12 Base000 - 00000300050003 000000000000000546696c657302464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f001000000000000000000000000020000000000000000ffffffff
237 6 Base000 - 00000300050004 000000000000000546696c657302464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f001000000000000000000000000020000000000000000ffffffff
238 6 Base000 - 00000300050005 000000000000000546696c657302464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f001000000000000000000000000020000000000000000ffffffff
239 6 Base000 - 00000300050006 000000000000000546696c657302464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f001000000000000000000000000020000000000000000ffffffff
240 10 Base000 - 00000300050007 000000000000000546696c657302464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f001000000000000000000000000020000000000000000ffffffff
241 6 Base000 - 00000300050008 000000000000000546696c657302464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f001000000000000000000000000020000000000000000ffffffff
242 3 Base000 - 00000300050009 000000000000000546696c657302464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f001000000000000000000000000020000000000000000ffffffff
243 4 Base000 - 0000030005000a 000000000000000546696c657302464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f001000000000000000000000000020000000000000000ffffffff
244 2 Base000 - 0000030005000b 000000000000000546696c657302464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f001000000000000000000000000020000000000000000ffffffff
245 2 Base000 - 0000030005000d 000000000000000546696c657302464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f001000000000000000000000000020000000000000000ffffffff
246 1 Base000 - 0000030005000e 000000000000000546696c657302464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f001000000000000000000000000020000000000000000ffffffff
247 1 Base000 - 00000300050012 000000000000000546696c657302464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f001000000000000000000000000020000000000000000ffffffff
248 1 Base000 - 0000030005001c 000000000000000546696c657302464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f001000000000000000000000000020000000000000000ffffffff
249 2 Base000 - 00000300090102000000000000000000000005d4e0e9ebfb02464c01000000010000001b000000000000000fd1e8f1f2e5ecedfbe920edeeece5f001000000000000000000000000060000000000000000ffffffffffffffffffffffffffffffffffffffff1700000003ffffffffffffffffffffffff06000000010000000000
250"""
229 251
230def destruct_base_definition(args, data): 252def destruct_base_definition(args, data):
231 """ 253 """
@@ -233,13 +255,24 @@ def destruct_base_definition(args, data):
233 """ 255 """
234 rd = ByteReader(data) 256 rd = ByteReader(data)
235 257
236 unk123 = [rd.readword() for _ in range(3)] 258 unk1 = rd.readword()
237 unk45 = [rd.readdword() for _ in range(2)] 259 version = rd.readbyte()
260 if version > 1:
261 _ = rd.readbyte() # always 0 anyway
262 unk2 = rd.readbyte() # if this is not 5 (but 9), there's another 4 bytes inserted
263 unk3 = rd.readbyte()
264
265 if unk2 > 5: # seen only 5 and 9 for now with 9 implying an extra dword
266 _ = rd.readdword()
267
268 unk4 = rd.readdword()
269 unk5 = rd.readdword()
270
238 tablename = rd.readname() 271 tablename = rd.readname()
239 unkname = rd.readname() 272 abbrev = rd.readname()
240 unk7 = rd.readdword() 273 unk7 = rd.readdword()
241 nrfields = rd.readdword() 274 nrfields = rd.readdword()
242 print("%d,%d,%d,%d,%d %d,%d '%s' '%s'" % (*unk123, *unk45, unk7, nrfields, tablename, unkname)) 275 print("%d,%d,%d,%d,%d,%d %d,%d '%s' '%s'" % (unk1, version, unk2, unk3, unk4, unk5, unk7, nrfields, tablename, abbrev))
243 fields = [] 276 fields = []
244 for _ in range(nrfields): 277 for _ in range(nrfields):
245 l = rd.readword() 278 l = rd.readword()