diff options
author | dannye <33dannye@gmail.com> | 2020-12-15 11:05:12 -0600 |
---|---|---|
committer | dannye <33dannye@gmail.com> | 2020-12-15 11:05:12 -0600 |
commit | 2654da5d157540d482790308f1c2948e1431fa46 (patch) | |
tree | 265d64b9fb8f6e8bd580cb6a5ec3c59224e9fdeb /tools/unnamed.py | |
parent | 48dc6a8cf4da512273e79e49346b35dcc225f773 (diff) | |
parent | f16f53096b39ccb5b9ab2345faa3e49434e19336 (diff) |
Merge branch 'master' of https://github.com/pret/pokered
Diffstat (limited to 'tools/unnamed.py')
-rwxr-xr-x | tools/unnamed.py | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/tools/unnamed.py b/tools/unnamed.py index b2e9aea3..bee4e29b 100755 --- a/tools/unnamed.py +++ b/tools/unnamed.py @@ -82,17 +82,38 @@ for objfile in objects: elif magic == b'RGB9': obj_ver = 10 + unpack_file("<I", f)[0] - if obj_ver not in [6, 10, 11, 12, 13, 15]: + if obj_ver not in [6, 10, 11, 12, 13, 15, 16]: print("Error: File '%s' is of an unknown format." % objfile, file=stderr) exit(1) - num_symbols = unpack_file("<II", f)[0] + num_symbols = unpack_file("<I", f)[0] + unpack_file("<I", f) # skip num sections + + if obj_ver in [16]: + node_filenames = [] + num_nodes = unpack_file("<I", f)[0] + for x in range(num_nodes): + unpack_file("<II", f) # parent id, parent line no + node_type = unpack_file("<B", f)[0] + if node_type: + node_filenames.append(read_string(f)) + else: + node_filenames.append("rept") + depth = unpack_file("<I", f)[0] + for i in range(depth): + unpack_file("<I", f) # rept iterations + node_filenames.reverse() + for x in range(num_symbols): sym_name = read_string(f) sym_type = symtype(unpack_file("<B", f)[0] & 0x7f) if sym_type == symtype.IMPORT: continue - sym_filename = read_string(f) + if obj_ver in [16]: + sym_fileno = unpack_file("<I", f)[0] + sym_filename = node_filenames[sym_fileno] + else: + sym_filename = read_string(f) unpack_file("<III", f) if sym_name not in symbols: continue |