diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-12-09 11:53:29 -0500 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-12-09 12:21:46 -0500 |
commit | e485280a8a59e43745d9261b491075e19dbef5f9 (patch) | |
tree | 40d952c4408ef2a66626f4a9f715b340e7234910 /tools/unnamed.py | |
parent | 6f226f584cf939015ccc3376f23c798833db4e83 (diff) |
Require rgbds 0.4.2
This allows [\1] to work when \1 is hl, bc, or de
The object file format has changed along with the version number
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 31e358047..3f4040e8f 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 |