diff options
author | klektron <klektron@users.noreply.github.com> | 2021-01-03 17:31:10 +0100 |
---|---|---|
committer | klektron <klektron@users.noreply.github.com> | 2021-01-03 17:31:10 +0100 |
commit | 779c7ddaa2613e41ce86e10893ee1b94ecc5b899 (patch) | |
tree | 286b04873ddce3f576d02a4ad58c843686fb80df /tools/unnamed.py | |
parent | a20ca92534f9cc6922f40e5f736a22862754db4b (diff) | |
parent | 21908ba30a8bae5c5e1c86b1164402ec95da0220 (diff) |
Merge last changes from pret
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 803685df..f99a38d8 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 |