diff options
author | Bryan Bishop <kanzure@gmail.com> | 2012-01-25 00:49:23 -0600 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2012-01-25 00:49:23 -0600 |
commit | cf80ada3c5c1bf342fc418fc5154cd9b7c3347a9 (patch) | |
tree | 1fc59219df304ee5b927b463838d423b8263c19a | |
parent | c171b4772974207e113fc873cd52ef3bdd26f930 (diff) |
pretty_trainer_headers.py - print out multiple headers simultaneously
hg-commit-id: 6fb8641fc65b
-rw-r--r-- | extras/pretty_trainer_headers.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/extras/pretty_trainer_headers.py b/extras/pretty_trainer_headers.py index 4c10f56e..7ddcbbf3 100644 --- a/extras/pretty_trainer_headers.py +++ b/extras/pretty_trainer_headers.py @@ -6,16 +6,16 @@ from gbz80disasm import load_labels, find_label from extract_maps import calculate_pointer import sys spacing = "\t" +rom = None def pretty_print_trainer_header(address, label=None): """make pretty text for a trainer header""" + global rom output = "" bank_id = 0 if address > 0x4000: bank_id = address / 0x4000 - rom = open("../baserom.gbc", "r").read() - #convert address to an integer if necessary if type(address) == str: if "$" in address: address = address.replace("$", "0x") @@ -97,6 +97,12 @@ def pretty_print_trainer_header(address, label=None): return output +def all_trainer_headers_at(address): + i = 0 + while ord(rom[address + (i*12)]) != 0xff: + print pretty_print_trainer_header(address + (i*12)) + i += 1 + def main(): load_labels() @@ -111,7 +117,11 @@ def main(): address = int(args[0], 16) label = args[1] - print pretty_print_trainer_header(address, label) + global rom + rom = open("../baserom.gbc", "r").read() + + #print pretty_print_trainer_header(address, label) + print all_trainer_headers_at(address) if __name__ == "__main__": main() |