From edbfce9ad3da45649d5939de261e003048d41013 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Tue, 10 Jan 2012 16:32:25 -0600 Subject: [PATCH] update analyze_texts to find missing $08s hg-commit-id: 298a5ffd0d98 --- extras/analyze_texts.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/extras/analyze_texts.py b/extras/analyze_texts.py index 539209e5..9d1ce39f 100644 --- a/extras/analyze_texts.py +++ b/extras/analyze_texts.py @@ -3,6 +3,7 @@ #date: 2012-01-06 #analyze texts, how many commands are unknown? import extract_maps +import analyze_incbins #for asm try: from pretty_map_headers import map_name_cleaner except Exception, exc: pass @@ -367,6 +368,21 @@ def analyze_texts(): extract_maps.map_headers[map_id]["texts"] = map2["texts"] return texts +def find_missing_08s(all_texts): + """determines which $08s have yet to be inserted + based on their start addresses""" + missing_08s = 0 + for map_id in all_texts.keys(): + for text_id in all_texts[map_id].keys(): + for line_id in all_texts[map_id][text_id].keys(): + if not line_id == 0: + current_line = all_texts[map_id][text_id][line_id] + if "type" in current_line.keys(): + if current_line["type"] == 0x8: + missing_08s += 1 + print "missing $08 on map_id=" + str(map_id) + " text_id=" + str(text_id) + " line_id=" + str(line_id) + " at " + hex(current_line["start_address"]) + return missing_08s + if __name__ == "__main__": extract_maps.load_rom() extract_maps.load_map_pointers() @@ -374,6 +390,8 @@ if __name__ == "__main__": text_output = analyze_texts() #print text_output + missing_08s = find_missing_08s(text_output) + print "\n\n---- stats ----\n\n" popular_text_commands = sorted(totals.iteritems(), key=itemgetter(1), reverse=True) @@ -384,3 +402,4 @@ 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)