From b3ab0153b31145cb2d2aea06b4aba3589c47530b Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Wed, 11 Jan 2012 01:40:53 -0600 Subject: [PATCH] analyze_texts to find missing texts in pokered.asm hg-commit-id: 7361a900a8ad --- extras/analyze_texts.py | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/extras/analyze_texts.py b/extras/analyze_texts.py index bec4f96f..3d1e894d 100644 --- a/extras/analyze_texts.py +++ b/extras/analyze_texts.py @@ -461,6 +461,37 @@ def text_pretty_printer_at(start_address, label="SomeLabel"): print output return output +def is_label_in_asm(label): + for line in analyze_incbins.asm: + if label in line: + if line[0:len(label)] == label: + return True + return False + +def find_undone_texts(): + if analyze_incbins.asm == None: + analyze_incbins.load_asm() + + for map_id in extract_maps.map_headers: + #skip bad maps + if map_id in extract_maps.bad_maps: continue + + map2 = extract_maps.map_headers[map_id] + name = map_name_cleaner(map2["name"], None)[:-2] + "Text" + + for text_id in map2["referenced_texts"]: + label = name + str(text_id) + + if len(extract_maps.map_headers[map_id]["texts"][text_id].keys()) == 0: continue + if len(extract_maps.map_headers[map_id]["texts"][text_id][0].keys()) == 0: continue + + try: + address = extract_maps.map_headers[map_id]["texts"][text_id][0]["start_address"] + except: + address = extract_maps.map_headers[map_id]["texts"][text_id][1]["start_address"] + + if not is_label_in_asm(label): + print label + " map_id=" + str(map_id) + " text_id=" + str(text_id) + " at " + hex(address) if __name__ == "__main__": extract_maps.load_rom() @@ -482,5 +513,7 @@ if __name__ == "__main__": print "total text commands: " + str(total_text_commands) print "total text scripts: " + str(should_be_total) print "missing 08s: " + str(missing_08s) + print "\n\n" - text_pretty_printer_at(0x800b1) + #text_pretty_printer_at(0x800b1) + find_undone_texts()